![]() |
Routines |
| Prev: 29230 | Up: Map | Next: 29323 |
|
Used by the routine at ReadTheInputLine.
Counts down the input delay while polling the keyboard. A key raises the next delay by 500, up to 3000, and is returned. If the delay runs out, 29329 is printed into the buffer, ENTER is returned, and the next delay is cleared.
|
||||
| Input_WaitForAKey | 29257 | PUSH HL | Read the input delay. | |
| 29258 | LD HL,(46868) | |||
| Input_WaitForAKey_Poll | 29261 | CALL GetKey | Poll the keyboard. | |
| 29264 | AND A | Jump to Input_WaitForAKey_AddToTheDelay if a key is waiting. | ||
| 29265 | JR NZ,Input_WaitForAKey_AddToTheDelay | |||
| 29267 | DEC HL | Loop back to Input_WaitForAKey_Poll to keep polling until the delay runs out. | ||
| 29268 | LD A,H | |||
| 29269 | OR L | |||
| 29270 | JR NZ,Input_WaitForAKey_Poll | |||
| 29272 | POP HL | Rub out the characters typed so far. | ||
| 29273 | PUSH HL | |||
| 29274 | CALL Input_RubOutCharacters | |||
| 29277 | LD DE,29329 | Point at the letters W, A, I, T. | ||
| 29280 | LD B,4 | Four letters. | ||
| Input_WaitForAKey_Wait | 29282 | LD A,(DE) | Store the next letter of 29329 in the input buffer. | |
| 29283 | LD (HL),A | |||
| 29284 | INC HL | |||
| 29285 | INC DE | |||
| 29286 | CALL Print_Character | Print that letter. | ||
| 29289 | DJNZ Input_WaitForAKey_Wait | Loop back to Input_WaitForAKey_Wait until 29329 is done. | ||
| 29291 | EX (SP),HL | Remember the pointer after 29329, and prepare ENTER. The next delay is 65036 plus 500, which is zero. | ||
| 29292 | LD B,124 | |||
| 29294 | LD A,13 | |||
| 29296 | LD HL,65036 | |||
| Input_WaitForAKey_AddToTheDelay | 29299 | PUSH AF | Add 500 to the delay. A key raises the current delay; the timeout path adds it to zero. | |
| 29300 | XOR A | |||
| 29301 | LD DE,500 | |||
| 29304 | ADC HL,DE | |||
| 29306 | LD DE,3000 | The cap is 3000. | ||
| 29309 | JR C,Input_WaitForAKey_Cap | Jump to Input_WaitForAKey_Cap if the sum overflowed, and use the cap. | ||
| 29311 | CALL Input_CompareTwoTotals | Call Input_CompareTwoTotals to compare the delay with the cap. | ||
| 29314 | JR C,Input_WaitForAKey_Store | Jump to Input_WaitForAKey_Store if the delay is still under the cap. | ||
| Input_WaitForAKey_Cap | 29316 | EX DE,HL | Use the cap instead. | |
| Input_WaitForAKey_Store | 29317 | LD (46868),HL | Store the next input delay. | |
| 29320 | POP AF | Restore AF and HL from the stack. | ||
| 29321 | POP HL | |||
| 29322 | RET | Return. | ||
| Prev: 29230 | Up: Map | Next: 29323 |