Prev: 47732 Up: Map Next: 47867
47742: 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 47742 XOR A Write 0 to BorderDrawnFlag.
47743 LD (23320),A
47746 LD HL,47892 Point HL at MenuColours.
47749 LD B,8 Set the number of lines to 8.
GameMenu_StopFlashing 47751 RES 7,(HL) Stop the line flashing.
47753 INC HL Move on to the next line.
47754 DJNZ GameMenu_StopFlashing Jump to GameMenu_StopFlashing until all of the lines are done.
47756 CALL ClearScreenBuffer Call ClearScreenBuffer.
47759 CALL DisplayMenu Call DisplayMenu.
47762 CALL FlashMenuOptions Call FlashMenuOptions.
Read the keys that choose the control method.
GameMenu_MenuLoop 47765 CALL DisplayMenu Call DisplayMenu.
47768 LD DE,46161 Point DE at MenuTune.
47771 CALL PlayMusicOnce Call PlayMusicOnce.
47774 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
47776 CALL ReadKeyboardPort
47779 LD E,A Keep the keys that are pressed in E.
47780 LD A,(23300) Fetch ControlMethod.
47783 LD (23302),A Set PreviousControlMethod.
47786 BIT 0,E Jump to GameMenu_TestKempston if "1" is not pressed.
47788 JR Z,GameMenu_TestKempston
47790 AND %11111001 Choose the keyboard.
Choose a joystick if one of those keys is pressed.
GameMenu_TestKempston 47792 BIT 1,E Jump to GameMenu_TestCursor if "2" is not pressed.
47794 JR Z,GameMenu_TestCursor
47796 AND %11111001 Clear bits 1 and 2.
47798 OR %00000010 Choose the Kempston joystick.
GameMenu_TestCursor 47800 BIT 2,E Jump to GameMenu_TestInterface if "3" is not pressed.
47802 JR Z,GameMenu_TestInterface
47804 AND %11111001 Clear bits 1 and 2.
47806 OR %00000100 Choose the cursor joystick.
GameMenu_TestInterface 47808 BIT 3,E Jump to GameMenu_SetMethod if "4" is not pressed.
47810 JR Z,GameMenu_SetMethod
47812 OR %00000110 Choose Interface II.
GameMenu_SetMethod 47814 LD (23300),A Set ControlMethod.
Toggle directional control once for each press of "5".
47817 LD HL,23346 Point HL at DirectionalKeyPressedFlag.
47820 BIT 4,E Jump to GameMenu_KeyReleased if "5" is not pressed.
47822 JR Z,GameMenu_KeyReleased
47824 BIT 0,(HL) Jump to GameMenu_TestStart if "5" was pressed last time as well.
47826 JR NZ,GameMenu_TestStart
47828 SET 0,(HL) Set bit 0 of DirectionalKeyPressedFlag.
47830 LD A,(23300) Fetch ControlMethod.
47833 XOR %00001000 Toggle directional control.
47835 LD (23300),A Set ControlMethod.
Start the game if "0" is pressed.
GameMenu_TestStart 47838 LD HL,23302 Point HL at PreviousControlMethod.
47841 CP (HL) Call PlayLowBeep if the control method has changed.
47842 CALL NZ,PlayLowBeep
47845 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
47847 CALL ReadKeyboardPort
47850 BIT 0,A Return if "0" is pressed.
47852 RET NZ
47853 LD HL,23296 Point HL at RandomSeed1.
47856 INC (HL) Increment RandomSeed1.
47857 CALL FlashMenuOptions Call FlashMenuOptions.
47860 JP GameMenu_MenuLoop Jump to GameMenu_MenuLoop.
"5" has been released.
GameMenu_KeyReleased 47863 RES 0,(HL) Reset bit 0 of DirectionalKeyPressedFlag.
47865 JR GameMenu_TestStart Jump to GameMenu_TestStart.
View the equivalent code in;
Prev: 47732 Up: Map Next: 47867