![]() |
Routines |
| Prev: BA74 | Up: Map | Next: BAFB |
|
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.
|
||||||||||||||||||||
|
Prepare the menu.
|
||||||||||||||||||||
| GameMenu | BA7E | XOR A | Write 00 to BorderDrawnFlag. | |||||||||||||||||
| BA7F | LD ($5B18),A | |||||||||||||||||||
| BA82 | LD HL,$BB14 | Point HL at MenuColours. | ||||||||||||||||||
| BA85 | LD B,$08 | Set the number of lines to 08. | ||||||||||||||||||
| GameMenu_StopFlashing | BA87 | RES 7,(HL) | Stop the line flashing. | |||||||||||||||||
| BA89 | INC HL | Move on to the next line. | ||||||||||||||||||
| BA8A | DJNZ GameMenu_StopFlashing | Jump to GameMenu_StopFlashing until all of the lines are done. | ||||||||||||||||||
| BA8C | CALL ClearScreenBuffer | Call ClearScreenBuffer. | ||||||||||||||||||
| BA8F | CALL DisplayMenu | Call DisplayMenu. | ||||||||||||||||||
| BA92 | CALL FlashMenuOptions | Call FlashMenuOptions. | ||||||||||||||||||
|
Read the keys that choose the control method.
|
||||||||||||||||||||
| GameMenu_MenuLoop | BA95 | CALL DisplayMenu | Call DisplayMenu. | |||||||||||||||||
|
|
||||||||||||||||||||
| BA98 | LD DE,$B451 | Point DE at MenuTune. | ||||||||||||||||||
| BA9B | CALL PlayMusicOnce | Call PlayMusicOnce. | ||||||||||||||||||
| BA9E | LD A,$F7 | Read from the keyboard;
|
||||||||||||||||||
| BAA0 | CALL ReadKeyboardPort | |||||||||||||||||||
| BAA3 | LD E,A | Keep the keys that are pressed in E. | ||||||||||||||||||
| BAA4 | LD A,($5B04) | Fetch ControlMethod. | ||||||||||||||||||
| BAA7 | LD ($5B06),A | Set PreviousControlMethod. | ||||||||||||||||||
| BAAA | BIT 0,E | Jump to GameMenu_TestKempston if "1" is not pressed. | ||||||||||||||||||
| BAAC | JR Z,GameMenu_TestKempston | |||||||||||||||||||
| BAAE | AND %11111001 | Choose the keyboard. | ||||||||||||||||||
|
Choose a joystick if one of those keys is pressed.
|
||||||||||||||||||||
| GameMenu_TestKempston | BAB0 | BIT 1,E | Jump to GameMenu_TestCursor if "2" is not pressed. | |||||||||||||||||
| BAB2 | JR Z,GameMenu_TestCursor | |||||||||||||||||||
| BAB4 | AND %11111001 | Clear bits 1 and 2. | ||||||||||||||||||
| BAB6 | OR %00000010 | Choose the Kempston joystick. | ||||||||||||||||||
| GameMenu_TestCursor | BAB8 | BIT 2,E | Jump to GameMenu_TestInterface if "3" is not pressed. | |||||||||||||||||
| BABA | JR Z,GameMenu_TestInterface | |||||||||||||||||||
| BABC | AND %11111001 | Clear bits 1 and 2. | ||||||||||||||||||
| BABE | OR %00000100 | Choose the cursor joystick. | ||||||||||||||||||
| GameMenu_TestInterface | BAC0 | BIT 3,E | Jump to GameMenu_SetMethod if "4" is not pressed. | |||||||||||||||||
| BAC2 | JR Z,GameMenu_SetMethod | |||||||||||||||||||
| BAC4 | OR %00000110 | Choose Interface II. | ||||||||||||||||||
| GameMenu_SetMethod | BAC6 | LD ($5B04),A | Set ControlMethod. | |||||||||||||||||
|
Toggle directional control once for each press of "5".
|
||||||||||||||||||||
| BAC9 | LD HL,$5B32 | Point HL at DirectionalKeyPressedFlag. | ||||||||||||||||||
| BACC | BIT 4,E | Jump to GameMenu_KeyReleased if "5" is not pressed. | ||||||||||||||||||
| BACE | JR Z,GameMenu_KeyReleased | |||||||||||||||||||
| BAD0 | BIT 0,(HL) | Jump to GameMenu_TestStart if "5" was pressed last time as well. | ||||||||||||||||||
| BAD2 | JR NZ,GameMenu_TestStart | |||||||||||||||||||
| BAD4 | SET 0,(HL) | Set bit 0 of DirectionalKeyPressedFlag. | ||||||||||||||||||
| BAD6 | LD A,($5B04) | Fetch ControlMethod. | ||||||||||||||||||
| BAD9 | XOR %00001000 | Toggle directional control. | ||||||||||||||||||
| BADB | LD ($5B04),A | Set ControlMethod. | ||||||||||||||||||
|
Start the game if "0" is pressed.
|
||||||||||||||||||||
| GameMenu_TestStart | BADE | LD HL,$5B06 | Point HL at PreviousControlMethod. | |||||||||||||||||
| BAE1 | CP (HL) | Call PlayLowBeep if the control method has changed. | ||||||||||||||||||
| BAE2 | CALL NZ,PlayLowBeep | |||||||||||||||||||
| BAE5 | LD A,$EF | Read from the keyboard;
|
||||||||||||||||||
| BAE7 | CALL ReadKeyboardPort | |||||||||||||||||||
| BAEA | BIT 0,A | Return if "0" is pressed. | ||||||||||||||||||
| BAEC | RET NZ | |||||||||||||||||||
| BAED | LD HL,$5B00 | Point HL at RandomSeed1. | ||||||||||||||||||
| BAF0 | INC (HL) | Increment RandomSeed1. | ||||||||||||||||||
| BAF1 | CALL FlashMenuOptions | Call FlashMenuOptions. | ||||||||||||||||||
| BAF4 | JP GameMenu_MenuLoop | Jump to GameMenu_MenuLoop. | ||||||||||||||||||
|
"5" has been released.
|
||||||||||||||||||||
| GameMenu_KeyReleased | BAF7 | RES 0,(HL) | Reset bit 0 of DirectionalKeyPressedFlag. | |||||||||||||||||
| BAF9 | JR GameMenu_TestStart | Jump to GameMenu_TestStart. | ||||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||||
| Prev: BA74 | Up: Map | Next: BAFB |