Prev: 6386 Up: Map Next: 63DA
6391: Initialise New Game
Used by the routine at StartGame.
Sets up a new game with three lives, no cups collected, and the miles and time reset. Continues into PlayerInit which sets up the first car.
Before After
new-game-before new-game-after
NewGame 6391 LD A,$03 Write starting lives to Player_Lives (duplicate of 5FF6 - possibly so POKEs would appear to not work?)
6393 LD ($5E3D),A
This entry point is used by the routine at HandlerCup.
NewGame_ResetCups 6396 XOR A Set the number of cups collected to 00.
6397 LD ($5E3C),A
639A CALL RandomiseCups Put the cups back at new positions using RandomiseCups.
Reset miles and time.
639D LD HL,$5E2D Point HL at the miles (Miles).
63A0 LD B,$07 Set the byte counter to 07 to cover the miles and the time.
GameInit_Reset 63A2 LD (HL),$00 Clear a byte of the miles and time.
63A4 INC HL Move on to the next byte.
63A5 DJNZ GameInit_Reset Decrease the byte counter by one and loop back to GameInit_Reset until the miles and time have been cleared.
This entry point is used by the routine at GameOver.
Set up a new car.
PlayerInit 63A7 CALL CreateWindow Create the game window using CreateWindow.
63AA CALL LocatePlayerMarker Call LocatePlayerMarker to find where the player's marker is on the map.
63AD CALL FlashPlayerMarker_SaveByte Call FlashPlayerMarker_SaveByte to save the screen byte at the position of the marker.
63B0 CALL FindFirstObject Find the first object using FindFirstObject.
63B3 CALL InitialiseEntities Set up the entities using InitialiseEntities.
63B6 LD HL,$C000 Write C000 (the maximum value for fuel) to Fuel_LSB.
63B9 LD ($5E0A),HL
63BC LD H,$00 Write 0000 to;
63BE LD ($5E0C),HL
63C1 LD ($5E0E),HL
63C4 LD ($5E10),HL
63C7 LD HL,$0C40 Set the player's X position on the map (PlayerMapPosition) to 0C40.
63CA LD ($5E05),HL
63CD LD HL,$0640 Set the player's Y position on the map (PlayerMapPositionY) to 0640.
63D0 LD ($5E08),HL
63D3 XOR A Clear the last place visited (LastPlaceVisited).
63D4 LD ($5E4F),A
63D7 JP FindFirstObject Jump to FindFirstObject to find the first object.
View the equivalent code in;
Prev: 6386 Up: Map Next: 63DA