Prev: 61C6 Up: Map Next: 61EA
61CD: Game Initialisation
Clears the high score, the game options, the sound flag and the 1UP and 2UP scores, calculates a checksum of the ROM BEEPER routine to set the sound flag, and sets the border colour system variable.
Blank the high score, game options, sound flag, 1UP and 2UP scores.
GameInitialisation 61CD LD HL,$5E00 HL=5E00 (the high score), B=0B (the byte counter) and C=00 (the value to write).
61D0 LD BC,$0B00
GameInitialisation_Loop 61D3 LD (HL),C Clear the byte.
61D4 INC HL Move onto the next byte.
61D5 DJNZ GameInitialisation_Loop Decrease the byte counter by one and loop back to GameInitialisation_Loop until all 0B bytes have been cleared.
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 tunes are not played.
61D7 LD HL,$03B5 HL=BEEPER.
61DA LD B,$43 Set the byte counter to 43 (the length of the routine).
61DC XOR A A=00 (the start of the checksum).
Mute_Loop 61DD ADD A,(HL) Add the byte of the routine to the checksum.
61DE INC HL Move onto the next byte of the routine.
61DF DJNZ Mute_Loop Decrease the byte counter by one and loop back to Mute_Loop until the whole routine has been added.
61E1 ADD A,$68 Add 68 to the checksum (which gives 00 if the routine is unchanged).
61E3 LD ($5E04),A Store the checksum at Sound_Enable (the sound flag).
61E6 XOR A Write 00 to BORDCR.
61E7 LD ($5C48),A
Continue on to Game_Restart.
View the equivalent code in;
Prev: 61C6 Up: Map Next: 61EA