![]() |
Routines |
| Prev: 6DAB | Up: Map | Next: 6E5D |
|
Used by the routine at Handler_Cars.
Generates random parameters for a new car entering from the right side of the screen. Sets a random movement speed, random sprite active flags, and resets the car to the bottom of the screen. Clamps the X position to a maximum of DE.
|
||||||||
| Randomise_Car_Position | 6E2F | CALL GenerateRandomNumber | Generate a random car speed of 01-04 and write to *CarSpeed. | |||||
| 6E32 | AND %00000011 | |||||||
| 6E34 | INC A | |||||||
| 6E35 | LD ($720B),A | |||||||
| 6E38 | CALL GenerateRandomNumber | Generate a random sprite active value of 04-07 and write to both *IX+02 and *IX+06. | ||||||
| 6E3B | AND %00000011 | |||||||
| 6E3D | ADD A,$04 | |||||||
| 6E3F | LD (IX+$02),A | |||||||
| 6E42 | LD (IX+$06),A | |||||||
| 6E45 | LD (IX+$01),$A0 | Set both Y positions (*IX+01 and *IX+05) to A0 (bottom of screen). | ||||||
| 6E49 | LD (IX+$05),$A0 | |||||||
| 6E4D | XOR A | Write 00 to *CarCrashCounter to clear it. | ||||||
| 6E4E | LD ($7209),A | |||||||
| 6E51 | LD A,(IX+$00) | Load the car X position from *IX+00. | ||||||
| 6E54 | CP $DE | Return if the car X position is less than DE. | ||||||
| 6E56 | LD A,$DE | |||||||
| 6E58 | RET C | |||||||
| 6E59 | LD (IX+$00),A | Otherwise clamp the X position to DE and return. | ||||||
| 6E5C | RET | |||||||
| Prev: 6DAB | Up: Map | Next: 6E5D |