Prev: 60FD Up: Map Next: 623F
60FE: Show Title Menu
Used by the routine at RunGame.
Draws the title menu and runs it until the player presses "0" to start the game. While it waits it plays the title tune, highlights the chosen player option and scrolls a message along the bottom of the screen.
Pressing "A" or "B" chooses a one or two player game. Pressing "1" or "2" steps player 1 or player 2 onto the next control method, which moves the marker of that player down the list of options.
show-title-menu
ShowTitleMenu 60FE LD HL,$1960 Set HL to the position for the logo.
6101 LD DE,$6066 Point DE at TitleLogo.
6104 CALL DrawPicture Call DrawPicture to draw it.
6107 LD HL,$FF0E HL is FF0E to write 0E to ScrollCounter (the scroll counter) and FF to A922 (the index of the next character of the scrolling message).
610A LD ($A921),HL Write them.
Copy the scores of the two players into the score boxes of the menu.
610D LD DE,$642F Point DE at the digits of the score of player 1 in the text record at 642B.
6110 LD HL,$E132 Point HL at the score of player 1 at ScoreText_PlayerOne.
6113 LD BC,$0005 Set the number of digits in BC to 05.
6116 LDIR Copy the digits.
6118 LD DE,$6438 Point DE at the digits of the score of player 2 in the text record at 6434.
611B LD HL,$E144 Point HL at the score of player 2 at ScoreText_PlayerTwo.
611E LD BC,$0005 Set the number of digits in BC to 05.
6121 LDIR Copy the digits.
Print the text of the menu and draw the frames and decorations.
6123 LD B,$0D Set the number of text records in B to 0D.
6125 LD DE,$63AF Point DE at the first text record at TitleMenuText.
6128 CALL PrintTextRecords Call PrintTextRecords to print the text records.
612B LD IX,$6318 Point IX at the two frame records at MenuFrames.
612F CALL DrawFrame Call DrawFrame to draw the first frame (the list of options).
6132 CALL DrawFrame Call DrawFrame to draw the second frame (the scrolling message).
6135 LD HL,$AD20 Set HL to the position of the left decoration.
6138 LD DE,$6307 Point DE at the decoration graphic at MenuCornerLeft.
613B CALL DrawPicture Call DrawPicture to draw it.
613E LD HL,$ADD8 Set HL to the position of the right decoration.
6141 LD DE,$630D Point DE at the decoration graphic at MenuCornerRight.
6144 CALL DrawPicture Call DrawPicture to draw it.
Draw the two markers and set up the highlight of the player option.
6147 XOR A Clear A.
6148 LD ($5CB8),A Write 00 to TitleAnimationFrame (the frame of the highlight animation).
614B LD ($5ADC),A Write 00 to the attribute at 5ADC.
614E LD A,$AE A is AE the low byte of the attribute address of the one player option.
6150 LD ($5CB9),A Write it to CellPosition.
6153 LD HL,($627F) Fetch the position of the marker of player 1 from MarkerRecords.
6156 LD DE,$6285 Point DE at Player1Marker.
6159 CALL DrawPicture Call DrawPicture to draw it.
615C LD HL,($6282) Fetch the position of the marker of player 2 from 6282.
615F LD DE,$62C6 Point DE at Player2Marker.
6162 CALL DrawPicture Call DrawPicture to draw it.
6165 LD A,($60FD) Fetch the number of players chosen.
6168 AND A Jump to ShowTitleMenu_Play if one player is chosen.
6169 JR Z,ShowTitleMenu_Play
616B LD A,$EE A is EE the low byte of the attribute address of the two player option.
616D LD ($5CB9),A Write it to CellPosition.
ShowTitleMenu_Play 6170 LD IY,($5CF1) Bring back IY from SavedIY.
6174 LD DE,$5FC3 Point DE at TitleTune.
6177 CALL PlayMusic_WaitKey Call PlayMusic_WaitKey to play it until a key is pressed.
The main loop of the menu.
ShowTitleMenu_Loop 617A EI Enable interrupts.
617B LD A,($5CB9) Fetch the low byte of the attribute address of the highlighted option.
617E LD L,A Copy it into L.
617F CP $AE Jump to ShowTitleMenu_TestOnePlayer if the two player option is highlighted.
6181 JR NZ,ShowTitleMenu_TestOnePlayer
6183 LD A,$7F Read from the keyboard;
Port Number Bit
0 1 2 3 4
7F SPACE SYMBOL SHIFT M N B
6185 CALL ReadKeyboard
6188 AND %00010000 Test the bit for "B".
618A JR Z,ShowTitleMenu_MoveMarkers Jump to ShowTitleMenu_MoveMarkers if "B" is not being pressed.
618C LD A,$01 Set the two player flag to 01.
618E JR ShowTitleMenu_SetPlayers Jump to ShowTitleMenu_SetPlayers.
ShowTitleMenu_TestOnePlayer 6190 LD A,$FD Read from the keyboard;
Port Number Bit
0 1 2 3 4
FD A S D F G
6192 CALL ReadKeyboard
6195 RRA Test the bit for "A".
6196 JR NC,ShowTitleMenu_MoveMarkers Jump to ShowTitleMenu_MoveMarkers if "A" is not being pressed.
6198 XOR A Set the one player flag to 00.
ShowTitleMenu_SetPlayers 6199 LD ($60FD),A Store the number of players.
619C LD A,L Fetch the low byte of the old attribute address.
619D XOR %01000000 Swap between the two options.
619F LD ($5CB9),A Store the new highlighted option.
61A2 LD H,$58 Point H at the attribute rows.
61A4 LD B,$09 Set the width of the highlight in B to 09.
ShowTitleMenu_ResetHighlight 61A6 LD (HL),$42 Set the attribute of the option which is no longer highlighted to the normal colour.
61A8 INC L Move onto the next attribute.
61A9 DJNZ ShowTitleMenu_ResetHighlight Decrease the width counter by one and jump back to ShowTitleMenu_ResetHighlight until the whole option has been reset.
Move the markers, if needed.
ShowTitleMenu_MoveMarkers 61AB EI Enable interrupts.
61AC LD IX,$627F Point IX at the record of the marker of player 1 at MarkerRecords.
61B0 LD E,$01 E is 01 the bit of the "1" key.
61B2 CALL MoveMarker Call MoveMarker to move the marker of player 1.
61B5 LD IX,$6282 Point IX at the record of the marker of player 2 at 6282.
61B9 INC E E is 02 the bit of the "2" key.
61BA CALL MoveMarker Call MoveMarker to move the marker of player 2.
Wait for the next frame.
ShowTitleMenu_WaitFrame 61BD LD A,($5CBA) Fetch the last value of FRAMES that was seen from 5CBA.
61C0 LD B,A Copy it into B.
61C1 LD A,($5C78) Fetch the low byte of FRAMES.
61C4 CP B Compare it with the last value.
61C5 JR Z,ShowTitleMenu_WaitFrame Jump back to ShowTitleMenu_WaitFrame until it has changed.
61C7 LD ($5CBA),A Store the new value in 5CBA.
61CA DI Disable interrupts.
Cycle the colours of the highlighted option.
61CB LD B,$09 Set the width of the highlight in B to 09.
61CD LD A,($5CB9) Fetch the low byte of the attribute address of the highlighted option.
61D0 LD L,A Copy it into L.
61D1 LD H,$58 Point H at the attribute rows.
61D3 LD A,($5CB8) Fetch the animation frame from TitleAnimationFrame.
61D6 DEC A Decrease it by one.
61D7 AND %00000111 Keep only bits 0-2.
61D9 LD ($5CB8),A Store it.
ShowTitleMenu_Highlight 61DC OR %01000000 Make the attribute bright with the ink from A.
61DE LD (HL),A Store it.
61DF INC L Move onto the next attribute.
61E0 INC A Move onto the next ink colour.
61E1 AND %00000111 Keep the ink colour in the range 00-07.
61E3 DJNZ ShowTitleMenu_Highlight Decrease the width counter by one and jump back to ShowTitleMenu_Highlight until the whole option has been done.
Redraw the markers.
61E5 LD DE,$6285 Point DE at Player1Marker.
61E8 LD HL,($627F) Fetch the position of the marker of player 1 from MarkerRecords.
61EB CALL DrawPicture Call DrawPicture to draw it.
61EE LD DE,$62C6 Point DE at Player2Marker.
61F1 LD HL,($6282) Fetch the position of the marker of player 2 from 6282.
61F4 CALL DrawPicture Call DrawPicture to draw it.
61F7 LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
61F9 CALL ReadKeyboard
61FC RRA Rotate the bit for "0" into the carry flag.
61FD JP C,LeaveTitleMenu Jump to LeaveTitleMenu if "0" is being pressed, to start the game.
Scroll the message along the bottom of the screen.
6200 LD HL,$B7E8 Set HL to the position of the right of the new character area.
6203 LD BC,$0207 Set the width in B to 02 bytes and the height in C to 07 rows.
6206 CALL ScrollAreaLeft Call ScrollAreaLeft to scroll the new character area left by one pixel.
6209 LD HL,$51DC HL is 51DC the screen address of the left of the new character area.
620C LD D,H H moves into D.
620D LD E,$DA E is DA to make the screen address of the right of the message frame.
620F CALL CopyColumn_Copy Call CopyColumn_Copy to copy the pixels of the leftmost byte across.
6212 LD HL,$B7D0 Set HL to the position of the right of the message frame.
6215 LD BC,$1607 Set the width in B to 16 bytes and the height in C to 07 rows.
6218 CALL ScrollAreaLeft Call ScrollAreaLeft to scroll the message frame left by one pixel.
621B AND %00001111 Keep only bits 0-3 of the scroll counter.
621D JP NZ,ShowTitleMenu_Loop Jump back to ShowTitleMenu_Loop unless the scroll counter is a multiple of 10.
Add the next character of the message.
6220 LD A,($A922) Fetch the index of the next character of the message from A922.
6223 INC A Move onto the next character.
6224 CP $8D Jump to ShowTitleMenu_StoreIndex if the end of the message has not been reached.
6226 JR NZ,ShowTitleMenu_StoreIndex
6228 XOR A Go back to the start of the message.
ShowTitleMenu_StoreIndex 6229 LD ($A922),A Store the index.
622C LD HL,$6322 Point HL at the scrolling message at ScrollingMessage.
622F CALL AddToAddress Add the index to find the address of the character.
6232 LD A,(HL) Fetch the character.
6233 LD ($6317),A Store it in the text record at ScrollerCharacter.
6236 LD DE,$6313 Point DE at ScrollerCharacter.
6239 CALL PrintText Call PrintText to print the character.
623C JP ShowTitleMenu_Loop Jump back to ShowTitleMenu_Loop.
Prev: 60FD Up: Map Next: 623F