Prev: 45568 Up: Map Next: 45646
45623: Handler: User Pressed "DELETE"
Used by the routine at HandlerUserInput.
Rub out the last character of the command when the player presses DELETE.
Input
HL Current position in the command buffer
HandlerUserPressedDELETE 45623 EX DE,HL See whether the cursor is still on the first character.
45624 LD HL,44796
45627 AND A
45628 SBC HL,DE
45630 EX DE,HL
45631 JR Z,Handler_UserInput_ReadKey Ignore DELETE at the start of the command.
Else delete the current character.
45633 PUSH HL Keep the pointer to the command buffer on the stack.
45634 LD HL,44880 Rub out the last character.
45637 CALL PrintString
45640 POP HL Restore the pointer to the command buffer from the stack.
Now adjust the command buffer pointer to match the new position.
45641 DEC HL Decrease the pointer to the command buffer by one.
45642 LD (HL),32 Write an ASCII space (32) into the command buffer at the current position.
45644 JR Handler_UserInput_ReadKey Read the next key.
View the equivalent code in;
Prev: 45568 Up: Map Next: 45646