![]() |
Routines |
| Prev: 42267 | Up: Map | Next: 42333 |
|
Used by the routine at ReadCommandLine_CommandLinePrints.
Waits for a key until the timer at 41017+2 runs out. GetKeypress sets bit 7 when a key is pressed. When the timer expires, DeleteInputCharacter runs. Either way the timer is reset to 3000.
|
||||
| WaitForKeyWithTimeout | 42294 | PUSH HL | Save the pointer and read the timeout at 41017+2. | |
| 42295 | LD HL,(41019) | |||
| WaitForKeyWithTimeout_Loop | 42298 | CALL GetKeypress | Jump ahead to WaitForKeyWithTimeout_KeyPressed if GetKeypress reports a key. | |
| 42301 | BIT 7,A | |||
| 42303 | JR NZ,WaitForKeyWithTimeout_KeyPressed | |||
| 42305 | LD A,0 | Start the delay at zero. | ||
| WaitForKeyWithTimeout_0 | 42307 | DEC A | Spin until the delay runs out. | |
| 42308 | PUSH HL | |||
| 42309 | POP HL | |||
| 42310 | JR NZ,WaitForKeyWithTimeout_0 | |||
| 42312 | DEC HL | Count the timeout down. | ||
| 42313 | LD A,H | |||
| 42314 | OR L | |||
| 42315 | JR NZ,WaitForKeyWithTimeout_Loop | |||
| 42317 | POP HL | Restore the pointer from the stack. | ||
| 42318 | PUSH HL | Call DeleteInputCharacter, keeping the pointer. | ||
| 42319 | CALL DeleteInputCharacter | |||
| 42322 | XOR A | Clear the key code. | ||
| WaitForKeyWithTimeout_KeyPressed | 42323 | AND 127 | Clear bit 7 and reset the timeout to 3000. | |
| 42325 | LD HL,3000 | |||
| 42328 | LD (41019),HL | |||
| 42331 | POP HL | Restore the saved pointer from the stack. | ||
| 42332 | RET | Return. | ||
| Prev: 42267 | Up: Map | Next: 42333 |