← 8EA8 Reset the play state for a new game or level Map 8F0A → Re-arm the object pool to serve a ball
8ED3: Initialize the score and game counters for a new game
Sets the start-of-game baseline. The score and the level index go to 0 and lives to 3. Every carried-over flag, marker and timer goes back to its default.
init_game_vars 8ED3 LD C,$01 Seed the lives addend. The lives count below adds it to 2, which gives 3 lives at the start.
8ED5 LD HL,score_display Fill the on-screen score digits with ASCII '0' and set bit 7 of the last digit as the print-string terminator. The score reads 0.
8ED8 LD B,$08
init_game_vars_0 8EDA LD (HL),$30
8EDC INC HL
8EDD DJNZ init_game_vars_0
8EDF DEC HL
8EE0 SET 7,(HL)
8EE2 LD HL,level_caption_hundreds Reset the three digit cells of the level caption to '0'. Two are ASCII '0', and the third is a game-font '0' whose bit 7 terminates the print string. This resets the hundreds cell, which is what starts the displayed level over at 1 for a new game.
8EE5 LD (HL),$30
8EE7 INC HL
8EE8 LD (HL),$30
8EEA INC HL
8EEB LD (HL),$B0
8EED LD A,$30 Reset the extra-life milestone marker to '0'. It is the saved ten-thousands score digit. The extra-life award compares the live score against it, to award one life per 10000 points.
8EEF LD (score_milestone_marker),A
8EF2 XOR A The level index starts at 0, the first level.
8EF3 LD (level),A
8EF6 XOR A Start the game with 3 lives.
8EF7 ADD A,$02
8EF9 ADD A,C
8EFA LD (lives),A
8EFD XOR A Clear the warp flag and its countdown: a new game starts with no warp in progress.
8EFE LD (warp_active_flag),A
8F01 LD (warp_countdown),A
8F04 LD A,$14 Restore the rally-acceleration interval to its start-of-game default: bounces per ball-speed step.
8F06 LD (rally_accel_interval),A
8F09 RET
← 8EA8 Reset the play state for a new game or level Map 8F0A → Re-arm the object pool to serve a ball
Fork me on GitHub