![]() |
Routines |
| Prev: 46789 | Up: Map | Next: 46915 |
|
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.
|
||||||||||||
| EnterInitials | 46807 | LD B,3 | Set the number of initials in B to 3. | |||||||||
| 46809 | LD HL,20589 | HL=20589 (the screen address of the first letter). | ||||||||||
| EnterInitials_Letter | 46812 | LD A,32 | Set the letter to a space (the first choice for each initial). | |||||||||
| EnterInitials_Wait | 46814 | PUSH AF | Stash the letter on the stack. | |||||||||
| 46815 | CALL HandlerControls | Read the controls. | ||||||||||
| 46818 | POP AF | Restore the letter from the stack. | ||||||||||
| 46819 | BIT 4,C | Jump to EnterInitials_Accept if "FIRE" is being pressed. | ||||||||||
| 46821 | JR NZ,EnterInitials_Accept | |||||||||||
| 46823 | BIT 0,C | Jump to EnterInitials_Previous if "LEFT" is being pressed. | ||||||||||
| 46825 | JR NZ,EnterInitials_Previous | |||||||||||
| 46827 | BIT 1,C | Jump to EnterInitials_Next if "RIGHT" is being pressed. | ||||||||||
| 46829 | JR NZ,EnterInitials_Next | |||||||||||
| 46831 | JR EnterInitials_Wait | Jump to EnterInitials_Wait to wait for the controls. | ||||||||||
|
Choose the previous letter.
|
||||||||||||
| EnterInitials_Previous | 46833 | CALL NewHighScore_Return | Pause and play a high tone. | |||||||||
| 46836 | DEC A | Move back to the previous letter. | ||||||||||
| 46837 | CP 64 | Jump to EnterInitials_Previous_Wrap unless the letter is the one before "A" (64). | ||||||||||
| 46839 | JR NZ,EnterInitials_Previous_Wrap | |||||||||||
| 46841 | LD A,32 | Wrap round to a space. | ||||||||||
| EnterInitials_Previous_Wrap | 46843 | CP 31 | Jump to EnterInitials_Print unless the letter is the one before a space (31). | |||||||||
| 46845 | JR NZ,EnterInitials_Print | |||||||||||
| 46847 | LD A,90 | Wrap round to "Z". | ||||||||||
|
Print the letter without moving along.
|
||||||||||||
| EnterInitials_Print | 46849 | PUSH AF | Stash the letter on the stack. | |||||||||
| 46850 | CALL PrintScreen | Print the letter. | ||||||||||
| 46853 | POP AF | Restore the letter from the stack. | ||||||||||
| 46854 | DEC L | Move back to the column of the letter. | ||||||||||
| 46855 | JR EnterInitials_Wait | Jump to EnterInitials_Wait. | ||||||||||
|
Choose the next letter.
|
||||||||||||
| EnterInitials_Next | 46857 | CALL NewHighScore_Return | Pause and play a high tone. | |||||||||
| 46860 | INC A | Move on to the next letter. | ||||||||||
| 46861 | CP 91 | Jump to EnterInitials_Next_Wrap unless the letter is the one after "Z" (91). | ||||||||||
| 46863 | JR NZ,EnterInitials_Next_Wrap | |||||||||||
| 46865 | LD A,32 | Wrap round to a space. | ||||||||||
| EnterInitials_Next_Wrap | 46867 | CP 33 | Jump to EnterInitials_Print unless the letter is the one after a space (33). | |||||||||
| 46869 | JR NZ,EnterInitials_Print | |||||||||||
| 46871 | LD A,65 | Wrap round to "A". | ||||||||||
| 46873 | JR EnterInitials_Print | Jump to EnterInitials_Print. | ||||||||||
|
Accept the letter. First wait for "fire" to be released.
|
||||||||||||
| EnterInitials_Accept | 46875 | PUSH AF | Stash the letter on the stack. | |||||||||
| 46876 | CALL HandlerControls | Read the controls. | ||||||||||
| 46879 | POP AF | Restore the letter from the stack. | ||||||||||
| 46880 | BIT 4,C | Jump to EnterInitials_Accept until "FIRE" has been released. | ||||||||||
| 46882 | JR NZ,EnterInitials_Accept | |||||||||||
| 46884 | LD (DE),A | Write the letter into the hall of fame. | ||||||||||
| 46885 | INC DE | Move to the next letter in the hall of fame. | ||||||||||
| 46886 | PUSH AF | Stash the letter on the stack. | ||||||||||
| 46887 | PUSH BC | Stash the initials counter on the stack. | ||||||||||
| 46888 | CALL PrintScreen | Print the chosen letter. | ||||||||||
| 46891 | INC L | Leave a gap before the next letter. | ||||||||||
| 46892 | CALL PlayLowTone | Play a low tone. | ||||||||||
| 46895 | LD BC,0 | Set the delay counter in BC to zero. | ||||||||||
| EnterInitials_Delay | 46898 | DEC BC | Decrease the delay counter by one. | |||||||||
| 46899 | LD A,B | Test whether the delay counter is zero. | ||||||||||
| 46900 | OR C | |||||||||||
| 46901 | JR NZ,EnterInitials_Delay | Loop back to EnterInitials_Delay until the delay is over. | ||||||||||
| 46903 | POP BC | Restore the initials counter from the stack. | ||||||||||
| 46904 | POP AF | Restore the letter from the stack. | ||||||||||
| 46905 | 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 65536 before returning (this jumps to a routine which returns).
|
||||||||||||
| 46907 | LD B,1 | Set the pause multiplier in B to 1. | ||||||||||
| 46909 | LD HL,0 | Set the pause counter in HL to zero. | ||||||||||
| 46912 | JP Pause | Jump to Pause to pause before returning. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 46789 | Up: Map | Next: 46915 |