Prev: C2E7 Up: Map Next: C57C
C452: Landscape related
Used by the routines at main_loop, cpu_driver and escape_scene.
main_loop_13 C452 LD ($C8A4),SP Self modify SP restore instruction
C456 XOR A
C457 LD ($A248),A var_a248 = 0
C45A LD ($C161),A Self modify 'LD A,x' @ C160 to be zero (tunnel drawing code)
C45D LD ($C890),A Self modify 'LD A,x' @ C88F to be zero
C460 LD A,$03 Self modify 'LD A,x' @ C6D8 to be 3
C462 LD ($C6D9),A
C465 LD IY,$E301 IY = $E301
C469 LD A,$60 C = $60 - IY[0]
C46B SUB (IY+$00)
C46E LD C,A
C46F LD A,($A240) Load road_buffer_offset into A
C472 ADD A,$40 Add 64 so it's the lanes data offset
C474 LD IXl,A IX = $EE00 + A
C476 LD IXh,$EE
C479 LD B,A B = A
C47A AND $01
C47C LD ($C6B3),A $C6B3 = A & 1
C47F RR B RR B twice
C481 RR B
C483 LD HL,$D010 HL = $D010 doubtful that this is a pointer
C486 LD A,H A = $D0
C487 LD B,$55 B = $55 -- Set this to $00 and the landscape goes blank - but only half the time
C489 JR C,j_c48f If B carried out earlier then jump
C48B LD HL,$0030 HL = $0030
C48E LD B,H B = $00
j_c48f C48F LD ($C6D4),A Self modify 'XOR x' @ C6D3 to be zero [OR $D0 -- check other code again]
C492 LD A,H A = $00
C493 LD ($C678),A Self modify 'ADD A,x' @ C677
C496 LD A,L A = $30
C497 LD ($C652),A Self modify 'ADD A,x' @ C651 to be $30
C49A INC A A = $31
C49B LD ($C699),A Self modify 'ADD A,x' @ C698 to be $31
C49E LD HL,$C534 HL = $C534
C4A1 LD ($C4B3),HL Self modify 'JP Z,x' @ C4B2 to be main_loop_13_9
C4A4 LD L,$FF L = $FF
C4A6 LD DE,$0100 DE = $0100
C4A9 LD A,B A = B
C4AA LD ($C6BD),A Self modify 'LD A,x' @ C6BC to be zero?
This entry point is used by the routine at C598.
main_loop_13_0 C4AD LD A,(IX+$00) A = IX[0] & 3
C4B0 AND $03
C4B2 JP Z,main_loop_13_9 Jump to <self modified> if zero
C4B5 EXX Bank
C4B6 LD L,(IX+$00) L = IX[0] -- sampled IX=$EEFD $EEFE $EEFF $EE00 .. etc.
C4B9 ADD A,$E7 A += $E7
C4BB LD ($C643),A Self modify 'LD H,x' @ C642
C4BE LD ($C5B4),A Self modify 'LD H,x' @ C5B3
C4C1 LD H,A H = A
C4C2 SLA L L <<= 1
C4C4 BIT 7,L New bit 7 set?
C4C6 JR NZ,main_loop_13_3 Jump if set -- Split road plotting path
C4C8 JR NC,main_loop_13_1
C4CA ADD A,$03 A &= 3
C4CC LD C,$FD C = $FD
C4CE JP main_loop_13_2 Jump
main_loop_13_1 C4D1 ADD A,$02 A += 2
C4D3 LD C,$FE C = $FE
main_loop_13_2 C4D5 LD ($C5DA),A Self modify 'LD H,x' @ C5D9
C4D8 LD ($C68B),A Self modify 'LD H,x' @ C68A
C4DB LD A,C A = C
C4DC LD ($C5AD),A Self modify 'LD B,x' @ C5AC
C4DF JP $C2E7 Jump
main_loop_13_3 C4E2 JR C,main_loop_13_7 -- Split road plotting path
C4E4 LD C,$FF C = $FF
C4E6 LD H,$01 H = $01
C4E8 BIT 4,L Bit 4 set?
C4EA JR NZ,main_loop_13_4 Jump if set
C4EC BIT 3,L Bit 3 set?
C4EE JR Z,main_loop_13_6 Jump if clear
main_loop_13_4 C4F0 LD A,IYl A = IY.low
C4F2 LD ($C15E),A Self modify 'CP x' @ C15D
C4F5 LD A,$01 A = 1
C4F7 INC C C++
C4F8 BIT 5,L Bit 5 set?
C4FA JR Z,main_loop_13_5 Jump if clear
C4FC DEC C C--
C4FD INC A A++
C4FE DEC H H--
main_loop_13_5 C4FF LD ($C161),A Self modify 'LD A,x' @ C160
main_loop_13_6 C502 LD A,H A = H
C503 LD ($C890),A Self modify 'LD A,x' @ C88F
C506 LD A,$EB A = $EB
C508 LD ($C5DA),A Self modify 'LD H,x' @ C5D9
C50B LD ($C68B),A Self modify 'LD H,x' @ C68A
C50E LD A,$FF A = $FF
C510 LD ($C5AD),A Self modify 'LD B,x' @ C5AC
C513 LD A,C A = C
C514 EXX Bank/unbank
C515 LD B,A B = A
C516 JP main_loop_13_11 Jump
main_loop_13_7 C519 BIT 6,L Bit 6 set?
C51B JP NZ,$C8E3 Jump if set -- Split road plotting path
C51E LD A,L A = L
C51F AND $18 A &= 24
C521 LD A,$00 A = 0
C523 JR NZ,main_loop_13_8 Jump if non-zero
C525 INC A A++
main_loop_13_8 C526 LD ($A248),A var_a248 = A
C529 LD A,$FF A = $FF
C52B LD ($C5AD),A Self modify 'LD B,x' @ C5AC
C52E LD HL,$C534
C531 JP main_loop_13_10 Jump forward
main_loop_13_9 C534 EXX Bank/unbank
C535 LD A,$E8 A = $E8
C537 LD ($C643),A Self modify 'LD H,x' @ C642
C53A LD ($C5B4),A Self modify 'LD H,x' @ C5B3
C53D ADD A,$04 A += 4
C53F LD ($C68B),A Self modify 'LD H,x' @ C68A
C542 LD ($C5DA),A Self modify 'LD H,x' @ C5D9
C545 LD A,$FC A = $FC
C547 LD ($C5AD),A Self modify 'LD B,x' @ C5AC
C54A LD HL,$C551
This entry point is used by the routine at C2E7.
main_loop_13_10 C54D LD ($C4B3),HL Self modify 'JP Z,x' @ C4B2
C550 EXX Bank/unbank
main_loop_13_11 C551 LD A,B A = B
C552 AND A Set flags
C553 JP NZ,$C598 Jump if non-zero
C556 EXX Bank/unbank
C557 LD HL,$C55F Self modify 'JP NZ,x' @ C6AD to be C55F
C55A LD ($C6AE),HL
C55D EXX Bank/unbank
C55E EX AF,AF'
C55F LD A,D A = D
C560 DEC D D--
C561 AND $0F A &= 15
C563 JR Z,$C58A Jump if zero
This entry point is used by the routine at C58A.
main_loop_13_12 C565 LD ($C56D),DE Self modify 'LD DE,x' @ C56C (below)
C569 LD B,$FF B = $FF
C56B EXX Bank/unbank
Calculate address of next bitmap scanline ??
C56C LD DE,$0000 DE = <self modified>
C56F LD A,E L = E + 31
C570 ADD A,$1F
C572 LD L,A
C573 LD H,D H = D
C574 LD SP,HL Put it in SP (so we can use PUSH for speed)
C575 LD HL,$0000 HL = 0 [not self modified apparently]
C578 LD C,L C = L
C579 JP $C62E Jump into a sequence of 15 PUSH HLs
Prev: C2E7 Up: Map Next: C57C