The current URL is datacrystal.tcrf.net.
Final Fantasy VI/ROM map/Assembly C11: Difference between revisions
m (Xkeeper moved page Final Fantasy VI:ROM map/Assembly C11 to Final Fantasy VI/ROM map/Assembly C11: normalize subpages and titles) |
|||
(16 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{subpage|game=Final Fantasy VI:ROM map}} | |||
==C1/102A unknow== | ==C1/102A unknow== | ||
C1/102A: 221500C0 JSL $C00015 (from only C1/01F0) | C1/102A: 221500C0 JSL $C00015 (from only C1/01F0) | ||
Line 21: | Line 22: | ||
C1/1055: 204619 JSR $1946 | C1/1055: 204619 JSR $1946 | ||
C1/1058: C220 REP #$20 | C1/1058: C220 REP #$20 | ||
C1/105A: 7B TDC | C1/105A: 7B TDC (Clear $7FA000 to $7FA3FF (RAM)) | ||
C1/105B: AA TAX | C1/105B: AA TAX | ||
C1/105C: 9F00A07F STA $7FA000,X | C1/105C: 9F00A07F STA $7FA000,X | ||
Line 32: | Line 33: | ||
C1/1071: D0E9 BNE $105C | C1/1071: D0E9 BNE $105C | ||
C1/1073: E220 SEP #$20 | C1/1073: E220 SEP #$20 | ||
C1/1075: AEE211 LDX $11E2 | C1/1075: AEE211 LDX $11E2 (load background saved in the formation loading) | ||
C1/1078: 8EB8EC STX $ECB8 | C1/1078: 8EB8EC STX $ECB8 (save as battle background ID) | ||
C1/107B: A9FF LDA #$FF | C1/107B: A9FF LDA #$FF | ||
C1/107D: 8546 STA $46 | C1/107D: 8546 STA $46 | ||
Line 84: | Line 85: | ||
C1/10EE: A20054 LDX #$5400 | C1/10EE: A20054 LDX #$5400 | ||
C1/10F1: A00004 LDY #$0400 | C1/10F1: A00004 LDY #$0400 | ||
C1/10F4: 20A517 JSR $17A5 | C1/10F4: 20A517 JSR $17A5 (Writes "$01EE" in VRAM from $5400 to $55FF) | ||
C1/10F7: A20078 LDX #$7800 | C1/10F7: A20078 LDX #$7800 | ||
C1/10FA: A00008 LDY #$0800 | C1/10FA: A00008 LDY #$0800 | ||
C1/10FD: 20A517 JSR $17A5 | C1/10FD: 20A517 JSR $17A5 (Writes "$01EE" in VRAM from $7800 to $7BFF) | ||
C1/1100: 200C6D JSR $6D0C | C1/1100: 200C6D JSR $6D0C | ||
C1/1103: 7B TDC | C1/1103: 7B TDC | ||
Line 429: | Line 430: | ||
C1/141C: 9C0FEC STZ $EC0F | C1/141C: 9C0FEC STZ $EC0F | ||
C1/141F: 60 RTS | C1/141F: 60 RTS | ||
==C1/1420 unknow== | ==C1/1420 unknow== | ||
C1/1420: 00 | C1/1420: 00 | ||
Line 899: | Line 901: | ||
7AD2 = 0 thru 5 formation index? (16 bits) | 7AD2 = 0 thru 5 formation index? (16 bits) | ||
afterwards: $7AD0,X <= $7AD4,X <= $7AD8,X <= etc ) | afterwards: $7AD0,X <= $7AD4,X <= $7AD8,X <= etc ) | ||
C1/1752: C2 20 REP #$20 | |||
C1/1752: C2 20 REP #$20 (set 16-bit Accumulator) | |||
C1/1754: 7B TDC | C1/1754: 7B TDC | ||
C1/1755: AA TAX | C1/1755: AA TAX (clear A and X) | ||
C1/1756: 64 10 STZ $10 | C1/1756: 64 10 STZ $10 | ||
C1/1758: A5 10 LDA $10 | C1/1758: A5 10 LDA $10 | ||
C1/175A: 9D D2 7A STA $7AD2,X | C1/175A: 9D D2 7A STA $7AD2,X (so 7AD0 = coordinate, 7AD2 = 0 thru 5 formation index?) | ||
C1/175D: E6 10 INC $10 | C1/175D: E6 10 INC $10 | ||
C1/175F: E8 INX | C1/175F: E8 INX | ||
Line 911: | Line 914: | ||
C1/1762: E8 INX | C1/1762: E8 INX | ||
C1/1763: E0 18 00 CPX #$0018 | C1/1763: E0 18 00 CPX #$0018 | ||
C1/1766: D0 F0 BNE $1758 | C1/1766: D0 F0 BNE $1758 (loop for all 6 monsters) | ||
C1/1768: 7B TDC | C1/1768: 7B TDC | ||
C1/1769: AA TAX | C1/1769: AA TAX (Clear A and X) | ||
C1/176A: 64 14 STZ $14 | C1/176A: 64 14 STZ $14 (counter of how many enemy swaps we made?) | ||
C1/176C: BD D0 7A LDA $7AD0,X | C1/176C: BD D0 7A LDA $7AD0,X (get coordinate of enemy) | ||
C1/176F: DD D4 7A CMP $7AD4,X | C1/176F: DD D4 7A CMP $7AD4,X (does it match coordinate of next one?) | ||
C1/1772: F0 20 BEQ $1794 | C1/1772: F0 20 BEQ $1794 (if so, branch) | ||
C1/1774: 90 1E BCC $1794 | C1/1774: 90 1E BCC $1794 (if it's less than coordinate of next enemy, also branch) | ||
C1/1776: E6 14 INC $14 | C1/1776: E6 14 INC $14 (if the enemies compared weren't ordered by coordinate, | ||
increment counter) | |||
C1/1778: BD D4 7A LDA $7AD4,X | C1/1778: BD D4 7A LDA $7AD4,X | ||
C1/177B: 48 PHA | C1/177B: 48 PHA (save coord of next enemy) | ||
C1/177C: BD D0 7A LDA $7AD0,X | C1/177C: BD D0 7A LDA $7AD0,X | ||
C1/177F: 9D D4 7A STA $7AD4,X | C1/177F: 9D D4 7A STA $7AD4,X (put current coord in coord for next enemy) | ||
C1/1782: 68 PLA | C1/1782: 68 PLA | ||
C1/1783: 9D D0 7A STA $7AD0,X | C1/1783: 9D D0 7A STA $7AD0,X (put coord of next enemy in current one) | ||
C1/1786: BD D6 7A LDA $7AD6,X | C1/1786: BD D6 7A LDA $7AD6,X | ||
C1/1789: 48 PHA | C1/1789: 48 PHA (save index of next enemy) | ||
C1/178A: BD D2 7A LDA $7AD2,X | C1/178A: BD D2 7A LDA $7AD2,X (now swap the 0 thru 5 index of current enemy with that of next one) | ||
C1/178D: 9D D6 7A STA $7AD6,X | C1/178D: 9D D6 7A STA $7AD6,X | ||
C1/1790: 68 PLA | C1/1790: 68 PLA | ||
Line 938: | Line 941: | ||
C1/1797: E8 INX | C1/1797: E8 INX | ||
C1/1798: E0 14 00 CPX #$0014 | C1/1798: E0 14 00 CPX #$0014 | ||
C1/179B: D0 CF BNE $176C | C1/179B: D0 CF BNE $176C (loop for first 5 enemies) | ||
C1/179D: A5 14 LDA $14 | C1/179D: A5 14 LDA $14 ($14 is greater than #$00 if the enemies are not in the correct order) | ||
C1/179F: D0 C7 BNE $1768 | C1/179F: D0 C7 BNE $1768 (if $14 is not #$00, repeat the whole sorting procedure) | ||
C1/17A1: 7B TDC | C1/17A1: 7B TDC (clear Accumulator) | ||
C1/17A2: E2 20 SEP #$20 | C1/17A2: E2 20 SEP #$20 (set 8-bit Accumulator) | ||
C1/17A4: 60 RTS | C1/17A4: 60 RTS | ||
==C1/17A5 | |||
==C1/17A5 unknown (graphics related)== | |||
C1/17A5: 8B PHB (from C1/10F4, C1/10FD) | C1/17A5: 8B PHB (from C1/10F4, C1/10FD) | ||
C1/17A6: A900 LDA #$00 | C1/17A6: A900 LDA #$00 (Set programm bank to #$00) | ||
C1/17A8: 48 PHA | C1/17A8: 48 PHA | ||
C1/17A9: AB PLB | C1/17A9: AB PLB | ||
C1/17AA: 8E1621 STX $2116 | C1/17AA: 8E1621 STX $2116 (X: Destination in VRAM) | ||
C1/17AD: C220 REP #$20 | C1/17AD: C220 REP #$20 | ||
C1/17AF: A9EE01 LDA #$01EE | C1/17AF: A9EE01 LDA #$01EE (Store #$01EE in VRAM) | ||
C1/17B2: 8D1821 STA $2118 | C1/17B2: 8D1821 STA $2118 | ||
C1/17B5: 88 DEY | C1/17B5: 88 DEY (Decrement Y) | ||
C1/17B6: D0FA BNE $17B2 | C1/17B6: D0FA BNE $17B2 (Repeat until Y = 0) | ||
C1/17B8: 7B TDC | C1/17B8: 7B TDC (Clear accumulator) | ||
C1/17B9: E220 SEP #$20 | C1/17B9: E220 SEP #$20 (A = 8 bit) | ||
C1/17BB: AB PLB | C1/17BB: AB PLB (Restore program bank) | ||
C1/17BC: 60 RTS | C1/17BC: 60 RTS | ||
==C1/17BD | |||
C1/17BD: A922 LDA #$22 | ==C1/17BD unknown (sound related)== | ||
C1/17BF: 8F402100 STA $002140 | C1/17BD: A922 LDA #$22 | ||
C1/17BF: 8F402100 STA $002140 (APU I/O Register 1) | |||
C1/17C3: 6495 STZ $95 | C1/17C3: 6495 STZ $95 | ||
C1/17C5: 60 RTS | C1/17C5: 60 RTS | ||
==C1/17C6 | |||
==C1/17C6 unknown (sound related)== | |||
C1/17C6: A921 LDA #$21 (from only C1/183D) | C1/17C6: A921 LDA #$21 (from only C1/183D) | ||
C1/17C8: 8F402100 STA $002140 | C1/17C8: 8F402100 STA $002140 (APU I/O Register 1) | ||
C1/17CC: 6494 STZ $94 | C1/17CC: 6494 STZ $94 | ||
C1/17CE: 60 RTS | C1/17CE: 60 RTS | ||
==C1/17CF | |||
==C1/17CF unknown (sound related)== | |||
C1/17CF: A920 LDA #$20 (from only C1/184B) | C1/17CF: A920 LDA #$20 (from only C1/184B) | ||
C1/17D1: 8F402100 STA $002140 | C1/17D1: 8F402100 STA $002140 (APU I/O Register 1) | ||
C1/17D5: 6496 STZ $96 | C1/17D5: 6496 STZ $96 | ||
C1/17D7: 60 RTS | C1/17D7: 60 RTS | ||
==C1/17D8 unknow== | ==C1/17D8 unknow== | ||
C1/17D8: ADCA62 LDA $62CA (from only C1/1836) | C1/17D8: ADCA62 LDA $62CA (from only C1/1836) | ||
Line 995: | Line 1,003: | ||
C1/17FC: EEECE9 INC $E9EC (Increment $E9EC) | C1/17FC: EEECE9 INC $E9EC (Increment $E9EC) | ||
C1/17FF: 60 RTS | C1/17FF: 60 RTS | ||
==C1/1800 | ==C1/1800 unknown (sound related)== | ||
C1/1800: ADEDE9 LDA $E9ED (from only C1/0CF7) | C1/1800: ADEDE9 LDA $E9ED (from only C1/0CF7) | ||
C1/1803: D055 BNE $185A | C1/1803: D055 BNE $185A | ||
Line 1,001: | Line 1,009: | ||
C1/1808: F019 BEQ $1823 | C1/1808: F019 BEQ $1823 | ||
C1/180A: ADEAE9 LDA $E9EA | C1/180A: ADEAE9 LDA $E9EA | ||
C1/180D: 8F422100 STA $002142 | C1/180D: 8F422100 STA $002142 (APU I/O Register 3) | ||
C1/1811: ADE9E9 LDA $E9E9 | C1/1811: ADE9E9 LDA $E9E9 | ||
C1/1814: 8F412100 STA $002141 | C1/1814: 8F412100 STA $002141 (APU I/O Register 2) | ||
C1/1818: ADE8E9 LDA $E9E8 | C1/1818: ADE8E9 LDA $E9E8 | ||
C1/181B: 8F402100 STA $002140 | C1/181B: 8F402100 STA $002140 (APU I/O Register 1) | ||
C1/181F: 9CECE9 STZ $E9EC | C1/181F: 9CECE9 STZ $E9EC | ||
C1/1822: 60 RTS | C1/1822: 60 RTS | ||
==C1/1823 | |||
==C1/1823 unknown (sound related)== | |||
C1/1823: AD8162 LDA $6281 (from only C1/1808) | C1/1823: AD8162 LDA $6281 (from only C1/1808) | ||
C1/1826: F00A BEQ $1832 | C1/1826: F00A BEQ $1832 | ||
C1/1828: A92C LDA #$2C | C1/1828: A92C LDA #$2C | ||
C1/182A: 8F402100 STA $002140 | C1/182A: 8F402100 STA $002140 (APU I/O Register 1) | ||
C1/182E: 9C8162 STZ $6281 | C1/182E: 9C8162 STZ $6281 | ||
C1/1831: 60 RTS | C1/1831: 60 RTS | ||
Line 1,035: | Line 1,044: | ||
C1/1850: F008 BEQ $185A | C1/1850: F008 BEQ $185A | ||
C1/1852: A989 LDA #$89 | C1/1852: A989 LDA #$89 | ||
C1/1854: 8F402100 STA $002140 | C1/1854: 8F402100 STA $002140 (APU I/O Register 1) | ||
C1/1858: 6497 STZ $97 | C1/1858: 6497 STZ $97 | ||
C1/185A: 60 RTS | C1/185A: 60 RTS | ||
==C1/185B unknow== | ==C1/185B unknow== | ||
C1/185B: DA PHX | C1/185B: DA PHX | ||
Line 1,338: | Line 1,348: | ||
==C1/1A51 unknow== | ==C1/1A51 unknow== | ||
C1/1A51: 8B PHB | ''Does sixteen $20 byte sized DMAs. I'm not sure if it transfers always the same $20 bytes (as I guess), or if it transfers the subsequent $200 bytes. It depends if the value in $43x2 gets incremented by DMA or not.'' | ||
C1/1A52: 48 PHA | |||
C1/1A53: A900 LDA #$00 | C1/1A51: 8B PHB (conserve program bank) | ||
C1/1A55: 48 PHA | C1/1A52: 48 PHA (conserve value in A) | ||
C1/1A56: AB PLB | C1/1A53: A900 LDA #$00 (set program bank to $00) | ||
C1/1A57: 68 PLA | C1/1A55: 48 PHA | ||
C1/1A58: 8E7243 STX $4372 | C1/1A56: AB PLB | ||
C1/1A5B: 8D7443 STA $4374 | C1/1A57: 68 PLA (Restore old value of A) | ||
C1/1A58: 8E7243 STX $4372 (X: Source Data Address) | |||
C1/1A5B: 8D7443 STA $4374 (A: Source Data Bank) | |||
C1/1A5E: A901 LDA #$01 | C1/1A5E: A901 LDA #$01 | ||
C1/1A60: 8D7043 STA $4370 | C1/1A60: 8D7043 STA $4370 (Transfer) | ||
C1/1A63: A918 LDA #$18 | C1/1A63: A918 LDA #$18 | ||
C1/1A65: 8D7143 STA $4371 | C1/1A65: 8D7143 STA $4371 (DMA destination: $(21)18 = VRAM) | ||
C1/1A68: C220 REP #$20 | C1/1A68: C220 REP #$20 | ||
C1/1A6A: E210 SEP #$10 | C1/1A6A: E210 SEP #$10 | ||
C1/1A6C: A020 LDY #$20 | C1/1A6C: A020 LDY #$20 | ||
C1/1A6E: A280 LDX #$80 | C1/1A6E: A280 LDX #$80 | ||
C1/1A70: A91000 LDA #$0010 | C1/1A70: A91000 LDA #$0010 (Setting up Loop counter value) | ||
C1/1A73: 8538 STA $38 | C1/1A73: 8538 STA $38 | ||
C1/1A75: A536 LDA $36 | C1/1A75: A536 LDA $36 | ||
C1/1A77: 8D1621 STA $2116 | |||
C1/1A7A: 8C7543 STY $4375 | C1/1A77: 8D1621 STA $2116 ($36 = Destination in VRAM) | ||
C1/1A7D: 8E0B42 STX $420B | C1/1A7A: 8C7543 STY $4375 (Data Size: always #$20 bytes) | ||
C1/1A7D: 8E0B42 STX $420B (Activate DMA channel 7) | |||
C1/1A80: 18 CLC | C1/1A80: 18 CLC | ||
C1/1A81: 692000 ADC #$0020 | C1/1A81: 692000 ADC #$0020 | ||
C1/1A84: C638 DEC $38 | C1/1A84: C638 DEC $38 | ||
C1/1A86: D0EF BNE $1A77 | C1/1A86: D0EF BNE $1A77 | ||
C1/1A88: 7B TDC | C1/1A88: 7B TDC | ||
C1/1A89: E220 SEP #$20 | C1/1A89: E220 SEP #$20 | ||
Line 1,369: | Line 1,383: | ||
C1/1A8D: AB PLB | C1/1A8D: AB PLB | ||
C1/1A8E: 60 RTS | C1/1A8E: 60 RTS | ||
==C1/1A8F unknow== | ==C1/1A8F unknow== | ||
C1/1A8F: A600 LDX $00 | C1/1A8F: A600 LDX $00 | ||
Line 1,390: | Line 1,405: | ||
0A 00 00 00 (10) | 0A 00 00 00 (10) | ||
==C1/1ABF unknow== | ==C1/1ABF unknow== | ||
''This turns the hexadecimal number in $10-2 into a decimal number. Each digit is stored in a register from $69 to $70. Keep in mind that the highest digit is stored in $69, the lowest in $70. '''Important:''' It is left to be found out what value is in $68. It is added to each digit.'' | |||
C1/1ABF: 7B TDC | C1/1ABF: 7B TDC | ||
C1/1AC0: AA TAX | C1/1AC0: AA TAX | ||
C1/1AC1: 9569 STA $69,X | C1/1AC1: 9569 STA $69,X (clear $69 to $70) | ||
C1/1AC3: E8 INX | C1/1AC3: E8 INX | ||
C1/1AC4: E00800 CPX #$0008 | C1/1AC4: E00800 CPX #$0008 | ||
C1/1AC7: D0F8 BNE $1AC1 | C1/1AC7: D0F8 BNE $1AC1 | ||
C1/1AC9: A20000 LDX #$0000 | |||
C1/1ACC: DA PHX | C1/1AC9: A20000 LDX #$0000 (set up loop counter) | ||
C1/1ACD: 8A TXA | C1/1ACC: DA PHX (push loop counter on tack) | ||
C1/1ACD: 8A TXA (transfer load index value in A) | |||
C1/1ACE: 0A ASL A | C1/1ACE: 0A ASL A | ||
C1/1ACF: 0A ASL A | C1/1ACF: 0A ASL A (multiply by 4 [each value from the table above is 4 bytes in size]) | ||
C1/1AD0: AA TAX | C1/1AD0: AA TAX (transfer back in X for the following loading commands) | ||
C1/1AD1: BFA31AC1 LDA $C11AA3,X | C1/1AD1: BFA31AC1 LDA $C11AA3,X (load divisor from the table above) | ||
C1/1AD5: 8514 STA $14 | C1/1AD5: 8514 STA $14 | ||
C1/1AD7: BFA41AC1 LDA $C11AA4,X | C1/1AD7: BFA41AC1 LDA $C11AA4,X | ||
Line 1,409: | Line 1,427: | ||
C1/1AE1: 8516 STA $16 | C1/1AE1: 8516 STA $16 | ||
C1/1AE3: 20FC1A JSR $1AFC | C1/1AE3: 20FC1A JSR $1AFC | ||
C1/1AE6: FA PLX | C1/1AE6: FA PLX (pull loop counter from stack) | ||
C1/1AE7: A518 LDA $18 | C1/1AE7: A518 LDA $18 (Load the division result) | ||
C1/1AE9: 18 CLC | C1/1AE9: 18 CLC | ||
C1/1AEA: 6568 ADC $68 | C1/1AEA: 6568 ADC $68 | ||
C1/1AEC: 9569 STA $69,X | C1/1AEC: 9569 STA $69,X (Store it) | ||
C1/1AEE: E8 INX | C1/1AEE: E8 INX | ||
C1/1AEF: E00700 CPX #$0007 | C1/1AEF: E00700 CPX #$0007 (loop is run seven times) | ||
C1/1AF2: D0D8 BNE $1ACC | C1/1AF2: D0D8 BNE $1ACC | ||
C1/1AF4: A510 LDA $10 | |||
C1/1AF4: A510 LDA $10 (The modulu of the last division is the value of the last digit) | |||
C1/1AF6: 18 CLC | C1/1AF6: 18 CLC | ||
C1/1AF7: 6568 ADC $68 | C1/1AF7: 6568 ADC $68 | ||
C1/1AF9: 8570 STA $70 | C1/1AF9: 8570 STA $70 | ||
C1/1AFB: 60 RTS | C1/1AFB: 60 RTS | ||
==C1/1AFC | |||
==C1/1AFC 24 bit division== | |||
''This divides the 24 bit value in $10-2 by the 24 bit value in $14-6. The modulu remains in $10-2, the division result is stored in $18.'' | |||
C1/1AFC: 6418 STZ $18 (from only C1/1AE3) | C1/1AFC: 6418 STZ $18 (from only C1/1AE3) | ||
C1/1AFE: A510 LDA $10 | C1/1AFE: A510 LDA $10 (subtracting a 24 bit value stored in $14-6 from a 24 bit value stored in $10-2) | ||
C1/1B00: 38 SEC | C1/1B00: 38 SEC | ||
C1/1B01: E514 SBC $14 | C1/1B01: E514 SBC $14 | ||
Line 1,435: | Line 1,457: | ||
C1/1B0F: 8512 STA $12 | C1/1B0F: 8512 STA $12 | ||
C1/1B11: E618 INC $18 | C1/1B11: E618 INC $18 | ||
C1/1B13: B0E9 BCS $1AFE | C1/1B13: B0E9 BCS $1AFE (loop if carry is set) | ||
C1/1B15: C618 DEC $18 | C1/1B15: C618 DEC $18 | ||
C1/1B17: A510 LDA $10 | C1/1B17: A510 LDA $10 (add the value back on it) | ||
C1/1B19: 18 CLC | C1/1B19: 18 CLC | ||
C1/1B1A: 6514 ADC $14 | C1/1B1A: 6514 ADC $14 | ||
Line 1,448: | Line 1,470: | ||
C1/1B28: 8512 STA $12 | C1/1B28: 8512 STA $12 | ||
C1/1B2A: 60 RTS | C1/1B2A: 60 RTS | ||
==C1/1B2B unknow== | ==C1/1B2B unknow== | ||
C1/1B2B: C220 REP #$20 (from C1/693F, C1/6957, C1/A53F, C1/A663) | C1/1B2B: C220 REP #$20 (from C1/693F, C1/6957, C1/A53F, C1/A663) |
Latest revision as of 02:41, 24 January 2024
This is a sub-page of Final Fantasy VI/ROM map.
C1/102A unknow
C1/102A: 221500C0 JSL $C00015 (from only C1/01F0) C1/102E: 7B TDC C1/102F: AA TAX C1/1030: A9E0 LDA #$E0 C1/1032: 9D0003 STA $0300,X C1/1035: E8 INX C1/1036: E00002 CPX #$0200 C1/1039: D0F7 BNE $1032 C1/103B: 7B TDC C1/103C: AA TAX C1/103D: 9E0005 STZ $0500,X C1/1040: E8 INX C1/1041: E02000 CPX #$0020 C1/1044: D0F7 BNE $103D C1/1046: A00040 LDY #$4000 C1/1049: A20020 LDX #$2000 C1/104C: 204619 JSR $1946 C1/104F: A0002C LDY #$2C00 C1/1052: A20004 LDX #$0400 C1/1055: 204619 JSR $1946 C1/1058: C220 REP #$20 C1/105A: 7B TDC (Clear $7FA000 to $7FA3FF (RAM)) C1/105B: AA TAX C1/105C: 9F00A07F STA $7FA000,X C1/1060: 9F00A17F STA $7FA100,X C1/1064: 9F00A27F STA $7FA200,X C1/1068: 9F00A37F STA $7FA300,X C1/106C: E8 INX C1/106D: E8 INX C1/106E: E00001 CPX #$0100 C1/1071: D0E9 BNE $105C C1/1073: E220 SEP #$20 C1/1075: AEE211 LDX $11E2 (load background saved in the formation loading) C1/1078: 8EB8EC STX $ECB8 (save as battle background ID) C1/107B: A9FF LDA #$FF C1/107D: 8546 STA $46 C1/107F: 9CEFE9 STZ $E9EF C1/1082: 20E00F JSR $0FE0 C1/1085: AD442F LDA $2F44 C1/1088: 49FF EOR #$FF C1/108A: 8DE6E9 STA $E9E6 C1/108D: 20B60F JSR $0FB6 C1/1090: 20F30D JSR $0DF3 C1/1093: 20670E JSR $0E67 C1/1096: 201F0F JSR $0F1F C1/1099: A9FF LDA #$FF C1/109B: 8DAB60 STA $60AB C1/109E: 8555 STA $55 C1/10A0: A951 LDA #$51 C1/10A2: 8557 STA $57 C1/10A4: 1A INC A C1/10A5: 8559 STA $59 C1/10A7: 7B TDC C1/10A8: AA TAX C1/10A9: A9C8 LDA #$C8 C1/10AB: 9DCC04 STA $04CC,X C1/10AE: A997 LDA #$97 C1/10B0: 9DCD04 STA $04CD,X C1/10B3: 7B TDC C1/10B4: 9DCE04 STA $04CE,X C1/10B7: 9DCF04 STA $04CF,X C1/10BA: E8 INX C1/10BB: E8 INX C1/10BC: E8 INX C1/10BD: E8 INX C1/10BE: E02400 CPX #$0024 C1/10C1: D0E6 BNE $10A9 C1/10C3: A980 LDA #$80 C1/10C5: 8D1C05 STA $051C C1/10C8: A9AA LDA #$AA C1/10CA: 8D1D05 STA $051D C1/10CD: 8D1E05 STA $051E C1/10D0: 9C1F05 STZ $051F C1/10D3: A20068 LDX #$6800 C1/10D6: A00008 LDY #$0800 C1/10D9: 201619 JSR $1916 C1/10DC: A20070 LDX #$7000 C1/10DF: A00008 LDY #$0800 C1/10E2: 201619 JSR $1916 C1/10E5: A2000C LDX #$0C00 C1/10E8: A00004 LDY #$0400 C1/10EB: 201F19 JSR $191F C1/10EE: A20054 LDX #$5400 C1/10F1: A00004 LDY #$0400 C1/10F4: 20A517 JSR $17A5 (Writes "$01EE" in VRAM from $5400 to $55FF) C1/10F7: A20078 LDX #$7800 C1/10FA: A00008 LDY #$0800 C1/10FD: 20A517 JSR $17A5 (Writes "$01EE" in VRAM from $7800 to $7BFF) C1/1100: 200C6D JSR $6D0C C1/1103: 7B TDC C1/1104: AA TAX C1/1105: BF43BFC2 LDA $C2BF43,X C1/1109: 9DD2E9 STA $E9D2,X C1/110C: E8 INX C1/110D: E00800 CPX #$0008 C1/1110: D0F3 BNE $1105 C1/1112: 20AF1D JSR $1DAF C1/1115: 207C25 JSR $257C C1/1118: 20DD22 JSR $22DD C1/111B: 20723E JSR $3E72 C1/111E: 208815 JSR $1588 C1/1121: 20D125 JSR $25D1 C1/1124: 203F40 JSR $403F C1/1127: 209C52 JSR $529C C1/112A: 20170F JSR $0F17 C1/112D: 20A203 JSR $03A2 C1/1130: 20476B JSR $6B47 C1/1133: 206B49 JSR $496B C1/1136: 208F46 JSR $468F C1/1139: 20014A JSR $4A01 C1/113C: 205947 JSR $4759 C1/113F: EEBB7B INC $7BBB C1/1142: 20273D JSR $3D27 C1/1145: 204D3E JSR $3E4D C1/1148: 2017B5 JSR $B517 C1/114B: A200E0 LDX #$E000 C1/114E: 86F3 STX $F3 C1/1150: A9D2 LDA #$D2 C1/1152: 85F5 STA $F5 C1/1154: A200A4 LDX #$A400 C1/1157: 86F6 STX $F6 C1/1159: A97F LDA #$7F C1/115B: 85F8 STA $F8 C1/115D: 226DFFC2 JSL $C2FF6D C1/1161: A20004 LDX #$0400 C1/1164: 8636 STX $36 C1/1166: A200B8 LDX #$B800 C1/1169: A97F LDA #$7F C1/116B: A0002E LDY #$2E00 C1/116E: 202B1A JSR $1A2B C1/1171: A28000 LDX #$0080 C1/1174: 8636 STX $36 C1/1176: A2AD5F LDX #$5FAD C1/1179: A97E LDA #$7E C1/117B: A00040 LDY #$4000 C1/117E: 202B1A JSR $1A2B C1/1181: 7B TDC C1/1182: AA TAX C1/1183: BD1F7A LDA $7A1F,X C1/1186: 9D477A STA $7A47,X C1/1189: E8 INX C1/118A: E02800 CPX #$0028 C1/118D: D0F4 BNE $1183 C1/118F: A909 LDA #$09 C1/1191: 8D6F89 STA $896F C1/1194: A909 LDA #$09 C1/1196: 8D7389 STA $8973 C1/1199: A902 LDA #$02 C1/119B: 8D7789 STA $8977 C1/119E: 9C7089 STZ $8970 C1/11A1: 9C7489 STZ $8974 C1/11A4: 9C7889 STZ $8978 C1/11A7: A90C LDA #$0C C1/11A9: 8D7189 STA $8971 C1/11AC: A961 LDA #$61 C1/11AE: 8D7289 STA $8972 C1/11B1: A954 LDA #$54 C1/11B3: 8D7B89 STA $897B C1/11B6: 8D7C89 STA $897C C1/11B9: A969 LDA #$69 C1/11BB: 8D7589 STA $8975 C1/11BE: A96C LDA #$6C C1/11C0: 8D7989 STA $8979 C1/11C3: A971 LDA #$71 C1/11C5: 8D7689 STA $8976 C1/11C8: 8D7A89 STA $897A C1/11CB: A979 LDA #$79 C1/11CD: 8D7F89 STA $897F C1/11D0: 8D8089 STA $8980 C1/11D3: 8D8489 STA $8984 C1/11D6: A940 LDA #$40 C1/11D8: 8D8389 STA $8983 C1/11DB: A910 LDA #$10 C1/11DD: 8D7D89 STA $897D C1/11E0: 8D7D60 STA $607D C1/11E3: A955 LDA #$55 C1/11E5: 8D7E89 STA $897E C1/11E8: A917 LDA #$17 C1/11EA: 8D8D89 STA $898D C1/11ED: 8D9189 STA $8991 C1/11F0: 9C8989 STZ $8989 C1/11F3: 9C8A89 STZ $898A C1/11F6: 9C8E89 STZ $898E C1/11F9: 9C9289 STZ $8992 C1/11FC: A922 LDA #$22 (Animation Script pointer) C1/11FE: 8D8189 STA $8981 C1/1201: 8D8589 STA $8985 C1/1204: A955 LDA #$55 C1/1206: 8D8289 STA $8982 C1/1209: 8D8689 STA $8986 C1/120C: 7B TDC C1/120D: AA TAX C1/120E: C220 REP #$20 C1/1210: A997FF LDA #$FF97 C1/1213: 9D32EA STA $EA32,X C1/1216: E8 INX C1/1217: E8 INX C1/1218: E0C001 CPX #$01C0 C1/121B: D0F6 BNE $1213 C1/121D: 7B TDC C1/121E: E220 SEP #$20 C1/1220: A980 LDA #$80 C1/1222: 8DF9E9 STA $E9F9 C1/1225: 7B TDC C1/1226: AA TAX C1/1227: A908 LDA #$08 C1/1229: 9D1F9A STA $9A1F,X C1/122C: 9E219A STZ $9A21,X C1/122F: A9F7 LDA #$F7 C1/1231: 9D209A STA $9A20,X C1/1234: 9D229A STA $9A22,X C1/1237: E8 INX C1/1238: E8 INX C1/1239: E8 INX C1/123A: E8 INX C1/123B: E05C02 CPX #$025C C1/123E: D0E7 BNE $1227 C1/1240: 9E1F9A STZ $9A1F,X C1/1243: 9E219A STZ $9A21,X C1/1246: A9F7 LDA #$F7 C1/1248: 9D209A STA $9A20,X C1/124B: 9D229A STA $9A22,X C1/124E: E8 INX C1/124F: E8 INX C1/1250: E8 INX C1/1251: E8 INX C1/1252: E00004 CPX #$0400 C1/1255: D0E9 BNE $1240 C1/1257: C220 REP #$20 C1/1259: 8B PHB C1/125A: A95F02 LDA #$025F C1/125D: A21F9A LDX #$9A1F C1/1260: A01F9F LDY #$9F1F C1/1263: 547E7E MVN $7E,$7E C1/1266: AB PLB C1/1267: 7B TDC C1/1268: E220 SEP #$20 C1/126A: 7B TDC C1/126B: AA TAX C1/126C: A9E0 LDA #$E0 C1/126E: 9D9689 STA $8996,X C1/1271: E8 INX C1/1272: E8 INX C1/1273: E8 INX C1/1274: E8 INX C1/1275: E05C02 CPX #$025C C1/1278: D0F4 BNE $126E C1/127A: 7B TDC C1/127B: AA TAX C1/127C: A9E0 LDA #$E0 C1/127E: 8510 STA $10 C1/1280: 641A STZ $1A C1/1282: A902 LDA #$02 C1/1284: 9DF08B STA $8BF0,X C1/1287: A982 LDA #$82 C1/1289: 9DF18B STA $8BF1,X C1/128C: A510 LDA $10 C1/128E: 9DF28B STA $8BF2,X C1/1291: E61A INC $1A C1/1293: A51A LDA $1A C1/1295: C903 CMP #$03 C1/1297: D00A BNE $12A3 C1/1299: 641A STZ $1A C1/129B: A510 LDA $10 C1/129D: C9FF CMP #$FF C1/129F: F002 BEQ $12A3 C1/12A1: E610 INC $10 C1/12A3: E8 INX C1/12A4: E8 INX C1/12A5: E8 INX C1/12A6: E8 INX C1/12A7: E02001 CPX #$0120 C1/12AA: D0D6 BNE $1282 C1/12AC: 7B TDC C1/12AD: AA TAX C1/12AE: A8 TAY C1/12AF: BDF68B LDA $8BF6,X C1/12B2: 9963EB STA $EB63,Y C1/12B5: A982 LDA #$82 C1/12B7: 9962EB STA $EB62,Y C1/12BA: E8 INX C1/12BB: E8 INX C1/12BC: E8 INX C1/12BD: E8 INX C1/12BE: C8 INY C1/12BF: C8 INY C1/12C0: C09000 CPY #$0090 C1/12C3: D0EA BNE $12AF C1/12C5: A2FFFF LDX #$FFFF (LDX $02!) C1/12C8: 8E0140 STX $4001 C1/12CB: 8E0340 STX $4003 C1/12CE: 7B TDC C1/12CF: AA TAX C1/12D0: 3A DEC A C1/12D1: 9D2D60 STA $602D,X C1/12D4: E8 INX C1/12D5: E04000 CPX #$0040 C1/12D8: D0F7 BNE $12D1 C1/12DA: 7B TDC C1/12DB: AA TAX C1/12DC: 3A DEC A C1/12DD: 8DAD7B STA $7BAD C1/12E0: 9DAE2B STA $2BAE,X C1/12E3: E8 INX C1/12E4: E02000 CPX #$0020 C1/12E7: D0F7 BNE $12E0 C1/12E9: 7B TDC C1/12EA: AA TAX C1/12EB: 8E302F STX $2F30 C1/12EE: 8E322F STX $2F32 C1/12F1: 205C0D JSR $0D5C C1/12F4: 20F61F JSR $1FF6 C1/12F7: A2C004 LDX #$04C0 C1/12FA: 8636 STX $36 C1/12FC: A27FA9 LDX #$A97F C1/12FF: A97E LDA #$7E C1/1301: A0000C LDY #$0C00 C1/1304: 202B1A JSR $1A2B C1/1307: A94C LDA #$4C C1/1309: 8DF7E9 STA $E9F7 C1/130C: 9CF8E9 STZ $E9F8 C1/130F: A901 LDA #$01 C1/1311: 8DF6E9 STA $E9F6 C1/1314: A2FF21 LDX #$21FF C1/1317: 8E9062 STX $6290 C1/131A: 8E9262 STX $6292 C1/131D: 8E9462 STX $6294 C1/1320: 8E9662 STX $6296 C1/1323: 8E9862 STX $6298 C1/1326: 208F0F JSR $0F8F C1/1329: 207C95 JSR $957C C1/132C: 205906 JSR $0659 C1/132F: 2252B6C2 JSL $C2B652 C1/1333: AEE011 LDX $11E0 (get enemy formation #) C1/1336: E0D701 CPX #$01D7 C1/1339: D00B BNE $1346 (if it's not Short Arm, Long Arm, Face,then branch) C1/133B: EE8262 INC $6282 C1/133E: 9CE6E9 STZ $E9E6 C1/1341: 9C1E20 STZ $201E (Clear all monster targets) C1/1344: 8024 BRA $136A
C1/1346: E0E501 CPX #$01E5 C1/1349: D01F BNE $136A (if it's not the 3 Soldiers Terra burns up during her flashback, branch) C1/134B: A20000 LDX #$0000 C1/134E: 8618 STX $18 C1/1350: A20002 LDX #$0200 C1/1353: 861A STX $1A C1/1355: 2242B4C2 JSL $C2B442 C1/1359: EE8A62 INC $628A (Set the game to flashback mode (yellow tint): 1 = yes) C1/135C: 7B TDC C1/135D: AA TAX C1/135E: BD807F LDA $7F80,X C1/1361: 9DAD81 STA $81AD,X C1/1364: E8 INX C1/1365: E08000 CPX #$0080 C1/1368: D0F4 BNE $135E C1/136A: A901 LDA #$01 C1/136C: 8D0D7B STA $7B0D C1/136F: 8D0E7B STA $7B0E C1/1372: 8D0F7B STA $7B0F C1/1375: 9C677B STZ $7B67 C1/1378: 9C6B7B STZ $7B6B C1/137B: A917 LDA #$17 C1/137D: 8F2C2100 STA $00212C C1/1381: 8F2E2100 STA $00212E C1/1385: 6446 STZ $46 C1/1387: EE9761 INC $6197 C1/138A: 222491C1 JSL $C19124 C1/138E: C220 REP #$20 C1/1390: 2258B2C2 JSL $C2B258 C1/1394: 7B TDC C1/1395: E220 SEP #$20 C1/1397: AD1E20 LDA $201E (Load valid monster targets) C1/139A: 48 PHA C1/139B: 9C1E20 STZ $201E (Clear all monster targets) C1/139E: AF104200 LDA $004210 C1/13A2: 10FA BPL $139E C1/13A4: AF104200 LDA $004210 C1/13A8: 10FA BPL $13A4 C1/13AA: A981 LDA #$81 C1/13AC: 8F004200 STA $004200 C1/13B0: 58 CLI C1/13B1: EE8C62 INC $628C C1/13B4: EEEFE9 INC $E9EF C1/13B7: 7B TDC C1/13B8: AA TAX C1/13B9: BF3114C1 LDA $C11431,X C1/13BD: 9D6E2D STA $2D6E,X (Battle dyamics command?) C1/13C0: E8 INX C1/13C1: E00900 CPX #$0009 C1/13C4: D0F3 BNE $13B9 C1/13C6: 68 PLA C1/13C7: 8D712D STA $2D71 (Battle Dynamics param. 3) C1/13CA: ADAB61 LDA $61AB C1/13CD: 48 PHA C1/13CE: 9CAB61 STZ $61AB C1/13D1: AD482F LDA $2F48 (Monst. Form. Aux. Byte 1) C1/13D4: 290F AND #$0F (Isolate "appearance effects") C1/13D6: 8D6F2D STA $2D6F (Battle Dynamics param. 1) C1/13D9: AA TAX C1/13DA: BF2014C1 LDA $C11420,X C1/13DE: F01C BEQ $13FC C1/13E0: AE6E2D LDX $2D6E (Battle Dynamics command?) C1/13E3: DA PHX C1/13E4: AE702D LDX $2D70 (Battle Dynamics param. 2) C1/13E7: DA PHX C1/13E8: AE722D LDX $2D72 C1/13EB: 8E6E2D STX $2D6E (Battle Dynamics command?) C1/13EE: AE742D LDX $2D74 C1/13F1: 8E702D STX $2D70 (Battle Dynamics param. 2) C1/13F4: FA PLX C1/13F5: 8E742D STX $2D74 C1/13F8: FA PLX C1/13F9: 8E722D STX $2D72 C1/13FC: 221295C1 JSL $C19512 C1/1400: 68 PLA C1/1401: 8DAB61 STA $61AB C1/1404: 202A02 JSR $022A C1/1407: ADF6E9 LDA $E9F6 C1/140A: D0F8 BNE $1404 C1/140C: 7B TDC C1/140D: AA TAX C1/140E: 8610 STX $10 C1/1410: 203CC2 JSR $C23C C1/1413: EE967B INC $7B96 C1/1416: 9CEFE9 STZ $E9EF C1/1419: 9C8C62 STZ $628C C1/141C: 9C0FEC STZ $EC0F C1/141F: 60 RTS
C1/1420 unknow
C1/1420: 00 C1/1421: 01 C1/1422: 00 C1/1423: 01 C1/1424: 01 C1/1425: 01 C1/1426: 01 C1/1427: 00 C1/1428: 00 C1/1429: 00 C1/142A: 00 C1/142B: 00 C1/142C: 00 C1/142D: 00 C1/142E: 00 C1/142F: 00 C1/1430: 00 (junk?)
C1/1431 unknow
C1/1431: 13 C1/1432: 00 C1/1433: 00 C1/1434: 00 C1/1435: 0F C1/1436: 00 C1/1437: 00 C1/1438: 00 C1/1439: FF
C1/143A setup battle participants based on formation (2-byte pointers)
C1/143A: 81 14 front C1/143C: 9A 14 back C1/143E: D7 14 pincer C1/1440: 33 15 side
C1/1442 unknow
C1/1442: 7B TDC C1/1443: AA TAX (X = 0) C1/1444: 3A DEC (A = 255) C1/1445: 9D 86 7A STA $7A86,X (null char/monster) C1/1448: E8 INX C1/1449: E0 18 00 CPX #$0018 C1/144C: D0 F7 BNE $1445 (loop through all enemy and character clumps) C1/144E: 7B TDC C1/144F: AA TAX C1/1450: 9E 7B 80 STZ $807B,X (store 0 as the enemy's width) C1/1453: E8 INX C1/1454: E0 0C 00 CPX #$000C C1/1457: D0 F7 BNE $1450 (loop for all enemies) C1/1459: 60 RTS
C1/145A unknow
C1/145A: 7B TDC C1/145B: AA TAX (clear A and X) C1/145C: 8A TXA C1/145D: 9D 86 7A STA $7A86,X (store X at $7A86 + X) C1/1460: E8 INX C1/1461: E0 06 00 CPX #$0006 C1/1464: D0 F6 BNE $145C (loop 6 times) C1/1466: 60 RTS
C1/1467 unknow
C1/1467: 7B TDC C1/1468: AA TAX (clear A and X) C1/1469: 8A TXA C1/146A: 9D 92 7A STA $7A92,X (store X at $7A92 + X) C1/146D: E8 INX C1/146E: E0 06 00 CPX #$0006 C1/1471: D0 F6 BNE $1469 (loop 6 times) C1/1473: 60 RTS
C1/1474 unknow
C1/1474: 7B TDC C1/1475: AA TAX (clear A and X) C1/1476: 8A TXA C1/1477: 9D 8C 7A STA $7A8C,X (store X at $7A8C + X) C1/147A: E8 INX C1/147B: E0 04 00 CPX #$0004 C1/147E: D0 F6 BNE $1476 (loop 4 times) C1/1480: 60 RTS
C1/1481 unknow
C1/1481: 20 5A 14 JSR $145A (initialize left enemy clump) C1/1484: 20 74 14 JSR $1474 (initialize some character clump) C1/1487: 7B TDC C1/1488: AA TAX (X = 0) C1/1489: BD 2F 81 LDA $812F,X (adjusted enemy width/8) C1/148C: 0A ASL C1/148D: 0A ASL C1/148E: 0A ASL C1/148F: 9D 7B 80 STA $807B,X (store width) C1/1492: E8 INX C1/1493: E8 INX C1/1494: E0 0C 00 CPX #$000C (we passed 6th enemy yet?) C1/1497: D0 F0 BNE $1489 (if not, loop for all enemies) C1/1499: 60 RTS
C1/149A setup back attack for battle
C1/149A: 20 67 14 JSR $1467 (initialize right enemy clump) C1/149D: 20 74 14 JSR $1474 (initialize some character clump) C1/14A0: 7B TDC C1/14A1: AA TAX C1/14A2: A9 20 LDA #$20 C1/14A4: 9D 9F 80 STA $809F,X (store 32 somewhere. maybe 32 is character width?) C1/14A7: E8 INX C1/14A8: E8 INX C1/14A9: E0 08 00 CPX #$0008 (loop 4 times. perhaps for characters?) C1/14AC: D0 F6 BNE $14A4 C1/14AE: 7B TDC C1/14AF: AA TAX C1/14B0: BD 2F 81 LDA $812F,X (adjusted enemy width/8) C1/14B3: 0A ASL C1/14B4: 0A ASL C1/14B5: 0A ASL C1/14B6: 85 10 STA $10 (store width) C1/14B8: BD C3 80 LDA $80C3,X (get monster's X coord) C1/14BB: 49 FF EOR #$FF C1/14BD: 1A INC (invert monster's X coordinate, and add 1) C1/14BE: 38 SEC C1/14BF: E5 10 SBC $10 (subtract the width) C1/14C1: 9D C3 80 STA $80C3,X (store updated X-coord. NewX = (256 - OldX) - Width.) C1/14C4: BD F3 80 LDA $80F3,X C1/14C7: 5D 7E 61 EOR $617E,X C1/14CA: 49 01 EOR #$01 C1/14CC: 9D F3 80 STA $80F3,X (flip the enemy's image?) C1/14CF: E8 INX C1/14D0: E8 INX C1/14D1: E0 0C 00 CPX #$000C C1/14D4: D0 DA BNE $14B0 (loop for all 6 enemies) C1/14D6: 60 RTS
C1/14D7 setup pincer attack for battle
C1/14D7: 20 74 14 JSR $1474 (initialize some character clump) C1/14DA: 7B TDC C1/14DB: AA TAX C1/14DC: 64 10 STZ $10 C1/14DE: 64 12 STZ $12 C1/14E0: 64 16 STZ $16 C1/14E2: BD 2F 81 LDA $812F,X (adjusted enemy width/8) C1/14E5: 0A ASL C1/14E6: 0A ASL C1/14E7: 0A ASL C1/14E8: 85 14 STA $14 (store width) C1/14EA: BD C3 80 LDA $80C3,X (monster's X coordinate) C1/14ED: 18 CLC C1/14EE: 65 14 ADC $14 (add width to it) C1/14F0: C9 68 CMP #$68 C1/14F2: 90 26 BCC $151A (branch if result is < 104, otherwise adjust position) C1/14F4: BD C3 80 LDA $80C3,X (get monster's X coordinate) C1/14F7: 38 SEC C1/14F8: E9 40 SBC #$40 (subtract 64) C1/14FA: 18 CLC C1/14FB: 65 14 ADC $14 (result = Xcoordinate - 64 + width) C1/14FD: 49 FF EOR #$FF C1/14FF: 1A INC (invert it and add 1) C1/1500: 9D C3 80 STA $80C3,X (store updated X-coordinate.NewX = (256 - OldX) - Width + 64) C1/1503: BD F3 80 LDA $80F3,X C1/1506: 5D 7E 61 EOR $617E,X C1/1509: 49 01 EOR #$01 C1/150B: 9D F3 80 STA $80F3,X (flip the enemy's image?) C1/150E: A5 12 LDA $12 C1/1510: A8 TAY C1/1511: A5 16 LDA $16 C1/1513: 99 92 7A STA $7A92,Y (store enemy index in right enemy clump?) C1/1516: E6 12 INC $12 (increment index into right clump) C1/1518: 80 0F BRA $1529 (branch, skipping update to left clump and width storage) C1/151A: A5 14 LDA $14 C1/151C: 9D 7B 80 STA $807B,X (store enemy width) C1/151F: A5 10 LDA $10 C1/1521: A8 TAY C1/1522: A5 16 LDA $16 C1/1524: 99 86 7A STA $7A86,Y (store enemy index in left enemy clump?) C1/1527: E6 10 INC $10 (increment index into left clump) C1/1529: E6 16 INC $16 (increment enemy index) C1/152B: E8 INX C1/152C: E8 INX C1/152D: E0 0C 00 CPX #$000C C1/1530: D0 B0 BNE $14E2 (loop for all 6 enemies) C1/1532: 60 RTS
C1/1533 setup side attack for battle
C1/1533: 20 67 14 JSR $1467 (initialize right enemy clump?) C1/1536: 7B TDC C1/1537: 8D 98 7A STA $7A98 (store 0 at first position in some stucture?) C1/153A: 1A INC C1/153B: 8D 99 7A STA $7A99 (store 1 at second position in some structure?) C1/153E: 1A INC C1/153F: 8D 8C 7A STA $7A8C (store 2 at first position in character clump) C1/1542: 1A INC C1/1543: 8D 8D 7A STA $7A8D (store 3 at second position in character clump) C1/1546: A9 20 LDA #$20 C1/1548: 8D A3 80 STA $80A3 C1/154B: 8D A5 80 STA $80A5 C1/154E: 7B TDC C1/154F: AA TAX C1/1550: BD 2F 81 LDA $812F,X (adjusted enemy width/8) C1/1553: 0A ASL C1/1554: 0A ASL C1/1555: 0A ASL C1/1556: 85 12 STA $12 (width) C1/1558: 4A LSR C1/1559: 85 10 STA $10 (width / 2) C1/155B: BD C3 80 LDA $80C3,X (get enemy's X-coordinate) C1/155E: 18 CLC C1/155F: 69 30 ADC #$30 (add 48) C1/1561: 9D C3 80 STA $80C3,X (update X coord) C1/1564: 18 CLC C1/1565: 65 10 ADC $10 (add width/2 to updated X position) C1/1567: 30 0D BMI $1576 (if the center of the enemy is past the halfway point on the screen, leave it facing right) C1/1569: BD F3 80 LDA $80F3,X C1/156C: 5D 7E 61 EOR $617E,X C1/156F: 49 01 EOR #$01 C1/1571: 9D F3 80 STA $80F3,X (otherwise, flip its image?) C1/1574: 80 05 BRA $157B C1/1576: A5 12 LDA $12 C1/1578: 9D 7B 80 STA $807B,X (store enemy width) C1/157B: E8 INX C1/157C: E8 INX C1/157D: E0 0C 00 CPX #$000C C1/1580: D0 CE BNE $1550 (loop for all 6 enemies) C1/1582: 60 RTS C1/1583: 60 RTS
C1/1584 adjust enemy position in colosseum battles (data)
C1/1584: 00 C1/1585: F8 C1/1586: 08 C1/1587: D8
C1/1588 unknow
C1/1588: 20 42 14 JSR $1442 (null out all enemy and character clumps, and set all enemy widths to zero) C1/158B: 9C 79 7B STZ $7B79 (mark binary array of left clump of enemies as empty) C1/158E: 9C 7A 7B STZ $7B7A (mark ' ' ' left clump of characters as empty) C1/1591: 9C 7B 7B STZ $7B7B (mark ' ' ' right clump of enemies as empty) C1/1594: 9C 7C 7B STZ $7B7C (mark ' ' ' right clump of characters as empty) C1/1597: 7B TDC C1/1598: AA TAX C1/1599: 9E F3 80 STZ $80F3,X (clear whatever flips the enemy's image) C1/159C: E8 INX C1/159D: E0 0C 00 CPX #$000C C1/15A0: D0 F7 BNE $1599 (loop for all enemies) C1/15A2: AD 1F 20 LDA $201F (get encounter type? 0 = front, 1 = back, 2 = pincer, 3 = side) C1/15A5: 0A ASL C1/15A6: AA TAX (multiply by 2, so it acts as index into function ptrs) C1/15A7: 20 04 16 JSR $1604 C1/15AA: 20 07 16 JSR $1607 C1/15AD: AD 79 7B LDA $7B79 C1/15B0: 8D AC 2E STA $2EAC (copy bit array of left enemy clump) C1/15B3: AD 7B 7B LDA $7B7B C1/15B6: 8D AD 2E STA $2EAD (copy bit array of right enemy clump) C1/15B9: AE E0 11 LDX $11E0 (get enemy formation number) C1/15BC: E0 3F 02 CPX #$023F C1/15BF: D0 42 BNE $1603 (if it's not Pugs formation 575, then exit) C1/15C1: AD 2F 81 LDA $812F (adjusted width/8 of enemy from slot #0) C1/15C4: 0A ASL C1/15C5: 0A ASL C1/15C6: 0A ASL C1/15C7: 85 10 STA $10 (store width) C1/15C9: AD 30 81 LDA $8130 (adjusted height/8 of enemy from slot #0) C1/15CC: 0A ASL C1/15CD: 0A ASL C1/15CE: 0A ASL C1/15CF: 85 12 STA $12 (store height) C1/15D1: A9 80 LDA #$80 C1/15D3: 38 SEC C1/15D4: E5 12 SBC $12 C1/15D6: AA TAX C1/15D7: 8E CF 80 STX $80CF (store result as Y coordinate for 1st monster) C1/15DA: AD 01 20 LDA $2001 (get monster # of 1st enemy in formation) C1/15DD: AA TAX C1/15DE: BF 00 E8 EC LDA $ECE800,X (mystery value from 256-byte block, value from 0 to 4) C1/15E2: D0 05 BNE $15E9 (if mystery index isn't 0, branch) C1/15E4: 9C CF 80 STZ $80CF (set Y coordinate to zero for 1st monster - enemy "hangs") C1/15E7: 80 0D BRA $15F6 C1/15E9: 3A DEC (decrement mystery index) C1/15EA: AA TAX (put it in X) C1/15EB: AD CF 80 LDA $80CF (retrieve Y coordinate) C1/15EE: 18 CLC C1/15EF: 7F 84 15 C1 ADC $C11584,X (Vertically adjust enemy using a little table.) C1/15F3: 8D CF 80 STA $80CF (update Y coordinate) C1/15F6: A9 80 LDA #$80 C1/15F8: 38 SEC C1/15F9: E5 10 SBC $10 (subtract width from 128) C1/15FB: 4A LSR (divide by 2) C1/15FC: 18 CLC C1/15FD: 69 18 ADC #$18 (add 24) C1/15FF: AA TAX C1/1600: 8E C3 80 STX $80C3 (centers the enemy) C1/1603: 60 RTS
C1/1604 unknow
C1/1604: 7C 3A 14 JMP ($143A,X)
C1/1607 unknow
C1/1607: 7B TDC C1/1608: AA TAX (Clear A and X) C1/1609: 3A DEC (A = FF) C1/160A: 9D 9E 7A STA $7A9E,X C1/160D: E8 INX C1/160E: E0 30 00 CPX #$0030 C1/1611: D0 F7 BNE $160A (loop 48 times, nulling out $7A9E through $7ACD) C1/1613: 7B TDC C1/1614: AA TAX (Clear A and X) C1/1615: 85 10 STA $10 C1/1617: A9 03 LDA #$03 C1/1619: 85 12 STA $12 C1/161B: A5 10 LDA $10 C1/161D: 9D B6 7A STA $7AB6,X C1/1620: 9D C2 7A STA $7AC2,X C1/1623: A5 12 LDA $12 C1/1625: 9D BC 7A STA $7ABC,X C1/1628: 9D C8 7A STA $7AC8,X C1/162B: E6 10 INC $10 (increment one counter) C1/162D: C6 12 DEC $12 (... while decrementing another) C1/162F: E8 INX C1/1630: E0 04 00 CPX #$0004 C1/1633: D0 E6 BNE $161B (loop 4 times) C1/1635: 7B TDC C1/1636: AA TAX C1/1637: A8 TAY (Clear A, X and Y) C1/1638: C2 20 REP #$20 (set 16-bit Accumulator) C1/163A: BD C3 80 LDA $80C3,X (get monster starting X-coordinate) C1/163D: 99 D0 7A STA $7AD0,Y (store it in 32-bit field instead of 16-bit one) C1/1640: E8 INX C1/1641: E8 INX C1/1642: C8 INY C1/1643: C8 INY C1/1644: C8 INY C1/1645: C8 INY C1/1646: E0 0C 00 CPX #$000C C1/1649: D0 EF BNE $163A (loop for all 6 monsters) C1/164B: 7B TDC C1/164C: E2 20 SEP #$20 (set 8-bit Accumulator) C1/164E: 20 52 17 JSR $1752 (put the 0 through 5 formation(?) index in 7AD2) C1/1651: 7B TDC C1/1652: AA TAX C1/1653: A8 TAY (Clear A, X and Y) C1/1654: BD D2 7A LDA $7AD2,X C1/1657: 99 9E 7A STA $7A9E,Y (store the enemy indices in an array of bytes) C1/165A: C8 INY C1/165B: E8 INX C1/165C: E8 INX C1/165D: E8 INX C1/165E: E8 INX C1/165F: C0 06 00 CPY #$0006 C1/1662: D0 F0 BNE $1654 (loop for all 6 enemies) C1/1664: 7B TDC C1/1665: AA TAX C1/1666: A8 TAY (Clear A, X and Y) C1/1667: C2 20 REP #$20 (set 16-bit Accumulator) C1/1669: BD 2F 81 LDA $812F,X (adjusted enemy width/8) C1/166C: 29 FF 00 AND #$00FF (just the width, clear out the height) C1/166F: 0A ASL C1/1670: 0A ASL C1/1671: 0A ASL (multiply by 8 to get actual width) C1/1672: 18 CLC C1/1673: 7D C3 80 ADC $80C3,X (add to enemy starting X coordinate) C1/1676: 99 D0 7A STA $7AD0,Y (now we have the ending X-coordinate of the enemy) C1/1679: E8 INX C1/167A: E8 INX C1/167B: C8 INY C1/167C: C8 INY C1/167D: C8 INY C1/167E: C8 INY C1/167F: E0 0C 00 CPX #$000C C1/1682: D0 E5 BNE $1669 (loop for all 6 enemies) C1/1684: 7B TDC C1/1685: E2 20 SEP #$20 (Clear Accumulator, set to 8-bit) C1/1687: 20 52 17 JSR $1752 (Sort the 7AD0 list by ENDING enemy X-coordinate) C1/168A: 7B TDC C1/168B: AA TAX (clear A and X) C1/168C: A0 05 00 LDY #$0005 C1/168F: BD D2 7A LDA $7AD2,X C1/1692: 99 A4 7A STA $7AA4,Y (store the enemy indices [sorted by ending X-coordinate] in an array of bytes IN REVERSE ORDER) C1/1695: 88 DEY C1/1696: E8 INX C1/1697: E8 INX C1/1698: E8 INX C1/1699: E8 INX C1/169A: E0 18 00 CPX #$0018 C1/169D: D0 F0 BNE $168F (loop for all 6 enemies) C1/169F: 7B TDC C1/16A0: AA TAX C1/16A1: A8 TAY (Clear A, X and Y) C1/16A2: C2 20 REP #$20 (Set 16-bit Accumulator) C1/16A4: BD CF 80 LDA $80CF,X (get enemy starting Y-coordinate) C1/16A7: 99 D0 7A STA $7AD0,Y C1/16AA: E8 INX C1/16AB: E8 INX C1/16AC: C8 INY C1/16AD: C8 INY C1/16AE: C8 INY C1/16AF: C8 INY C1/16B0: E0 0C 00 CPX #$000C C1/16B3: D0 EF BNE $16A4 (loop for all 6 enemies) C1/16B5: 7B TDC C1/16B6: E2 20 SEP #$20 (Clear A, set to 8-bit) C1/16B8: 20 52 17 JSR $1752 (Sort the 7AD0 list by starting enemy Y-coordinate) C1/16BB: 7B TDC C1/16BC: AA TAX C1/16BD: A8 TAY (Clear A, X and Y) C1/16BE: BD D2 7A LDA $7AD2,X C1/16C1: 99 AA 7A STA $7AAA,Y (store the enemy indices [sorted by starting Y-coordinate]) C1/16C4: C8 INY C1/16C5: E8 INX C1/16C6: E8 INX C1/16C7: E8 INX C1/16C8: E8 INX C1/16C9: C0 06 00 CPY #$0006 C1/16CC: D0 F0 BNE $16BE (loop for all 6 enemies) C1/16CE: 7B TDC C1/16CF: AA TAX C1/16D0: A8 TAY (Clear A, X and Y) C1/16D1: C2 20 REP #$20 (Set 16-bit Accumulator) C1/16D3: BD 30 81 LDA $8130,X (adjusted enemy height/8) C1/16D6: 29 FF 00 AND #$00FF (get just the height, not whatever's in byte after it) C1/16D9: 0A ASL C1/16DA: 0A ASL C1/16DB: 0A ASL (multiply by 8 to get actual height) C1/16DC: 18 CLC C1/16DD: 7D CF 80 ADC $80CF,X (add to enemy starting Y-coordinate) C1/16E0: 99 D0 7A STA $7AD0,Y (we now have the ending Y-coordinate of the enemy) C1/16E3: E8 INX C1/16E4: E8 INX C1/16E5: C8 INY C1/16E6: C8 INY C1/16E7: C8 INY C1/16E8: C8 INY C1/16E9: E0 0C 00 CPX #$000C C1/16EC: D0 E5 BNE $16D3 (loop for all 6 enemies) C1/16EE: 7B TDC C1/16EF: E2 20 SEP #$20 (Clear A, set to 8-bit) C1/16F1: 20 52 17 JSR $1752 (Sort the 7AD0 list by ENDING enemy Y-coordinate) C1/16F4: 7B TDC C1/16F5: AA TAX (Clear A and X) C1/16F6: A0 05 00 LDY #$0005 C1/16F9: BD D2 7A LDA $7AD2,X C1/16FC: 99 B0 7A STA $7AB0,Y (store the enemy indices [sorted by ending Y-coordinate] in REVERSE ORDER) C1/16FF: 88 DEY C1/1700: E8 INX C1/1701: E8 INX C1/1702: E8 INX C1/1703: E8 INX C1/1704: E0 18 00 CPX #$0018 C1/1707: D0 F0 BNE $16F9 (loop for all 6 enemies) C1/1709: 7B TDC C1/170A: A8 TAY (Clear A and Y) C1/170B: B9 86 7A LDA $7A86,Y (enemy formation index in "left enemy clump". should be 0 thru 5) C1/170E: 30 0B BMI $171B (if there is no enemy there, we have FFh. so branch) C1/1710: AA TAX C1/1711: BF 61 77 C1 LDA $C17761,X (get 2^x from table) C1/1715: 0D 79 7B ORA $7B79 C1/1718: 8D 79 7B STA $7B79 (so $7B79 is bit array of all enemies in left clump) C1/171B: B9 8C 7A LDA $7A8C,Y (get character index in "left character clump." should be 0 thru 3) C1/171E: 30 0B BMI $172B (if it's FFh, it's empty, so branch) C1/1720: AA TAX C1/1721: BF 61 77 C1 LDA $C17761,X (get 2^x) C1/1725: 0D 7A 7B ORA $7B7A C1/1728: 8D 7A 7B STA $7B7A (so $7B7A is bit array of all characters in left clump) C1/172B: B9 92 7A LDA $7A92,Y (enemy formation index in "right enemy clump", s/b 0 thru 5) C1/172E: 30 0B BMI $173B (if there's no enemy, it's FFh, so branch) C1/1730: AA TAX C1/1731: BF 61 77 C1 LDA $C17761,X (get 2^x) C1/1735: 0D 7B 7B ORA $7B7B C1/1738: 8D 7B 7B STA $7B7B (so $7B7B is bit array of all enemies in right clump) C1/173B: B9 98 7A LDA $7A98,Y (get character index in "right character clump", s/b 0 thru 3) C1/173E: 30 0B BMI $174B (if there's no character there, it's FFh, branch) C1/1740: AA TAX C1/1741: BF 61 77 C1 LDA $C17761,X (get 2^x) C1/1745: 0D 7C 7B ORA $7B7C C1/1748: 8D 7C 7B STA $7B7C (so $7B7C is bit array of all characters in right clump) C1/174B: C8 INY C1/174C: C0 06 00 CPY #$0006 C1/174F: D0 BA BNE $170B (loop for all 6 slots of all 4 clumps) C1/1751: 60 RTS
C1/1752 order enemies based on X or Y position
(Order enemies by their starting or ending X or Y-coordinate 7AD0 = X or Y coordinate (16 bits) 7AD2 = 0 thru 5 formation index? (16 bits) afterwards: $7AD0,X <= $7AD4,X <= $7AD8,X <= etc )
C1/1752: C2 20 REP #$20 (set 16-bit Accumulator) C1/1754: 7B TDC C1/1755: AA TAX (clear A and X) C1/1756: 64 10 STZ $10 C1/1758: A5 10 LDA $10 C1/175A: 9D D2 7A STA $7AD2,X (so 7AD0 = coordinate, 7AD2 = 0 thru 5 formation index?) C1/175D: E6 10 INC $10 C1/175F: E8 INX C1/1760: E8 INX C1/1761: E8 INX C1/1762: E8 INX C1/1763: E0 18 00 CPX #$0018 C1/1766: D0 F0 BNE $1758 (loop for all 6 monsters) C1/1768: 7B TDC C1/1769: AA TAX (Clear A and X) C1/176A: 64 14 STZ $14 (counter of how many enemy swaps we made?) C1/176C: BD D0 7A LDA $7AD0,X (get coordinate of enemy) C1/176F: DD D4 7A CMP $7AD4,X (does it match coordinate of next one?) C1/1772: F0 20 BEQ $1794 (if so, branch) C1/1774: 90 1E BCC $1794 (if it's less than coordinate of next enemy, also branch) C1/1776: E6 14 INC $14 (if the enemies compared weren't ordered by coordinate, increment counter) C1/1778: BD D4 7A LDA $7AD4,X C1/177B: 48 PHA (save coord of next enemy) C1/177C: BD D0 7A LDA $7AD0,X C1/177F: 9D D4 7A STA $7AD4,X (put current coord in coord for next enemy) C1/1782: 68 PLA C1/1783: 9D D0 7A STA $7AD0,X (put coord of next enemy in current one) C1/1786: BD D6 7A LDA $7AD6,X C1/1789: 48 PHA (save index of next enemy) C1/178A: BD D2 7A LDA $7AD2,X (now swap the 0 thru 5 index of current enemy with that of next one) C1/178D: 9D D6 7A STA $7AD6,X C1/1790: 68 PLA C1/1791: 9D D2 7A STA $7AD2,X C1/1794: E8 INX C1/1795: E8 INX C1/1796: E8 INX C1/1797: E8 INX C1/1798: E0 14 00 CPX #$0014 C1/179B: D0 CF BNE $176C (loop for first 5 enemies) C1/179D: A5 14 LDA $14 ($14 is greater than #$00 if the enemies are not in the correct order) C1/179F: D0 C7 BNE $1768 (if $14 is not #$00, repeat the whole sorting procedure) C1/17A1: 7B TDC (clear Accumulator) C1/17A2: E2 20 SEP #$20 (set 8-bit Accumulator) C1/17A4: 60 RTS
C1/17A5: 8B PHB (from C1/10F4, C1/10FD) C1/17A6: A900 LDA #$00 (Set programm bank to #$00) C1/17A8: 48 PHA C1/17A9: AB PLB C1/17AA: 8E1621 STX $2116 (X: Destination in VRAM) C1/17AD: C220 REP #$20 C1/17AF: A9EE01 LDA #$01EE (Store #$01EE in VRAM) C1/17B2: 8D1821 STA $2118 C1/17B5: 88 DEY (Decrement Y) C1/17B6: D0FA BNE $17B2 (Repeat until Y = 0) C1/17B8: 7B TDC (Clear accumulator) C1/17B9: E220 SEP #$20 (A = 8 bit) C1/17BB: AB PLB (Restore program bank) C1/17BC: 60 RTS
C1/17BD: A922 LDA #$22 C1/17BF: 8F402100 STA $002140 (APU I/O Register 1) C1/17C3: 6495 STZ $95 C1/17C5: 60 RTS
C1/17C6: A921 LDA #$21 (from only C1/183D) C1/17C8: 8F402100 STA $002140 (APU I/O Register 1) C1/17CC: 6494 STZ $94 C1/17CE: 60 RTS
C1/17CF: A920 LDA #$20 (from only C1/184B) C1/17D1: 8F402100 STA $002140 (APU I/O Register 1) C1/17D5: 6496 STZ $96 C1/17D7: 60 RTS
C1/17D8 unknow
C1/17D8: ADCA62 LDA $62CA (from only C1/1836) C1/17DB: 2903 AND #$03 C1/17DD: AA TAX C1/17DE: BD9861 LDA $6198,X C1/17E1: 18 CLC C1/17E2: 6928 ADC #$28 C1/17E4: 8F402100 STA $002140 C1/17E8: 6493 STZ $93 C1/17EA: 60 RTS
C1/17EB unknow
C1/17EB: 20EF17 JSR $17EF (from C2/E654) C1/17EE: 6B RTL
C1/17EF unknow
C1/17EF: 8DE9E9 STA $E9E9 (Store parameter 3 to $E9E9 if this's BDS 14) C1/17F2: A510 LDA $10 ($10 held parameter 2 if we're in BDS 14) C1/17F4: 8DEAE9 STA $E9EA (Store parameter 2 to $E9EA) C1/17F7: A918 LDA #$18 (Load #$18 into A) C1/17F9: 8DE8E9 STA $E9E8 (Store #$18 into $E9E8) C1/17FC: EEECE9 INC $E9EC (Increment $E9EC) C1/17FF: 60 RTS
C1/1800: ADEDE9 LDA $E9ED (from only C1/0CF7) C1/1803: D055 BNE $185A C1/1805: ADECE9 LDA $E9EC C1/1808: F019 BEQ $1823 C1/180A: ADEAE9 LDA $E9EA C1/180D: 8F422100 STA $002142 (APU I/O Register 3) C1/1811: ADE9E9 LDA $E9E9 C1/1814: 8F412100 STA $002141 (APU I/O Register 2) C1/1818: ADE8E9 LDA $E9E8 C1/181B: 8F402100 STA $002140 (APU I/O Register 1) C1/181F: 9CECE9 STZ $E9EC C1/1822: 60 RTS
C1/1823: AD8162 LDA $6281 (from only C1/1808) C1/1826: F00A BEQ $1832 C1/1828: A92C LDA #$2C C1/182A: 8F402100 STA $002140 (APU I/O Register 1) C1/182E: 9C8162 STZ $6281 C1/1831: 60 RTS
C1/1832: A593 LDA $93 (from only C1/1826) C1/1834: F003 BEQ $1839 C1/1836: 4CD817 JMP $17D8
C1/1839: A594 LDA $94 (from only C1/1832) C1/183B: F003 BEQ $1840 C1/183D: 4CC617 JMP $17C6
C1/1840: A595 LDA $95 (from only C1/183B) C1/1842: F003 BEQ $1847 C1/1844: 4CBD17 JMP $17BD
C1/1847: A596 LDA $96 (from only C1/1842) C1/1849: F003 BEQ $184E C1/184B: 4CCF17 JMP $17CF
C1/184E: A597 LDA $97 (from only C1/1849) C1/1850: F008 BEQ $185A C1/1852: A989 LDA #$89 C1/1854: 8F402100 STA $002140 (APU I/O Register 1) C1/1858: 6497 STZ $97 C1/185A: 60 RTS
C1/185B unknow
C1/185B: DA PHX C1/185C: A572 LDA $72 C1/185E: AA TAX C1/185F: E672 INC $72 C1/1861: BF00FDC0 LDA $C0FD00,X (Random number table) C1/1865: FA PLX C1/1866: 60 RTS
C1/1867 unknow
C1/1867: 6430 STZ $30 (from C1/3AA6, C1/3AB0, C1/89A7) C1/1869: 6432 STZ $32 C1/186B: 6434 STZ $34 C1/186D: A20800 LDX #$0008 C1/1870: 462C LSR $2C C1/1872: 900D BCC $1881 C1/1874: A530 LDA $30 C1/1876: 18 CLC C1/1877: 652E ADC $2E C1/1879: 8530 STA $30 C1/187B: A532 LDA $32 C1/187D: 6534 ADC $34 C1/187F: 8532 STA $32 C1/1881: 062E ASL $2E C1/1883: 2634 ROL $34 C1/1885: CA DEX C1/1886: D0E8 BNE $1870 C1/1888: 60 RTS
C1/1889 unknow
C1/1889: C220 REP #$20 C1/188B: 6430 STZ $30 C1/188D: 6432 STZ $32 C1/188F: 6434 STZ $34 C1/1891: A21000 LDX #$0010 C1/1894: 462C LSR $2C C1/1896: 900D BCC $18A5 C1/1898: A530 LDA $30 C1/189A: 18 CLC C1/189B: 652E ADC $2E C1/189D: 8530 STA $30 C1/189F: A532 LDA $32 C1/18A1: 6534 ADC $34 C1/18A3: 8532 STA $32 C1/18A5: 062E ASL $2E C1/18A7: 2634 ROL $34 C1/18A9: CA DEX C1/18AA: D0E8 BNE $1894 C1/18AC: 7B TDC C1/18AD: E220 SEP #$20 C1/18AF: 60 RTS
C1/18B0 unknow
C1/18B0: A600 LDX $00 C1/18B2: 8630 STX $30 C1/18B4: A20800 LDX #$0008 C1/18B7: 662E ROR $2E C1/18B9: 9007 BCC $18C2 C1/18BB: A52C LDA $2C C1/18BD: 18 CLC C1/18BE: 6531 ADC $31 C1/18C0: 8531 STA $31 C1/18C2: 6631 ROR $31 C1/18C4: 6630 ROR $30 C1/18C6: CA DEX C1/18C7: D0EE BNE $18B7 C1/18C9: 60 RTS
C1/18CA half multiplier
C1/18CA: 8F024200 STA $004202 C1/18CE: EB XBA C1/18CF: 8F034200 STA $004203 C1/18D3: 7B TDC C1/18D4: 60 RTS
C1/18D5 multiplier (JSL)
C1/18D5: 20D918 JSR $18D9 (from C2/BD70, C2/BB52) C1/18D8: 6B RTL
C1/18D9 multiplier
C1/18D9: A522 LDA $22 C1/18DB: 8F024200 STA $004202 C1/18DF: A524 LDA $24 C1/18E1: 8F034200 STA $004203 C1/18E5: C220 REP #$20 C1/18E7: C220 REP #$20 C1/18E9: EA NOP C1/18EA: AF164200 LDA $004216 C1/18EE: 8526 STA $26 (obviously, $26 holds the product) C1/18F0: 7B TDC C1/18F1: E220 SEP #$20 C1/18F3: 60 RTS
C1/18F4 unknow
C1/18F4: 6426 STZ $26 C1/18F6: 6428 STZ $28 C1/18F8: 642A STZ $2A C1/18FA: A20800 LDX #$0008 C1/18FD: 4622 LSR $22 C1/18FF: 900D BCC $190E C1/1901: A526 LDA $26 C1/1903: 18 CLC C1/1904: 6524 ADC $24 C1/1906: 8526 STA $26 C1/1908: A528 LDA $28 C1/190A: 652A ADC $2A C1/190C: 8528 STA $28 C1/190E: 0624 ASL $24 C1/1910: 262A ROL $2A C1/1912: CA DEX C1/1913: D0E8 BNE $18FD C1/1915: 60 RTS
C1/1916 unknow
C1/1916: DA PHX C1/1917: A2EE00 LDX #$00EE C1/191A: 8610 STX $10 C1/191C: FA PLX C1/191D: 8010 BRA $192F C1/191F: DA PHX C1/1920: A2EE02 LDX #$02EE C1/1923: 8610 STX $10 C1/1925: FA PLX C1/1926: 8007 BRA $192F C1/1928: DA PHX C1/1929: A2EE01 LDX #$01EE C1/192C: 8610 STX $10 C1/192E: FA PLX C1/192F: 8B PHB (conserve program bank) C1/1930: A900 LDA #$00 (set program bank to #$00) C1/1932: 48 PHA C1/1933: AB PLB C1/1934: 8E1621 STX $2116 (Set VRAM address: $0xEE, x ={0,1,2} ) C1/1937: C220 REP #$20 C1/1939: A510 LDA $10 (Store value in $10/$11 in the VRAM) C1/193B: 8D1821 STA $2118 C1/193E: 88 DEY (Repeat until Y = 0) C1/193F: D0FA BNE $193B C1/1941: 7B TDC C1/1942: E220 SEP #$20 C1/1944: AB PLB (restore program bank) C1/1945: 60 RTS
C1/1946 Fixed DMA for VRAM clearing
C1/1946: 8B PHB (from C1/104C, C1/1055) C1/1947: A900 LDA #$00 C1/1949: 48 PHA C1/194A: AB PLB C1/194B: 8C1621 STY $2116 (Y: VRAM Destination) C1/194E: 8E7543 STX $4375 (X: Data Size) C1/1951: A26D19 LDX #$196D C1/1954: 8E7243 STX $4372 (Source Data Address: $196D, see below) C1/1957: A909 LDA #$09 C1/1959: 8D7043 STA $4370 (Transfer settings: Fixed transfer) C1/195C: A918 LDA #$18 C1/195E: 8D7143 STA $4371 (DMA Destination: $(21)18 = VRAM) C1/1961: A9C1 LDA #$C1 C1/1963: 8D7443 STA $4374 (Source Data Bank: $1C, see below) C1/1966: A980 LDA #$80 C1/1968: 8D0B42 STA $420B (Activate DMA channel 7) C1/196B: AB PLB C1/196C: 60 RTS C1/196D: 0000 BRK #$00 (Data Bytes for Fixed Transfer)
C1/196F unknow
C1/196F: AD0080 LDA $8000 C1/1972: F014 BEQ $1988 C1/1974: AE0680 LDX $8006 C1/1977: 8636 STX $36 C1/1979: AE0180 LDX $8001 C1/197C: AC0480 LDY $8004 C1/197F: AD0380 LDA $8003 C1/1982: 202B1A JSR $1A2B C1/1985: 9C0080 STZ $8000 C1/1988: 60 RTS
C1/1989 unknow
The subroutine starting at $198D ends with a RTS, and thus cannot be accessed from any other bank, because it would leave remnants on the stack (JSL pushes three byte on the stack, RTS only pulls two). So, this is an adapter for accesses from other banks. Other banks jump here (pushes a long address on stack), this jumps to $198D (pushes the word address "$198C" on stack, the RTS at the end of $198D pulls the word-sized address and the RTL leads back where it originally came from.
C1/1989: 208D19 JSR $198D (from C2/A9F8) C1/198C: 6B RTL
C1/198D unknow
C1/198D: DA PHX (from C1/1989, C1/1F33, C1/24C5, C1/BEF4) C1/198E: 5A PHY C1/198F: 48 PHA C1/1990: A610 LDX $10 C1/1992: DA PHX C1/1993: AD0080 LDA $8000 C1/1996: F005 BEQ $199D C1/1998: 202A02 JSR $022A C1/199B: 80F6 BRA $1993 C1/199D: FA PLX C1/199E: 8E0880 STX $8008 C1/19A1: 68 PLA C1/19A2: 8D0380 STA $8003 C1/19A5: 7A PLY C1/19A6: 8C0480 STY $8004 C1/19A9: FA PLX C1/19AA: 8E0180 STX $8001 C1/19AD: 9C0A80 STZ $800A C1/19B0: C220 REP #$20 C1/19B2: AD0880 LDA $8008 C1/19B5: C90004 CMP #$0400 C1/19B8: F00A BEQ $19C4 C1/19BA: 9008 BCC $19C4 C1/19BC: A90004 LDA #$0400 C1/19BF: 8D0680 STA $8006 C1/19C2: 8006 BRA $19CA C1/19C4: 8D0680 STA $8006 C1/19C7: EE0A80 INC $800A C1/19CA: 7B TDC C1/19CB: E220 SEP #$20 C1/19CD: EE0080 INC $8000 C1/19D0: 202A02 JSR $022A C1/19D3: AD0080 LDA $8000 C1/19D6: D0F8 BNE $19D0 C1/19D8: C220 REP #$20 C1/19DA: AD0180 LDA $8001 C1/19DD: 18 CLC C1/19DE: 690004 ADC #$0400 C1/19E1: 8D0180 STA $8001 C1/19E4: AD0480 LDA $8004 C1/19E7: 18 CLC C1/19E8: 690002 ADC #$0200 C1/19EB: 8D0480 STA $8004 C1/19EE: AD0880 LDA $8008 C1/19F1: 38 SEC C1/19F2: E90004 SBC #$0400 C1/19F5: 8D0880 STA $8008 C1/19F8: 7B TDC C1/19F9: E220 SEP #$20 C1/19FB: AD0A80 LDA $800A C1/19FE: F0B0 BEQ $19B0 C1/1A00: 60 RTS
C1/1A01 unknow
C1/1A01: 01 C1/1A02: 02 C1/1A03: 04 C1/1A04: 08 C1/1A05: 10 C1/1A06: 20 C1/1A07: 40 C1/1A08: 80
C1/1A09 set bit according to Accumlator
The value in A must be between 0 and 7. According to that number, a value is loaded into A; the value has one bit set, the number of that bit is the same as the original value. So, if the original value is #$03, the resulting value is #$08 = #%0000.1000 (bit 4 is set), if the original value is #$10 = #%0001.0000 (bit 5 is set). Values higher than 7 make the subroutine consume itself: #$08 --> #$AA, #$09 --> #$BF, #$0A --> #$01 and so on.
C1/1A09: AA TAX (from C1/2C04) C1/1A0A: BF011AC1 LDA $C11A01,X C1/1A0E: 60 RTS
C1/1A0F unknow
C1/1A0F: A600 LDX $00 C1/1A11: 4A LSR A C1/1A12: B008 BCS $1A1C C1/1A14: E8 INX C1/1A15: E00800 CPX #$0008 C1/1A18: D0F7 BNE $1A11 C1/1A1A: 7B TDC C1/1A1B: 60 RTS
C1/1A1C: 8A TXA C1/1A1D: 2907 AND #$07 C1/1A1F: 60 RTS
C1/1A20 unknow
C1/1A20: 20241A JSR $1A24 C1/1A23: 60 RTS
C1/1A24 wait for NMI routine
C1/1A24: E647 INC $47 (from C1/01FD, C1/022C, C1/1A20) C1/1A26: A547 LDA $47 C1/1A28: D0FC BNE $1A26 C1/1A2A: 60 RTS
C1/1A2B VRAM DMA
When this is called, the following values have to be in the corresponding registers:
A: Contains the bank of the data that has to be transfered X: Contains the address of the data Y: Contains the VRAM destination for the data $36: Contains the Data Size
(from C1/0500, C1/1982, C1/1CE0) C1/1A2B: 8B PHB (conserve old bank on stack) C1/1A2C: 48 PHA (conserve value in A) C1/1A2D: A900 LDA #$00 (set program bank to $00, so the following DMA prep can be done with word addresses) C1/1A2F: 48 PHA C1/1A30: AB PLB C1/1A31: 68 PLA (restore old value in A) C1/1A32: 8C1621 STY $2116 (VRAM address) C1/1A35: 8E7243 STX $4372 (Data Source Address) C1/1A38: 8D7443 STA $4374 (Data Source Bank) C1/1A3B: A901 LDA #$01 C1/1A3D: 8D7043 STA $4370 (DMA transfer type) C1/1A40: A918 LDA #$18 C1/1A42: 8D7143 STA $4371 (transfer to $(21)18 --- VRAM) C1/1A45: A636 LDX $36 C1/1A47: 8E7543 STX $4375 ($36 contains the Data Size) C1/1A4A: A980 LDA #$80 C1/1A4C: 8D0B42 STA $420B (activate DMA channel 7) C1/1A4F: AB PLB (restore old program bank) C1/1A50: 60 RTS
C1/1A51 unknow
Does sixteen $20 byte sized DMAs. I'm not sure if it transfers always the same $20 bytes (as I guess), or if it transfers the subsequent $200 bytes. It depends if the value in $43x2 gets incremented by DMA or not.
C1/1A51: 8B PHB (conserve program bank) C1/1A52: 48 PHA (conserve value in A) C1/1A53: A900 LDA #$00 (set program bank to $00) C1/1A55: 48 PHA C1/1A56: AB PLB C1/1A57: 68 PLA (Restore old value of A) C1/1A58: 8E7243 STX $4372 (X: Source Data Address) C1/1A5B: 8D7443 STA $4374 (A: Source Data Bank) C1/1A5E: A901 LDA #$01 C1/1A60: 8D7043 STA $4370 (Transfer) C1/1A63: A918 LDA #$18 C1/1A65: 8D7143 STA $4371 (DMA destination: $(21)18 = VRAM) C1/1A68: C220 REP #$20 C1/1A6A: E210 SEP #$10 C1/1A6C: A020 LDY #$20 C1/1A6E: A280 LDX #$80 C1/1A70: A91000 LDA #$0010 (Setting up Loop counter value) C1/1A73: 8538 STA $38 C1/1A75: A536 LDA $36 C1/1A77: 8D1621 STA $2116 ($36 = Destination in VRAM) C1/1A7A: 8C7543 STY $4375 (Data Size: always #$20 bytes) C1/1A7D: 8E0B42 STX $420B (Activate DMA channel 7) C1/1A80: 18 CLC C1/1A81: 692000 ADC #$0020 C1/1A84: C638 DEC $38 C1/1A86: D0EF BNE $1A77 C1/1A88: 7B TDC C1/1A89: E220 SEP #$20 C1/1A8B: C210 REP #$10 C1/1A8D: AB PLB C1/1A8E: 60 RTS
C1/1A8F unknow
C1/1A8F: A600 LDX $00 C1/1A91: B569 LDA $69,X C1/1A93: 38 SEC C1/1A94: E568 SBC $68 C1/1A96: D00A BNE $1AA2 C1/1A98: A9FF LDA #$FF C1/1A9A: 9569 STA $69,X C1/1A9C: E8 INX C1/1A9D: E00300 CPX #$0003 C1/1AA0: D0EF BNE $1A91 C1/1AA2: 60 RTS
C1/1AA3 unknow
C1/1AA3: 80 96 98 00 (10,000,000) 40 42 0F 00 (1,000,000) A0 86 01 00 (100,000) 10 27 00 00 (10,000) E8 03 00 00 (1,000) 64 00 00 00 (100) 0A 00 00 00 (10)
C1/1ABF unknow
This turns the hexadecimal number in $10-2 into a decimal number. Each digit is stored in a register from $69 to $70. Keep in mind that the highest digit is stored in $69, the lowest in $70. Important: It is left to be found out what value is in $68. It is added to each digit.
C1/1ABF: 7B TDC C1/1AC0: AA TAX C1/1AC1: 9569 STA $69,X (clear $69 to $70) C1/1AC3: E8 INX C1/1AC4: E00800 CPX #$0008 C1/1AC7: D0F8 BNE $1AC1 C1/1AC9: A20000 LDX #$0000 (set up loop counter) C1/1ACC: DA PHX (push loop counter on tack) C1/1ACD: 8A TXA (transfer load index value in A) C1/1ACE: 0A ASL A C1/1ACF: 0A ASL A (multiply by 4 [each value from the table above is 4 bytes in size]) C1/1AD0: AA TAX (transfer back in X for the following loading commands) C1/1AD1: BFA31AC1 LDA $C11AA3,X (load divisor from the table above) C1/1AD5: 8514 STA $14 C1/1AD7: BFA41AC1 LDA $C11AA4,X C1/1ADB: 8515 STA $15 C1/1ADD: BFA51AC1 LDA $C11AA5,X C1/1AE1: 8516 STA $16 C1/1AE3: 20FC1A JSR $1AFC C1/1AE6: FA PLX (pull loop counter from stack) C1/1AE7: A518 LDA $18 (Load the division result) C1/1AE9: 18 CLC C1/1AEA: 6568 ADC $68 C1/1AEC: 9569 STA $69,X (Store it) C1/1AEE: E8 INX C1/1AEF: E00700 CPX #$0007 (loop is run seven times) C1/1AF2: D0D8 BNE $1ACC C1/1AF4: A510 LDA $10 (The modulu of the last division is the value of the last digit) C1/1AF6: 18 CLC C1/1AF7: 6568 ADC $68 C1/1AF9: 8570 STA $70 C1/1AFB: 60 RTS
C1/1AFC 24 bit division
This divides the 24 bit value in $10-2 by the 24 bit value in $14-6. The modulu remains in $10-2, the division result is stored in $18.
C1/1AFC: 6418 STZ $18 (from only C1/1AE3) C1/1AFE: A510 LDA $10 (subtracting a 24 bit value stored in $14-6 from a 24 bit value stored in $10-2) C1/1B00: 38 SEC C1/1B01: E514 SBC $14 C1/1B03: 8510 STA $10 C1/1B05: A511 LDA $11 C1/1B07: E515 SBC $15 C1/1B09: 8511 STA $11 C1/1B0B: A512 LDA $12 C1/1B0D: E516 SBC $16 C1/1B0F: 8512 STA $12 C1/1B11: E618 INC $18 C1/1B13: B0E9 BCS $1AFE (loop if carry is set) C1/1B15: C618 DEC $18 C1/1B17: A510 LDA $10 (add the value back on it) C1/1B19: 18 CLC C1/1B1A: 6514 ADC $14 C1/1B1C: 8510 STA $10 C1/1B1E: A511 LDA $11 C1/1B20: 6515 ADC $15 C1/1B22: 8511 STA $11 C1/1B24: A512 LDA $12 C1/1B26: 6516 ADC $16 C1/1B28: 8512 STA $12 C1/1B2A: 60 RTS
C1/1B2B unknow
C1/1B2B: C220 REP #$20 (from C1/693F, C1/6957, C1/A53F, C1/A663) C1/1B2D: 6422 STZ $22 C1/1B2F: 6424 STZ $24 C1/1B31: 6426 STZ $26 C1/1B33: 6428 STZ $28 C1/1B35: 8A TXA C1/1B36: 38 SEC C1/1B37: E9E803 SBC #$03E8 (Subtract 1000) C1/1B3A: 9005 BCC $1B41 (Branch if now less than 1000) C1/1B3C: E622 INC $22 (Increment the value for this digit) C1/1B3E: 4C361B JMP $1B36 (why not BRA?)
C1/1B41: 18 CLC C1/1B42: 69E803 ADC #$03E8 (Add 1000) C1/1B45: 38 SEC C1/1B46: E96400 SBC #$0064 (Subtract 100) C1/1B49: 9005 BCC $1B50 (Branch if now less than 100) C1/1B4B: E624 INC $24 (Increment the value for this digit) C1/1B4D: 4C451B JMP $1B45 (why not BRA?)
C1/1B50: 18 CLC C1/1B51: 696400 ADC #$0064 (Add 100) C1/1B54: 38 SEC C1/1B55: E90A00 SBC #$000A (Subtract 10) C1/1B58: 9005 BCC $1B5F (Branch if now less than 10) C1/1B5A: E626 INC $26 (Increment the value for this digit) C1/1B5C: 4C541B JMP $1B54 (why not BRA?)
C1/1B5F: 18 CLC C1/1B60: 690A00 ADC #$000A (Add 10) C1/1B63: 8528 STA $28 (Store the value for this digit) C1/1B65: 7B TDC C1/1B66: E220 SEP #$20 C1/1B68: A522 LDA $22 C1/1B6A: 18 CLC C1/1B6B: 6568 ADC $68 C1/1B6D: 8569 STA $69 C1/1B6F: A524 LDA $24 C1/1B71: 18 CLC C1/1B72: 6568 ADC $68 C1/1B74: 856A STA $6A C1/1B76: A526 LDA $26 C1/1B78: 18 CLC C1/1B79: 6568 ADC $68 C1/1B7B: 856B STA $6B C1/1B7D: A528 LDA $28 C1/1B7F: 18 CLC C1/1B80: 6568 ADC $68 C1/1B82: 856C STA $6C C1/1B84: 60 RTS
C1/1B85 unknow
C1/1B85: 8B PHB (from only C1/0D3B) C1/1B86: 7B TDC C1/1B87: 48 PHA C1/1B88: AB PLB C1/1B89: AFCA627E LDA $7E62CA C1/1B8D: 2903 AND #$03 C1/1B8F: 8F010200 STA $000201 C1/1B93: 220300C3 JSL $C30003 C1/1B97: AB PLB C1/1B98: A604 LDX $04 C1/1B9A: DA PHX C1/1B9B: A60A LDX $0A C1/1B9D: 8604 STX $04 C1/1B9F: FA PLX C1/1BA0: 860A STX $0A C1/1BA2: 8E6862 STX $6268 C1/1BA5: C220 REP #$20 C1/1BA7: AD6662 LDA $6266 C1/1BAA: 49FFFF EOR #$FFFF C1/1BAD: 2D6862 AND $6268 C1/1BB0: 29F0F0 AND #$F0F0 C1/1BB3: 8D6862 STA $6268 C1/1BB6: 8A TXA C1/1BB7: 290F0F AND #$0F0F C1/1BBA: 0D6862 ORA $6268 C1/1BBD: 8D6862 STA $6268 C1/1BC0: 8E6662 STX $6266 C1/1BC3: 7B TDC C1/1BC4: E220 SEP #$20 C1/1BC6: 60 RTS
C1/1BC7 unknow
C1/1BC7: 22DDD8C2 JSL $C2D8DD (from C1/D612, C1/F088) C1/1BCB: 60 RTS
C1/1BCC unknow
C1/1BCC: 226DDAC2 JSL $C2DA6D (from C1/E496, C1/E4FD) C1/1BD0: 60 RTS
C1/1BD1 unknow
C1/1BD1: 9CDFE9 STZ $E9DF (from C1/928A) C1/1BD4: 9CDEE9 STZ $E9DE C1/1BD7: EEDEE9 INC $E9DE C1/1BDA: 8006 BRA $1BE2 C1/1BDC: 9CDFE9 STZ $E9DF C1/1BDF: 9CDEE9 STZ $E9DE C1/1BE2: 9CDCE9 STZ $E9DC C1/1BE5: EEDCE9 INC $E9DC C1/1BE8: 9CDDE9 STZ $E9DD C1/1BEB: C9FF CMP #$FF C1/1BED: D003 BNE $1BF2 C1/1BEF: 4C771C JMP $1C77 C1/1BF2: 8522 STA $22 C1/1BF4: A906 LDA #$06 C1/1BF6: 8524 STA $24 C1/1BF8: 20D918 JSR $18D9 C1/1BFB: A626 LDX $26 C1/1BFD: A00010 LDY #$1000 C1/1C00: 20F51C JSR $1CF5 C1/1C03: E8 INX C1/1C04: A00018 LDY #$1800 C1/1C07: 20F51C JSR $1CF5 C1/1C0A: E8 INX C1/1C0B: EEDDE9 INC $E9DD C1/1C0E: A00048 LDY #$4800 C1/1C11: 20F51C JSR $1CF5 C1/1C14: E8 INX C1/1C15: A00060 LDY #$6000 C1/1C18: 207B1C JSR $1C7B C1/1C1B: E8 INX C1/1C1C: ADDFE9 LDA $E9DF C1/1C1F: D00B BNE $1C2C C1/1C21: ADDEE9 LDA $E9DE C1/1C24: D006 BNE $1C2C C1/1C26: A00064 LDY #$6400 C1/1C29: 207B1C JSR $1C7B C1/1C2C: E8 INX C1/1C2D: BF0000E7 LDA $E70000,X (Loads Unknown ) C1/1C31: 2980 AND #$80 C1/1C33: 8D8362 STA $6283 C1/1C36: BF0000E7 LDA $E70000,X (Loads Unknown ) C1/1C3A: 297F AND #$7F C1/1C3C: C220 REP #$20 C1/1C3E: 0A ASL A C1/1C3F: 0A ASL A C1/1C40: 0A ASL A C1/1C41: 0A ASL A C1/1C42: 0A ASL A C1/1C43: 8522 STA $22 C1/1C45: 0A ASL A C1/1C46: 18 CLC C1/1C47: 6522 ADC $22 C1/1C49: AA TAX C1/1C4A: 7B TDC C1/1C4B: E220 SEP #$20 C1/1C4D: A8 TAY C1/1C4E: ADDEE9 LDA $E9DE C1/1C51: F013 BEQ $1C66 C1/1C53: BF5001E7 LDA $E70150,X (Loads bottom battle background palatte X) C1/1C57: 99607E STA $7E60,Y C1/1C5A: 99607C STA $7C60,Y C1/1C5D: E8 INX C1/1C5E: C8 INY C1/1C5F: C04000 CPY #$0040 C1/1C62: D0EF BNE $1C53 C1/1C64: 8011 BRA $1C77 C1/1C66: BF5001E7 LDA $E70150,X (Loads bottom battle background palatte X) C1/1C6A: 99A07E STA $7EA0,Y C1/1C6D: 99A07C STA $7CA0,Y C1/1C70: E8 INX C1/1C71: C8 INY C1/1C72: C06000 CPY #$0060 C1/1C75: D0EF BNE $1C66 C1/1C77: 20E203 JSR $03E2 C1/1C7A: 60 RTS
C1/1C7B unknow
C1/1C7B: DA PHX (from C1/1C18, C1/1C29, C1/1DDE) C1/1C7C: 5A PHY C1/1C7D: BF0000E7 LDA $E70000,X (Loads Unknown) C1/1C81: C9FF CMP #$FF C1/1C83: F06D BEQ $1CF2 C1/1C85: 0A ASL A C1/1C86: AA TAX C1/1C87: BF4818E7 LDA $E71848,X C1/1C8B: 85F3 STA $F3 C1/1C8D: BF4918E7 LDA $E71849,X C1/1C91: 85F4 STA $F4 C1/1C93: A9E7 LDA #$E7 C1/1C95: 85F5 STA $F5 C1/1C97: 202F1E JSR $1E2F C1/1C9A: 5A PHY C1/1C9B: 226DFFC2 JSR $C2FF6D C1/1C9F: 7A PLY C1/1CA0: ADDEE9 LDA $E9DE C1/1CA3: F02C BEQ $1CD1 C1/1CA5: 8B PHB C1/1CA6: A97F LDA #$7F C1/1CA8: 48 PHA C1/1CA9: AB PLB C1/1CAA: 7B TDC C1/1CAB: AA TAX C1/1CAC: BD01C4 LDA $C401,X C1/1CAF: 1A INC A C1/1CB0: 1A INC A C1/1CB1: 38 SEC C1/1CB2: E908 SBC #$08 C1/1CB4: 9D01C4 STA $C401,X C1/1CB7: E8 INX C1/1CB8: E8 INX C1/1CB9: E00008 CPX #$0800 C1/1CBC: D0EE BNE $1CAC C1/1CBE: AB PLB C1/1CBF: A2C004 LDX #$04C0 C1/1CC2: 8610 STX $10 C1/1CC4: A97F LDA #$7F C1/1CC6: A200C4 LDX #$C400 C1/1CC9: A0A065 LDY #$65A0 C1/1CCC: 208D19 JSR $198D C1/1CCF: 8021 BRA $1CF2 C1/1CD1: ADDCE9 LDA $E9DC C1/1CD4: D00F BNE $1CE5 C1/1CD6: A20008 LDX #$0800 C1/1CD9: 8636 STX $36 C1/1CDB: A97F LDA #$7F C1/1CDD: A200C4 LDX #$C400 C1/1CE0: 202B1A JSR $1A2B C1/1CE3: 800D BRA $1CF2 C1/1CE5: A20008 LDX #$0800 C1/1CE8: 8610 STX $10 C1/1CEA: A97F LDA #$7F C1/1CEC: A200C4 LDX #$C400 C1/1CEF: 208D19 JSR $198D C1/1CF2: 7A PLY C1/1CF3: FA PLX C1/1CF4: 60 RTS
C1/1CF5 unknow
C1/1CF5: DA PHX C1/1CF6: 5A PHY C1/1CF7: BF0000E7 LDA $E70000,X (Loads Unknown) C1/1CFB: C9FF CMP #$FF C1/1CFD: D003 BNE $1D02 C1/1CFF: 4CAC1D JMP $1DAC C1/1D02: DA PHX C1/1D03: 297F AND #$7F C1/1D05: 85F3 STA $F3 C1/1D07: 0A ASL A C1/1D08: 18 CLC C1/1D09: 65F3 ADC $F3 C1/1D0B: AA TAX C1/1D0C: BF5016E7 LDA $E71650,X (Pointer to top battle background palettes) C1/1D10: 85F3 STA $F3 C1/1D12: BF5116E7 LDA $E71651,X C1/1D16: 85F4 STA $F4 C1/1D18: BF5216E7 LDA $E71652,X C1/1D1C: 85F5 STA $F5 C1/1D1E: C9E7 CMP #$E7 C1/1D20: 9002 BCC $1D24 C1/1D22: 8028 BRA $1D4C C1/1D24: 5A PHY C1/1D25: 8B PHB C1/1D26: A97F LDA #$7F C1/1D28: 48 PHA C1/1D29: AB PLB C1/1D2A: C220 REP #$20 C1/1D2C: 7B TDC C1/1D2D: A8 TAY C1/1D2E: B7F3 LDA [$F3],Y C1/1D30: 9900C4 STA $C400,Y C1/1D33: C8 INY C1/1D34: C8 INY C1/1D35: C00020 CPY #$2000 C1/1D38: D0F4 BNE $1D2E C1/1D3A: 7B TDC C1/1D3B: E220 SEP #$20 C1/1D3D: AB PLB C1/1D3E: A97F LDA #$7F C1/1D40: 8DF4E9 STA $E9F4 C1/1D43: A200C4 LDX #$C400 C1/1D46: 8EF2E9 STX $E9F2 C1/1D49: 7A PLY C1/1D4A: 8014 BRA $1D60 C1/1D4C: A97F LDA #$7F C1/1D4E: 8DF4E9 STA $E9F4 C1/1D51: A200C4 LDX #$C400 C1/1D54: 8EF2E9 STX $E9F2 C1/1D57: 202F1E JSR $1E2F C1/1D5A: 5A PHY C1/1D5B: 226DFFC2 JSR $C2FF6D C1/1D5F: 7A PLY C1/1D60: FA PLX C1/1D61: BF0000E7 LDA $E70000,X (Loads Unknown) C1/1D65: 3005 BMI $1D6C C1/1D67: A20010 LDX #$1000 C1/1D6A: 8003 BRA $1D6F C1/1D6C: A20020 LDX #$2000 C1/1D6F: ADDDE9 LDA $E9DD C1/1D72: F00B BEQ $1D7F C1/1D74: C220 REP #$20 C1/1D76: 8A TXA C1/1D77: 38 SEC C1/1D78: E92000 SBC #$0020 C1/1D7B: AA TAX C1/1D7C: 7B TDC C1/1D7D: E220 SEP #$20 C1/1D7F: ADDCE9 LDA $E9DC C1/1D82: D00D BNE $1D91 C1/1D84: 8636 STX $36 C1/1D86: AEF2E9 LDX $E9F2 C1/1D89: ADF4E9 LDA $E9F4 C1/1D8C: 202B1A JSR $1A2B C1/1D8F: 801B BRA $1DAC C1/1D91: 8610 STX $10 C1/1D93: ADDEE9 LDA $E9DE C1/1D96: F00B BEQ $1DA3 C1/1D98: C220 REP #$20 C1/1D9A: 98 TYA C1/1D9B: 18 CLC C1/1D9C: 690020 ADC #$2000 C1/1D9F: A8 TAY C1/1DA0: 7B TDC C1/1DA1: E220 SEP #$20 C1/1DA3: AEF2E9 LDX $E9F2 C1/1DA6: ADF4E9 LDA $E9F4 C1/1DA9: 208D19 JSR $198D C1/1DAC: 7A PLY C1/1DAD: FA PLX C1/1DAE: 60 RTS
C1/1DAF unknow
C1/1DAF: 9CDCE9 STZ $E9DC (from only C1/1112) C1/1DB2: 9CDDE9 STZ $E9DD C1/1DB5: 9CDEE9 STZ $E9DE C1/1DB8: ADB8EC LDA $ECB8 (battle background ID) C1/1DBB: 8522 STA $22 C1/1DBD: A906 LDA #$06 C1/1DBF: 8524 STA $24 C1/1DC1: 20D918 JSR $18D9 C1/1DC4: A626 LDX $26 C1/1DC6: A00010 LDY #$1000 C1/1DC9: 20F51C JSR $1CF5 C1/1DCC: E8 INX C1/1DCD: A00018 LDY #$1800 C1/1DD0: 20F51C JSR $1CF5 C1/1DD3: E8 INX C1/1DD4: A00048 LDY #$4800 C1/1DD7: 20F51C JSR $1CF5 C1/1DDA: E8 INX C1/1DDB: A00060 LDY #$6000 C1/1DDE: 207B1C JSR $1C7B C1/1DE1: E8 INX C1/1DE2: A00064 LDY #$6400 C1/1DE5: 207B1C JSR $1C7B C1/1DE8: E8 INX C1/1DE9: BF0000E7 LDA $E70000,X (Loads Unknown) C1/1DED: 2980 AND #$80 C1/1DEF: 8D8362 STA $6283 C1/1DF2: BF0000E7 LDA $E70000,X (Loads Unknown) C1/1DF6: 297F AND #$7F C1/1DF8: C220 REP #$20 C1/1DFA: 0A ASL A C1/1DFB: 0A ASL A C1/1DFC: 0A ASL A C1/1DFD: 0A ASL A C1/1DFE: 0A ASL A C1/1DFF: 8522 STA $22 C1/1E01: 0A ASL A C1/1E02: 18 CLC C1/1E03: 6522 ADC $22 C1/1E05: AA TAX C1/1E06: 7B TDC C1/1E07: E220 SEP #$20 C1/1E09: A8 TAY C1/1E0A: BF5001E7 LDA $E70150,X (Bottom battle background palettes) C1/1E0E: 99A07E STA $7EA0,Y C1/1E11: E8 INX C1/1E12: C8 INY C1/1E13: C06000 CPY #$0060 C1/1E16: D0F2 BNE $1E0A C1/1E18: C220 REP #$20 C1/1E1A: A9F057 LDA #$57F0 C1/1E1D: 8F162100 STA $002116 C1/1E21: A21000 LDX #$0010 C1/1E24: 7B TDC C1/1E25: 8F182100 STA $002118 C1/1E29: CA DEX C1/1E2A: D0F9 BNE $1E25 C1/1E2C: E220 SEP #$20 C1/1E2E: 60 RTS
C1/1E2F unknow
C1/1E2F: A900 LDA #$00 (from C1/1C97) C1/1E31: 85F6 STA $F6 C1/1E33: A9C4 LDA #$C4 C1/1E35: 85F7 STA $F7 C1/1E37: A97F LDA #$7F C1/1E39: 85F8 STA $F8 C1/1E3B: 60 RTS
C1/1E3C unknow
C1/1E3C: 7B TDC (from C1/1E7F) C1/1E3D: AA TAX C1/1E3E: 6424 STZ $24 C1/1E40: BDF480 LDA $80F4,X C1/1E43: 4A LSR A C1/1E44: 0524 ORA $24 C1/1E46: 6A ROR A C1/1E47: 8524 STA $24 C1/1E49: E8 INX C1/1E4A: E8 INX C1/1E4B: E00C00 CPX #$000C C1/1E4E: D0F0 BNE $1E40 C1/1E50: 4A LSR A C1/1E51: 4A LSR A C1/1E52: 8524 STA $24 C1/1E54: 60 RTS
C1/1E55 unknow
C1/1E55: 20591E JSR $1E59 (from C2/F93C) C1/1E58: 6B RTL
C1/1E59: 20F61F JSR $1FF6 (from C1/1E55) C1/1E5C: 4C261F JMP $1F26
C1/1E5F unknow
C1/1E5F: 20631E JSR $1E63 (from C2/F32B, C2/F881, C2/F8FA) C1/1E62: 6B RTL
C1/1E63: 48 PHA (from C1/1E5F, C1/AF85) C1/1E64: 20000F JSR $0F00 C1/1E67: 20F61F JSR $1FF6 C1/1E6A: 68 PLA C1/1E6B: 2D1E20 AND $201E (Remove any invalid monster targets) C1/1E6E: 2DAB61 AND $61AB C1/1E71: 2DE6E9 AND $E9E6 C1/1E74: 8524 STA $24 C1/1E76: 4C951E JMP $1E95 (branch would be better)
C1/1E79 unknow
C1/1E79: 20000F JSR $0F00 (from C1/B17C) C1/1E7C: 20F61F JSR $1FF6 C1/1E7F: 203C1E JSR $1E3C C1/1E82: A524 LDA $24 C1/1E84: 2D1E20 AND $201E (Remove any invalid monster targets) C1/1E87: 2DAB61 AND $61AB C1/1E8A: 2DE6E9 AND $E9E6 C1/1E8D: 2D9161 AND $6191 C1/1E90: 8524 STA $24 C1/1E92: 4C951E JMP $1E95 (totally useless)
C1/1E95 unknow
C1/1E95: A524 LDA $24 (from C1/1E76, C1/1E92) C1/1E97: 8522 STA $22 C1/1E99: 7B TDC C1/1E9A: AA TAX C1/1E9B: 6410 STZ $10 C1/1E9D: 4622 LSR $22 C1/1E9F: 9029 BCC $1ECA C1/1EA1: DA PHX C1/1EA2: A510 LDA $10 C1/1EA4: 9DFF80 STA $80FF,X C1/1EA7: 0A ASL A C1/1EA8: 0A ASL A C1/1EA9: 0A ASL A C1/1EAA: 0A ASL A C1/1EAB: 0A ASL A C1/1EAC: A8 TAY C1/1EAD: BDDB80 LDA $80DB,X C1/1EB0: 4A LSR A C1/1EB1: 0A ASL A C1/1EB2: 0A ASL A C1/1EB3: 0A ASL A C1/1EB4: 0A ASL A C1/1EB5: 0A ASL A C1/1EB6: AA TAX C1/1EB7: A920 LDA #$20 C1/1EB9: 8512 STA $12 C1/1EBB: BD007F LDA $7F00,X C1/1EBE: 99607E STA $7E60,Y C1/1EC1: E8 INX C1/1EC2: C8 INY C1/1EC3: C612 DEC $12 C1/1EC5: D0F4 BNE $1EBB C1/1EC7: E610 INC $10 C1/1EC9: FA PLX C1/1ECA: E8 INX C1/1ECB: E8 INX C1/1ECC: E00C00 CPX #$000C C1/1ECF: D0CC BNE $1E9D C1/1ED1: 7B TDC C1/1ED2: AA TAX C1/1ED3: 4624 LSR $24 C1/1ED5: 9043 BCC $1F1A C1/1ED7: BDC380 LDA $80C3,X (Get enemy's X-coord.) C1/1EDA: 4A LSR A C1/1EDB: 4A LSR A C1/1EDC: 4A LSR A C1/1EDD: 8514 STA $14 C1/1EDF: BDCF80 LDA $80CF,X C1/1EE2: 4A LSR A C1/1EE3: 4A LSR A C1/1EE4: 4A LSR A C1/1EE5: 8516 STA $16 C1/1EE7: BD2F81 LDA $812F,X (Get adjusted enemy width/8) C1/1EEA: 8510 STA $10 C1/1EEC: BD3081 LDA $8130,X (Get adjusted enemy height/8) C1/1EEF: 8512 STA $12 C1/1EF1: BDFF80 LDA $80FF,X C1/1EF4: 18 CLC C1/1EF5: 6903 ADC #$03 C1/1EF7: 0A ASL A C1/1EF8: 0A ASL A C1/1EF9: 8522 STA $22 C1/1EFB: BD0081 LDA $8100,X C1/1EFE: 0522 ORA $22 C1/1F00: 0903 ORA #$03 C1/1F02: 8519 STA $19 C1/1F04: BF74C4C2 LDA $C2C474,X C1/1F08: 8526 STA $26 C1/1F0A: BF75C4C2 LDA $C2C475,X C1/1F0E: 8527 STA $27 C1/1F10: A00200 LDY #$0002 C1/1F13: B126 LDA ($26),Y C1/1F15: 8518 STA $18 C1/1F17: 20831F JSR $1F83 C1/1F1A: E8 INX C1/1F1B: E8 INX C1/1F1C: E00C00 CPX #$000C C1/1F1F: D0B2 BNE $1ED3 C1/1F21: 60 RTS
C1/1F22 unknow
C1/1F22: 20261F JSR $1F26 (from C2/F332, C2/F885, C2/F8FE) C1/1F25: 6B RTL
C1/1F26: A2C004 LDX #$04C0 C1/1F29: 8610 STX $10 C1/1F2B: A27FA9 LDX #$A97F C1/1F2E: A97E LDA #$7E C1/1F30: A0000C LDY #$0C00 C1/1F33: 4C8D19 JMP $198D
C1/1F36 unknow
C1/1F36: DA PHX (from only C1/1F84) C1/1F37: A510 LDA $10 C1/1F39: 851E STA $1E C1/1F3B: A514 LDA $14 C1/1F3D: 18 CLC C1/1F3E: 6510 ADC $10 C1/1F40: C920 CMP #$20 C1/1F42: 9007 BCC $1F4B C1/1F44: A920 LDA #$20 C1/1F46: 38 SEC C1/1F47: E514 SBC $14 C1/1F49: 851E STA $1E C1/1F4B: A516 LDA $16 C1/1F4D: 18 CLC C1/1F4E: 6512 ADC $12 C1/1F50: C913 CMP #$13 C1/1F52: 9007 BCC $1F5B C1/1F54: A913 LDA #$13 C1/1F56: 38 SEC C1/1F57: E516 SBC $16 C1/1F59: 8512 STA $12 C1/1F5B: 6411 STZ $11 C1/1F5D: 6413 STZ $13 C1/1F5F: 6415 STZ $15 C1/1F61: 6417 STZ $17 C1/1F63: 641F STZ $1F C1/1F65: 6421 STZ $21 C1/1F67: C220 REP #$20 C1/1F69: A516 LDA $16 C1/1F6B: 0A ASL A C1/1F6C: 0A ASL A C1/1F6D: 0A ASL A C1/1F6E: 0A ASL A C1/1F6F: 0A ASL A C1/1F70: 0A ASL A C1/1F71: 0614 ASL $14 C1/1F73: 18 CLC C1/1F74: 6514 ADC $14 C1/1F76: 697FA9 ADC #$A97F C1/1F79: 851A STA $1A C1/1F7B: 0610 ASL $10 C1/1F7D: 061E ASL $1E C1/1F7F: E220 SEP #$20 C1/1F81: FA PLX C1/1F82: 60 RTS
C1/1F83 unknow
C1/1F83: DA PHX (from only C1/1F17) C1/1F84: 20361F JSR $1F36 C1/1F87: BDF380 LDA $80F3,X C1/1F8A: 5D7E61 EOR $617E,X C1/1F8D: 2901 AND #$01 C1/1F8F: D028 BNE $1FB9 C1/1F91: C220 REP #$20 C1/1F93: 7B TDC C1/1F94: A8 TAY C1/1F95: A518 LDA $18 C1/1F97: 911A STA ($1A),Y C1/1F99: 1A INC A C1/1F9A: C8 INY C1/1F9B: C8 INY C1/1F9C: C41E CPY $1E C1/1F9E: D0F7 BNE $1F97 C1/1FA0: A518 LDA $18 C1/1FA2: 18 CLC C1/1FA3: 691000 ADC #$0010 C1/1FA6: 8518 STA $18 C1/1FA8: A51A LDA $1A C1/1FAA: 18 CLC C1/1FAB: 694000 ADC #$0040 C1/1FAE: 851A STA $1A C1/1FB0: C612 DEC $12 C1/1FB2: D0DF BNE $1F93 C1/1FB4: 7B TDC C1/1FB5: E220 SEP #$20 C1/1FB7: FA PLX C1/1FB8: 60 RTS
C1/1FB9 unknow
C1/1FB9: C220 REP #$20 (from only C1/1F8F) C1/1FBB: A510 LDA $10 C1/1FBD: 4A LSR A C1/1FBE: 3A DEC A C1/1FBF: 18 CLC C1/1FC0: 6518 ADC $18 C1/1FC2: 090040 ORA #$4000 C1/1FC5: 8518 STA $18 C1/1FC7: 7B TDC C1/1FC8: A8 TAY C1/1FC9: A518 LDA $18 C1/1FCB: 911A STA ($1A),Y C1/1FCD: 3A DEC A C1/1FCE: C8 INY C1/1FCF: C8 INY C1/1FD0: C41E CPY $1E C1/1FD2: D0F7 BNE $1FCB C1/1FD4: A518 LDA $18 C1/1FD6: 18 CLC C1/1FD7: 691000 ADC #$0010 C1/1FDA: 8518 STA $18 C1/1FDC: A51A LDA $1A C1/1FDE: 18 CLC C1/1FDF: 694000 ADC #$0040 C1/1FE2: 851A STA $1A C1/1FE4: C612 DEC $12 C1/1FE6: D0DF BNE $1FC7 C1/1FE8: 7B TDC C1/1FE9: E220 SEP #$20 C1/1FEB: FA PLX C1/1FEC: 60 RTS
C1/1FED unknow
C1/1FED: C220 REP #$20 (from C1/940D, C1/B07E, C1/B096, C1/B19B) C1/1FEF: 7B TDC C1/1FF0: AA TAX C1/1FF1: A9EE01 LDA #$01EE C1/1FF4: 8007 BRA $1FFD
C1/1FF6 unknow
C1/1FF6: C220 REP #$20 (from C1/1E59, C1/1E67, C1/1E7C) C1/1FF8: 7B TDC C1/1FF9: AA TAX C1/1FFA: A9EE02 LDA #$02EE C1/1FFD: 9D7FA9 STA $A97F,X C1/2000: 9D17AA STA $AA17,X C1/2003: 9DAFAA STA $AAAF,X C1/2006: 9D47AB STA $AB47,X C1/2009: 9DDFAB STA $ABDF,X C1/200C: 9D77AC STA $AC77,X C1/200F: 9D0FAD STA $AD0F,X C1/2012: 9DA7AD STA $ADA7,X C1/2015: E8 INX C1/2016: E8 INX C1/2017: E09800 CPX #$0098 C1/201A: D0E1 BNE $1FFD C1/201C: 7B TDC C1/201D: E220 SEP #$20 C1/201F: 60 RTS