![]() |
Routines |
| Prev: 47781 | Up: Map | Next: 47987 |
|
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 | 47890 | LD A,255 | Set the last method of control that was seen to an impossible value. | |||||||||||||||||
| 47892 | LD (38450),A | |||||||||||||||||||
| 47895 | XOR A | Clear the attribute. | ||||||||||||||||||
| 47896 | CALL ClearLargeWindowWithAttributes | Call ClearLargeWindowWithAttributes. | ||||||||||||||||||
|
Read the keys that choose the control method.
|
||||||||||||||||||||
| GameMenu_Loop | 47899 | CALL DisplayMenu | Draw the menu using DisplayMenu. | |||||||||||||||||
|
|
||||||||||||||||||||
| 47902 | LD DE,49641 | Point DE at TitleTune. | ||||||||||||||||||
| 47905 | CALL PlayMusic_WaitKey | Play it using PlayMusic_WaitKey, if it has not been played yet. | ||||||||||||||||||
| 47908 | LD A,247 | Read from the keyboard;
|
||||||||||||||||||
| 47910 | CALL ReadKeys | |||||||||||||||||||
| 47913 | LD E,A | Keep the keys that are pressed in E. | ||||||||||||||||||
| 47914 | LD A,(38426) | Fetch the method of control. | ||||||||||||||||||
| 47917 | BIT 0,E | Jump if the key 1 is not pressed. | ||||||||||||||||||
| 47919 | JR Z,GameMenu_CheckKey2 | |||||||||||||||||||
| 47921 | AND %11111001 | Use method zero (keyboard). | ||||||||||||||||||
|
Choose a joystick if one of those keys is pressed.
|
||||||||||||||||||||
| GameMenu_CheckKey2 | 47923 | BIT 1,E | Jump if the key 2 is not pressed. | |||||||||||||||||
| 47925 | JR Z,GameMenu_CheckKey3 | |||||||||||||||||||
| 47927 | AND %11111001 | Use method one (Kempston joystick)... | ||||||||||||||||||
| 47929 | OR %00000010 | Set the method to the Kempston joystick. | ||||||||||||||||||
| GameMenu_CheckKey3 | 47931 | BIT 2,E | Jump if the key 3 is not pressed. | |||||||||||||||||
| 47933 | JR Z,GameMenu_CheckKey4 | |||||||||||||||||||
| 47935 | AND %11111001 | Use method two (cursor keys)... | ||||||||||||||||||
| 47937 | OR %00000100 | Set the method to the cursor keys. | ||||||||||||||||||
| GameMenu_CheckKey4 | 47939 | BIT 3,E | Jump if the key 4 is not pressed. | |||||||||||||||||
| 47941 | JR Z,GameMenu_StoreControl | |||||||||||||||||||
| 47943 | OR %00000110 | Choose Interface II. | ||||||||||||||||||
| GameMenu_StoreControl | 47945 | LD (38426),A | Store the method of control. | |||||||||||||||||
|
Start the game if "0" is pressed.
|
||||||||||||||||||||
| 47948 | LD A,239 | Read from the keyboard;
|
||||||||||||||||||
| 47950 | CALL ReadKeys | |||||||||||||||||||
| 47953 | AND %00000001 | ...and keep the key 0. | ||||||||||||||||||
| 47955 | JR NZ,StartGameSequence | Jump to start the game if it is pressed. | ||||||||||||||||||
| 47957 | LD HL,38450 | Point HL at the last method of control that was seen. | ||||||||||||||||||
| 47960 | LD A,(38426) | Fetch the method of control... | ||||||||||||||||||
| 47963 | CP (HL) | Compare it with the last method. | ||||||||||||||||||
| 47964 | LD (38450),A | Set LastControlMethod. | ||||||||||||||||||
| 47967 | CALL UpdateIdleTimer | Reset the idle timer if the method has changed, or count it down, using UpdateIdleTimer. | ||||||||||||||||||
|
Flash the chosen control method.
|
||||||||||||||||||||
| 47970 | LD HL,47333 | Point HL at Menu_Attributes. | ||||||||||||||||||
| 47973 | LD A,(38426) | Fetch the method of control... | ||||||||||||||||||
| 47976 | RRCA | Move the method to bits 0 and 1. | ||||||||||||||||||
| 47977 | AND %00000011 | Keep only bits 0 and 1. | ||||||||||||||||||
| 47979 | LD B,4 | There are four lines for the methods of control. | ||||||||||||||||||
| 47981 | CALL SetFlashingAttribute | Make the line for the method flash using SetFlashingAttribute. | ||||||||||||||||||
| 47984 | JP GameMenu_Loop | Jump back to draw the menu again. | ||||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||||
| Prev: 47781 | Up: Map | Next: 47987 |