Prev: 29338 Up: Map Next: 29456
29365: Collect Players Name
Used by the routine at WinnersTableNameEntry.
Input
B The entry ID
HL The appropriate entry from TablePointersWinnersData
This is a highscore so collect the users name.
CollectName 29365 PUSH BC Stash BC and HL on the stack.
29366 PUSH HL
29367 LD HL,29593 HL=Messaging_YourName.
29370 CALL 6269 Call OUT_LINE2.
Clear out the buffer from any previous name entries.
29373 LD HL,29571 HL=Buffer_NameEntry.
29376 LD B,22 Set a counter of 22 which is the maximum length of the name entry buffer.
Clear_NameEntryBuffer_Loop 29378 LD (HL),32 Write an ASCII "SPACE" (32) to *HL.
29380 INC HL Increment HL by one.
29381 DJNZ Clear_NameEntryBuffer_Loop Decrease counter by one and loop back to Clear_NameEntryBuffer_Loop until counter is zero.
29383 XOR A Write 0 to *FlagKeyEntry.
29384 LD (29494),A
29387 LD HL,29571 HL=Buffer_NameEntry.
29390 LD B,13 B=13.
This entry point is used by the routine at NameEntryDelete.
NameEntryCollectInput 29392 PUSH BC Stash BC and the buffer pointer on the stack.
29393 PUSH HL
This entry point is used by the routine at NameEntryDelete.
NameEntryCollectInput_Loop 29394 RES 5,(IY+1) Reset bit 5 of *FLAGS which resets "when a new key has been pressed".
29398 CALL 703 Call KEYBOARD.
29401 BIT 5,(IY+1) Jump to NameEntryCollectInput_Loop if no key was pressed.
29405 JR Z,NameEntryCollectInput_Loop
29407 LD A,(23560) Jump to ShiftHighScores if *LAST-K (last key pressed) is "enter".
29410 CP 13
29412 JR Z,ShiftHighScores
29414 CP 12 Jump to NameEntryDelete if *LAST-K (last key pressed) is "delete".
29416 JR Z,NameEntryDelete
29418 LD B,A Copy the keypress into B.
29419 LD A,(29494) Jump to NameEntryCollectInput_Loop if *FlagKeyEntry is not zero.
29422 OR A
29423 JR NZ,NameEntryCollectInput_Loop
29425 LD A,B Jump to NameEntryCollectInput_Loop if B is lower than 32.
29426 CP 32
29428 JR C,NameEntryCollectInput_Loop
29430 CP 123 Jump to NameEntryCollectInput_Loop if B is higher than 123.
29432 JR NC,NameEntryCollectInput_Loop
29434 POP HL Restore the buffer pointer from the stack.
29435 PUSH HL Stash the buffer pointer on the stack again.
29436 LD (HL),A Write the keypress to the current position in the buffer.
29437 RST 16 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 +0 to +39 the value being different for each of the forty keys of the keyboard, or the value +255 for no-key.
NameEntryDebounce_Loop 29438 CALL 654 Call KEY_SCAN.
29441 INC E Set the zero flag if no keys have been pressed.
29442 JR NZ,NameEntryDebounce_Loop Jump to NameEntryDebounce_Loop unless no keys are being pressed.
29444 POP HL Restore the buffer pointer and BC from the stack.
29445 POP BC
29446 INC HL Increment HL by one.
29447 DJNZ NameEntryCollectInput Decrease counter by one and loop back to NameEntryCollectInput until counter is zero.
29449 LD A,1 Write 1 to *FlagKeyEntry.
29451 LD (29494),A
29454 JR NameEntryCollectInput Jump to NameEntryCollectInput.
Prev: 29338 Up: Map Next: 29456