Routines |
Prev: F257 | Up: Map | Next: F2AD |
This scans for a keypress. It will either start the game, select an input device or do nothing. If an input device is chosen, update the menu highlight to match and record which input device was chosen.
Used by the routine at menu_screen.
If the game is started then copy the required input routine to $F075. If the chosen input device is the keyboard, then exit via choose_keys.
|
||||
check_menu_keys | F271 | CALL menu_keyscan | Scan for keys that select an input device. Result is in A | |
F274 | CP $FF | Nothing selected? | ||
F276 | RET Z | Return if so | ||
F277 | AND A | Start game (zero) pressed? | ||
F278 | JR Z,cmk_cpy_rout | Jump if so | ||
F27A | DEC A | Turn 1..4 into 0..3 | ||
Clear old selection.
|
||||
F27B | PUSH AF | Preserve index | ||
F27C | LD A,($F445) | Load previously chosen input device index | ||
F27F | LD E,$07 | Set E to attribute_WHITE_OVER_BLACK | ||
F281 | CALL set_menu_item_attributes | Set the screen attributes of the specified menu item | ||
F284 | POP AF | Restore index | ||
Highlight new selection.
|
||||
F285 | LD ($F445),A | Set chosen input device index | ||
F288 | LD E,$46 | Set E to attribute_BRIGHT_YELLOW_OVER_BLACK | ||
F28A | CALL set_menu_item_attributes | Set the screen attributes of the specified menu item | ||
F28D | RET | Return | ||
Zero pressed to start game.
Copy the input routine to $F075, choose keys if keyboard was chosen, then return to main.
|
||||
cmk_cpy_rout | F28E | LD A,($F445) | Load chosen input device index | |
F291 | ADD A,A | Double it | ||
This is tricky. A' is left with the low byte of the inputroutine address. In the case of the keyboard, it's zero. choose_keys relies on that in a non-obvious way. [DPT: Check this comment]
|
||||
F292 | LD C,A | Widen to BC | ||
F293 | LD B,$00 | |||
F295 | EX AF,AF' | Preserve index | ||
F296 | LD HL,$F43D | Point HL at the list of available input routines | ||
F299 | ADD HL,BC | Combine | ||
F29A | LD A,(HL) | Fetch input routine address into HL | ||
F29B | INC HL | |||
F29C | LD H,(HL) | |||
F29D | LD L,A | |||
F29E | LD DE,$F075 | Set the destination address | ||
F2A1 | LD BC,$004A | Worst-case length of an input routine | ||
F2A4 | LDIR | Copy | ||
F2A6 | EX AF,AF' | Restore index | ||
F2A7 | AND A | Was the keyboard chosen? | ||
F2A8 | CALL Z,choose_keys | Call choose keys if so | ||
F2AB | POP BC | Discard the previous return address and resume at F17D | ||
F2AC | RET |
Prev: F257 | Up: Map | Next: F2AD |