Prev: 39258 Up: Map Next: 39338
39264: Game Initialisation
Clears the game variables, the screen and the attribute buffer, builds the lookup table used when drawing sprites (BuildShiftTable) and colours and draws the banner and score line. The game selection menu (HandlerGameMenu) is shown, then the game variables are cleared again, the scores are printed, the start-up jingle (the music data at MusicData_GameInitialisation) is played and InitialiseGame sets up both players and the first room before the main loop at MainLoop is entered.
game-start
jungle-strip
GameInitialisation 39264 CALL ClearBuffers Clear the game variables.
39267 XOR A Set the border to BLACK.
39268 OUT (254),A
39270 CALL ResetAttributes Clear the attribute buffer.
39273 CALL ResetScreen Reset the screen buffer.
39276 CALL BuildShiftTable Build the shift table used when drawing sprites.
Set the attributes for the top banner (the whole line is INK:WHITE, PAPER:BLACK (BRIGHT)).
39279 LD HL,22528 Set the attribute pointer in HL to the start of the attribute buffer at 22528.
39282 LD BC,8263 Set the column counter in B to 32 and the banner colour in C to INK:WHITE, PAPER:BLACK (BRIGHT).
CreateWindow_Loop_Banner 39285 LD (HL),C Write the banner colour to the attribute buffer.
39286 INC L Move onto the next column.
39287 DJNZ CreateWindow_Loop_Banner Decrease the column counter by one and loop back to CreateWindow_Loop_Banner until all 32 columns have been coloured.
39289 CALL PrintBanner Print the banner.
Set the attributes for the score line (the whole line is INK:YELLOW, PAPER:BLACK (BRIGHT)).
39292 LD HL,22560 Set the attribute pointer in HL to the start of the score line at 22560.
39295 LD BC,8262 Set the column counter in B to 32 and the score line colour in C to INK:YELLOW, PAPER:BLACK (BRIGHT).
CreateWindow_Loop_Score 39298 LD (HL),C Write the score line colour to the attribute buffer.
39299 INC L Move onto the next column.
39300 DJNZ CreateWindow_Loop_Score Decrease the column counter by one and loop back to CreateWindow_Loop_Score until all 32 columns have been coloured.
Print the 1UP, 2UP and HI scores on the score line.
39302 CALL Score_1UP Print the 1UP score.
39305 CALL Score_2UP Print the 2UP score.
39308 CALL Score_HI Print the high score.
This entry point is used by the routine at GameOver_ControllerRestart.
Show the game selection menu and wait for a game to be chosen. This is also where the game restarts when a game is over.
Game_Restart 39311 CALL HandlerGameMenu Show the game menu.
Write 0 to every address from 1UP_Score_1 to 39257 (the scores, the player data, the actor table and the other game variables).
39314 LD HL,38552 Set the start of the game variables in HL to 1UP_Score_1.
39317 LD BC,706 Set the number of bytes to clear in BC to 706.
39320 CALL ClearBuffers_Loop Clear the game variables.
Print the (now zero) 1UP and 2UP scores.
39323 CALL Score_1UP Print the 1UP score.
39326 CALL Score_2UP Print the 2UP score.
Play the start-up jingle.
39329 LD DE,48453 Point DE at MusicData_GameInitialisation.
39332 CALL PlayMusic Play the start-up tune.
Set up both players and the first room, then carry on into the main loop.
39335 CALL InitialiseGame Set up the players and the first room.
Continue on to MainLoop.
View the equivalent code in;
Prev: 39258 Up: Map Next: 39338