Prev: 47972 Up: Map Next: 48088
47988: Game Selection Menu
Used by the routine at RunGame.
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, and "0" starts the game. The menu tune is played once. The choice is held in ControlMethod.
The menu
game-selection-menu
Prepare the menu.
GameMenu 47988 XOR A Write 0 to BorderDrawnFlag, so that the frame will be drawn.
47989 LD (42804),A
47992 LD HL,48113 Start at the colours of the lines of the menu, MenuColours.
47995 LD B,8 Set the number of lines to 8.
GameMenu_Steady 47997 RES 7,(HL) Stop the line flashing.
47999 INC HL Move on to the next line.
48000 DJNZ GameMenu_Steady Decrease the counter and loop until all the colours are steady.
48002 CALL ClearScreenBuffer Call ClearScreenBuffer to clear the buffer.
48005 CALL DisplayMenu Call DisplayMenu to draw the menu.
48008 CALL FlashMenuOptions Call FlashMenuOptions.
Read the keys that choose the control method.
GameMenu_Loop 48011 CALL DisplayMenu Call DisplayMenu to draw the menu.
48014 LD DE,55247 Take the menu tune, MenuTune.
48017 CALL PlayMusicOnce Call PlayMusicOnce to play it until a key is pressed.
Read the keys that choose the control method.
48020 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
48022 CALL ReadKeyboardPort
48025 LD E,A Stash the keys that are pressed in E.
48026 LD A,(42761) Fetch the control method from ControlMethod.
48029 LD (42764),A Set PreviousControlMethod.
48032 BIT 0,E Jump to GameMenu_TestKempston if key 49 is not pressed.
48034 JR Z,GameMenu_TestKempston
48036 AND %11111001 Choose the keyboard, by clearing the bits of the control method.
Choose a joystick if one of those keys is pressed.
GameMenu_TestKempston 48038 BIT 1,E Jump to GameMenu_TestCursor if key 50 is not pressed.
48040 JR Z,GameMenu_TestCursor
48042 AND %11111001 Clear the bits of the control method...
48044 OR %00000010 Choose the Kempston joystick.
GameMenu_TestCursor 48046 BIT 2,E Jump to GameMenu_TestInterfaceII if key 51 is not pressed.
48048 JR Z,GameMenu_TestInterfaceII
48050 AND %11111001 Clear the bits of the control method...
48052 OR %00000100 Choose the cursor joystick.
GameMenu_TestInterfaceII 48054 BIT 3,E Jump to GameMenu_SetMethod if key 52 is not pressed.
48056 JR Z,GameMenu_SetMethod
48058 OR %00000110 Choose the Interface II joystick.
GameMenu_SetMethod 48060 LD (42761),A Write the control method to ControlMethod.
Start the game if "0" is pressed.
48063 LD HL,42805 Point HL at UnusedValue.
48066 LD HL,42764 Take the previous control method, PreviousControlMethod.
48069 CP (HL) Compare the control method with the previous one, which is not used.
Start the game if key 48 is pressed.
48070 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
48072 CALL ReadKeyboardPort
48075 BIT 0,A Return if key 48 is pressed.
48077 RET NZ
48078 LD HL,42762 Point HL at MenuPassCounter.
48081 INC (HL) Increment MenuPassCounter.
48082 CALL FlashMenuOptions Call FlashMenuOptions.
48085 JP GameMenu_Loop Jump to GameMenu_Loop for another pass.
View the equivalent code in;
Prev: 47972 Up: Map Next: 48088