Prev: 613B Up: Map Next: 6332
6298: Game Initialisation
Used by the routine at SecurityCheck.
Blank the 1UP, 2UP and HI scores.
GameInitialisation 6298 LD HL,$5F09 Write 00 to 0B bytes from HI_Score to 5F13.
629B LD BC,$0B00
GameInitialisation_Loop 629E LD (HL),C
629F INC HL
62A0 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.
62A2 LD HL,$03B5 HL=BEEPER.
62A5 LD B,$43 B=43 (counter).
62A7 XOR A A=00.
Mute_Loop 62A8 ADD A,(HL) Add the byte at HL to A.
62A9 INC HL Increment HL by one.
62AA DJNZ Mute_Loop Decrease counter by one and loop back to Mute_Loop until counter is zero.
62AC ADD A,$68 A=A + 68.
62AE LD ($5F0D),A Store this number at Sound_Enable.
62B1 XOR A Write 00 to BORDCR.
62B2 LD ($5C48),A
This entry point is used by the routine at GameOver_1UP.
Game_Restart 62B5 DI Disable interrupts.
62B6 LD SP,$5F00 Set the stack pointer to SecurityCheck.
62B9 CALL CreateWindow Call CreateWindow.
GameSelect_Loop 62BC CALL GameMenu Call GameMenu.
62BF LD A,$F7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
62C1 OUT ($FD),A
62C3 IN A,($FE)
62C5 CPL Flip the bits.
62C6 LD E,A E=A.
62C7 LD A,($5F0C) A=GameOptions.
Handle 1UP selection.
62CA BIT 0,E Has key "1" been pressed? ("1 PLAYER GAME").
62CC JR Z,GameSelect_CheckP2 If not jump to GameSelect_CheckP2.
62CE RES 0,A Set player count = 1.
Handle 2UP selection.
GameSelect_CheckP2 62D0 BIT 1,E Has key "2" been pressed? ("2 PLAYER GAME").
62D2 JR Z,GameSelect_CheckKeyboard If not jump to GameSelect_CheckKeyboard.
62D4 SET 0,A Set player count = 2.
Handle Keyboard selection.
GameSelect_CheckKeyboard 62D6 BIT 2,E Has key "3" been pressed? ("KEYBOARD").
62D8 JR Z,GameSelect_CheckKempston If not jump to GameSelect_CheckKempston.
62DA AND %11111001 Keep only bits 0, 3-7.
Handle Kempston Joystick selection.
GameSelect_CheckKempston 62DC BIT 3,E Has key "4" been pressed? ("KEMPSTON JOYSTICK").
62DE JR Z,GameSelect_CheckCursor If not jump to GameSelect_CheckCursor.
62E0 AND %11111001 Keep only bits.
62E2 OR %00000010 Set bit 1.
Handle Cursor Joystick selection.
GameSelect_CheckCursor 62E4 BIT 4,E Has key "5" been pressed? ("CURSOR JOYSTICK").
62E6 JR Z,GameSelect_CheckStart If not jump to GameSelect_CheckStart.
62E8 AND %11111001 Keep only bits 0, 3-7.
62EA OR %00000100 Set bit 2.
GameSelect_CheckStart 62EC LD ($5F0C),A Store A at GameOptions.
"0" for "Start Game" is on a different port.
62EF LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
62F1 OUT ($FD),A
62F3 IN A,($FE)
62F5 CPL Flip the bits.
Handle starting a new game.
62F6 BIT 0,A Has key "0" been pressed? ("START GAME").
62F8 JP NZ,StartGame If so, jump to StartGame.
Handle flashing each selection.
62FB LD HL,$635F HL=635F.
62FE LD A,($5F0C) C=GameOptions.
6301 LD C,A
6302 BIT 0,C If a 1UP game is selected, jump to GameInitialisation_4.
6304 JR NZ,GameInitialisation_4
6306 CALL GameInitialisation_5 Call GameInitialisation_5.
GameInitialisation_0 6309 LD B,$03 B=03.
630B LD A,C A=C.
630C RRCA
GameInitialisation_1 630D AND %00000011 Keep only bits 0-1.
630F JR Z,GameInitialisation_3
6311 CALL GameInitialisation_6 Call GameInitialisation_6.
GameInitialisation_2 6314 DEC A Decrease A by one.
6315 DJNZ GameInitialisation_1 Decrease counter by one and loop back to GameInitialisation_1 until counter is zero.
6317 JP GameSelect_Loop Jump back to GameSelect_Loop.
GameInitialisation_3 631A CALL GameInitialisation_8 Call GameInitialisation_8.
631D JR GameInitialisation_2 Jump to GameInitialisation_2.
GameInitialisation_4 631F CALL GameInitialisation_7 Call GameInitialisation_7.
6322 JR GameInitialisation_0 Jump to GameInitialisation_0.
GameInitialisation_5 6324 SET 7,(HL) Set bit 7 of HL.
6326 INC HL Increase HL by one.
GameInitialisation_6 6327 RES 7,(HL) Reset bit 7 of HL.
6329 INC HL Increase HL by one.
632A RET Return.
GameInitialisation_7 632B RES 7,(HL) Reset bit 7 of HL.
632D INC HL Increase HL by one.
GameInitialisation_8 632E SET 7,(HL) Set bit 7 of HL.
6330 INC HL Increase HL by one.
6331 RET Return.
Prev: 613B Up: Map Next: 6332