Prev: 47703 Up: Map Next: 47797
47731: Invert INK and PAPER bits to (de-)highlight currently active menu item
Used by the routines at 47502, 47603 and 47703.
Input
A y-coordinate of menu hand cursor (pixels)
47731 PUSH AF Store AF (A = y-coordinate of menu hand cursor)
47732 LD A,(23408) Load A with x-coordinate of left edge of current window to draw (characters)
47735 ADD A,2 Add 2, as menu hand cursor is two characters wide...
47737 LD C,A ...and load into C (x-coordinate of start of row of text in menu)
47738 POP AF Restore AF (A = y-coordinate of menu hand cursor)
47739 ADD A,5 Add five (as the "finger" of the cursor naturally points five pixels below the cursor's actual position)
47741 CALL 40658 Divide this new y-coordinate by eight to get y-coordinate in characters
47744 LD B,A Load this y-coordinate into B
47745 LD A,(23456) Load initial y-coordinate of top of hand cursor relative to current window, into A
47748 ADD A,B Add this to y-coordinate of "finger"
47749 LD B,A Load this into B, so that B now contains y-coordinate of "finger" relative to top of window (characters)
47750 LD A,(23409) Load y-coordinate of top edge of current window into A
47753 ADD A,B Add...
47754 INC A ...then add one (for window frame at top) so we now have absolute y-coordinate of "finger"
47755 LD B,A Load into B
47756 LD (23476),BC Store coordinates at 23476
47760 CALL 63219 Point HL at attribute file address for character coordinates x=C, y=B
47763 LD A,(23408) Load B with x-coordinate of left edge of current window to draw (characters)...
47766 LD B,A ...
47767 LD A,(23410) Load A with x-coordinate of right edge of current window...
47770 SUB B ...and subtract x-coordinate of left edge to get width
47771 DEC A Decrease width by one to take into account window frame width...
47772 LD B,A ...and load into B
47773 LD A,(HL) Load attribute at current position in attribute file into A
47774 AND 56 Reset INK, BRIGHT and FLASH bits, preserving PAPER only
47776 RRCA Shift PAPER bits into INK bit slots...
47777 RRCA ...
47778 RRCA ...
47779 LD C,A Store this value (new INK colour) in C
47780 LD A,(HL) Load attribute at current position in attribute file into A
47781 RLCA Shift all bits right by three (i.e. INK bits now contain former PAPER colour)...
47782 RLCA ...
47783 RLCA ...
47784 AND 56 Reset INK, BRIGHT and FLASH bits, preserving PAPER only (i.e. PAPER bits now contain former INK colour)
47786 OR C Merge modified PAPER value back in, to give new attribute (i.e. swapped INK and PAPER colours)...
47787 LD C,A ...and load into C
47788 LD A,(HL) Load attribute at current position in attribute file into A
47789 AND 192 Reset INK and PAPER bits, preserving BRIGHT and FLASH only...
47791 OR C ...and merge in swapped INK and PAPER values
47792 LD (HL),A Write this new attribute value back to the attribute file
47793 INC HL Advance HL to next byte in attribute file
47794 DJNZ 47792 Decrease B (remaining number of characters to invert) and loop back to 47792 for next character block
47796 RET Return
Prev: 47703 Up: Map Next: 47797