![]() |
Routines |
| Prev: A51B | Up: Map | Next: A55D |
|
Used by the routine at ReadCommandLine_CommandLinePrints.
Waits for a key until the timer at A039+02 runs out. GetKeypress sets bit 7 when a key is pressed. When the timer expires, DeleteInputCharacter runs. Either way the timer is reset to 0BB8.
|
||||
| WaitForKeyWithTimeout | A536 | PUSH HL | Save the pointer and read the timeout at A039+02. | |
| A537 | LD HL,($A03B) | |||
| WaitForKeyWithTimeout_Loop | A53A | CALL GetKeypress | Jump ahead to WaitForKeyWithTimeout_KeyPressed if GetKeypress reports a key. | |
| A53D | BIT 7,A | |||
| A53F | JR NZ,WaitForKeyWithTimeout_KeyPressed | |||
| A541 | LD A,$00 | Start the delay at zero. | ||
| WaitForKeyWithTimeout_0 | A543 | DEC A | Spin until the delay runs out. | |
| A544 | PUSH HL | |||
| A545 | POP HL | |||
| A546 | JR NZ,WaitForKeyWithTimeout_0 | |||
| A548 | DEC HL | Count the timeout down. | ||
| A549 | LD A,H | |||
| A54A | OR L | |||
| A54B | JR NZ,WaitForKeyWithTimeout_Loop | |||
| A54D | POP HL | Restore the pointer from the stack. | ||
| A54E | PUSH HL | Call DeleteInputCharacter, keeping the pointer. | ||
| A54F | CALL DeleteInputCharacter | |||
| A552 | XOR A | Clear the key code. | ||
| WaitForKeyWithTimeout_KeyPressed | A553 | AND $7F | Clear bit 7 and reset the timeout to 0BB8. | |
| A555 | LD HL,$0BB8 | |||
| A558 | LD ($A03B),HL | |||
| A55B | POP HL | Restore the saved pointer from the stack. | ||
| A55C | RET | Return. | ||
| Prev: A51B | Up: Map | Next: A55D |