![]() |
Routines |
| Prev: 36906 | Up: Map | Next: 37062 |
|
Used by the routine at Start_Game_Selection.
Sets up the game selection screen and waits for the player to choose a control method and start the game.
The method is chosen with the keys 1 to 4 (see GameSelection_Attributes) and is stored in GameOptions. Pressing 0 starts the game at Run_Game.
Everything from GameOptions up to Select_Game_Options is cleared first, so this routine also gives every object record and every game variable its starting value of zero.
|
||||||||||||||||||||
|
Set the border to black, build the shift tables and clear the game variables, the object records and the attributes.
|
||||||||||||||||||||
| Select_Game_Options | 36946 | XOR A | Set the border to black by writing 0 to port 254. | |||||||||||||||||
| 36947 | OUT (254),A | |||||||||||||||||||
| 36949 | CALL BuildShiftTable | Build the shift tables used to draw the sprites. | ||||||||||||||||||
| 36952 | LD HL,36565 | Point at the start of the game variables (GameOptions). | ||||||||||||||||||
| 36955 | LD BC,381 | Set the number of bytes to 381 which reaches Select_Game_Options. | ||||||||||||||||||
| 36958 | CALL FillMemory | Fill the variables and the object records with zero. | ||||||||||||||||||
| 36961 | LD HL,22528 | Point at the start of the attribute buffer (22528). | ||||||||||||||||||
| 36964 | LD BC,768 | Set the size of the attribute buffer to 768. | ||||||||||||||||||
| 36967 | CALL FillMemory | Set every attribute to black ink on black paper. | ||||||||||||||||||
|
This entry point is used by the routine at Show_Game_Over.
|
||||||||||||||||||||
| Select_Game_Options_Restart | 36970 | CALL Clear_Screen | Clear the screen. | |||||||||||||||||
| 36973 | CALL Reset_World_Map | Clear the second byte of every room in the world map. | ||||||||||||||||||
| 36976 | CALL Place_Weapon_Pickups | Choose where the four weapons are hidden. | ||||||||||||||||||
| 36979 | LD A,6 | Set the number of lives to 6. | ||||||||||||||||||
| 36981 | LD (36570),A | |||||||||||||||||||
|
Draw the selection menu and the icons, and read the keys 1 to 4.
|
||||||||||||||||||||
| Select_Game_Options_Loop | 36984 | CALL GameMenu | Draw the five lines of the menu, the title and the copyright message. | |||||||||||||||||
| 36987 | CALL Draw_Menu_Icons | Draw the icons next to the menu lines. | ||||||||||||||||||
| 36990 | LD A,247 | Read from the keyboard;
|
||||||||||||||||||
| 36992 | OUT (253),A | |||||||||||||||||||
| 36994 | IN A,(254) | |||||||||||||||||||
| 36996 | CPL | Flip the bits so that a pressed key gives a set bit. | ||||||||||||||||||
| 36997 | LD E,A | Keep the state of the keys for the tests below. | ||||||||||||||||||
| 36998 | LD A,(36565) | Fetch the control method from GameOptions. | ||||||||||||||||||
|
Key 1 selects the keyboard (0).
|
||||||||||||||||||||
| 37001 | BIT 0,E | Jump to Select_Game_Options_Test_Key_2 if key 1 is not pressed. | ||||||||||||||||||
| 37003 | JR Z,Select_Game_Options_Test_Key_2 | |||||||||||||||||||
| 37005 | AND %11111100 | Clear the control method bits (bits 0 and 1). | ||||||||||||||||||
|
Key 2 selects a Kempston joystick (1).
|
||||||||||||||||||||
| Select_Game_Options_Test_Key_2 | 37007 | BIT 1,E | Jump to Select_Game_Options_Test_Key_3 if key 2 is not pressed. | |||||||||||||||||
| 37009 | JR Z,Select_Game_Options_Test_Key_3 | |||||||||||||||||||
| 37011 | AND %11111100 | Clear the control method bits (bits 0 and 1). | ||||||||||||||||||
| 37013 | OR %00000001 | Set the control method to 1. | ||||||||||||||||||
|
Key 3 selects a cursor joystick (2).
|
||||||||||||||||||||
| Select_Game_Options_Test_Key_3 | 37015 | BIT 2,E | Jump to Select_Game_Options_Test_Key_4 if key 3 is not pressed. | |||||||||||||||||
| 37017 | JR Z,Select_Game_Options_Test_Key_4 | |||||||||||||||||||
| 37019 | AND %11111100 | Clear the control method bits (bits 0 and 1). | ||||||||||||||||||
| 37021 | OR %00000010 | Set the control method to 2. | ||||||||||||||||||
|
Key 4 selects an Interface II joystick (3).
|
||||||||||||||||||||
| Select_Game_Options_Test_Key_4 | 37023 | BIT 3,E | Jump to Select_Game_Options_Store_Method if key 4 is not pressed. | |||||||||||||||||
| 37025 | JR Z,Select_Game_Options_Store_Method | |||||||||||||||||||
| 37027 | AND %11111100 | Clear the control method bits (bits 0 and 1). | ||||||||||||||||||
| 37029 | OR %00000011 | Set the control method to 3. | ||||||||||||||||||
|
Store the control method and test key 0 which starts the game.
|
||||||||||||||||||||
| Select_Game_Options_Store_Method | 37031 | LD D,A | Keep the control method while the keys are read. | |||||||||||||||||
| 37032 | LD A,239 | Read from the keyboard;
|
||||||||||||||||||
| 37034 | OUT (253),A | |||||||||||||||||||
| 37036 | IN A,(254) | |||||||||||||||||||
| 37038 | CPL | Flip the bits so that a pressed key gives a set bit. | ||||||||||||||||||
| 37039 | LD E,A | Keep the state of the keys for the test below. | ||||||||||||||||||
| 37040 | LD A,D | Store the control method in GameOptions. | ||||||||||||||||||
| 37041 | LD (36565),A | |||||||||||||||||||
| 37044 | LD C,A | Keep the control method while key 0 is tested. | ||||||||||||||||||
| 37045 | BIT 0,E | Jump to Run_Game if key 0 is pressed. | ||||||||||||||||||
| 37047 | JP NZ,Run_Game | |||||||||||||||||||
|
Highlight the line of the chosen control method and go round again.
|
||||||||||||||||||||
| 37050 | LD HL,37145 | Point at the attributes of the menu lines (GameSelection_Attributes). | ||||||||||||||||||
| 37053 | LD B,4 | Set the number of control methods to 4. | ||||||||||||||||||
| 37055 | LD A,C | Fetch the control method as the number of the chosen line. | ||||||||||||||||||
| 37056 | CALL Highlight_Selected_Option | Flash the attribute of the chosen line. | ||||||||||||||||||
| 37059 | JP Select_Game_Options_Loop | Jump back to Select_Game_Options_Loop. | ||||||||||||||||||
| Prev: 36906 | Up: Map | Next: 37062 |