Prev: BCEC Up: Map Next: BD89
BD0C: Game Selection Menu
Used by the routine at InitialiseGame.
Displays the menu and waits for the control method to be chosen and the game to be started. The keys "1" to "4" choose the keyboard, the Kempston joystick, the cursor joystick and Interface II, "5" turns directional control on or off, and "0" starts the game. A low beep sounds when the choice changes. The menu tune is played once. The choice is held in ControlMethod.
game-selection-menu
Prepare the menu.
GameMenu BD0C XOR A Write 00 to BorderDrawnFlag.
BD0D LD ($5BB8),A
BD10 LD HL,$BDA2 Point HL at MenuColours.
BD13 LD B,$08 Set the number of lines to 08.
GameMenu_StopFlashing BD15 RES 7,(HL) Stop the line flashing.
BD17 INC HL Move on to the next line.
BD18 DJNZ GameMenu_StopFlashing Jump to GameMenu_StopFlashing until all of the lines are done.
BD1A CALL ClearScreenBuffer Call ClearScreenBuffer.
BD1D CALL DisplayMenu Call DisplayMenu.
BD20 CALL FlashMenuOptions Call FlashMenuOptions.
Read the keys that choose the control method.
GameMenu_MenuLoop BD23 CALL DisplayMenu Call DisplayMenu.
BD26 LD DE,$B253 Point DE at MenuTune.
BD29 CALL PlayMusicOnce Call PlayMusicOnce.
BD2C LD A,$F7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
BD2E CALL ReadKeyboardPort
BD31 LD E,A Keep the keys that are pressed in E.
BD32 LD A,($5BA4) Fetch ControlMethod.
BD35 LD ($5BA6),A Set PreviousControlMethod.
BD38 BIT 0,E Jump to GameMenu_TestKempston if "1" is not pressed.
BD3A JR Z,GameMenu_TestKempston
BD3C AND %11111001 Choose the keyboard.
Choose a joystick if one of those keys is pressed.
GameMenu_TestKempston BD3E BIT 1,E Jump to GameMenu_TestCursor if "2" is not pressed.
BD40 JR Z,GameMenu_TestCursor
BD42 AND %11111001 Clear bits 1 and 2.
BD44 OR %00000010 Choose the Kempston joystick.
GameMenu_TestCursor BD46 BIT 2,E Jump to GameMenu_TestInterface if "3" is not pressed.
BD48 JR Z,GameMenu_TestInterface
BD4A AND %11111001 Clear bits 1 and 2.
BD4C OR %00000100 Choose the cursor joystick.
GameMenu_TestInterface BD4E BIT 3,E Jump to GameMenu_SetMethod if "4" is not pressed.
BD50 JR Z,GameMenu_SetMethod
BD52 OR %00000110 Choose Interface II.
GameMenu_SetMethod BD54 LD ($5BA4),A Set ControlMethod.
Toggle directional control once for each press of "5".
BD57 LD HL,$5BD2 Point HL at DirectionalKeyPressedFlag.
BD5A BIT 4,E Jump to GameMenu_ReleaseKey5 if "5" is not pressed.
BD5C JR Z,GameMenu_ReleaseKey5
BD5E BIT 0,(HL) Jump to GameMenu_TestStart if "5" was pressed last time as well.
BD60 JR NZ,GameMenu_TestStart
BD62 SET 0,(HL) Set bit 0 of DirectionalKeyPressedFlag.
BD64 LD A,($5BA4) Fetch ControlMethod.
BD67 XOR %00001000 Toggle directional control.
BD69 LD ($5BA4),A Set ControlMethod.
Start the game if "0" is pressed.
GameMenu_TestStart BD6C LD HL,$5BA6 Point HL at PreviousControlMethod.
BD6F CP (HL) Call PlayLowBeep if the control method has changed.
BD70 CALL NZ,PlayLowBeep
BD73 LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
BD75 CALL ReadKeyboardPort
BD78 BIT 0,A Return if "0" is pressed.
BD7A RET NZ
BD7B LD HL,$5BA0 Point HL at RandomSeed1.
BD7E INC (HL) Increment RandomSeed1.
BD7F CALL FlashMenuOptions Call FlashMenuOptions.
BD82 JP GameMenu_MenuLoop Jump to GameMenu_MenuLoop.
"5" has been released.
GameMenu_ReleaseKey5 BD85 RES 0,(HL) Reset bit 0 of DirectionalKeyPressedFlag.
BD87 JR GameMenu_TestStart Jump to GameMenu_TestStart.
View the equivalent code in;
Prev: BCEC Up: Map Next: BD89