Prev: B6C5 Up: Map Next: B743
B6D7: Enter Initials
Used by the routine at NewHighScore_Enter.
Lets the player choose three initials for the hall of fame, using the controls (see HandlerControls). "Left" and "right" step through the letters (space followed by "A" to "Z"), and "fire" accepts the letter and moves to the next one. The initials are written to the hall of fame and drawn on the screen.
Before After EnterInitials
enter-initials-before enter-initials-after
Input
DE Address of the initials in the hall of fame
EnterInitials B6D7 LD B,$03 Set the number of initials in B to 03.
B6D9 LD HL,$506D HL=506D (the screen address of the first letter).
EnterInitials_Letter B6DC LD A,$20 Set the letter to a space (the first choice for each initial).
EnterInitials_Wait B6DE PUSH AF Stash the letter on the stack.
B6DF CALL HandlerControls Read the controls.
B6E2 POP AF Restore the letter from the stack.
B6E3 BIT 4,C Jump to EnterInitials_Accept if "FIRE" is being pressed.
B6E5 JR NZ,EnterInitials_Accept
B6E7 BIT 0,C Jump to EnterInitials_Previous if "LEFT" is being pressed.
B6E9 JR NZ,EnterInitials_Previous
B6EB BIT 1,C Jump to EnterInitials_Next if "RIGHT" is being pressed.
B6ED JR NZ,EnterInitials_Next
B6EF JR EnterInitials_Wait Jump to EnterInitials_Wait to wait for the controls.
Choose the previous letter.
EnterInitials_Previous B6F1 CALL NewHighScore_Return Pause and play a high tone.
B6F4 DEC A Move back to the previous letter.
B6F5 CP $40 Jump to EnterInitials_Previous_Wrap unless the letter is the one before "A" (40).
B6F7 JR NZ,EnterInitials_Previous_Wrap
B6F9 LD A,$20 Wrap round to a space.
EnterInitials_Previous_Wrap B6FB CP $1F Jump to EnterInitials_Print unless the letter is the one before a space (1F).
B6FD JR NZ,EnterInitials_Print
B6FF LD A,$5A Wrap round to "Z".
Print the letter without moving along.
EnterInitials_Print B701 PUSH AF Stash the letter on the stack.
B702 CALL PrintScreen Print the letter.
B705 POP AF Restore the letter from the stack.
B706 DEC L Move back to the column of the letter.
B707 JR EnterInitials_Wait Jump to EnterInitials_Wait.
Choose the next letter.
EnterInitials_Next B709 CALL NewHighScore_Return Pause and play a high tone.
B70C INC A Move on to the next letter.
B70D CP $5B Jump to EnterInitials_Next_Wrap unless the letter is the one after "Z" (5B).
B70F JR NZ,EnterInitials_Next_Wrap
B711 LD A,$20 Wrap round to a space.
EnterInitials_Next_Wrap B713 CP $21 Jump to EnterInitials_Print unless the letter is the one after a space (21).
B715 JR NZ,EnterInitials_Print
B717 LD A,$41 Wrap round to "A".
B719 JR EnterInitials_Print Jump to EnterInitials_Print.
Accept the letter. First wait for "fire" to be released.
EnterInitials_Accept B71B PUSH AF Stash the letter on the stack.
B71C CALL HandlerControls Read the controls.
B71F POP AF Restore the letter from the stack.
B720 BIT 4,C Jump to EnterInitials_Accept until "FIRE" has been released.
B722 JR NZ,EnterInitials_Accept
B724 LD (DE),A Write the letter into the hall of fame.
B725 INC DE Move to the next letter in the hall of fame.
B726 PUSH AF Stash the letter on the stack.
B727 PUSH BC Stash the initials counter on the stack.
B728 CALL PrintScreen Print the chosen letter.
B72B INC L Leave a gap before the next letter.
B72C CALL PlayLowTone Play a low tone.
B72F LD BC,$0000 Set the delay counter in BC to zero.
EnterInitials_Delay B732 DEC BC Decrease the delay counter by one.
B733 LD A,B Test whether the delay counter is zero.
B734 OR C
B735 JR NZ,EnterInitials_Delay Loop back to EnterInitials_Delay until the delay is over.
B737 POP BC Restore the initials counter from the stack.
B738 POP AF Restore the letter from the stack.
B739 DJNZ EnterInitials_Letter Decrease the letter counter by one and loop back to EnterInitials_Letter until all three letters have been chosen.
Introduce a pause by counting down from 10000 before returning (this jumps to a routine which returns).
B73B LD B,$01 Set the pause multiplier in B to 01.
B73D LD HL,$0000 Set the pause counter in HL to zero.
B740 JP Pause Jump to Pause to pause before returning.
View the equivalent code in;
Prev: B6C5 Up: Map Next: B743