Prev: C8BE Up: Map Next: CBA4
C8E3: Split road plotting
Used by the routine at main_loop_13.
C8E3 EXX Bank
Reset/Update a load of self modified locations.
C8E4 LD A,($C6D9) Read 'LD A,x' @ C6D8
C8E7 LD ($CB66),A Self modify 'LD A,x' @ CB65
C8EA LD A,($C6B3) Read 'LD A,x' @ C6B2
C8ED LD ($CB37),A Self modify 'LD A,x' @ CB36
C8F0 LD A,($C6D4) Read 'XOR x' @ C6D3
C8F3 LD ($CB5E),A Self modify 'XOR x' @ CB5D
C8F6 LD A,($C678) Read 'ADD A,x' @ C677
C8F9 LD ($CA9E),A Self modify 'ADD A,x' @ CA9D
C8FC LD ($CB00),A Self modify 'ADD A,x' @ CAFF
C8FF LD A,($C652) Read 'ADD A,x' @ C651
C902 LD ($CA7B),A Self modify 'ADD A,x' @ CA7A
C905 LD ($CADD),A Self modify 'ADD A,x' @ CADC
C908 INC A A++
C909 LD ($CB1D),A Self modify 'ADD A,x' @ CB1C
C90C LD ($CABC),A Self modify 'ADD A,x' @ CABB
C90F LD A,($C6BD) Read 'LD A,x' @ C6BC
C912 LD ($CB41),A Self modify 'LD A,x' @ CB40
This entry point is used by the routines at CBA4 and CBC5.
C915 LD A,B A = B
C916 AND A Set flags
C917 JP NZ,$C95A Jump if non-zero
C91A EXX Unbank
C91B LD HL,$C923 Self modify 'JP NZ' @ CB31 to be C923
C91E LD ($CB32),HL
C921 EXX Bank
C922 EX AF,AF'
C923 LD A,D A = (D - 1) & 15
C924 DEC D
C925 AND $0F
C927 JR Z,$C94C Jump if zero
This entry point is used by the routine at C94C.
C929 LD ($C92F),DE Self modify 'LD DE,x' @ C92E (just below)
C92D EXX Unbank
Calculate address of next bitmap scanline ??
C92E LD DE,$0000 DE = <self modified>
C931 LD A,E L = E + 31
C932 ADD A,$1F
C934 LD L,A
C935 LD H,D H = D
C936 LD SP,HL Put it in SP (so we can use POP for speed)
C937 LD HL,$0000 HL = 0 [not self modified apparently]
C93A LD C,L C = L
C93B JP $CA57 Jump into a sequence of 15 PUSH HLs
Smells line scanline counting foo.
C93E LD A,E E -= 32
C93F SUB $20
C941 LD E,A
C942 JP C,$C969 Jump if E < 32
C945 LD A,D D -= 16
C946 ADD A,$10
C948 LD D,A
C949 JP $C969
Smells line scanline counting foo.
C94C LD A,E E -= 32
C94D SUB $20
C94F LD E,A
C950 JP C,$C929 Jump if E < 32
C953 LD A,D D -= 16
C954 ADD A,$10
C956 LD D,A
C957 JP $C929
C95A EXX Unbank
C95B LD HL,$C963 Self modify 'JP NZ,x' @ CB31 to be C963
C95E LD ($CB32),HL
C961 EXX
C962 EX AF,AF'
C963 LD A,D A = D
C964 DEC D D--
C965 AND $0F A &= $0F
C967 JR Z,$C93E Jump if zero
C969 LD ($CA01),DE Self modify 'LD DE,x' @ CA00 to load current DE
C96D LD A,L A = L
C96E EXX Bank/unbank
C96F LD L,A L = A
C970 LD BC,$10F8 B = 16, C = $F8 (mask)
C973 LD H,$E8 HL = $E8xx
C975 LD A,(HL) A = *HL
C976 AND A Set flags
C977 JP Z,$C984 Jump if zero
C97A LD A,$00 A = 0 (not self modified)
C97C JP M,$C993 Jump if negative
C97F LD A,$0F A = 15
C981 JP $C993 Jump
Variation 1?
C984 DEC L A = HL[-1]
C985 LD A,(HL)
C986 INC L
C987 AND C A &= C -- C is the mask $F8 here
C988 RRCA A >>= 3
C989 RRCA
C98A RRCA
C98B RRA A >>= 1
C98C ADC A,$00 Add carry
C98E CP B Jump if A < B
C98F JP C,$C993
C992 DEC A A--
C993 LD E,A E = A
C994 CPL A = ~A
C995 ADD A,B A += B
C996 LD ($CA56),A Self modify 'JR x' @ CA55 -- jump table target
C999 INC H H++
C99A INC H
C99B LD A,(HL) A = *HL
C99C AND A Set flags
C99D JP Z,$C9AA Jump if zero
C9A0 LD A,$00 A = 0 (not self modified)
C9A2 JP M,$C9B2 Jump if negative
C9A5 LD A,$0F A = 15
C9A7 JP $C9B2 Jump
Variation 2?
C9AA DEC L A = HL[-1]
C9AB LD A,(HL)
C9AC INC L
C9AD AND C A &= C -- C is the mask $F8 here
C9AE RRCA A >>= 3
C9AF RRCA
C9B0 RRCA
C9B1 RRA A >>= 1
C9B2 LD D,A D = A
C9B3 SUB E A = ~(A - E) + B
C9B4 CPL
C9B5 ADD A,B
C9B6 LD ($CA45),A Self modify jump table target
C9B9 INC H H++
C9BA LD A,(HL) A = *HL
C9BB AND A Set flags
C9BC JP Z,$C9C9 Jump if zero
C9BF LD A,$00 A = 0 (not self modified)
C9C1 JP M,$C9D8 Jump if negative
C9C4 LD A,$0F A = 15
C9C6 JP $C9D8 Jump
Variation 3?
C9C9 DEC L A = HL[-1]
C9CA LD A,(HL)
C9CB INC L
C9CC AND C A &= C -- C is the mask $F8 here
C9CD RRCA A >>= 3
C9CE RRCA
C9CF RRCA
C9D0 RRA A >>= 1
C9D1 ADC A,$00 Add carry
C9D3 CP B Jump if A < B
C9D4 JP C,$C9D8
C9D7 DEC A A--
C9D8 LD E,A E = A
C9D9 SUB D A -= D
C9DA CPL A = ~A
C9DB ADD A,B A += B
C9DC LD ($CA34),A Self modify 'JR x' @ CA33 -- jump table target
C9DF INC H H += 2
C9E0 INC H
C9E1 LD A,(HL) A = *HL
C9E2 AND A Set flags
C9E3 JP Z,$C9F0 Jump if zero
C9E6 LD A,$00 A = 0 (not self modified)
C9E8 JP M,$C9F7 Jump if negative
C9EB LD A,$0F A = 15
C9ED JP $C9F7 Jump
Different chunk
C9F0 DEC L A = HL[-1]
C9F1 LD A,(HL)
C9F2 AND C A &= C -- C is the mask $F8 here
C9F3 RRCA A >>= 3
C9F4 RRCA
C9F5 RRCA
C9F6 RRA A >>= 1
C9F7 LD ($CA12),A Self modify 'JR x' @ CA11 -- jump table target
C9FA SUB E A -= E
C9FB CPL A = ~A + B
C9FC ADD A,B
C9FD LD ($CA23),A Self modify 'JR x' @ CA22 -- jump table target
CA00 LD DE,$0000 Self modified
CA03 LD A,E A = E + 31
CA04 ADD A,$1F
CA06 LD L,A L = A
CA07 LD H,D H = D
CA08 LD SP,HL Put it in SP (so we can use POP for speed)
CA09 EX AF,AF' Bank A
CA0A RLCA A <<= 1 -- Rotate the road shading pattern (0x55 <-> 0xAA)
CA0B LD H,A H = A -- Prepare pattern for storing
CA0C LD L,A L = A
CA0D EX AF,AF' Unbank A
This BC filling the blank parts of the road when drawing the split road.
CA0E LD BC,$0000 BC = 0 [doesn't seem self modified]
CA11 JR $CA11 Jump table (self modified) Write 16 pixels
CA13 PUSH HL
CA14 PUSH HL
CA15 PUSH HL
CA16 PUSH HL
CA17 PUSH HL
CA18 PUSH HL
CA19 PUSH HL
CA1A PUSH HL
CA1B PUSH HL
CA1C PUSH HL
CA1D PUSH HL
CA1E PUSH HL
CA1F PUSH HL
CA20 PUSH HL
CA21 PUSH HL
CA22 JR $CA22 Jump table (self modified)
CA24 PUSH BC
CA25 PUSH BC
CA26 PUSH BC
CA27 PUSH BC
CA28 PUSH BC
CA29 PUSH BC
CA2A PUSH BC
CA2B PUSH BC
CA2C PUSH BC
CA2D PUSH BC
CA2E PUSH BC
CA2F PUSH BC
CA30 PUSH BC
CA31 PUSH BC
CA32 PUSH BC
CA33 JR $CA33 Jump table (self modified)
CA35 PUSH HL
CA36 PUSH HL
CA37 PUSH HL
CA38 PUSH HL
CA39 PUSH HL
CA3A PUSH HL
CA3B PUSH HL
CA3C PUSH HL
CA3D PUSH HL
CA3E PUSH HL
CA3F PUSH HL
CA40 PUSH HL
CA41 PUSH HL
CA42 PUSH HL
CA43 PUSH HL
CA44 JR $CA44 Jump table (self modified)
CA46 PUSH BC
CA47 PUSH BC
CA48 PUSH BC
CA49 PUSH BC
CA4A PUSH BC
CA4B PUSH BC
CA4C PUSH BC
CA4D PUSH BC
CA4E PUSH BC
CA4F PUSH BC
CA50 PUSH BC
CA51 PUSH BC
CA52 PUSH BC
CA53 PUSH BC
CA54 PUSH BC
CA55 JR $CA55 Jump table (self modified)
CA57 PUSH HL
CA58 PUSH HL
CA59 PUSH HL
CA5A PUSH HL
CA5B PUSH HL
CA5C PUSH HL
CA5D PUSH HL
CA5E PUSH HL
CA5F PUSH HL
CA60 PUSH HL
CA61 PUSH HL
CA62 PUSH HL
CA63 PUSH HL
CA64 PUSH HL
CA65 PUSH HL
CA66 LD B,E B = E
CA67 DEC C C--
CA68 LD H,$E4 H = $E4
CA6A EXX Bank/unbank
CA6B LD H,$E8 H = $E8
CA6D LD A,(HL) A = *HL
CA6E AND A Set flags
CA6F JR NZ,$CA90 Jump if non-zero
CA71 DEC L A = HL[-1]
CA72 LD A,(HL)
CA73 INC L
CA74 EXX Bank/unbank
CA75 LD E,A E = A
CA76 AND $07 A &= 7
CA78 RLCA A = A ROL 2
CA79 RLCA
CA7A ADD A,$00 A += <self modified>
CA7C LD L,A L = A
CA7D LD A,E A = E
CA7E RRA A = A (rotate right through carry) 3
CA7F RRA
CA80 RRA
CA81 AND $1F A = (A & 31) + B
CA83 ADD A,B
CA84 LD E,A E = A
CA85 LD A,(DE) A = *DE
CA86 AND (HL) A = A & *HL
CA87 INC L L++
CA88 OR (HL) A |= *HL
CA89 LD (DE),A *DE = A
CA8A INC L L += 2
CA8B INC L
CA8C INC E E++
CA8D LDI *DE++ = *HL++, BC--
CA8F EXX Bank/unbank
Similar chunk to above
CA90 INC H H++
CA91 LD A,(HL) A = *HL
CA92 AND A Set flags
CA93 JR NZ,$CAAD Jump if non-zero
CA95 DEC L A = HL[-1]
CA96 LD A,(HL)
CA97 INC L
CA98 EXX Bank/unbank
CA99 LD E,A E = A
CA9A AND $07 A &= 7
CA9C RLCA A = A ROL 1
CA9D ADD A,$00 A += <self modified>
CA9F LD L,A L = A
CAA0 LD A,E A = E
CAA1 RRA A = A (rotate right through carry) 3
CAA2 RRA
CAA3 RRA
CAA4 AND $1F A = (A & 31) + B
CAA6 ADD A,B
CAA7 LD E,A E = A
CAA8 LDI *DE++ = *HL++, BC--
CAAA LD A,(HL) A = *HL
CAAB LD (DE),A *DE = A
CAAC EXX Bank/unbank
Similar chunk again to above... different rotates
CAAD INC H H++
CAAE LD A,(HL) A = *HL
CAAF AND A Set flags
CAB0 JR NZ,$CACE Jump if non-zero
CAB2 DEC L A = HL[-1]
CAB3 LD A,(HL)
CAB4 INC L
CAB5 EXX Bank/unbank
CAB6 LD E,A E = A
CAB7 AND $07 A &= 7
CAB9 RLCA A = A ROL 2
CABA RLCA
CABB ADD A,$11 A += <self modified>
CABD LD L,A L = A
CABE LD A,E A = E
CABF RRA A = A (rotate right through carry) 3
CAC0 RRA
CAC1 RRA
CAC2 AND $1F A = (A & 31) + B
CAC4 ADD A,B
CAC5 LD E,A E = A
CAC6 LDI *DE++ = *HL++, BC--
CAC8 LD A,(DE) A = *DE & *HL
CAC9 AND (HL)
CACA INC L L++
CACB OR (HL) A |= *HL
CACC LD (DE),A *DE = A
CACD EXX Bank/unbank
Similar chunk again
CACE INC H H++
CACF LD A,(HL) A = *HL
CAD0 AND A Set flags
CAD1 JR NZ,$CAF2 Jump if non-zero
CAD3 DEC L A = HL[-1]
CAD4 LD A,(HL)
CAD5 INC L
CAD6 EXX Bank/unbank
CAD7 LD E,A E = A
CAD8 AND $07 A &= 7
CADA RLCA A = A ROL 2
CADB RLCA
CADC ADD A,$00 A += <self modified>
CADE LD L,A L = A
CADF LD A,E A = E
CAE0 RRA A = A (rotate right through carry) 3
CAE1 RRA
CAE2 RRA
CAE3 AND $1F A = (A & 31) + B
CAE5 ADD A,B
CAE6 LD E,A E = A
CAE7 LD A,(DE) A = *DE & *HL
CAE8 AND (HL)
CAE9 INC L L++
CAEA OR (HL) A |= *HL
CAEB LD (DE),A *DE = A
CAEC INC L L += 2
CAED INC L
CAEE INC E E++
CAEF LDI *DE++ = *HL++, BC--
CAF1 EXX Bank/unbank
Similar chunk again
CAF2 INC H H++
CAF3 LD A,(HL) A = *HL
CAF4 AND A Set flags
CAF5 JR NZ,$CB0F Jump if non-zero
CAF7 DEC L A = HL[-1]
CAF8 LD A,(HL)
CAF9 INC L
CAFA EXX Bank/unbank
CAFB LD E,A E = A
CAFC AND $07 A &= 7
CAFE RLCA A = A ROL 1
CAFF ADD A,$00 A += <self modified>
CB01 LD L,A L = A
CB02 LD A,E A = E
CB03 RRA A >>= 3
CB04 RRA
CB05 RRA
CB06 AND $1F A &= $1F
CB08 ADD A,B A += B
CB09 LD E,A E = A
CB0A LDI
CB0C LD A,(HL) A = *HL
CB0D LD (DE),A *DE = A
CB0E EXX Bank/unbank
CB0F INC H A = HL[-1]
CB10 LD A,(HL)
CB11 DEC L
CB12 AND A Set flags
CB13 JR NZ,$CB2F Jump if non-zero
CB15 LD A,(HL) A = *HL
CB16 EXX Bank/unbank
CB17 LD E,A E = A
CB18 AND $07 A &= 7
CB1A RLCA A <<= 2
CB1B RLCA
CB1C ADD A,$11 A += 17
CB1E LD L,A L = A
CB1F LD A,E A = E
CB20 RRA A = A (rotate right through carry) 3
CB21 RRA
CB22 RRA
CB23 AND $1F A = (A & 31) + B
CB25 ADD A,B
CB26 LD E,A E = A
CB27 LDI *DE++ = *HL++, BC--
CB29 LD A,(DE) A = *DE
CB2A AND (HL) A &= *HL [AND-OR masking?]
CB2B INC L L++
CB2C OR (HL) A |= *HL
CB2D LD (DE),A *DE = A
CB2E EXX Bank/unbank
CB2F DEC L L--
CB30 DEC C C--
CB31 JP NZ,$0000 Jump if non-zero to <self modified>
CB34 EX AF,AF'
CB35 LD B,A B = A
CB36 LD A,$00 A = <self modified>
CB38 XOR $01 Toggle bit 0
CB3A LD ($CB37),A Self modify 'LD A,x' @ CB36 (just above)
CB3D JP NZ,$CB65 Jump if non-zero
CB40 LD A,$00 A = <self modified>
CB42 XOR $55 Toggle every other bit
CB44 LD ($CB41),A Self modify 'LD A,x' @ CB40 (just above)
CB47 LD B,A B = A
CB48 LD A,($CA7B) Self modify 'LD A,x' @ CA7A
CB4B XOR $20
CB4D LD ($CA7B),A
CB50 LD ($CADD),A Self modify 'ADD A,x' @ CADC
CB53 INC A A++
CB54 LD ($CB1D),A Self modify 'ADD A,x' @ CB1C
CB57 LD ($CABC),A Self modify 'ADD A,x' @ CABB
CB5A LD A,($CA9E) Read 'LD A,x' @ CA9D
CB5D XOR $00 [nested self modification - INCEPTION ACHIEVED]
CB5F LD ($CA9E),A Self modify 'LD A,x' @ CA9D
CB62 LD ($CB00),A Self modify 'ADD A,x' @ CAFF
CB65 LD A,$00 A = <self modified> - 1
CB67 DEC A
CB68 LD ($CB66),A Self modify 'LD A,x' @ CB65
CB6B JP NZ,$CB90
CB6E LD A,($CB5E) Self modify 'XOR x' @ CB5D
CB71 ADD A,$10
CB73 JR C,$CB90
CB75 LD ($CB5E),A
CB78 LD C,A C = A
CB79 LD A,($CA9E) self modified chunk Set flags Jump if zero A = C
CB7C AND A
CB7D JR Z,$CB83
CB7F LD A,C
CB80 LD ($CA9E),A
CB83 LD A,($CA7B) Self modify 'LD A,x' @ CA7A
CB86 ADD A,$40
CB88 LD ($CA7B),A
CB8B LD A,$05 Self modify 'LD A,x' @ CB65 to load 5
CB8D LD ($CB66),A
CB90 LD A,(IY+$00) A = IY[0]
CB93 INC IY IY++
CB95 INC IXl IX.low++
CB97 SUB (IY+$00) A -= IY[0]
CB9A JR Z,$CB9F Jump if zero
CB9C JP P,$CBC5 Jump if positive
CB9F DEC L L -= 2
CBA0 DEC L
CBA1 JP $CB36 Loop
Prev: C8BE Up: Map Next: CBA4