![]() |
Routines |
| Prev: 6F8D | Up: Map | Next: 7082 |
|
Used by the routine at Handler_Cars.
Handles a car driving left across the screen. When it reaches the left boundary it reinitialises from the right edge. Speed is fixed at 01.
|
||||
| Handler_CarType3 | 7028 | LD IX,$DAC8 | IX=Sprite02_3Wide_X_Position. | |
| 702C | LD HL,$720B | HL=CarSpeed. | ||
| 702F | LD (HL),$01 | Write 01 to *HL (fixed speed of 01). | ||
|
If the room is being initialised, set up the car.
|
||||
| 7031 | LD A,($5FBB) | Jump to Handler_CarType3_Initialise if *RespawnFlag is set. | ||
| 7034 | OR A | |||
| 7035 | JR NZ,Handler_CarType3_Initialise | |||
|
If the car crash timer is active, handle the crash animation.
|
||||
| 7037 | LD A,($7208) | Jump to Handler_Car_Type1_0 if *CarCrashTimer is active. | ||
| 703A | OR A | |||
| 703B | JP NZ,Handler_Car_Type1_0 | |||
|
Check which road the car is on.
|
||||
| 703E | LD A,(IX+$01) | A=*IX+01 (car Y position). | ||
| 7041 | CP $90 | Jump to Handler_CarType3_DriveRight if the car is on the upper road. | ||
| 7043 | JR Z,Handler_CarType3_DriveRight | |||
|
Car is on the lower road — driving left.
|
||||
| 7045 | LD A,(IX+$00) | A=*IX+00 (car X position). | ||
| 7048 | SUB (HL) | A-=*HL (subtract speed). | ||
| 7049 | JR C,Handler_CarType3_Initialise | Jump to Handler_CarType3_Initialise if the result underflowed (reinitialise). | ||
| 704B | JP Handler_CarType2_UpdateLeft | Jump to Handler_CarType2_UpdateLeft. | ||
|
Initialise car type 3 — pick a random colour (rejecting 01) and start from the right edge.
|
||||
| Handler_CarType3_Initialise | 704E | PUSH HL | Stash HL on the stack. | |
| 704F | CALL GenerateRandomNumber | Call GenerateRandomNumber. | ||
| 7052 | POP HL | Restore HL from the stack. | ||
| 7053 | AND %00000011 | Keep only bits 0-1 (random colour from BLACK,BLUE,RED,MAGENTA). | ||
| 7055 | CP $01 | Jump to Handler_CarType3_Initialise if the colour is BLUE (pick again). | ||
| 7057 | JR Z,Handler_CarType3_Initialise | |||
| 7059 | LD (IX+$02),A | Write A to *IX+02 (front colour). | ||
| 705C | LD (IX+$06),A | Write A to *IX+06 (rear colour). | ||
| 705F | XOR A | A=00 (start from the left edge). | ||
| 7060 | JP Handler_CarType2_UpdateRight | Jump to Handler_CarType2_UpdateRight. | ||
|
Car is on the upper road — driving right.
|
||||
| Handler_CarType3_DriveRight | 7063 | LD A,(IX+$00) | A=*IX+00 (car X position). | |
| 7066 | ADD A,(HL) | A+=*HL (add speed). | ||
| 7067 | CP $28 | Jump to Handler_CarType3_Restart if past the boundary. | ||
| 7069 | JR NC,Handler_CarType3_Restart | |||
| 706B | JP Handler_CarType2_UpdateRight | Jump to Handler_CarType2_UpdateRight. | ||
|
Pick a new bright colour and restart from 28.
|
||||
| Handler_CarType3_Restart | 706E | PUSH HL | Stash HL on the stack. | |
| 706F | CALL GenerateRandomNumber | Call GenerateRandomNumber. | ||
| 7072 | POP HL | Restore HL from the stack. | ||
| 7073 | AND %00000011 | Keep only bits 0-1. | ||
| 7075 | ADD A,$04 | A+=04 (bright colour range). | ||
| 7077 | LD (IX+$02),A | Write A to *IX+02 (front colour). | ||
| 707A | LD (IX+$06),A | Write A to *IX+06 (rear colour). | ||
| 707D | LD A,$28 | A=28. | ||
| 707F | JP Handler_CarType2_UpdateLeft | Jump to Handler_CarType2_UpdateLeft. | ||
| Prev: 6F8D | Up: Map | Next: 7082 |