Prev: BAA5 Up: Map Next: BB73
BB12: Game Selection Menu
Used by the routines at InitialiseGame and GameMenu_Unused.
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. If nothing is done for a while then the hall of fame is shown.
GameMenu BB12 LD A,$FF Set the last method of control that was seen to an impossible value.
BB14 LD ($9632),A
BB17 XOR A Clear the attribute.
BB18 CALL ClearLargeWindowWithAttributes Call ClearLargeWindowWithAttributes.
Read the keys that choose the control method.
GameMenu_Loop BB1B CALL DisplayMenu Draw the menu using DisplayMenu.
BB1E LD DE,$C1E9 Point DE at TitleTune.
BB21 CALL PlayMusic_WaitKey Play it using PlayMusic_WaitKey, if it has not been played yet.
BB24 LD A,$F7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
BB26 CALL ReadKeys
BB29 LD E,A Keep the keys that are pressed in E.
BB2A LD A,($961A) Fetch the method of control.
BB2D BIT 0,E Jump if the key 01 is not pressed.
BB2F JR Z,GameMenu_CheckKey2
BB31 AND %11111001 Use method zero (keyboard).
Choose a joystick if one of those keys is pressed.
GameMenu_CheckKey2 BB33 BIT 1,E Jump if the key 02 is not pressed.
BB35 JR Z,GameMenu_CheckKey3
BB37 AND %11111001 Use method one (Kempston joystick)...
BB39 OR %00000010 Set the method to the Kempston joystick.
GameMenu_CheckKey3 BB3B BIT 2,E Jump if the key 03 is not pressed.
BB3D JR Z,GameMenu_CheckKey4
BB3F AND %11111001 Use method two (cursor keys)...
BB41 OR %00000100 Set the method to the cursor keys.
GameMenu_CheckKey4 BB43 BIT 3,E Jump if the key 04 is not pressed.
BB45 JR Z,GameMenu_StoreControl
BB47 OR %00000110 Choose Interface II.
GameMenu_StoreControl BB49 LD ($961A),A Store the method of control.
Start the game if "0" is pressed.
BB4C LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
BB4E CALL ReadKeys
BB51 AND %00000001 ...and keep the key 00.
BB53 JR NZ,StartGameSequence Jump to start the game if it is pressed.
BB55 LD HL,$9632 Point HL at the last method of control that was seen.
BB58 LD A,($961A) Fetch the method of control...
BB5B CP (HL) Compare it with the last method.
BB5C LD ($9632),A Set LastControlMethod.
BB5F CALL UpdateIdleTimer Reset the idle timer if the method has changed, or count it down, using UpdateIdleTimer.
Flash the chosen control method.
BB62 LD HL,$B8E5 Point HL at Menu_Attributes.
BB65 LD A,($961A) Fetch the method of control...
BB68 RRCA Move the method to bits 0 and 1.
BB69 AND %00000011 Keep only bits 0 and 1.
BB6B LD B,$04 There are four lines for the methods of control.
BB6D CALL SetFlashingAttribute Make the line for the method flash using SetFlashingAttribute.
BB70 JP GameMenu_Loop Jump back to draw the menu again.
View the equivalent code in;
Prev: BAA5 Up: Map Next: BB73