Prev: 25030 Up: Map Next: 25168
25037: Game Initialisation
Blank the 1UP, 2UP and HI scores.
GameInitialisation 25037 LD HL,24064 Write 0 to 11 bytes from 24064 to 24075.
25040 LD BC,2816
GameInitialisation_Loop 25043 LD (HL),C
25044 INC HL
25045 DJNZ GameInitialisation_Loop
This calculates a "checksum" of the BEEPER routine. The expected value at the end is 0 and if Sound_Enable does not contain 0 then the game is muted.
25047 LD HL,949 HL=BEEPER.
25050 LD B,67 B=67 (counter).
25052 XOR A A=0.
Mute_Loop 25053 ADD A,(HL) Add the byte at HL to A.
25054 INC HL Increment HL by one.
25055 DJNZ Mute_Loop Decrease counter by one and loop back to Mute_Loop until counter is zero.
25057 ADD A,104 A=A + 104.
25059 LD (24068),A Store this number at Sound_Enable.
25062 XOR A Write 0 to BORDCR.
25063 LD (23624),A
This entry point is used by the routine at GameOver1UP.
Game_Restart 25066 DI Disable interrupts.
25067 LD SP,23808 Set the stack pointer to 23808.
25070 CALL CreateWindow Call CreateWindow.
GameSelect_Loop 25073 CALL GameMenu Call GameMenu.
25076 LD A,(24067) D=GameOptions.
25079 LD D,A
25080 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
25082 OUT (253),A
25084 IN A,(254)
25086 CPL Flip the bits.
Handle 1UP selection.
25087 BIT 0,A Has key "1" been pressed? ("1 PLAYER GAME").
25089 JR Z,GameSelect_CheckP2 If not jump to GameSelect_CheckP2.
25091 RES 0,D Set player count = 1.
Handle 2UP selection.
GameSelect_CheckP2 25093 BIT 1,A Has key "2" been pressed? ("2 PLAYER GAME").
25095 JR Z,GameSelect_CheckKeyboard If not jump to GameSelect_CheckKeyboard.
25097 SET 0,D Set player count = 2.
Handle Keyboard selection.
GameSelect_CheckKeyboard 25099 BIT 2,A Has key "3" been pressed? ("KEYBOARD").
25101 JR Z,GameSelect_CheckKempston If not jump to GameSelect_CheckKempston.
25103 RES 1,D Set control method = keyboard.
Handle Kempston Joystick selection.
GameSelect_CheckKempston 25105 BIT 3,A Has key "4" been pressed? ("KEMPSTON JOYSTICK").
25107 JR Z,GameSelect_StartGame If not jump to GameSelect_StartGame.
25109 SET 1,D Set control method = joystick.
Handle starting a new game.
GameSelect_StartGame 25111 BIT 4,A Has key "5" been pressed? ("START GAME").
25113 JP NZ,GameStart If so, jump to GameStart.
Handle flashing each selection.
25116 LD A,D Write D to GameOptions.
25117 LD (24067),A
25120 LD HL,25213 HL=GameSelection_Attributes.
25123 LD A,(24067) C=GameOptions.
25126 LD C,A
MenuAttributeCheckPlayer 25127 BIT 0,C If a 2UP game is selected, jump to MenuAttrHandle2UP.
25129 JR NZ,MenuAttrHandle2UP
25131 CALL MenuAttributeSetFirst Else, call MenuAttributeSetFirst.
Check control method.
MenuAttributeCheckControl 25134 BIT 1,C If joystick is selected, jump to MenuAttrHandleJoystick.
25136 JR NZ,MenuAttrHandleJoystick
25138 CALL MenuAttributeSetFirst Else, call MenuAttributeSetFirst.
GameSelect_End 25141 JP GameSelect_Loop Jump back to GameSelect_Loop.
Handle flashing 2UP.
MenuAttrHandle2UP 25144 CALL MenuAttributeSetSecond Call MenuAttributeSetSecond.
25147 JR MenuAttributeCheckControl Jump to MenuAttributeCheckControl.
Handle flashing joystick.
MenuAttrHandleJoystick 25149 CALL MenuAttributeSetSecond Call MenuAttributeSetSecond.
25152 JR GameSelect_End Jump to GameSelect_End.
Set the first menu item, unset the second.
MenuAttributeSetFirst 25154 SET 7,(HL) Set the FLASH attribute for the first selection.
25156 INC HL Move onto the next menu attribute.
25157 RES 7,(HL) Unset the FLASH attribute for the second selection.
25159 INC HL Move onto the next menu selection attribute.
25160 RET Return.
Unset the first menu item, set the second.
MenuAttributeSetSecond 25161 RES 7,(HL) Unset the FLASH attribute for the first selection.
25163 INC HL Move onto the next menu attribute.
25164 SET 7,(HL) Set the FLASH attribute for the second selection.
25166 INC HL Move onto the next menu selection attribute.
25167 RET Return.
View the equivalent code in;
Prev: 25030 Up: Map Next: 25168