Chase H.Q. | Routines |
Prev: CBC5 | Up: Map | Next: CD3A |
Used by the routine at main_loop_12.
|
||||
CBCE | LD HL,$EEEC | Load two high bytes ($EExx table offset, $ECxx table offset) | ||
CBD1 | LD DE,$44ED | $ED $44 => NEG instr for CC21 & CC22 | ||
CBD4 | JR $CBDC | |||
This entry point is used by the routine at main_loop_12.
|
||||
CBD6 | LD HL,$EDE9 | Load two high bytes ($ED00 table offset, $E900 table offset) | ||
CBD9 | LD DE,$0000 | Pair of NOPs for CC21 & CC22 | ||
This entry point is used by the routine at CBCE.
|
||||
CBDC | LD ($CC21),DE | Write instructions in DE to CC21 & CC22 | ||
CBE0 | LD A,H | Self modify 'LD HL' @ CC70 to load ($ED00 + H) | ||
CBE1 | LD ($CC72),A | |||
CBE4 | LD A,L | Self modify 'LD HL' @ CCA5 to load ($E900 + L) | ||
CBE5 | LD ($CCA7),A | |||
CBE8 | LD HL,($A240) | Load road_buffer_offset into HL | ||
CBEB | LD C,(HL) | Read a curvature data byte | ||
There's similar code at CD47.
|
||||
CBEC | LD A,($A23F) | A = fast_counter & $E0 -- top three bits | ||
CBEF | AND $E0 | |||
CBF1 | LD B,A | |||
Reduces A by 31.25% ... unsure why that figure.
|
||||
CBF2 | RRC B | Divide A by 4 and subtract | ||
CBF4 | RRC B | |||
CBF6 | SUB B | |||
CBF7 | RRC B | Divide A by 16 and subtract | ||
CBF9 | RRC B | |||
CBFB | SUB B | |||
CBFC | ADD A,$B0 | IY = data_e6b0[A] | ||
CBFE | LD IYl,A | |||
CC00 | LD A,$E6 | |||
CC02 | ADC A,$00 | |||
CC04 | LD IYh,A | |||
CC06 | CALL multiply | Call multiply (A = multiplier, C = multiplicand) | ||
CC09 | NEG | A = (128 - A) & $FE | ||
CC0B | ADD A,$80 | |||
CC0D | AND $FE | |||
CC0F | LD IXl,A | IX = $E500 + A -- distance shift table | ||
CC11 | LD IXh,$E5 | |||
CC14 | LD DE,$E320 | not a pointer, separate values | ||
CC17 | LD B,$16 | 20 iterations | ||
CC19 | EXX | Bank | ||
CC1A | LD DE,($A26C) | Get road position | ||
CC1E | PUSH DE | |||
CC1F | EXX | Unbank | ||
CC20 | LD A,(HL) | Read road buffer byte | ||
CC21 | NOP | Self modified above - Set to NOP or NEG | ||
CC22 | NOP | |||
CC23 | INC L | Advance road buffer pointer (wrapping) | ||
CC24 | EXX | Bank | ||
CC25 | ADD A,IXl | |||
CC27 | LD IXl,A | |||
CC29 | LD HL,$0000 | |||
CC2C | LD A,(IX+$00) | Reads from the E540 table (distance shift table) | ||
Subtract DE from table entry, result in BC.
|
||||
CC2F | SUB E | A -= E | ||
CC30 | LD C,A | C = A | ||
CC31 | LD A,(IX+$01) | high byte | ||
CC34 | SBC A,D | A -= D | ||
CC35 | LD B,A | B = A | ||
Sampled IY = E71E E71F E720 ..
|
||||
CC36 | LD A,(IY+$00) | IY seems to point to $E6xx..E7xx | ||
CC39 | INC IY | |||
This is a multiplier of HL (distance shift value computed above) by A (value from $E600+).
|
||||
CC3B | ADD A,A | shift left | ||
CC3C | JR NC,$CC41 | top bit not set | ||
CC3E | LD H,B | HL = BC copy of distance shift value | ||
CC3F | LD L,C | |||
CC40 | ADD HL,HL | shift result left. HL seems to be zeroed above, so this is confusing | ||
CC41 | ADD A,A | shift topmost bit out | ||
CC42 | JR NC,$CC45 | jump if top bit not set | ||
CC44 | ADD HL,BC | otherwise HL += BC | ||
CC45 | ADD HL,HL | repeat | ||
CC46 | ADD A,A | |||
CC47 | JR NC,$CC4A | |||
CC49 | ADD HL,BC | |||
CC4A | ADD HL,HL | repeat | ||
CC4B | ADD A,A | |||
CC4C | JR NC,$CC4F | |||
CC4E | ADD HL,BC | |||
CC4F | ADD HL,HL | repeat | ||
CC50 | ADD A,A | |||
CC51 | JR NC,$CC54 | |||
CC53 | ADD HL,BC | |||
CC54 | ADD HL,HL | repeat | ||
CC55 | ADD A,A | |||
CC56 | JR NC,$CC59 | |||
CC58 | ADD HL,BC | |||
CC59 | LD A,H | A = H | ||
CC5A | RL L | L <<= 1 | ||
CC5C | LD H,$00 | H = 0 | ||
CC5E | ADC A,H | A += H + carry | ||
CC5F | LD L,A | L = A | ||
CC60 | ADD A,A | A <<= 1 | ||
CC61 | JR NC,$CC64 | jump if top bit not set | ||
CC63 | DEC H | H-- | ||
CC64 | RRA | A >>= 1 | ||
CC65 | ADD HL,DE | |||
CC66 | EX DE,HL | |||
CC67 | EXX | Unbank | ||
CC68 | LD (DE),A | *DE++ = A | ||
CC69 | INC E | |||
CC6A | DJNZ $CC20 | Loop back to read buffer byte bit | ||
CC6C | POP DE | |||
CC6D | LD B,$00 | |||
CC6F | EXX | Bank | ||
CC70 | LD HL,$ED00 | |||
CC73 | CALL $CCA8 | subroutine | ||
CC76 | LD A,($A23F) | A = fast_counter | ||
CC79 | AND $E0 | take top three bits | ||
CC7B | LD B,A | same pattern as above | ||
CC7C | RRC B | |||
CC7E | RRC B | |||
CC80 | SUB B | |||
CC81 | RRC B | |||
CC83 | RRC B | |||
CC85 | SUB B | |||
CC86 | ADD A,$60 | |||
CC88 | LD L,A | HL = $E700 | A | ||
CC89 | LD H,$E7 | |||
CC8B | JR NC,$CC8E | Jump if A+$60 had no carry | ||
CC8D | INC H | Add carry otherwise | ||
CC8E | LD DE,$E320 | [points to presumed lanes data in pristine memory map but must be something else] | ||
CC91 | LD B,$16 | B = 20 | ||
CC93 | LD A,(DE) | *DE += *HL | ||
This reads from $E760+ in sequence.
|
||||
CC94 | ADD A,(HL) | |||
CC95 | LD (DE),A | } | ||
CC96 | INC HL | HL++ | ||
CC97 | INC E | E++ | ||
CC98 | DJNZ $CC93 | Loop while B | ||
CC9A | LD HL,($A26C) | HL = road position - 295 | ||
CC9D | LD DE,$FED9 | |||
CCA0 | ADD HL,DE | |||
CCA1 | EX DE,HL | swap | ||
CCA2 | LD B,$00 | B = 0 | ||
CCA4 | EXX | Unbank | ||
CCA5 | LD HL,$E900 | table? | ||
CCA8 | LD IY,$E300 | table? | ||
CCAC | LD B,$15 | B = 21 | ||
CCAE | LD ($CCF5),SP | Save SP to restore later (self modify) | ||
CCB2 | LD SP,HL | Put address in SP (so we can use POP for speed) | ||
CCB3 | EXX | Bank | ||
CCB4 | LD A,B | A = B - 2 | ||
CCB5 | SUB $02 | |||
CCB7 | ADD A,(IY+$00) | A += *IY | ||
CCBA | INC IYl | IY++ | ||
CCBC | SUB (IY+$00) | A -= *IY | ||
CCBF | JP M,$CD0C | |||
CCC2 | ADD A,$02 | A += 2 | ||
CCC4 | LD (IY+$4E),A | IY[$4E] = A | ||
CCC7 | SUB B | A -= B | ||
CCC8 | LD C,A | C = A | ||
CCC9 | LD B,A | B = A | ||
CCCA | LD L,(IY+$1F) | L = IY[$1F] | ||
CCCD | BIT 7,L | test bit 7 of L | ||
CCCF | JR Z,$CCDE | jump if ? | ||
CCD1 | LD A,L | L = -L | ||
CCD2 | NEG | |||
CCD4 | LD L,A | |||
CCD5 | LD A,B | A = B | ||
CCD6 | CP L | A < L ? | ||
CCD7 | LD A,$1B | Opcode for DEC DE | ||
CCD9 | JR C,$CCF8 | jump if A < L | ||
CCDB | JP $CCE3 | |||
CCDE | CP L | A < L ? | ||
CCDF | LD A,$13 | Opcode for INC DE | ||
CCE1 | JR C,$CCF8 | jump if A < L | ||
CCE3 | LD ($CCED),A | Self modify instruction below | ||
CCE6 | LD A,B | A = B | ||
CCE7 | RRA | A >>= 1 | ||
CCE8 | ADD A,L | A += L | ||
CCE9 | CP C | A < C ? | ||
CCEA | JR C,$CCEE | jump if A < C | ||
CCEC | SUB C | A -= C | ||
CCED | INC DE | Self modified: INC DE or DEC DE | ||
CCEE | PUSH DE | |||
CCEF | DJNZ $CCE8 | Loop while B | ||
CCF1 | EXX | Unbank | ||
CCF2 | DJNZ $CCB3 | Outer loop? | ||
CCF4 | LD SP,$0000 | Restore original SP (must be self modified) | ||
CCF7 | RET | Return | ||
CCF8 | LD ($CCFC),A | Self modify instruction below | ||
CCFB | XOR A | A = 0 | ||
CCFC | INC DE | Self modified: INC DE or DEC DE | ||
CCFD | ADD A,C | A += C | ||
CCFE | JR C,$CD03 | jump if overflow | ||
CD00 | CP L | A < L ? | ||
CD01 | JR C,$CCFC | jump if A < L | ||
CD03 | SUB L | A -= L | ||
CD04 | PUSH DE | |||
CD05 | DJNZ $CCFC | Loop while B | ||
CD07 | EXX | Bank | ||
CD08 | DJNZ $CCB3 | Outer loop? | ||
CD0A | JR $CCF4 | Exit | ||
CD0C | LD (IY+$4E),$01 | IY[$4E] = 1 | ||
CD10 | INC A | A++ | ||
CD11 | JR Z,$CD27 | |||
CD13 | INC A | A++ | ||
CD14 | LD B,A | B = A | ||
CD15 | LD A,(IY+$1F) | A = IY[$1F] | ||
CD18 | LD L,A | L = A | ||
CD19 | ADD A,A | A <<= 1 | ||
CD1A | SBC A,A | A = A - A - carry | ||
CD1B | LD H,A | H = A | ||
CD1C | ADD HL,DE | HL += DE | ||
CD1D | EX DE,HL | swap | ||
CD1E | PUSH DE | push | ||
CD1F | EXX | Unbank | ||
CD20 | DEC B | B-- | ||
CD21 | JP NZ,$CCB3 | Outer loop? | ||
CD24 | JP $CCF4 | Exit | ||
CD27 | LD B,A | B = A | ||
CD28 | LD A,(IY+$1F) | A = IY[$1F] | ||
CD2B | LD L,A | L = A | ||
CD2C | ADD A,A | A <<= 1 | ||
CD2D | SBC A,A | A = A - A - carry | ||
CD2E | LD H,A | H = A | ||
CD2F | ADD HL,DE | HL += DE | ||
CD30 | EX DE,HL | swap | ||
CD31 | PUSH DE | push | ||
CD32 | EXX | Bank | ||
CD33 | DEC B | B-- | ||
CD34 | JP NZ,$CCB3 | Outer loop? | ||
CD37 | JP $CCF4 | Exit |
Prev: CBC5 | Up: Map | Next: CD3A |