Prev: 45894 Up: Map Next: 46142
46037: 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 46037 LD A,255 Set the last seen options in PreviousGameOptions to 255.
46039 LD (38583),A
46042 CALL ClearPlayArea_Attributes Clear the attribute buffer of the play area.
46045 CALL ClearPlayArea Clear the play area.
46048 LD HL,25030 HL=Room_Special_MainMenu.
46051 CALL DrawRoom Draw the room.
46054 CALL GameMenu Print the game selection menu.
46057 CALL HallOfFameCheck Update the flashing selections.
46060 LD DE,48231 Point DE at the music at MusicData_GameComplete.
46063 CALL PlayMusic_WaitKey Play the music until a key is pressed.
HandlerGameMenu_Loop 46066 CALL GameMenu Print the game selection menu.
46069 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
46071 OUT (253),A
46073 IN A,(254)
46075 CPL Flip the bits.
46076 LD E,A Store the result in E.
46077 LD A,(38546) Fetch the game options from GameOptions.
Handle 1UP game selection.
GameSelect_Check1UP 46080 BIT 0,E Jump to GameSelect_Check2UP if key "1" ("1 PLAYER GAME") has not been pressed.
46082 JR Z,GameSelect_Check2UP
46084 RES 0,A Select a one player game by resetting bit 0.
Handle 2UP game selection.
GameSelect_Check2UP 46086 BIT 1,E Jump to GameSelect_CheckKeyboard if key "2" ("2 PLAYER GAME") has not been pressed.
46088 JR Z,GameSelect_CheckKeyboard
46090 SET 0,A Select a two player game by setting bit 0.
Handle Keyboard selection.
GameSelect_CheckKeyboard 46092 BIT 2,E Jump to GameSelect_CheckKempston if key "3" ("KEYBOARD") has not been pressed.
46094 JR Z,GameSelect_CheckKempston
46096 AND %11111001 Select the keyboard by clearing the control method.
Handle Kempston Joystick selection.
GameSelect_CheckKempston 46098 BIT 3,E Jump to GameSelect_CheckCursor if key "4" ("KEMPSTON JOYSTICK") has not been pressed.
46100 JR Z,GameSelect_CheckCursor
46102 AND %11111001 Clear the control method.
46104 OR %00000010 Select the Kempston joystick by setting control method 2.
Handle Cursor Joystick selection.
GameSelect_CheckCursor 46106 BIT 4,E Jump to GameSelect_ReadSecondKeyRow if key "5" ("CURSOR JOYSTICK") has not been pressed.
46108 JR Z,GameSelect_ReadSecondKeyRow
46110 AND %11111001 Clear the control method.
46112 OR %00000100 Select the Cursor joystick by setting control method 4.
This entry point is used by the routine at PlayMusic_WaitKey.
GameSelect_ReadSecondKeyRow 46114 LD C,A Stash the game options in C.
46115 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
46117 OUT (253),A
46119 IN A,(254)
46121 CPL Flip the bits.
46122 LD E,A Store the result in E.
46123 LD A,C Restore the game options to A.
Handle Interface II Joystick selection.
GameSelect_CheckInterface2 46124 BIT 4,E Jump to GameSelect_StoreOptions if key "6" ("INTERFACE II") has not been pressed.
46126 JR Z,GameSelect_StoreOptions
46128 OR %00000110 Select the Interface II joystick by setting control method 6.
GameSelect_StoreOptions 46130 LD (38546),A Store the game options in GameOptions.
Handle starting a new game.
GameSelect_Start 46133 BIT 0,E Return if key "0" ("START GAME") has been pressed.
46135 RET NZ
46136 CALL HallOfFameCheck Update the flashing selections.
46139 JP HandlerGameMenu_Loop Jump to HandlerGameMenu_Loop.
Prev: 45894 Up: Map Next: 46142