Prev: 61CD Up: Map Next: 6242
61EA: Select Game
Used by the routine at GameOver_ControllerRestart.
Shows the game selection menu and reads the keys "1" to "5" until the player starts the game by pressing "5". Keys "1" and "2" choose the number of players, keys "3" and "4" choose the control method, and the chosen options are shown by flashing the menu lines.
Before After pressing "2" and "4" (the chosen lines flash)
select-before select-after
Game_Restart 61EA DI Disable interrupts.
61EB LD SP,$5D00 Reset the stack pointer to 5D00 (the top of the game's stack).
61EE CALL CreateWindow Create the game window using CreateWindow.
GameSelect_Loop 61F1 CALL GameMenu Print the menu using GameMenu.
61F4 LD A,($5E03) Fetch the game options from GameOptions into D.
61F7 LD D,A
61F8 LD A,$F7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
61FA OUT ($FD),A
61FC IN A,($FE)
61FE CPL Flip the bits, so that a key being pressed is a set bit.
Handle 1UP selection.
61FF BIT 0,A Jump to GameSelect_CheckP2 if key "1" ("1 PLAYER GAME") is not being pressed.
6201 JR Z,GameSelect_CheckP2
6203 RES 0,D Reset bit 0 of D (a 1UP game).
Handle 2UP selection.
GameSelect_CheckP2 6205 BIT 1,A Jump to GameSelect_CheckKeyboard if key "2" ("2 PLAYER GAME") is not being pressed.
6207 JR Z,GameSelect_CheckKeyboard
6209 SET 0,D Set bit 0 of D (a 2UP game).
Handle Keyboard selection.
GameSelect_CheckKeyboard 620B BIT 2,A Jump to GameSelect_CheckKempston if key "3" ("KEYBOARD") is not being pressed.
620D JR Z,GameSelect_CheckKempston
620F RES 1,D Reset bit 1 of D (keyboard control).
Handle Kempston Joystick selection.
GameSelect_CheckKempston 6211 BIT 3,A Jump to GameSelect_StartGame if key "4" ("KEMPSTON JOYSTICK") is not being pressed.
6213 JR Z,GameSelect_StartGame
6215 SET 1,D Set bit 1 of D (joystick control).
Handle starting a new game.
GameSelect_StartGame 6217 BIT 4,A Jump to StartGame if key "5" ("START GAME") is being pressed.
6219 JP NZ,StartGame
Handle flashing each selection.
621C LD A,D Write D to GameOptions.
621D LD ($5E03),A
6220 LD HL,$627D HL=GameSelection_Attributes_Options (the first selectable line, skipping the title).
6223 LD A,($5E03) Fetch the game options from GameOptions into C.
6226 LD C,A
MenuAttributeCheckPlayer 6227 BIT 0,C Jump to MenuAttributeHandle2UP if a 2UP game is selected.
6229 JR NZ,MenuAttributeHandle2UP
622B CALL MenuAttributeSetFirst Else, flash the first line using MenuAttributeSetFirst.
Check control method.
MenuAttributeCheckControl 622E BIT 1,C Jump to MenuAttributeHandleJoystick if joystick control is selected.
6230 JR NZ,MenuAttributeHandleJoystick
6232 CALL MenuAttributeSetFirst Else, flash the first line using MenuAttributeSetFirst.
GameSelect_End 6235 JP GameSelect_Loop Jump back to GameSelect_Loop.
Handle flashing 2UP.
MenuAttributeHandle2UP 6238 CALL MenuAttributeSetSecond Flash the second line using MenuAttributeSetSecond.
623B JR MenuAttributeCheckControl Jump to MenuAttributeCheckControl.
Handle flashing joystick.
MenuAttributeHandleJoystick 623D CALL MenuAttributeSetSecond Flash the second line using MenuAttributeSetSecond.
6240 JR GameSelect_End Jump to GameSelect_End.
Prev: 61CD Up: Map Next: 6242