![]() |
Routines |
| Prev: 6557 | Up: Map | Next: 65B1 |
|
Used by the routine at HandlerPlayer.
Moves the dots which are scattered over the play area, to give the impression that the car is moving. Nothing happens unless the car has moved since last time. Each of the 10 dots at TerrainDots is then redrawn by UpdateTerrainDot. The low bytes of the player's X (flipped) and Y positions are saved in PlayerWorldPosition so the dots can be erased from where they were drawn.
|
||||||||
| UpdateTerrainDots | 6588 | LD HL,($5E34) | Fetch the player position used last time (PlayerWorldPosition). | |||||
| 658B | LD A,($5E05) | Fetch the low byte of the player's X position on the map (PlayerMapPosition). | ||||||
| 658E | CPL | Flip all the bits, as the dots move the opposite way to the car. | ||||||
| 658F | LD E,A | Keep the flipped X position in E. | ||||||
| 6590 | LD A,($5E08) | Fetch the low byte of the player's Y position on the map (PlayerMapPositionY) and keep it in D. | ||||||
| 6593 | LD D,A | |||||||
|
Check if the player has moved.
|
||||||||
| 6594 | AND A | Reset the carry flag. | ||||||
| 6595 | PUSH HL | Stash HL on the stack. | ||||||
| 6596 | SBC HL,DE | Compare the new player position with the position used last time. | ||||||
| 6598 | POP HL | Restore HL from the stack. | ||||||
| 6599 | RET Z | Return if the player has not moved. | ||||||
| 659A | PUSH DE | Stash the new player position on the stack. | ||||||
| 659B | LD IX,$65FD | Point IX at the first terrain dot (TerrainDots). | ||||||
| 659F | LD B,$10 | Set the dot counter to 10. | ||||||
| UpdateTerrainDots_Loop | 65A1 | PUSH BC | Stash the dot counter on the stack. | |||||
| 65A2 | CALL UpdateTerrainDot | Update the dot using UpdateTerrainDot. | ||||||
| 65A5 | INC IX | Point IX at the next dot. | ||||||
| 65A7 | INC IX | |||||||
| 65A9 | POP BC | Restore the dot counter from the stack. | ||||||
| 65AA | DJNZ UpdateTerrainDots_Loop | Decrease the dot counter by one and loop back to UpdateTerrainDots_Loop until all 10 dots have been updated. | ||||||
| 65AC | POP HL | Restore the new player position from the stack. | ||||||
| 65AD | LD ($5E34),HL | Write HL to PlayerWorldPosition. | ||||||
| 65B0 | RET | Return. | ||||||
| Prev: 6557 | Up: Map | Next: 65B1 |