Prev: 50197 Up: Map Next: 50270
50207: Get Keypress
Used by the routines at GameEntryPoint, 42189 and WaitForKeypress_Loop.
Output
A Keypress value, or 0 for no keypress
GetKeypress 50207 PUSH IY Stash IY, IX, HL, DE and BC on the stack.
50209 PUSH IX
50211 PUSH HL
50212 PUSH DE
50213 PUSH BC
50214 LD IY,23610 IY=ERR_NR.
50218 EI Enable interrupts.
50219 HALT Halt operation (suspend CPU until the next interrupt).
50220 DI Disable interrupts.
50221 LD A,(23611) Jump to GetKeypress_Process if bit 5 of *FLAGS is set, indicating that a key has been pressed.
50224 BIT 5,A
50226 JR NZ,GetKeypress_Process
No key has been pressed.
50228 XOR A Load A with 0 (no keypress).
50229 JR GetKeypress_Return Jump to GetKeypress_Return.
A key has been pressed, so process it.
GetKeypress_Process 50231 RES 5,A Reset bit 5 of *FLAGS which resets "when a new key has been pressed".
50233 LD (23611),A
50236 LD A,(23560) Jump to GetKeypress_CheckDelete if *LAST-K (last key pressed) is not ASCII 95 ("_").
50239 CP 95
50241 JR NZ,GetKeypress_CheckDelete
50243 LD A,24 A=24.
Did the player press "DELETE"?
GetKeypress_CheckDelete 50245 CP 12 Jump to GetKeypress_CheckEnter if *LAST-K (last key pressed) is not ASCII 12 ("DELETE").
50247 JR NZ,GetKeypress_CheckEnter
50249 LD A,8 Load A with 8 (delete was pressed).
Did the player press "ENTER"?
GetKeypress_CheckEnter 50251 CP 11 Jump to GetKeypress_Validate if *LAST-K (last key pressed) is not ASCII 11 ("ENTER").
50253 JR NZ,GetKeypress_Validate
50255 LD A,91 Load A with 91 (enter was pressed).
GetKeypress_Validate 50257 CALL ValidateKeypress Call ValidateKeypress.
50260 SET 7,A Set bit 7 of A.
GetKeypress_Return 50262 POP BC Restore BC, DE, HL, IX and IY from the stack.
50263 POP DE
50264 POP HL
50265 POP IX
50267 POP IY
50269 RET Return.
Prev: 50197 Up: Map Next: 50270