![]()  | 
Routines | 
| Prev: C415 | Up: Map | Next: C45E | 
  | 
||||||||
| GetKeypress | C41F | PUSH IY | Stash IY, IX, HL, DE and BC on the stack. | |||||
| C421 | PUSH IX | |||||||
| C423 | PUSH HL | |||||||
| C424 | PUSH DE | |||||||
| C425 | PUSH BC | |||||||
| C426 | LD IY,$5C3A | IY=ERR_NR. | ||||||
| C42A | EI | Enable interrupts. | ||||||
| C42B | HALT | Halt operation (suspend CPU until the next interrupt). | ||||||
| C42C | DI | Disable interrupts. | ||||||
| C42D | LD A,($5C3B) | Jump to GetKeypress_Process if bit 5 of *FLAGS is set, indicating that a key has been pressed. | ||||||
| C430 | BIT 5,A | |||||||
| C432 | JR NZ,GetKeypress_Process | |||||||
| 
 
No key has been pressed.
 
 | 
||||||||
| C434 | XOR A | Load A with 00 (no keypress). | ||||||
| C435 | JR GetKeypress_Return | Jump to GetKeypress_Return. | ||||||
| 
 
A key has been pressed, so process it.
 
 | 
||||||||
| GetKeypress_Process | C437 | RES 5,A | Reset bit 5 of *FLAGS which resets "when a new key has been pressed". | |||||
| C439 | LD ($5C3B),A | |||||||
| C43C | LD A,($5C08) | Jump to GetKeypress_CheckDelete if *LAST-K (last key pressed) is not ASCII 5F ("_"). | ||||||
| C43F | CP $5F | |||||||
| C441 | JR NZ,GetKeypress_CheckDelete | |||||||
| C443 | LD A,$18 | A=18. | ||||||
| 
 
Did the player press "DELETE"?
 
 | 
||||||||
| GetKeypress_CheckDelete | C445 | CP $0C | Jump to GetKeypress_CheckUp if *LAST-K (last key pressed) is not ASCII 0C ("DELETE"). | |||||
| C447 | JR NZ,GetKeypress_CheckUp | |||||||
| C449 | LD A,$08 | Load A with 08 (delete was pressed). | ||||||
| 
 
Did the player press "UP"?
 
 | 
||||||||
| GetKeypress_CheckUp | C44B | CP $0B | Jump to GetKeypress_Validate if *LAST-K (last key pressed) is not ASCII 0B ("UP"). | |||||
| C44D | JR NZ,GetKeypress_Validate | |||||||
| C44F | LD A,$5B | Load A with 5B (up was pressed). | ||||||
| GetKeypress_Validate | C451 | CALL ValidateKeypress | Call ValidateKeypress. | |||||
| C454 | SET 7,A | Set bit 7 of A. | ||||||
| GetKeypress_Return | C456 | POP BC | Restore BC, DE, HL, IX and IY from the stack. | |||||
| C457 | POP DE | |||||||
| C458 | POP HL | |||||||
| C459 | POP IX | |||||||
| C45B | POP IY | |||||||
| C45D | RET | Return. | ||||||
| Prev: C415 | Up: Map | Next: C45E |