Prev: F274 Up: Map Next: F33E
F295: Handle Name Input
Countdown HallOfFame_Timer and read the controls while a name is being entered.
HallOfFame_Input F295 LD HL,($5E6D) Fetch HallOfFame_Timer.
F298 DEC HL Decrease it by one.
F299 LD ($5E6D),HL Write it back.
F29C LD A,L Jump to InsertHighScore if the timer is now zero.
F29D OR H
F29E JP Z,InsertHighScore
F2A1 CALL HandlerControls Call HandlerControls.
F2A4 BIT 4,A Jump to HallOfFame_Input_AcceptFire if fire is pressed.
F2A6 JP Z,HallOfFame_Input_AcceptFire
Only check Left and Right once every sixteen ticks.
F2A9 LD A,($5E6D) Fetch the low byte of HallOfFame_Timer.
F2AC AND %00001111 Keep only bits 0-3.
F2AE JP NZ,HallOfFame_Input_DrawLetter Jump to HallOfFame_Input_DrawLetter if the result is not zero.
Release the fire lock, then read Left and Right.
F2B1 XOR A Write 00 to HallOfFame_FireLock.
F2B2 LD ($5E70),A
F2B5 CALL HandlerControls Call HandlerControls.
F2B8 BIT 0,A Jump to HallOfFame_Input_StepForward if Right is pressed.
F2BA JP Z,HallOfFame_Input_StepForward
F2BD BIT 1,A Jump to HallOfFame_Input_StepBackward if Left is pressed.
F2BF JP Z,HallOfFame_Input_StepBackward
Draw the current letter and restart the input wait.
HallOfFame_Input_DrawLetter F2C2 LD A,($5E6F) Fetch HallOfFame_Index.
F2C5 LD HL,$5E78 HL=HallOfFame_Name.
F2C8 LD C,A Copy the index into C.
F2C9 LD B,$00 Clear B.
F2CB ADD HL,BC Point HL at the current letter.
F2CC LD A,(HL) Fetch the letter.
F2CD LD HL,($5E75) Fetch HallOfFame_Pointer.
F2D0 CALL PrintScreen Call PrintScreen.
F2D3 JP StartNameEntry Jump to StartNameEntry.
Fire accepts the letter and advances the cursor.
HallOfFame_Input_AcceptFire F2D6 LD A,($5E70) Fetch HallOfFame_FireLock.
F2D9 AND A Jump to HallOfFame_Input_DrawLetter if fire is still locked.
F2DA JP NZ,HallOfFame_Input_DrawLetter
F2DD CALL SoundsDropItem Call SoundsDropItem.
F2E0 LD A,$01 Write 01 to HallOfFame_FireLock.
F2E2 LD ($5E70),A
Advance to the next letter, finishing after three.
F2E5 LD A,($5E6F) Fetch HallOfFame_Index.
F2E8 INC A Increase the index by one.
F2E9 CP $03 Jump to InsertHighScore if all three letters are done.
F2EB JP Z,InsertHighScore
F2EE LD ($5E6F),A Write the new index.
Move the screen pointer on to the next letter.
F2F1 LD HL,($5E75) Fetch HallOfFame_Pointer.
F2F4 LD A,$40 A=40 (unused).
F2F6 INC L Advance the screen pointer by two columns.
F2F7 INC L
F2F8 LD ($5E75),HL Write it back.
F2FB JP HallOfFame_Input_DrawLetter Jump to HallOfFame_Input_DrawLetter.
Right steps the letter forward.
HallOfFame_Input_StepForward F2FE CALL SoundsTakeObject Call SoundsTakeObject.
Fetch the current letter and step it forward.
F301 LD A,($5E6F) Fetch HallOfFame_Index.
F304 LD C,A Copy the index into C.
F305 LD B,$00 Clear B.
F307 LD HL,$5E78 HL=HallOfFame_Name.
F30A ADD HL,BC Point HL at the current letter.
F30B LD A,(HL) Fetch the letter.
F30C INC A Increase it by one.
Wrap the letter around: after "Z" comes a space, and after a space comes "A".
F30D CP $5B Jump to HallOfFame_Input_Space if it wrapped past "Z".
F30F JR Z,HallOfFame_Input_Space
F311 CP $21 Jump to HallOfFame_Input_WriteLetter if it is not "!".
F313 JP NZ,HallOfFame_Input_WriteLetter
F316 LD A,$41 A=41.
HallOfFame_Input_WriteLetter F318 LD (HL),A Write the letter.
F319 JP HallOfFame_Input_DrawLetter Jump to HallOfFame_Input_DrawLetter.
Left steps the letter backward.
HallOfFame_Input_StepBackward F31C CALL SoundsTakeObject Call SoundsTakeObject.
Fetch the current letter and step it backward.
F31F LD A,($5E6F) Fetch HallOfFame_Index.
F322 LD C,A Copy the index into C.
F323 LD B,$00 Clear B.
F325 LD HL,$5E78 HL=HallOfFame_Name.
F328 ADD HL,BC Point HL at the current letter.
F329 LD A,(HL) Fetch the letter.
F32A DEC A Decrease it by one.
Wrap the letter around: before "A" comes a space, and before a space comes "Z".
F32B CP $40 Jump to HallOfFame_Input_Space if it wrapped past "A".
F32D JR Z,HallOfFame_Input_Space
F32F CP $1F Jump to HallOfFame_Input_Loop if it is not 1F.
F331 JP NZ,HallOfFame_Input_Loop
F334 LD A,$5A A=5A.
HallOfFame_Input_Loop F336 LD (HL),A Write the letter.
F337 JP HallOfFame_Input_DrawLetter Jump to HallOfFame_Input_DrawLetter.
HallOfFame_Input_Space F33A LD A,$20 A=20.
F33C JR HallOfFame_Input_Loop Jump to HallOfFame_Input_Loop.
Prev: F274 Up: Map Next: F33E