Prev: 24829 Up: Map Next: 25151
24830: 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 24830 LD HL,6496 Set HL to the position for the logo.
24833 LD DE,24678 Point DE at TitleLogo.
24836 CALL DrawPicture Call DrawPicture to draw it.
24839 LD HL,65294 HL is 65294 to write 14 to ScrollCounter (the scroll counter) and 255 to 43298 (the index of the next character of the scrolling message).
24842 LD (43297),HL Write them.
Copy the scores of the two players into the score boxes of the menu.
24845 LD DE,25647 Point DE at the digits of the score of player 1 in the text record at 25643.
24848 LD HL,57650 Point HL at the score of player 1 at ScoreText_PlayerOne.
24851 LD BC,5 Set the number of digits in BC to 5.
24854 LDIR Copy the digits.
24856 LD DE,25656 Point DE at the digits of the score of player 2 in the text record at 25652.
24859 LD HL,57668 Point HL at the score of player 2 at ScoreText_PlayerTwo.
24862 LD BC,5 Set the number of digits in BC to 5.
24865 LDIR Copy the digits.
Print the text of the menu and draw the frames and decorations.
24867 LD B,13 Set the number of text records in B to 13.
24869 LD DE,25519 Point DE at the first text record at TitleMenuText.
24872 CALL PrintTextRecords Call PrintTextRecords to print the text records.
24875 LD IX,25368 Point IX at the two frame records at MenuFrames.
24879 CALL DrawFrame Call DrawFrame to draw the first frame (the list of options).
24882 CALL DrawFrame Call DrawFrame to draw the second frame (the scrolling message).
24885 LD HL,44320 Set HL to the position of the left decoration.
24888 LD DE,25351 Point DE at the decoration graphic at MenuCornerLeft.
24891 CALL DrawPicture Call DrawPicture to draw it.
24894 LD HL,44504 Set HL to the position of the right decoration.
24897 LD DE,25357 Point DE at the decoration graphic at MenuCornerRight.
24900 CALL DrawPicture Call DrawPicture to draw it.
Draw the two markers and set up the highlight of the player option.
24903 XOR A Clear A.
24904 LD (23736),A Write 0 to TitleAnimationFrame (the frame of the highlight animation).
24907 LD (23260),A Write 0 to the attribute at 23260.
24910 LD A,174 A is 174 the low byte of the attribute address of the one player option.
24912 LD (23737),A Write it to CellPosition.
24915 LD HL,(25215) Fetch the position of the marker of player 1 from MarkerRecords.
24918 LD DE,25221 Point DE at Player1Marker.
24921 CALL DrawPicture Call DrawPicture to draw it.
24924 LD HL,(25218) Fetch the position of the marker of player 2 from 25218.
24927 LD DE,25286 Point DE at Player2Marker.
24930 CALL DrawPicture Call DrawPicture to draw it.
24933 LD A,(24829) Fetch the number of players chosen.
24936 AND A Jump to ShowTitleMenu_Play if one player is chosen.
24937 JR Z,ShowTitleMenu_Play
24939 LD A,238 A is 238 the low byte of the attribute address of the two player option.
24941 LD (23737),A Write it to CellPosition.
ShowTitleMenu_Play 24944 LD IY,(23793) Bring back IY from SavedIY.
24948 LD DE,24515 Point DE at TitleTune.
24951 CALL PlayMusic_WaitKey Call PlayMusic_WaitKey to play it until a key is pressed.
The main loop of the menu.
ShowTitleMenu_Loop 24954 EI Enable interrupts.
24955 LD A,(23737) Fetch the low byte of the attribute address of the highlighted option.
24958 LD L,A Copy it into L.
24959 CP 174 Jump to ShowTitleMenu_TestOnePlayer if the two player option is highlighted.
24961 JR NZ,ShowTitleMenu_TestOnePlayer
24963 LD A,127 Read from the keyboard;
Port Number Bit
0 1 2 3 4
127 SPACE SYMBOL SHIFT M N B
24965 CALL ReadKeyboard
24968 AND %00010000 Test the bit for "B".
24970 JR Z,ShowTitleMenu_MoveMarkers Jump to ShowTitleMenu_MoveMarkers if "B" is not being pressed.
24972 LD A,1 Set the two player flag to 1.
24974 JR ShowTitleMenu_SetPlayers Jump to ShowTitleMenu_SetPlayers.
ShowTitleMenu_TestOnePlayer 24976 LD A,253 Read from the keyboard;
Port Number Bit
0 1 2 3 4
253 A S D F G
24978 CALL ReadKeyboard
24981 RRA Test the bit for "A".
24982 JR NC,ShowTitleMenu_MoveMarkers Jump to ShowTitleMenu_MoveMarkers if "A" is not being pressed.
24984 XOR A Set the one player flag to 0.
ShowTitleMenu_SetPlayers 24985 LD (24829),A Store the number of players.
24988 LD A,L Fetch the low byte of the old attribute address.
24989 XOR %01000000 Swap between the two options.
24991 LD (23737),A Store the new highlighted option.
24994 LD H,88 Point H at the attribute rows.
24996 LD B,9 Set the width of the highlight in B to 9.
ShowTitleMenu_ResetHighlight 24998 LD (HL),66 Set the attribute of the option which is no longer highlighted to the normal colour.
25000 INC L Move onto the next attribute.
25001 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 25003 EI Enable interrupts.
25004 LD IX,25215 Point IX at the record of the marker of player 1 at MarkerRecords.
25008 LD E,1 E is 1 the bit of the "1" key.
25010 CALL MoveMarker Call MoveMarker to move the marker of player 1.
25013 LD IX,25218 Point IX at the record of the marker of player 2 at 25218.
25017 INC E E is 2 the bit of the "2" key.
25018 CALL MoveMarker Call MoveMarker to move the marker of player 2.
Wait for the next frame.
ShowTitleMenu_WaitFrame 25021 LD A,(23738) Fetch the last value of FRAMES that was seen from 23738.
25024 LD B,A Copy it into B.
25025 LD A,(23672) Fetch the low byte of FRAMES.
25028 CP B Compare it with the last value.
25029 JR Z,ShowTitleMenu_WaitFrame Jump back to ShowTitleMenu_WaitFrame until it has changed.
25031 LD (23738),A Store the new value in 23738.
25034 DI Disable interrupts.
Cycle the colours of the highlighted option.
25035 LD B,9 Set the width of the highlight in B to 9.
25037 LD A,(23737) Fetch the low byte of the attribute address of the highlighted option.
25040 LD L,A Copy it into L.
25041 LD H,88 Point H at the attribute rows.
25043 LD A,(23736) Fetch the animation frame from TitleAnimationFrame.
25046 DEC A Decrease it by one.
25047 AND %00000111 Keep only bits 0-2.
25049 LD (23736),A Store it.
ShowTitleMenu_Highlight 25052 OR %01000000 Make the attribute bright with the ink from A.
25054 LD (HL),A Store it.
25055 INC L Move onto the next attribute.
25056 INC A Move onto the next ink colour.
25057 AND %00000111 Keep the ink colour in the range 0-7.
25059 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.
25061 LD DE,25221 Point DE at Player1Marker.
25064 LD HL,(25215) Fetch the position of the marker of player 1 from MarkerRecords.
25067 CALL DrawPicture Call DrawPicture to draw it.
25070 LD DE,25286 Point DE at Player2Marker.
25073 LD HL,(25218) Fetch the position of the marker of player 2 from 25218.
25076 CALL DrawPicture Call DrawPicture to draw it.
25079 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
25081 CALL ReadKeyboard
25084 RRA Rotate the bit for "0" into the carry flag.
25085 JP C,LeaveTitleMenu Jump to LeaveTitleMenu if "0" is being pressed, to start the game.
Scroll the message along the bottom of the screen.
25088 LD HL,47080 Set HL to the position of the right of the new character area.
25091 LD BC,519 Set the width in B to 2 bytes and the height in C to 7 rows.
25094 CALL ScrollAreaLeft Call ScrollAreaLeft to scroll the new character area left by one pixel.
25097 LD HL,20956 HL is 20956 the screen address of the left of the new character area.
25100 LD D,H H moves into D.
25101 LD E,218 E is 218 to make the screen address of the right of the message frame.
25103 CALL CopyColumn_Copy Call CopyColumn_Copy to copy the pixels of the leftmost byte across.
25106 LD HL,47056 Set HL to the position of the right of the message frame.
25109 LD BC,5639 Set the width in B to 22 bytes and the height in C to 7 rows.
25112 CALL ScrollAreaLeft Call ScrollAreaLeft to scroll the message frame left by one pixel.
25115 AND %00001111 Keep only bits 0-3 of the scroll counter.
25117 JP NZ,ShowTitleMenu_Loop Jump back to ShowTitleMenu_Loop unless the scroll counter is a multiple of 16.
Add the next character of the message.
25120 LD A,(43298) Fetch the index of the next character of the message from 43298.
25123 INC A Move onto the next character.
25124 CP 141 Jump to ShowTitleMenu_StoreIndex if the end of the message has not been reached.
25126 JR NZ,ShowTitleMenu_StoreIndex
25128 XOR A Go back to the start of the message.
ShowTitleMenu_StoreIndex 25129 LD (43298),A Store the index.
25132 LD HL,25378 Point HL at the scrolling message at ScrollingMessage.
25135 CALL AddToAddress Add the index to find the address of the character.
25138 LD A,(HL) Fetch the character.
25139 LD (25367),A Store it in the text record at ScrollerCharacter.
25142 LD DE,25363 Point DE at ScrollerCharacter.
25145 CALL PrintText Call PrintText to print the character.
25148 JP ShowTitleMenu_Loop Jump back to ShowTitleMenu_Loop.
Prev: 24829 Up: Map Next: 25151