Prev: 49198 Up: Map Next: 49297
49224: Read Key
Reads keys until ENTER. DELETE rubs out, and letters are stored in capitals.
Input
HL Command buffer pointer
Output
HL Pointer after the last stored character
ReadKey 49224 CALL 26157 Call WaitForKey to read one key.
49227 CP 12 Jump to ReadKey_Delete if the key is DELETE.
49229 JR Z,ReadKey_Delete
49231 CP 13 Jump to ParseLine if the key is ENTER.
49233 JR Z,ParseLine
49235 JR ReadKey_Store Jump to ReadKey_Store to store the key.
Rub the last character out, unless the buffer is already empty.
ReadKey_Delete 49237 PUSH AF Stash the key on the stack.
49238 LD A,(23438) Jump to ReadKey_Ignore if *InputLength is empty.
49241 OR A
49242 JR Z,ReadKey_Ignore
49244 POP AF Restore the key from the stack.
49245 CALL 25492 Call PrintCharacter to rub the character out.
49248 DEC HL Decrement the buffer pointer and *InputLength.
49249 LD A,(23438)
49252 DEC A
49253 LD (23438),A
49256 JR ReadKey Jump to ReadKey.
Throw the key away and read another.
ReadKey_Ignore 49258 POP AF Drop the rejected key from the stack.
49259 JR ReadKey Jump to ReadKey.
Store a capital letter if the buffer still has room.
ReadKey_Store 49261 PUSH AF Stash the key on the stack.
49262 LD A,(23438) Jump to ReadKey_Ignore if *InputLength already holds 94 characters.
49265 CP 94
49267 JR Z,ReadKey_Ignore
49269 POP AF Restore the key from the stack.
49270 CP 32 Jump to ReadKey if a control or a graphic is rejected.
49272 JR C,ReadKey
49274 CP 97 Fold a lowercase letter to capitals.
49276 JR C,ReadKey_Fold
49278 SUB 32
ReadKey_Fold 49280 CP 91 Jump to ReadKey if the character is above "Z".
49282 JR NC,ReadKey
49284 LD (HL),A Store the capital and call PrintCharacter to echo it.
49285 CALL 25492
49288 INC HL Advance the pointer and increment *InputLength.
49289 PUSH HL
49290 LD HL,23438
49293 INC (HL)
49294 POP HL Restore the buffer pointer from the stack.
49295 JR ReadKey Jump to ReadKey.
Prev: 49198 Up: Map Next: 49297