Prev: 6581 Up: Map Next: 65EA
659B: Main Menu
Used by the routine at Initialise_Lives.
Displays the pre-game title screen and waits for the player to press ENTER to start the game. The title screen is stored as room 0C.
Load and display the title screen.
MainMenu 659B LD A,$0C Write 0C to;
659D LD ($5FC5),A
65A0 LD ($5FA1),A
65A3 CALL PopulateRoomBuffer Call PopulateRoomBuffer.
65A6 XOR A Write 00 to *Screen_Initialised_Flag.
65A7 LD ($5FA1),A
Print the credits text onto the title screen.
65AA LD HL,$4896 Point HL at 4896 (screen buffer position for the credits).
65AD LD B,$04 Set the row counter to 04 in B.
65AF LD DE,$660D Point DE to Messaging_PressEnterToStart.
Print_Credits_Row_Loop 65B2 PUSH BC Stash the row counter and screen buffer pointer on the stack.
65B3 PUSH HL
65B4 LD B,$05 Set a counter in B for 05 characters to print in each row.
Print_Credits_Char_Loop 65B6 PUSH HL Stash the screen buffer pointer, message pointer and the character counter on the stack.
65B7 PUSH DE
65B8 PUSH BC
65B9 LD A,(DE) Fetch the next character from the text data.
65BA CALL PrintCharacter Call PrintCharacter.
65BD POP BC Restore the character counter, message pointer and the screen buffer pointer from the stack.
65BE POP DE
65BF POP HL
65C0 INC L Advance to the next screen column.
65C1 INC DE Advance to the next character in the text data.
65C2 DJNZ Print_Credits_Char_Loop Decrease the character counter and loop back to Print_Credits_Char_Loop until all 05 characters in the row are printed.
65C4 POP HL Restore the screen buffer pointer from the stack.
65C5 LD BC,$0020 Advance HL by 0020 to move to the next character row.
65C8 ADD HL,BC
65C9 POP BC Restore the row counter from the stack.
65CA DJNZ Print_Credits_Row_Loop Decrease the row counter and loop back to Print_Credits_Row_Loop until all 04 rows are printed.
Play the title screen music.
65CC LD B,$3D B=3D.
65CE CALL Print_AuthorByline Call Print_AuthorByline.
Wait for the player to press ENTER to start the game.
65D1 LD BC,$BFFE Read from the keyboard;
Port Number Bit
0 1 2 3 4
BF ENTER L K J H
WaitForEnterToStart_Loop 65D4 IN A,(C)
65D6 RRCA Jump to WaitForEnterToStart_Loop if "ENTER" is not being pressed.
65D7 JR C,WaitForEnterToStart_Loop
ENTER pressed; initialise the game state and start the game.
65D9 LD A,$01 Set the border to BLUE.
65DB OUT ($FE),A
65DD LD B,$0A Set the clear counter to 0A in B.
65DF LD HL,$5FA1 Point HL at Screen_Initialised_Flag.
Clear_Game_State_Loop 65E2 LD (HL),$00 Write 00 to *HL.
65E4 INC HL Increment HL by one.
65E5 DJNZ Clear_Game_State_Loop Decrease the counter and loop back to Clear_Game_State_Loop until 0A bytes from Screen_Initialised_Flag onwards are cleared.
65E7 JP SetUpNewLevel Jump to SetUpNewLevel.
Prev: 6581 Up: Map Next: 65EA