Prev: D352 Up: Map Next: D4D6
D469: Start Game
Used by the routine at Game_Loop.
The game always starts with the cursor inside the home box.
This is position 02/ 02:
cursor-02-02
StartGame D469 LD A,$02 Write 02 to:
D46B LD ($D830),A
D46E LD ($D831),A
D471 LD ($D82E),A
D474 LD ($D82F),A
Tile 09 is the home box:
tile-ids
Set the players starting tile.
D477 LD A,$09 Write 09 to *PlayerCursor_TileID.
D479 LD ($D834),A
Spend a life to play the game.
D47C LD HL,$D827 HL=Lives.
D47F DEC (HL) Decrease *HL by one.
D480 JP Z,GameOver Jump to GameOver if the player is out of lives.
D483 LD HL,$D83A Write 00 to *Time.
D486 LD (HL),$00
D488 CALL Draw_TimeBar Call Draw_TimeBar.
The life icons are static, drawn from Data_PlayareaSurround, in order to display the correct number of lives - we paint them to be the same PAPER/ INK colour as their background.
D48B LD HL,($D872) HL=*LifeIcons_ScreenPosition.
First; hide the top part of the icon.
D48E LD (HL),$2D Write INK: CYAN, PAPER: CYAN to *HL.
D490 INC HL Increment HL by one.
D491 LD (HL),$2D Write INK: CYAN, PAPER: CYAN to *HL.
D493 INC HL Increment HL by one.
D494 LD ($D872),HL Update the icon position marker at *LifeIcons_ScreenPosition.
Move down one line, and left two character blocks.
D497 LD DE,$001E HL+=001E.
D49A ADD HL,DE
Lastly; colour the bottom part of the icon.
D49B LD (HL),$2D Write INK: CYAN, PAPER: CYAN to *HL.
D49D INC HL Increment HL by one.
D49E LD (HL),$2D Write INK: CYAN, PAPER: CYAN to *HL.
D4A0 LD HL,$D83A HL=Time.
D4A3 SET 0,(HL) Set bit 0 of *HL.
This entry point is used by the routine at D352.
StartGame_0 D4A5 LD A,($D83A) A=*Time.
D4A8 AND %11110001 Keep only bits 0, 4-7.
D4AA LD ($D83A),A Write A to *Time.
D4AD LD A,($D830) Write *StorageCursor_Y_Position to *DestinationCursor_Y_Position.
D4B0 LD ($D82C),A
D4B3 LD A,($D831) Write *StorageCursor_X_Position to *DestinationCursor_X_Position.
D4B6 LD ($D82D),A
D4B9 LD A,($D824) Write *Timer_Crack_13 to *D832.
D4BC LD ($D832),A
D4BF LD A,($D835) Jump to StartGame_1 if *PlayerCursor_Flag is not equal to 00.
D4C2 CP $00
D4C4 JR NZ,StartGame_1
D4C6 LD A,($D834) Jump to StartGame_1 if *PlayerCursor_TileID is equal to 09.
D4C9 CP $09
D4CB JR Z,StartGame_1
D4CD CALL Display_PlayerCursor Call Display_PlayerCursor.
StartGame_1 D4D0 CALL Handler_IsLevelComplete Call Handler_IsLevelComplete.
D4D3 JP $D352 Jump to D352.
Prev: D352 Up: Map Next: D4D6