Prev: 902A Up: Map Next: 90C6
9052: Select Game Options
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 9052 XOR A Set the border to black by writing 00 to port FE.
9053 OUT ($FE),A
9055 CALL BuildShiftTable Build the shift tables used to draw the sprites.
9058 LD HL,$8ED5 Point at the start of the game variables (GameOptions).
905B LD BC,$017D Set the number of bytes to 017D which reaches Select_Game_Options.
905E CALL FillMemory Fill the variables and the object records with zero.
9061 LD HL,$5800 Point at the start of the attribute buffer (5800).
9064 LD BC,$0300 Set the size of the attribute buffer to 0300.
9067 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 906A CALL Clear_Screen Clear the screen.
906D CALL Reset_World_Map Clear the second byte of every room in the world map.
9070 CALL Place_Weapon_Pickups Choose where the four weapons are hidden.
9073 LD A,$06 Set the number of lives to 06.
9075 LD ($8EDA),A
Draw the selection menu and the icons, and read the keys 1 to 4.
Select_Game_Options_Loop 9078 CALL GameMenu Draw the five lines of the menu, the title and the copyright message.
907B CALL Draw_Menu_Icons Draw the icons next to the menu lines.
907E LD A,$F7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
9080 OUT ($FD),A
9082 IN A,($FE)
9084 CPL Flip the bits so that a pressed key gives a set bit.
9085 LD E,A Keep the state of the keys for the tests below.
9086 LD A,($8ED5) Fetch the control method from GameOptions.
Key 1 selects the keyboard (00).
9089 BIT 0,E Jump to Select_Game_Options_Test_Key_2 if key 1 is not pressed.
908B JR Z,Select_Game_Options_Test_Key_2
908D AND %11111100 Clear the control method bits (bits 0 and 1).
Key 2 selects a Kempston joystick (01).
Select_Game_Options_Test_Key_2 908F BIT 1,E Jump to Select_Game_Options_Test_Key_3 if key 2 is not pressed.
9091 JR Z,Select_Game_Options_Test_Key_3
9093 AND %11111100 Clear the control method bits (bits 0 and 1).
9095 OR %00000001 Set the control method to 01.
Key 3 selects a cursor joystick (02).
Select_Game_Options_Test_Key_3 9097 BIT 2,E Jump to Select_Game_Options_Test_Key_4 if key 3 is not pressed.
9099 JR Z,Select_Game_Options_Test_Key_4
909B AND %11111100 Clear the control method bits (bits 0 and 1).
909D OR %00000010 Set the control method to 02.
Key 4 selects an Interface II joystick (03).
Select_Game_Options_Test_Key_4 909F BIT 3,E Jump to Select_Game_Options_Store_Method if key 4 is not pressed.
90A1 JR Z,Select_Game_Options_Store_Method
90A3 AND %11111100 Clear the control method bits (bits 0 and 1).
90A5 OR %00000011 Set the control method to 03.
Store the control method and test key 0 which starts the game.
Select_Game_Options_Store_Method 90A7 LD D,A Keep the control method while the keys are read.
90A8 LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
90AA OUT ($FD),A
90AC IN A,($FE)
90AE CPL Flip the bits so that a pressed key gives a set bit.
90AF LD E,A Keep the state of the keys for the test below.
90B0 LD A,D Store the control method in GameOptions.
90B1 LD ($8ED5),A
90B4 LD C,A Keep the control method while key 0 is tested.
90B5 BIT 0,E Jump to Run_Game if key 0 is pressed.
90B7 JP NZ,Run_Game
Highlight the line of the chosen control method and go round again.
90BA LD HL,$9119 Point at the attributes of the menu lines (GameSelection_Attributes).
90BD LD B,$04 Set the number of control methods to 04.
90BF LD A,C Fetch the control method as the number of the chosen line.
90C0 CALL Highlight_Selected_Option Flash the attribute of the chosen line.
90C3 JP Select_Game_Options_Loop Jump back to Select_Game_Options_Loop.
Prev: 902A Up: Map Next: 90C6