![]() |
Routines |
| Prev: 683B | Up: Map | Next: 68A0 |
|
Used by the routine at CreateWindow.
Draws one car icon in the bottom row of the sidebar for each life remaining in Player_Lives.
|
||||||||
|
||||||||
| DisplayPlayerLives | 687B | LD A,($5E3D) | Return if there are no lives left (Player_Lives). | |||||
| 687E | AND A | |||||||
| 687F | RET Z | |||||||
| 6880 | LD B,A | Set the lives counter to the number of lives (Player_Lives). | ||||||
| 6881 | LD HL,$BC08 | HL=BC08 (pixel co-ordinates: H is the Y position and L is the X position of the first car). | ||||||
| 6884 | XOR A | Write 00 to NewSpriteShift. | ||||||
| 6885 | LD ($5E41),A | |||||||
| DisplayPlayerLives_Loop | 6888 | LD DE,$7CD6 | Point DE at the car sprite (Sprite_Car_1). | |||||
| 688B | CALL DisplayPlayerLives_Print | Print a car using DisplayPlayerLives_Print. | ||||||
| 688E | DJNZ DisplayPlayerLives_Loop | Decrease the lives counter by one and loop back to DisplayPlayerLives_Loop until a car has been shown for every life. | ||||||
| 6890 | RET | Return. | ||||||
|
Print the player sprite.
|
||||||||
| DisplayPlayerLives_Print | 6891 | PUSH BC | Stash the lives counter and the pixel co-ordinates on the stack. | |||||
| 6892 | PUSH HL | |||||||
| 6893 | CALL PrepareActorSprite_Shift | Call PrepareActorSprite_Shift to set up the sprite at the co-ordinates in HL. | ||||||
| 6896 | CALL DrawEntity_NoOldSprite | Call DrawEntity_NoOldSprite to draw the sprite. | ||||||
| 6899 | POP HL | Restore the pixel co-ordinates and the lives counter from the stack. | ||||||
| 689A | POP BC | |||||||
|
Move onto the next life "slot".
|
||||||||
| 689B | LD A,L | Add 10 to the X position, ready for the next car. | ||||||
| 689C | ADD A,$10 | |||||||
| 689E | LD L,A | |||||||
| 689F | RET | Return. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: 683B | Up: Map | Next: 68A0 |