Prev: 25030 Up: Map Next: 25066
25037: 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 25037 LD HL,24064 HL=24064 (the high score), B=11 (the byte counter) and C=0 (the value to write).
25040 LD BC,2816
GameInitialisation_Loop 25043 LD (HL),C Clear the byte.
25044 INC HL Move onto the next byte.
25045 DJNZ GameInitialisation_Loop Decrease the byte counter by one and loop back to GameInitialisation_Loop until all 11 bytes have been cleared.
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 tunes are not played.
25047 LD HL,949 HL=BEEPER.
25050 LD B,67 Set the byte counter to 67 (the length of the routine).
25052 XOR A A=0 (the start of the checksum).
Mute_Loop 25053 ADD A,(HL) Add the byte of the routine to the checksum.
25054 INC HL Move onto the next byte of the routine.
25055 DJNZ Mute_Loop Decrease the byte counter by one and loop back to Mute_Loop until the whole routine has been added.
25057 ADD A,104 Add 104 to the checksum (which gives 0 if the routine is unchanged).
25059 LD (24068),A Store the checksum at Sound_Enable (the sound flag).
25062 XOR A Write 0 to BORDCR.
25063 LD (23624),A
Continue on to Game_Restart.
View the equivalent code in;
Prev: 25030 Up: Map Next: 25066