Prev: 61C6 Up: Map Next: 6250
61CD: Game Initialisation
Blank the 1UP, 2UP and HI scores.
GameInitialisation 61CD LD HL,$5E00 Write 00 to 0B bytes from 5E00 to 5E0B.
61D0 LD BC,$0B00
GameInitialisation_Loop 61D3 LD (HL),C
61D4 INC HL
61D5 DJNZ GameInitialisation_Loop
This calculates a "checksum" of the BEEPER routine. The expected value at the end is 00 and if Sound_Enable does not contain 00 then the game is muted.
61D7 LD HL,$03B5 HL=BEEPER.
61DA LD B,$43 B=43 (counter).
61DC XOR A A=00.
Mute_Loop 61DD ADD A,(HL) Add the byte at HL to A.
61DE INC HL Increment HL by one.
61DF DJNZ Mute_Loop Decrease counter by one and loop back to Mute_Loop until counter is zero.
61E1 ADD A,$68 A=A + 68.
61E3 LD ($5E04),A Store this number at Sound_Enable.
61E6 XOR A Write 00 to BORDCR.
61E7 LD ($5C48),A
This entry point is used by the routine at GameOver1UP.
Game_Restart 61EA DI Disable interrupts.
61EB LD SP,$5D00 Set the stack pointer to 5D00.
61EE CALL CreateWindow Call CreateWindow.
GameSelect_Loop 61F1 CALL GameMenu Call GameMenu.
61F4 LD A,($5E03) D=GameOptions.
61F7 LD D,A
61F8 LD A,$F7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
61FA OUT ($FD),A
61FC IN A,($FE)
61FE CPL Flip the bits.
Handle 1UP selection.
61FF BIT 0,A Has key "1" been pressed? ("1 PLAYER GAME").
6201 JR Z,GameSelect_CheckP2 If not jump to GameSelect_CheckP2.
6203 RES 0,D Set player count = 1.
Handle 2UP selection.
GameSelect_CheckP2 6205 BIT 1,A Has key "2" been pressed? ("2 PLAYER GAME").
6207 JR Z,GameSelect_CheckKeyboard If not jump to GameSelect_CheckKeyboard.
6209 SET 0,D Set player count = 2.
Handle Keyboard selection.
GameSelect_CheckKeyboard 620B BIT 2,A Has key "3" been pressed? ("KEYBOARD").
620D JR Z,GameSelect_CheckKempston If not jump to GameSelect_CheckKempston.
620F RES 1,D Set control method = keyboard.
Handle Kempston Joystick selection.
GameSelect_CheckKempston 6211 BIT 3,A Has key "4" been pressed? ("KEMPSTON JOYSTICK").
6213 JR Z,GameSelect_StartGame If not jump to GameSelect_StartGame.
6215 SET 1,D Set control method = joystick.
Handle starting a new game.
GameSelect_StartGame 6217 BIT 4,A Has key "5" been pressed? ("START GAME").
6219 JP NZ,GameStart If so, jump to GameStart.
Handle flashing each selection.
621C LD A,D Write D to GameOptions.
621D LD ($5E03),A
6220 LD HL,$627D HL=GameSelection_Attributes.
6223 LD A,($5E03) C=GameOptions.
6226 LD C,A
MenuAttributeCheckPlayer 6227 BIT 0,C If a 2UP game is selected, jump to MenuAttrHandle2UP.
6229 JR NZ,MenuAttrHandle2UP
622B CALL MenuAttributeSetFirst Else, call MenuAttributeSetFirst.
Check control method.
MenuAttributeCheckControl 622E BIT 1,C If joystick is selected, jump to MenuAttrHandleJoystick.
6230 JR NZ,MenuAttrHandleJoystick
6232 CALL MenuAttributeSetFirst Else, call MenuAttributeSetFirst.
GameSelect_End 6235 JP GameSelect_Loop Jump back to GameSelect_Loop.
Handle flashing 2UP.
MenuAttrHandle2UP 6238 CALL MenuAttributeSetSecond Call MenuAttributeSetSecond.
623B JR MenuAttributeCheckControl Jump to MenuAttributeCheckControl.
Handle flashing joystick.
MenuAttrHandleJoystick 623D CALL MenuAttributeSetSecond Call MenuAttributeSetSecond.
6240 JR GameSelect_End Jump to GameSelect_End.
Set the first menu item, unset the second.
MenuAttributeSetFirst 6242 SET 7,(HL) Set the FLASH attribute for the first selection.
6244 INC HL Move onto the next menu attribute.
6245 RES 7,(HL) Unset the FLASH attribute for the second selection.
6247 INC HL Move onto the next menu selection attribute.
6248 RET Return.
Unset the first menu item, set the second.
MenuAttributeSetSecond 6249 RES 7,(HL) Unset the FLASH attribute for the first selection.
624B INC HL Move onto the next menu attribute.
624C SET 7,(HL) Set the FLASH attribute for the second selection.
624E INC HL Move onto the next menu selection attribute.
624F RET Return.
View the equivalent code in;
Prev: 61C6 Up: Map Next: 6250