Prev: B346 Up: Map Next: B43E
B3D5: Handler: Game Menu
Used by the routine at GameInitialisation.
Shows the game selection menu and waits for the player to start the game. The keys are:
Key Action
1 One player game
2 Two player game
3 Keyboard controls
4 Kempston joystick
5 Cursor joystick
6 Interface II joystick
0 Start the game
The choices are stored in GameOptions.
The tune at MusicData_GameComplete is played while the menu is waiting, and a key press stops it. While nothing is changed the hall of fame is shown after a time (see HandlerHallOfFame).
Before After
game-menu-before game-menu-after
HandlerGameMenu B3D5 LD A,$FF Set the last seen options in PreviousGameOptions to FF.
B3D7 LD ($96B7),A
B3DA CALL ClearPlayArea_Attributes Clear the attribute buffer of the play area.
B3DD CALL ClearPlayArea Clear the play area.
B3E0 LD HL,$61C6 HL=Room_Special_MainMenu.
B3E3 CALL DrawRoom Draw the room.
B3E6 CALL GameMenu Print the game selection menu.
B3E9 CALL HallOfFameCheck Update the flashing selections.
B3EC LD DE,$BC67 Point DE at the music at MusicData_GameComplete.
B3EF CALL PlayMusic_WaitKey Play the music until a key is pressed.
HandlerGameMenu_Loop B3F2 CALL GameMenu Print the game selection menu.
B3F5 LD A,$F7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
B3F7 OUT ($FD),A
B3F9 IN A,($FE)
B3FB CPL Flip the bits.
B3FC LD E,A Store the result in E.
B3FD LD A,($9692) Fetch the game options from GameOptions.
Handle 1UP game selection.
GameSelect_Check1UP B400 BIT 0,E Jump to GameSelect_Check2UP if key "1" ("1 PLAYER GAME") has not been pressed.
B402 JR Z,GameSelect_Check2UP
B404 RES 0,A Select a one player game by resetting bit 0.
Handle 2UP game selection.
GameSelect_Check2UP B406 BIT 1,E Jump to GameSelect_CheckKeyboard if key "2" ("2 PLAYER GAME") has not been pressed.
B408 JR Z,GameSelect_CheckKeyboard
B40A SET 0,A Select a two player game by setting bit 0.
Handle Keyboard selection.
GameSelect_CheckKeyboard B40C BIT 2,E Jump to GameSelect_CheckKempston if key "3" ("KEYBOARD") has not been pressed.
B40E JR Z,GameSelect_CheckKempston
B410 AND %11111001 Select the keyboard by clearing the control method.
Handle Kempston Joystick selection.
GameSelect_CheckKempston B412 BIT 3,E Jump to GameSelect_CheckCursor if key "4" ("KEMPSTON JOYSTICK") has not been pressed.
B414 JR Z,GameSelect_CheckCursor
B416 AND %11111001 Clear the control method.
B418 OR %00000010 Select the Kempston joystick by setting control method 02.
Handle Cursor Joystick selection.
GameSelect_CheckCursor B41A BIT 4,E Jump to GameSelect_ReadSecondKeyRow if key "5" ("CURSOR JOYSTICK") has not been pressed.
B41C JR Z,GameSelect_ReadSecondKeyRow
B41E AND %11111001 Clear the control method.
B420 OR %00000100 Select the Cursor joystick by setting control method 04.
This entry point is used by the routine at PlayMusic_WaitKey.
GameSelect_ReadSecondKeyRow B422 LD C,A Stash the game options in C.
B423 LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
B425 OUT ($FD),A
B427 IN A,($FE)
B429 CPL Flip the bits.
B42A LD E,A Store the result in E.
B42B LD A,C Restore the game options to A.
Handle Interface II Joystick selection.
GameSelect_CheckInterface2 B42C BIT 4,E Jump to GameSelect_StoreOptions if key "6" ("INTERFACE II") has not been pressed.
B42E JR Z,GameSelect_StoreOptions
B430 OR %00000110 Select the Interface II joystick by setting control method 06.
GameSelect_StoreOptions B432 LD ($9692),A Store the game options in GameOptions.
Handle starting a new game.
GameSelect_Start B435 BIT 0,E Return if key "0" ("START GAME") has been pressed.
B437 RET NZ
B438 CALL HallOfFameCheck Update the flashing selections.
B43B JP HandlerGameMenu_Loop Jump to HandlerGameMenu_Loop.
Prev: B346 Up: Map Next: B43E