Prev: 35285 Up: Map Next: 35386
35296: Process keyboard / joystick input on a menu and load A with selected item index
Used by the routines at 26670, 26745, 30001, 30145, 30686, 31041, 31537, 31688, 32895, 33952, 34122 and 55115.
Output
A Selected menu item index (zero-based)
35296 LD A,(35087) Check whether to draw hand cursor on menu...
35299 CP 105 ...and if not...
35301 RET NZ ...then return
35302 LD A,(23493) Load A with x-coordinate of left edge of current window to draw (characters)...
35305 LD (23489),A ...and store at 23489
35308 INC A Increase by one character...
35309 LD (23490),A ...and store for later use
35312 LD A,(23456) Load starting y-coordinate of hand cursor into A...
35315 LD B,A and copy into B
35316 LD A,(23494) Load y-coordinate of current window's top-left corner into A...
35319 ADD A,B ...add to B...
35320 ADD A,A ...and multiply by 8 to get y-coordinate of top of hand cursor in pixels...
35321 ADD A,A ...
35322 ADD A,A ...
35323 LD (23491),A Then store for later use
35326 LD A,(23496) Load y-coordinate of current window's bottom edge into A...
35329 ADD A,A ...multiply by eight...
35330 ADD A,A ...
35331 ADD A,A ...
35332 ADD A,7 ...then add 7 to get y-coordinate of absolute bottom of window in pixels
35334 LD (23492),A ...and store for later
35337 LD A,(23494) Load y-coordinate of current window's top-left corner into A...
35340 LD B,A ...and copy into B
35341 LD A,(23496) Load y-coordinate of current window's bottom-right corner into A...
35344 SUB B ...subtract B...
35345 DEC A ...then subtract one to get height of window, not including frame
35346 LD B,A Copy this into B
35347 LD A,(23456) Load A with initial y-coordinate of hand cursor relative to current window...
35350 SUB B ...subtract B...
35351 NEG ...and negate to give vertical distance available to hand cursor to move
35353 ADD A,A Multiply this by eight to convert from characters to pixels...
35354 ADD A,A ...
35355 ADD A,A ...
35356 LD (23475),A ...and store at 23475
35359 LD A,(23479) Load A with current y-coordinate of hand cursor relative to its starting position (pixels)...
35362 CALL 35525 ...and invert INK and PAPER bits to highlight currently active menu item at this position
This entry point is used by the routines at 35397 and 35459.
35365 CALL 54942 Capture keyboard or joystick input loading result into A
35368 HALT Wait for interrupt
35369 BIT 2,A If "up" pressed then...
35371 JP NZ,35397 ...jump to routine to move hand cursor up and update menu item highlighting
35374 BIT 3,A If "down" pressed then...
35376 JP NZ,35459 ...jump to routine to move hand cursor down and update menu item highlighting
35379 BIT 4,A If "fire" has not been pressed then...
35381 JR Z,35365 Loop back to 35365
35383 JP 35497 Load A with (zero-based) index of selected menu item and return
Prev: 35285 Up: Map Next: 35386