Chase H.Q. | Routines |
Prev: B8D2 | Up: Map | Next: BB69 |
|
||||
main_loop_12 | B9F4 | LD A,($A240) | Load road_buffer_offset into A [as byte] | |
B9F7 | ADD A,$40 | Add 64 so it's the lanes data offset | ||
B9F9 | LD E,A | DE = $EE00 | A | ||
B9FA | LD D,$EE | |||
B9FC | LD BC,$16E1 | B=20, C=$E1 -- counter, mask | ||
B9FF | LD L,$00 | Counter/Index | ||
Suspect this is counting the distance to road split.
|
||||
main_loop_12_0 | BA01 | LD A,(DE) | Load a lanes byte | |
BA02 | AND C | Jump if (byte & $E1) == $E1 | ||
BA03 | CP C | |||
BA04 | JP Z,main_loop_12_3 | |||
BA07 | INC E | Advance to next lanes byte (wrapping around) | ||
BA08 | INC L | Increment counter | ||
BA09 | DJNZ main_loop_12_0 | Loop while B | ||
No road split found?
|
||||
BA0B | CALL $CBD6 | [road is still rendered if this is NOPped, but road is in wrong position] | ||
BA0E | LD ($BA4E),SP | Self modify return path | ||
BA12 | LD SP,$EC30 | must be data | ||
BA15 | LD A,$30 | |||
main_loop_12_1 | BA17 | LD HL,$BA36 | Self modify BA35 to load $EA30 | |
BA1A | LD DE,$BA40 | Self modify BA3F to load $EB30 | ||
BA1D | LD BC,$BA45 | Self modify BA44 to load $E930 | ||
main_loop_12_2 | BA20 | LD (HL),A | ||
BA21 | LD (DE),A | |||
BA22 | LD (BC),A | |||
BA23 | LD ($BA29),A | Self modify BA27 to load ($E800 | A) | ||
BA26 | EXX | Bank | ||
BA27 | LD DE,($E800) | Self modified | ||
BA2B | POP HL | |||
BA2C | SBC HL,DE | |||
BA2E | SRA H | |||
BA30 | RR L | |||
BA32 | LD B,H | BC = HL | ||
BA33 | LD C,L | |||
BA34 | ADD HL,DE | |||
BA35 | LD ($EA00),HL | |||
BA38 | LD D,B | DE = BC | ||
BA39 | LD E,C | |||
BA3A | SRA B | |||
BA3C | RR C | |||
BA3E | ADD HL,BC | |||
BA3F | LD ($EB00),HL | |||
BA42 | SBC HL,DE | |||
BA44 | LD ($E900),HL | |||
BA47 | INC A | A += 2 | ||
BA48 | INC A | |||
BA49 | EXX | Unbank | ||
BA4A | JP NZ,main_loop_12_2 | Loop while A > 0 ? | ||
ml12_exit | BA4D | LD SP,$0000 | Restore original SP | |
BA50 | RET | Return | ||
Handle road split.
|
||||
main_loop_12_3 | BA51 | LD A,L | ||
BA52 | LD ($A266),A | split_road_countdown = A | ||
BA55 | LD H,$E3 | |||
BA57 | LD A,$60 | Set split_road visible | ||
BA59 | LD ($A265),A | |||
BA5C | SUB (HL) | |||
BA5D | CPL | A = ~A + $69 | ||
BA5E | ADD A,$69 | |||
BA60 | PUSH AF | |||
BA61 | LD HL,($A267) | HL = var_a267 | ||
BA64 | LD A,(DE) | A = *DE & 4 | ||
BA65 | AND $04 | |||
BA67 | JR NZ,main_loop_12_9 | |||
BA69 | LD A,($A269) | A = var_a269 - 1 | ||
BA6C | DEC A | |||
BA6D | JR Z,main_loop_12_6 | Jump if zero | ||
BA6F | NEG | A = -A | ||
BA71 | LD ($A269),A | var_a269 = A | ||
BA74 | LD DE,($A26C) | Get road position | ||
BA78 | LD A,$01 | A = 1 | ||
BA7A | DEC D | D-- | ||
BA7B | JP M,main_loop_12_5 | |||
BA7E | JP NZ,main_loop_12_4 | |||
BA81 | LD A,E | A = E | ||
BA82 | CP $0C | |||
BA84 | LD A,$01 | |||
BA86 | JR C,main_loop_12_5 | Jump if E < 12 | ||
main_loop_12_4 | BA88 | DEC A | A-- | |
main_loop_12_5 | BA89 | LD ($A249),A | Set fork_taken to A | |
BA8C | INC A | A++ | ||
BA8D | PUSH HL | |||
BA8E | LD HL,$A226 | Address of correct_fork | ||
BA91 | CP (HL) | Match? | ||
BA92 | LD HL,$9941 | -> Tony: "LET'S GO. MR. DRIVER." <STOP> | ||
BA95 | JR Z,ml12_chatter | Jump to ml12_chatter if correct fork was taken | ||
Incorrect fork was taken.
|
||||
BA97 | LD A,$5F | |||
BA99 | LD ($A195),A | A195 is horz position of perp car | ||
Add a bonus of (40,000 + 10,000 * level number) for going the wrong way...?
|
||||
BA9C | LD A,($8007) | A = wanted_stage_number + 4 | ||
BA9F | ADD A,$04 | |||
BAA1 | LD D,A | Set top digits | ||
BAA2 | XOR A | Clear low digit | ||
BAA3 | LD E,A | Clear middle digits | ||
BAA4 | CALL bonus | Call bonus | ||
BAA7 | LD HL,$98D0 | -> Raymond: "WHAT ARE YOU DOING MAN!!" / "THE BAD GUYS ARE GOING THE OTHER WAY." <STOP> | ||
ml12_chatter | BAAA | LD A,$14 | Set priority to 20 | |
BAAC | CALL chatter | Call chatter (priority 20) | ||
BAAF | POP HL | |||
main_loop_12_6 | BAB0 | LD A,($A254) | Load another_spawning_flag | |
BAB3 | AND A | |||
BAB4 | JR Z,main_loop_12_8 | Jump if zero | ||
BAB6 | LD C,A | C = A | ||
BAB7 | LD A,($A16D) | A = var_a16d | ||
BABA | ADD A,C | A += C | ||
BABB | LD C,A | C = A | ||
BABC | SUB $02 | A -= 2 | ||
BABE | JR C,main_loop_12_7 | |||
BAC0 | LD C,A | C = A | ||
BAC1 | LD DE,$0010 | DE = 16 | ||
BAC4 | ADD HL,DE | HL += DE | ||
BAC5 | LD ($A267),HL | var_a267 = HL | ||
main_loop_12_7 | BAC8 | LD A,C | ||
BAC9 | LD ($A16D),A | var_a16d = A | ||
main_loop_12_8 | BACC | LD A,($A16D) | A = var_a16d | |
BACF | RRA | |||
BAD0 | LD A,($A23F) | A = fast_counter | ||
BAD3 | RLA | A ROR 4 | ||
BAD4 | RLA | |||
BAD5 | RLA | |||
BAD6 | RLA | |||
BAD7 | AND $0F | A &= $0F | ||
BAD9 | SUB $10 | A -= 16 | ||
BADB | LD E,A | DE = $FF00 | A | ||
BADC | LD D,$FF | |||
BADE | ADD HL,DE | HL += DE | ||
main_loop_12_9 | BADF | PUSH HL | ||
BAE0 | LD A,($A249) | Jump if fork_taken was 1 (right fork taken) | ||
BAE3 | DEC A | |||
BAE4 | JR Z,main_loop_12_10 | |||
Left fork was taken.
|
||||
BAE6 | CALL $CBD6 | |||
BAE9 | POP DE | |||
BAEA | LD HL,($A26C) | Get road position | ||
BAED | PUSH HL | |||
BAEE | ADD HL,DE | |||
BAEF | LD ($A26C),HL | Set road position | ||
BAF2 | CALL $CBCE | |||
BAF5 | JR main_loop_12_11 | |||
Right fork was taken.
|
||||
main_loop_12_10 | BAF7 | CALL $CBCE | ||
BAFA | POP DE | |||
BAFB | LD HL,($A26C) | Get road position | ||
BAFE | PUSH HL | |||
BAFF | SBC HL,DE | |||
BB01 | LD ($A26C),HL | Set road position | ||
BB04 | CALL $CBD6 | |||
main_loop_12_11 | BB07 | POP HL | ||
BB08 | LD ($A26C),HL | Get road position | ||
BB0B | POP BC | |||
BB0C | LD ($BA4E),SP | |||
BB10 | LD SP,$EC30 | |||
BB13 | LD A,$30 | |||
BB15 | LD HL,$BB38 | |||
BB18 | LD DE,$BB40 | |||
main_loop_12_12 | BB1B | LD (HL),A | ||
BB1C | LD (DE),A | |||
BB1D | LD ($BB2F),A | |||
BB20 | LD ($BB44),A | |||
BB23 | LD ($BB47),A | |||
BB26 | LD ($BB4F),A | |||
BB29 | LD ($BB57),A | |||
BB2C | EXX | |||
BB2D | LD DE,($E800) | |||
BB31 | POP HL | |||
BB32 | ADD HL,DE | |||
BB33 | SRA H | |||
BB35 | RR L | |||
BB37 | LD ($EA00),HL | |||
BB3A | ADD HL,DE | |||
BB3B | SRA H | |||
BB3D | RR L | |||
BB3F | LD ($E900),HL | |||
BB42 | LD DE,($ED00) | |||
BB46 | LD HL,($EB00) | |||
BB49 | ADD HL,DE | |||
BB4A | SRA H | |||
BB4C | RR L | |||
BB4E | LD ($EB00),HL | |||
BB51 | ADD HL,DE | |||
BB52 | SRA H | |||
BB54 | RR L | |||
BB56 | LD ($EC00),HL | |||
BB59 | INC A | |||
BB5A | INC A | |||
BB5B | EXX | |||
BB5C | DJNZ main_loop_12_12 | |||
BB5E | AND A | |||
BB5F | JP Z,ml12_exit | |||
BB62 | LD H,$EC | |||
BB64 | LD L,A | |||
BB65 | LD SP,HL | |||
BB66 | JP main_loop_12_1 |
Prev: B8D2 | Up: Map | Next: BB69 |