Prev: 35497 Up: Map Next: 35591
35525: Invert INK and PAPER bits to (de-)highlight currently active menu item
Used by the routines at 35296, 35397 and 35497.
Input
A y-coordinate of menu hand cursor (pixels)
35525 PUSH AF Store AF (A = y-coordinate of menu hand cursor)
35526 LD A,(23493) Load A with x-coordinate of left edge of current window to draw (characters)
35529 ADD A,2 Add 2, as menu hand cursor is two characters wide...
35531 LD C,A ...and load into C (x-coordinate of start of row of text in menu)
35532 POP AF Restore AF (A = y-coordinate of menu hand cursor)
35533 ADD A,5 Add five (as the "finger" of the cursor naturally points five pixels below the cursor's actual position)
35535 CALL 28625 Divide this new y-coordinate by eight to get y-coordinate in characters
35538 LD B,A Load this y-coordinate into B
35539 LD A,(23456) Load initial y-coordinate of top of hand cursor relative to current window, into A
35542 ADD A,B Add this to y-coordinate of "finger"
35543 LD B,A Load this into B, so that B now contains y-coordinate of "finger" relative to top of window (characters)
35544 LD A,(23494) Load y-coordinate of top edge of current window into A
35547 ADD A,B Add...
35548 INC A ...then add one (for window frame at top) so we now have absolute y-coordinate of "finger"
35549 LD B,A Load into B
35550 LD (23476),BC Store coordinates at 23476
35554 CALL 54148 Point HL at attribute file address for character coordinates x=C, y=B
35557 LD A,(23493) Load B with x-coordinate of left edge of current window to draw (characters)...
35560 LD B,A ...
35561 LD A,(23495) Load A with x-coordinate of right edge of current window...
35564 SUB B ...and subtract x-coordinate of left edge to get width
35565 DEC A Decrease width by one to take into account window frame width...
35566 LD B,A ...and load into B
35567 LD A,(HL) Load attribute at current position in attribute file into A
35568 AND 56 Reset INK, BRIGHT and FLASH bits, preserving PAPER only
35570 RRCA Shift PAPER bits into INK bit slots...
35571 RRCA ...
35572 RRCA ...
35573 LD C,A Store this value (new INK colour) in C
35574 LD A,(HL) Load attribute at current position in attribute file into A
35575 RLCA Shift all bits right by three (i.e. INK bits now contain former PAPER colour)...
35576 RLCA ...
35577 RLCA ...
35578 AND 56 Reset INK, BRIGHT and FLASH bits, preserving PAPER only (i.e. PAPER bits now contain former INK colour)
35580 OR C Merge modified PAPER value back in, to give new attribute (i.e. swapped INK and PAPER colours)...
35581 LD C,A ...and load into C
35582 LD A,(HL) Load attribute at current position in attribute file into A
35583 AND 192 Reset INK and PAPER bits, preserving BRIGHT and FLASH only...
35585 OR C ...and merge in swapped INK and PAPER values
35586 LD (HL),A Write this new attribute value back to the attribute file
35587 INC HL Advance HL to next byte in attribute file
35588 DJNZ 35586 Decrease B (remaining number of characters to invert) and loop back to 35586 for next character block
35590 RET Return
Prev: 35497 Up: Map Next: 35591