Prev: BA01 Up: Map Next: BA93
BA19: Enter Initials
Used by the routine at NewHighScore_Enter.
Asks the player for three initials. The turning controls change the letter, which cycles through the space and the letters A to Z, and the fire control for the first weapon accepts it.
Input
DE Address of the name
EnterInitials BA19 LD B,$03 There are three letters.
BA1B XOR A Clear the controls.
BA1C LD ($9625),A
BA1F LD HL,$5069 Point HL at the screen address of the first letter.
EnterInitials_Letter BA22 LD A,$20 Start with a space.
EnterInitials_Read BA24 PUSH AF Save the letter.
BA25 CALL ReadControls Read the controls using ReadControls.
BA28 XOR A Clear the controls.
BA29 LD ($9625),A
BA2C POP AF Restore the letter.
BA2D BIT 4,C Jump to accept the letter if the fire control is being used.
BA2F JR NZ,EnterInitials_Fire
BA31 BIT 1,C Jump to go back a letter if the control to turn left is being used.
BA33 JR NZ,EnterInitials_PreviousLetter
BA35 BIT 0,C Jump to go on a letter if the control to turn right is being used.
BA37 JR NZ,EnterInitials_NextLetter
BA39 JR EnterInitials_Read Jump to read the controls again.
EnterInitials_PreviousLetter BA3B CALL NewHighScore_Return Make a sound using NewHighScore_Return.
BA3E DEC A Go back a letter.
BA3F CP $40 Jump if that is not the character before 41 ("A").
BA41 JR NZ,EnterInitials_CheckSpace
BA43 LD A,$20 Use a space.
EnterInitials_CheckSpace BA45 CP $1F Jump if that is not the character before a space.
BA47 JR NZ,EnterInitials_Show
BA49 LD A,$5A Use "Z".
EnterInitials_Show BA4B PUSH AF Save the letter.
BA4C CALL PrintScreen Print the letter using PrintScreen.
BA4F POP AF Restore the letter.
BA50 DEC L Go back to the screen address of the letter.
BA51 JR EnterInitials_Read Jump to read the controls again.
EnterInitials_NextLetter BA53 CALL NewHighScore_Return Make a sound using NewHighScore_Return.
BA56 INC A Go on a letter.
BA57 CP $5B Jump if that is not the character after "Z".
BA59 JR NZ,EnterInitials_CheckAfterZ
BA5B LD A,$20 Use a space.
EnterInitials_CheckAfterZ BA5D CP $21 Jump if that is not the character after a space.
BA5F JR NZ,EnterInitials_Show
BA61 LD A,$41 Use "A".
BA63 JR EnterInitials_Show Jump to show the letter.
EnterInitials_Fire BA65 PUSH AF Save the letter.
BA66 CALL ReadControls Read the controls using ReadControls.
BA69 XOR A Clear the controls.
BA6A LD ($9625),A
BA6D POP AF Restore the letter.
BA6E BIT 4,C Jump back until the fire control is released.
BA70 JR NZ,EnterInitials_Fire
BA72 LD (DE),A Store the letter in the name.
BA73 INC DE Move on to the next letter of the name.
BA74 PUSH AF Save the letter...
BA75 PUSH BC ...and the counter.
BA76 CALL PrintScreen Print the letter using PrintScreen.
BA79 INC L Leave a gap before the next letter.
BA7A LD C,$00 Make a sound using PlayNoiseSound_Counter.
BA7C CALL PlayNoiseSound_Counter
BA7F LD BC,$0000 Wait for 10000 iterations.
EnterInitials_Delay BA82 DEC BC Count down the delay.
BA83 LD A,B Loop back until the count reaches zero.
BA84 OR C
BA85 JR NZ,EnterInitials_Delay
BA87 POP BC Restore the counter...
BA88 POP AF ...and the letter.
BA89 DJNZ EnterInitials_Letter Loop back until all three letters have been entered.
BA8B LD B,$01 Use one pass of the delay...
BA8D LD HL,$0000 ...with a count of 00...
BA90 JP Delay ...and wait using Delay.
View the equivalent code in;
Prev: BA01 Up: Map Next: BA93