| Chase H.Q. | Routines |
| Prev: 8401 | Up: Map | Next: 858C |
|
This runs the game loop while driving the car.
|
||||
| cpu_driver | 852A | LD HL,($A26C) | Get road position | |
|
If we're on the left, go right.
|
||||
| 852D | PUSH HL | Subtract centre-left edge. Carry flag will be set if we're on the right hand side of it | ||
| 852E | LD DE,$0105 | |||
| 8531 | SBC HL,DE | |||
| 8533 | POP HL | |||
| 8534 | LD A,$09 | Set input ACCELERATE + RIGHT | ||
| 8536 | JR NC,cd_check_speed | Jump to cd_check_speed if we're on the left | ||
|
If we're on the right, go left.
|
||||
| 8538 | LD DE,$00F5 | Subtract centre-right edge. Carry flag will be set if we're on the right hand side of it | ||
| 853B | SBC HL,DE | |||
| 853D | LD A,$0A | Set input ACCELERATE + LEFT | ||
| 853F | JR C,cd_check_speed | Jump to cd_check_speed if we're on the right | ||
|
Otherwise we're in the centre zone.
|
||||
| 8541 | LD A,$08 | Set input ACCELERATE | ||
| cd_check_speed | 8543 | LD C,A | Move input into C for the moment | |
| 8544 | LD HL,($A24A) | Calculate (speed - 150) | ||
| 8547 | LD DE,$0096 | |||
| 854A | SBC HL,DE | |||
| 854C | LD A,($A253) | Load gear | ||
| 854F | SBC A,$00 | Set gear to low if speed < 150, otherwise high | ||
| 8551 | JR NZ,cd_set_input | |||
| 8553 | SET 4,C | Set input GEAR | ||
| cd_set_input | 8555 | LD A,C | Set user input | |
| 8556 | LD ($A0D5),A | |||
| 8559 | CALL read_map | Call read_map | ||
| 855C | CALL spawn_cars | Call spawn_cars | ||
| 855F | CALL cycle_counters | Call cycle_counters | ||
| 8562 | CALL build_height_table | Call build_height_table | ||
| 8565 | CALL scroll_horizon | Call scroll_horizon | ||
| 8568 | CALL layout_road | Call layout_road | ||
| 856B | CALL draw_road | Call draw_road | ||
| 856E | CALL layout_objects | Call layout_objects | ||
| 8571 | CALL prepare_tunnel | Call prepare_tunnel | ||
| 8574 | CALL spawn_hazards | Call spawn_hazards | ||
| 8577 | CALL choose_dirt_and_stones | Call choose_dirt_and_stones | ||
| 857A | CALL layout_dirt_and_stones | Call layout_dirt_and_stones | ||
| 857D | CALL draw_hazards | Call draw_hazards | ||
| 8580 | CALL move_hero_car | Call move_hero_car | ||
| 8583 | CALL check_collisions | Call check_collisions | ||
| 8586 | CALL draw_everything_else | Call draw_everything_else | ||
| 8589 | JP animate_hero_car | Exit via animate_hero_car | ||
| Prev: 8401 | Up: Map | Next: 858C |