Routines |
Prev: 729A | Up: Map | Next: 7310 |
Used by the routine at WinnersTableNameEntry.
|
||||||||||
This is a highscore so collect the users name.
|
||||||||||
CollectName | 72B5 | PUSH BC | Stash BC and HL on the stack. | |||||||
72B6 | PUSH HL | |||||||||
72B7 | LD HL,$7399 | HL=Messaging_YourName. | ||||||||
72BA | CALL $187D | Call OUT_LINE2. | ||||||||
Clear out the buffer from any previous name entries.
|
||||||||||
72BD | LD HL,$7383 | HL=Buffer_NameEntry. | ||||||||
72C0 | LD B,$16 | Set a counter of 16 which is the maximum length of the name entry buffer. | ||||||||
Clear_NameEntryBuffer_Loop | 72C2 | LD (HL),$20 | Write an ASCII "SPACE" (20) to *HL. | |||||||
72C4 | INC HL | Increment HL by one. | ||||||||
72C5 | DJNZ Clear_NameEntryBuffer_Loop | Decrease counter by one and loop back to Clear_NameEntryBuffer_Loop until counter is zero. | ||||||||
72C7 | XOR A | Write 00 to *FlagKeyEntry. | ||||||||
72C8 | LD ($7336),A | |||||||||
72CB | LD HL,$7383 | HL=Buffer_NameEntry. | ||||||||
72CE | LD B,$0D | B=0D. | ||||||||
This entry point is used by the routine at NameEntryDelete.
|
||||||||||
NameEntryCollectInput | 72D0 | PUSH BC | Stash BC and the buffer pointer on the stack. | |||||||
72D1 | PUSH HL | |||||||||
This entry point is used by the routine at NameEntryDelete.
|
||||||||||
NameEntryCollectInput_Loop | 72D2 | RES 5,(IY+$01) | Reset bit 5 of *FLAGS which resets "when a new key has been pressed". | |||||||
72D6 | CALL $02BF | Call KEYBOARD. | ||||||||
72D9 | BIT 5,(IY+$01) | Jump to NameEntryCollectInput_Loop if no key was pressed. | ||||||||
72DD | JR Z,NameEntryCollectInput_Loop | |||||||||
72DF | LD A,($5C08) | Jump to ShiftHighScores if *LAST-K (last key pressed) is "enter". | ||||||||
72E2 | CP $0D | |||||||||
72E4 | JR Z,ShiftHighScores | |||||||||
72E6 | CP $0C | Jump to NameEntryDelete if *LAST-K (last key pressed) is "delete". | ||||||||
72E8 | JR Z,NameEntryDelete | |||||||||
72EA | LD B,A | Copy the keypress into B. | ||||||||
72EB | LD A,($7336) | Jump to NameEntryCollectInput_Loop if *FlagKeyEntry is not zero. | ||||||||
72EE | OR A | |||||||||
72EF | JR NZ,NameEntryCollectInput_Loop | |||||||||
72F1 | LD A,B | Jump to NameEntryCollectInput_Loop if B is lower than 20. | ||||||||
72F2 | CP $20 | |||||||||
72F4 | JR C,NameEntryCollectInput_Loop | |||||||||
72F6 | CP $7B | Jump to NameEntryCollectInput_Loop if B is higher than 7B. | ||||||||
72F8 | JR NC,NameEntryCollectInput_Loop | |||||||||
72FA | POP HL | Restore the buffer pointer from the stack. | ||||||||
72FB | PUSH HL | Stash the buffer pointer on the stack again. | ||||||||
72FC | LD (HL),A | Write the keypress to the current position in the buffer. | ||||||||
72FD | RST $10 | Print the keypress to the screen. | ||||||||
Handle if no keys are being pressed, for reference:
In all instances the E register is returned with a value in the range of +00 to +27 the value being different for each of the forty keys of the keyboard, or the value +FF for no-key. |
||||||||||
NameEntryDebounce_Loop | 72FE | CALL $028E | Call KEY_SCAN. | |||||||
7301 | INC E | Set the zero flag if no keys have been pressed. | ||||||||
7302 | JR NZ,NameEntryDebounce_Loop | Jump to NameEntryDebounce_Loop unless no keys are being pressed. | ||||||||
7304 | POP HL | Restore the buffer pointer and BC from the stack. | ||||||||
7305 | POP BC | |||||||||
7306 | INC HL | Increment HL by one. | ||||||||
7307 | DJNZ NameEntryCollectInput | Decrease counter by one and loop back to NameEntryCollectInput until counter is zero. | ||||||||
7309 | LD A,$01 | Write 01 to *FlagKeyEntry. | ||||||||
730B | LD ($7336),A | |||||||||
730E | JR NameEntryCollectInput | Jump to NameEntryCollectInput. |
Prev: 729A | Up: Map | Next: 7310 |