Prev: 47491 Up: Map Next: 47592
47502: Process keyboard / joystick input on a menu and load A with selected item index
Used by the routines at 37689, 37764, 42494, 42638, 43043, 43874, 44635, 45809, 45963, 46106 and 64207.
Output
A Selected menu item index (zero-based)
47502 LD A,(47290) Check whether to draw hand cursor on menu...
47505 CP 105 ...and if not...
47507 RET NZ ...then return
47508 LD A,(23408) Load A with x-coordinate of left edge of current window to draw (characters)...
47511 LD (23404),A ...and store at 23404
47514 INC A Increase by one character...
47515 LD (23405),A ...and store for later use
47518 LD A,(23456) Load starting y-coordinate of hand cursor into A...
47521 LD B,A and copy into B
47522 LD A,(23409) Load y-coordinate of current window's top-left corner into A...
47525 ADD A,B ...add to B...
47526 ADD A,A ...and multiply by 8 to get y-coordinate of top of hand cursor in pixels...
47527 ADD A,A ...
47528 ADD A,A ...
47529 LD (23406),A Then store for later use
47532 LD A,(23411) Load y-coordinate of current window's bottom edge into A...
47535 ADD A,A ...multiply by eight...
47536 ADD A,A ...
47537 ADD A,A ...
47538 ADD A,7 ...then add 7 to get y-coordinate of absolute bottom of window in pixels
47540 LD (23407),A ...and store for later
47543 LD A,(23409) Load y-coordinate of current window's top-left corner into A...
47546 LD B,A ...and copy into B
47547 LD A,(23411) Load y-coordinate of current window's bottom-right corner into A...
47550 SUB B ...subtract B...
47551 DEC A ...then subtract one to get height of window, not including frame
47552 LD B,A Copy this into B
47553 LD A,(23456) Load A with initial y-coordinate of hand cursor relative to current window...
47556 SUB B ...subtract B...
47557 NEG ...and negate to give vertical distance available to hand cursor to move
47559 ADD A,A Multiply this by eight to convert from characters to pixels...
47560 ADD A,A ...
47561 ADD A,A ...
47562 LD (23475),A ...and store at 23475
47565 LD A,(23479) Load A with current y-coordinate of hand cursor relative to its starting position (pixels)...
47568 CALL 47731 ...and invert INK and PAPER bits to highlight currently active menu item at this position
This entry point is used by the routines at 47603 and 47665.
47571 CALL 64034 Capture keyboard or joystick input loading result into A
47574 HALT Wait for interrupt
47575 BIT 2,A If "up" pressed then...
47577 JP NZ,47603 ...jump to routine to move hand cursor up and update menu item highlighting
47580 BIT 3,A If "down" pressed then...
47582 JP NZ,47665 ...jump to routine to move hand cursor down and update menu item highlighting
47585 BIT 4,A If "fire" has not been pressed then...
47587 JR Z,47571 Loop back to 47571
47589 JP 47703 Load A with (zero-based) index of selected menu item and return
Prev: 47491 Up: Map Next: 47592