The current URL is datacrystal.tcrf.net.
Snoopy Concert/ROM map
The following article is a ROM map for Snoopy Concert.
Bank $00
$C0/0000 Boot Sequence
$C0/0000 E2 20 SEP #$20 ; A = 8 bit $C0/0002 C2 10 REP #$10 ; X/Y = 16 bit $C0/0004 A9 01 LDA #$01 ; Activate FastROM $C0/0006 8D 0D 42 STA $420D $C0/0009 A9 80 LDA #$80 ; FBLANK $C0/000B 8D 00 21 STA $2100 $C0/000E 9C 00 42 STZ $4200 ; Deactivate NMI/HIRQ/VIRQ/Auto Joypad Read $C0/0011 9C 0C 42 STZ $420C ; Deactivate HDMAs $C0/0014 9C 0B 42 STZ $420B ; Deactivate DMAs $C0/0017 9C 40 21 STZ $2140 ; Clear APU Communication Registers $C0/001A 9C 41 21 STZ $2141 $C0/001D 9C 42 21 STZ $2142 $C0/0020 9C 43 21 STZ $2143 $C0/0023 A2 FF 1F LDX #$1FFF ; Stack starts at $1FFF $C0/0026 9A TXS $C0/0027 C2 20 REP #$20 ; Set Direct Page to $0000 $C0/0029 A9 00 00 LDA #$0000 $C0/002C 48 PHA $C0/002D 2B PLD $C0/002E E2 20 SEP #$20 $C0/0030 A9 82 LDA #$82 ; Set Direct Bank to $82 $C0/0032 48 PHA $C0/0033 AB PLB $C0/0034 E2 20 SEP #$20 ; Probably unnecessary line $C0/0036 A2 00 E0 LDX #$E000 A:0082 X:1FFF Y:0000 P:eNvMxdIzC $C0/0039 A0 00 00 LDY #$0000 A:0082 X:E000 Y:0000 P:eNvMxdIzC $C0/003C A9 C0 LDA #$C0 A:0082 X:E000 Y:0000 P:envMxdIZC $C0/003E 85 11 STA $11 [$00:0011] A:00C0 X:E000 Y:0000 P:eNvMxdIzC $C0/0040 C2 20 REP #$20 A:00C0 X:E000 Y:0000 P:eNvMxdIzC $C0/0042 A9 73 00 LDA #$0073 A:00C0 X:E000 Y:0000 P:eNvmxdIzC $C0/0045 85 0F STA $0F [$00:000F] A:0073 X:E000 Y:0000 P:envmxdIzC $C0/0047 64 12 STZ $12 [$00:0012] A:0073 X:E000 Y:0000 P:envmxdIzC $C0/0049 B7 0F LDA [$0F],y[$C0:0073] A:0073 X:E000 Y:0000 P:envmxdIzC $C0/004B DF 00 00 7E CMP $7E0000,x[$7E:E000] A:6948 X:E000 Y:0000 P:envmxdIzC $C0/004F 9F 00 00 7E STA $7E0000,x[$7E:E000] A:6948 X:E000 Y:0000 P:envmxdIzC $C0/0053 F0 05 BEQ $05 [$005A] A:6948 X:E000 Y:0000 P:envmxdIzC $C0/0055 A9 01 00 LDA #$0001 A:6948 X:E000 Y:0000 P:envmxdIzC $C0/0058 85 12 STA $12 [$00:0012] A:0001 X:E000 Y:0000 P:envmxdIzC $C0/005A C8 INY A:0001 X:E000 Y:0000 P:envmxdIzC $C0/005B C8 INY A:0001 X:E000 Y:0001 P:envmxdIzC $C0/005C 98 TYA A:0001 X:E000 Y:0002 P:envmxdIzC $C0/005D 29 0F 00 AND #$000F A:0002 X:E000 Y:0002 P:envmxdIzC $C0/0060 A8 TAY A:0002 X:E000 Y:0002 P:envmxdIzC $C0/0061 E8 INX A:0002 X:E000 Y:0002 P:envmxdIzC $C0/0062 E8 INX A:0002 X:E001 Y:0002 P:eNvmxdIzC $C0/0063 D0 E4 BNE $E4 [$0049] A:0002 X:E002 Y:0002 P:eNvmxdIzC $C0/0065 A9 34 12 LDA #$1234 A:0000 X:0000 Y:0000 P:envmxdIZc $C0/0068 CD 04 01 CMP $0104 [$82:0104] A:1234 X:0000 Y:0000 P:envmxdIzc $C0/006B D0 16 BNE $16 [$0083] A:1234 X:0000 Y:0000 P:eNvmxdIzc
$C0/0083 C2 20 REP #$20 A:1234 X:0000 Y:0000 P:eNvmxdIzc $C0/0085 A9 00 00 LDA #$0000 ; Clear Loop for $7E/0000 to $7E/DFFF $C0/0088 AA TAX $C0/0089 9F 00 00 7E STA $7E0000,x $C0/008D E8 INX $C0/008E E8 INX $C0/008F E0 00 E0 CPX #$E000 $C0/0092 D0 F5 BNE $F5 ; [$0089] $C0/0094 AA TAX ; Clear Loop for whole Bank $7F $C0/0095 9F 00 00 7F STA $7F0000,x $C0/0099 E8 INX $C0/009A E8 INX $C0/009B D0 F8 BNE $F8 ; [$0095] $C0/009D 20 DE 01 JSR $01DE [$C0:01DE] A:0000 X:0000 Y:0000 P:envmxdIZC $C0/00A0 E2 20 SEP #$20 A:05E5 X:0000 Y:0003 P:envMXdIZC $C0/00A2 9C 06 01 STZ $0106 [$82:0106] A:05E5 X:0000 Y:0003 P:envMXdIZC $C0/00A5 9C 07 01 STZ $0107 [$82:0107] A:05E5 X:0000 Y:0003 P:envMXdIZC $C0/00A8 C2 20 REP #$20 A:05E5 X:0000 Y:0003 P:envMXdIZC $C0/00AA AD 04 01 LDA $0104 [$82:0104] A:05E5 X:0000 Y:0003 P:envmXdIZC $C0/00AD C9 34 12 CMP #$1234 A:0000 X:0000 Y:0003 P:envmXdIZC $C0/00B0 D0 07 BNE $07 [$00B9] A:0000 X:0000 Y:0003 P:eNvmXdIzc $C0/00B9 C2 20 REP #$20 A:0000 X:0000 Y:0003 P:eNvmXdIzc $C0/00BB A9 34 12 LDA #$1234 A:0000 X:0000 Y:0003 P:eNvmXdIzc $C0/00BE 8D 04 01 STA $0104 [$82:0104] A:1234 X:0000 Y:0003 P:envmXdIzc $C0/00C1 20 E9 00 JSR $00E9 ; Graphic Settings $C0/00C4 E2 20 SEP #$20 A:1234 X:0000 Y:0003 P:envmXdIzc $C0/00C6 A9 58 LDA #$58 A:1234 X:0000 Y:0003 P:envMXdIzc $C0/00C8 8D 0B 01 STA $010B [$82:010B] A:1258 X:0000 Y:0003 P:envMXdIzc $C0/00CB A9 02 LDA #$02 A:1258 X:0000 Y:0003 P:envMXdIzc $C0/00CD 8D 0C 01 STA $010C [$82:010C] A:1202 X:0000 Y:0003 P:envMXdIzc $C0/00D0 A9 C0 LDA #$C0 A:1202 X:0000 Y:0003 P:envMXdIzc $C0/00D2 8D 0D 01 STA $010D [$82:010D] A:12C0 X:0000 Y:0003 P:eNvMXdIzc $C0/00D5 20 22 09 JSR $0922 [$C0:0922] A:12C0 X:0000 Y:0003 P:eNvMXdIzc $C0/00D8 AD 08 01 LDA $0108 ; Deactivate NMI $C0/00DB 29 CF AND #$CF $C0/00DD 8D 00 42 STA $4200 $C0/00E0 8D 08 01 STA $0108 $C0/00E3 58 CLI ; Enable interrupts $C0/00E4 20 0D 0D JSR $0D0D [$C0:0D0D] A:1201 X:0000 Y:0003 P:envMXdizc
$C0/00E9 Graphic Settings
This subroutine sets a lot of screen settings. For more detail, see comments at $C0/00F4
$C0/00E9 22 C5 07 C0 JSL $C007C5 ; Set values of a number of registers
Arguments: $C0/00ED C0 F4 00 00 4E 00 ; Transfer #$4E data sets from $C0/00F4
$C0/00F3 60 RTS
$C0/00F4 Data for $C0/00E9
A whole lot of graphic settings, see $C0/00E9
$C0/00F4 00 42 01 ; Data Set #$01: Activate Auto Joypad Read, Deactivate NMI/HIRQ/VIRQ $C0/00F7 08 01 01 ; Data Set #$02: Update $4200 buffer, too $C0/00FA 16 40 00 ; Data Set #$03: Clear Joypad Input Register $C0/00FD 17 40 00 ; Data Set #$04: Clear Joypad Input Register $C0/0100 01 42 FF ; Data Set #$05: VBLANK Flag register... read only!? Unnecessary line? $C0/0103 02 42 00 ; Data Set #$06: Unused CPU Port? Unnecessary line? $C0/0106 03 42 00 ; Data Set #$07: Unused CPU Port? Unnecessary line? $C0/0109 04 42 00 ; Data Set #$08: Unused CPU Port? Unnecessary line? $C0/010C 05 42 00 ; Data Set #$09: Unused CPU Port? Unnecessary line? $C0/010F 06 42 00 ; Data Set #$0A: Unused CPU Port? Unnecessary line? $C0/0112 07 42 00 ; Data Set #$0B: Unused CPU Port? Unnecessary line? $C0/0115 08 42 00 ; Data Set #$0C: Unused CPU Port? Unnecessary line? $C0/0118 09 42 00 ; Data Set #$0D: Unused CPU Port? Unnecessary line? $C0/011B 0A 42 00 ; Data Set #$0E: Unused CPU Port? Unnecessary line? $C0/011E 0B 42 00 ; Data Set #$0F: Unused CPU Port? Unnecessary line? $C0/0121 0C 42 00 ; Data Set #$10: Unused CPU Port? Unnecessary line? $C0/0124 00 21 80 ; Data Set #$11: FBLANK $C0/0127 09 01 80 ; Data Set #$12: Update $2100 buffer, too $C0/012A 02 21 00 ; Data Set #$13: OAM Address $8000 $C0/012D 03 21 80 ; Data Set #$14: OAM Address $8000 $C0/0130 04 21 00 ; Data Set #$15: Write #$0000 to OAM $C0/0133 04 21 00 ; Data Set #$16: Write #$0000 to OAM $C0/0136 0D 21 00 ; Data Set #$17: BG1 H-Scroll = #$0000 $C0/0139 0D 21 00 ; Data Set #$18: BG1 H-Scroll = #$0000 $C0/013C 0E 21 00 ; Data Set #$19: BG1 V-Scroll = #$0000 $C0/013F 0E 21 00 ; Data Set #$1A: BG1 V-Scroll = #$0000 $C0/0142 0F 21 00 ; Data Set #$1B: BG2 H-Scroll = #$0000 $C0/0145 0F 21 00 ; Data Set #$1C: BG2 H-Scroll = #$0000 $C0/0148 10 21 00 ; Data Set #$1D: BG2 V-Scroll = #$0000 $C0/014B 10 21 00 ; Data Set #$1E: BG2 V-Scroll = #$0000 $C0/014E 11 21 00 ; Data Set #$1F: BG3 H-Scroll = #$0000 $C0/0151 11 21 00 ; Data Set #$20: BG3 H-Scroll = #$0000 $C0/0154 12 21 00 ; Data Set #$21: BG3 V-Scroll = #$0000 $C0/0157 12 21 00 ; Data Set #$22: BG3 V-Scroll = #$0000 $C0/015A 13 21 00 ; Data Set #$23: BG4 H-Scroll = #$0000 $C0/015D 13 21 00 ; Data Set #$24: BG4 H-Scroll = #$0000 $C0/0160 14 21 00 ; Data Set #$25: BG4 V-Scroll = #$0000 $C0/0163 14 21 00 ; Data Set #$26: BG4 V-Scroll = #$0000 $C0/0166 15 21 00 ; Data Set #$27: VRAM Settings $C0/0169 16 21 00 ; Data Set #$28: VRAM Address Low Byte $C0/016C 17 21 00 ; Data Set #$29: VRAM Address High Byte $C0/016F 18 21 00 ; Data Set #$2A: Write $0000 to VRAM $C0/0172 19 21 00 ; Data Set #$2B: Write $0000 to VRAM $C0/0175 1A 21 00 ; Data Set #$2C: Mode 7 - Clear Rotation Scaling Settings $C0/0178 1B 21 00 ; Data Set #$2D: Mode 7 - Rotation/Scaling Parameter A $C0/017B 1B 21 01 ; Data Set #$2E: Mode 7 - Rotation/Scaling Parameter A $C0/017E 1C 21 00 ; Data Set #$2F: Mode 7 - Rotation/Scaling Parameter B $C0/0181 1C 21 00 ; Data Set #$30: Mode 7 - Rotation/Scaling Parameter B $C0/0184 1D 21 00 ; Data Set #$31: Mode 7 - Rotation/Scaling Parameter C $C0/0187 1D 21 00 ; Data Set #$32: Mode 7 - Rotation/Scaling Parameter C $C0/018A 1E 21 00 ; Data Set #$33: Mode 7 - Rotation/Scaling Parameter D $C0/018D 1E 21 01 ; Data Set #$34: Mode 7 - Rotation/Scaling Parameter D $C0/0190 1F 21 00 ; Data Set #$35: Mode 7 - Rotation/Scaling Center Coordinate X $C0/0193 1F 21 00 ; Data Set #$36: Mode 7 - Rotation/Scaling Center Coordinate X $C0/0196 20 21 00 ; Data Set #$37: Mode 7 - Rotation/Scaling Center Coordinate Y $C0/0199 20 21 00 ; Data Set #$38: Mode 7 - Rotation/Scaling Center Coordinate Y $C0/019C 21 21 00 ; Data Set #$39: CGRAM Address: #$00 $C0/019F 22 21 00 ; Data Set #$3A: Write #$0000 to CGRAM (Pitchblack) $C0/01A2 22 21 00 ; Data Set #$3B: Write #$0000 to CGRAM (Pitchblack) $C0/01A5 23 21 00 ; Data Set #$3C: Window BG1/BG2 Mask Settings $C0/01A8 24 21 00 ; Data Set #$3D: Window BG3/BG4 Mask Settings $C0/01AB 25 21 00 ; Data Set #$3E: Window OBJ/MATH Mask Settings $C0/01AE 26 21 00 ; Data Set #$3F: Window 1 Left Position (X1) $C0/01B1 27 21 FF ; Data Set #$40: Window 1 Right Position (X2) $C0/01B4 28 21 00 ; Data Set #$41: Window 2 Left Position (X1) $C0/01B7 29 21 FF ; Data Set #$42: Window 2 Right Position (X2) $C0/01BA 2A 21 00 ; Data Set #$43: Window 1/2 Mask Logic (BG1-BG4) $C0/01BD 2B 21 00 ; Data Set #$44: Window 1/2 Mask Logic (OBJ/MATH) $C0/01C0 2C 21 00 ; Data Set #$45: Main Screen Designation $C0/01C3 2D 21 00 ; Data Set #$46: Main Screen Designation $C0/01C6 2E 21 00 ; Data Set #$47: Window Area Main Screen Disable $C0/01C9 2F 21 00 ; Data Set #$48: Window Area Sub Screen Disable $C0/01CC 30 21 00 ; Data Set #$49: Color Math Control Register A $C0/01CF 31 21 00 ; Data Set #$4A: Color Math Control Register B $C0/01D2 32 21 00 ; Data Set #$4B: Color Math Sub Screen Backdrop Color $C0/01D5 33 21 00 ; Data Set #$4C: Display Control 2 $C0/01D8 06 21 00 ; Data Set #$4D: Mosaic $C0/01DB 0A 01 00 ; Data Set #$4E: ? (Mosaic Buffer?)
This subroutine calls two other subroutines which are both (sound related
$C0/01DE E2 30 SEP #$30 ; A/X/Y = 8 bit $C0/01E0 20 E5 0A JSR $0AE5 [$C0:0AE5] A:0000 X:0000 Y:0000 P:envMXdIZC $C0/01E3 20 36 0B JSR $0B36 [$C0:0B36] A:00FF X:0087 Y:0000 P:envMXdIZC $C0/01E6 60 RTS
$C0/01E7 NMI Handler
$C0/01E7 C2 30 REP #$30 ; Buffer Direct Bank, Direct Page and A/X/Y on stack $C0/01E9 8B PHB $C0/01EA 0B PHD $C0/01EB 48 PHA $C0/01EC DA PHX $C0/01ED 5A PHY $C0/01EE E2 30 SEP #$30 ; A/X/Y = 8 bit $C0/01F0 A9 82 LDA #$82 ; Set Direct Bank to $82 $C0/01F2 48 PHA $C0/01F3 AB PLB $C0/01F4 AD 10 42 LDA $4210 ; Remove NMI flag $C0/01F7 A5 A9 LDA $A9 ; Check General Update flag (are there updates to do?) $C0/01F9 F0 03 BEQ $03 ; [$01FE] Branch if there are updates to do $C0/01FB 4C 58 02 JMP $0258 ; Jump to the exit if not $C0/01FE A5 AA LDA $AA ; Shall the VRAM Pipeline be worked off? $C0/0200 F0 03 BEQ $03 ; [$0205] Branch if not $C0/0202 20 62 02 JSR $0262 ; VRAM DMA Pipeline during NMI Handler
$C0/0205 A5 AB LDA $AB ; Has $2100 to be updated? $C0/0207 F0 0A BEQ $0A ; [$0213] Branch if not $C0/0209 A5 57 LDA $57 ; Load value for $2100 $C0/020B 8D 00 21 STA $2100 ; Set $2100 to it $C0/020E 8D 09 01 STA $0109 ; Store in buffer of current $2100 value $C0/0211 64 AB STZ $AB ; Remove $2100 update flag $C0/0213 A5 AC LDA $AC [$00:00AC] A:0480 X:0087 Y:0003 P:eNvMXdIzC $C0/0215 F0 0A BEQ $0A [$0221] A:0400 X:0087 Y:0003 P:envMXdIZC
code is missing here
$C0/0221 A5 AD LDA $AD ; Do the scroll registers have to be updated? $C0/0223 F0 03 BEQ $03 ; [$0228] Branch if not $C0/0225 20 D8 02 JSR $02D8 ; Update Scroll Registers $C0/0228 A5 AE LDA $AE ; Do the Mode 7 registers have to be updated? $C0/022A F0 03 BEQ $03 ; [$022F] Branch if not $C0/022C 20 2B 03 JSR $032B ; Update Mode 7 registers
$C0/022F A5 AF LDA $AF [$00:00AF] A:0400 X:0087 Y:0003 P:envMXdIZC $C0/0231 F0 03 BEQ $03 [$0236] A:0400 X:0087 Y:0003 P:envMXdIZC
code is missing here
$C0/0236 E2 20 SEP #$20 A:0400 X:0087 Y:0003 P:envMXdIZC $C0/0238 A5 B0 LDA $B0 ; Set HDMA flags $C0/023A 8D 0C 42 STA $420C
sound related
$C0/023D A5 B1 LDA $B1 [$00:00B1] A:0400 X:0087 Y:0003 P:envMXdIZC $C0/023F F0 03 BEQ $03 [$0244] A:0400 X:0087 Y:0003 P:envMXdIZC $C0/0241 20 85 03 JSR $0385 [$C0:0385] A:8001 X:00FF Y:0003 P:envMXdIzC $C0/0244 A5 B2 LDA $B2 ; Flag set to update Joypad Input registers? $C0/0246 F0 06 BEQ $06 ; [$024E] Branch if not $C0/0248 20 FD 03 JSR $03FD ; Buffer Joypad Inputs $C0/024B 20 9D 09 JSR $099D [$C0:099D] A:0000 X:0004 Y:0000 P:envMXdIZC
code is missing here
$C0/024E A5 B3 LDA $B3 [$00:00B3] A:0400 X:0087 Y:0003 P:envMXdIZC $C0/0250 F0 03 BEQ $03 [$0255] A:0400 X:0087 Y:0003 P:envMXdIZC
code is missing here
$C0/0255 20 18 04 JSR $0418 [$C0:0418] A:0400 X:0087 Y:0003 P:envMXdIZC $C0/0258 E6 B4 INC $B4 ; Increment Frame Counter(?) $C0/025A C2 30 REP #$30 ; Restore Direct Bank, Direct Page and A/X/Y $C0/025C 7A PLY $C0/025D FA PLX $C0/025E 68 PLA $C0/025F 2B PLD $C0/0260 AB PLB $C0/0261 40 RTI
$C0/0262 VRAM DMA Pipeline during NMI Handler
$C0/0262 A9 80 LDA #$80 A:2401 X:0062 Y:0000 P:envMXdIzC $C0/0264 8D 03 21 STA $2103 [$82:2103] A:2480 X:0062 Y:0000 P:eNvMXdIzC $C0/0267 9C 02 21 STZ $2102 [$82:2102] A:2480 X:0062 Y:0000 P:eNvMXdIzC $C0/026A A2 00 LDX #$00 A:2480 X:0062 Y:0000 P:eNvMXdIzC $C0/026C BD 0E 01 LDA $010E,x ; Has this slot a flag set that it is used? $C0/026F F0 54 BEQ $54 ; [$02C5] If not, branch (and exit) $C0/0271 9E 0E 01 STZ $010E,x ; Before working off, remove that flag of this slot $C0/0274 BD 0F 01 LDA $010F,x ; Build a 24-bit address in [$3F] out of the other three bytes of this slot $C0/0277 85 3F STA $3F $C0/0279 BD 10 01 LDA $0110,x $C0/027C 85 40 STA $40 $C0/027E BD 11 01 LDA $0111,x $C0/0281 85 41 STA $41 $C0/0283 A0 00 LDY #$00 A:2482 X:0000 Y:0000 P:eNvMXdIzC $C0/0285 B7 3F LDA [$3F],y[$82:8010] A:2482 X:0000 Y:0000 P:envMXdIZC $C0/0287 8D 00 43 STA $4300 [$82:4300] A:2402 X:0000 Y:0000 P:envMXdIzC $C0/028A C8 INY A:2402 X:0000 Y:0000 P:envMXdIzC $C0/028B B7 3F LDA [$3F],y[$82:8011] A:2402 X:0000 Y:0001 P:envMXdIzC $C0/028D 8D 01 43 STA $4301 [$82:4301] A:2404 X:0000 Y:0001 P:envMXdIzC $C0/0290 C8 INY A:2404 X:0000 Y:0001 P:envMXdIzC $C0/0291 B7 3F LDA [$3F],y[$82:8012] A:2404 X:0000 Y:0002 P:envMXdIzC $C0/0293 8D 02 43 STA $4302 [$82:4302] A:2407 X:0000 Y:0002 P:envMXdIzC $C0/0296 C8 INY A:2407 X:0000 Y:0002 P:envMXdIzC $C0/0297 B7 3F LDA [$3F],y[$82:8013] A:2407 X:0000 Y:0003 P:envMXdIzC $C0/0299 8D 03 43 STA $4303 [$82:4303] A:2422 X:0000 Y:0003 P:envMXdIzC $C0/029C C8 INY A:2422 X:0000 Y:0003 P:envMXdIzC $C0/029D B7 3F LDA [$3F],y[$82:8014] A:2422 X:0000 Y:0004 P:envMXdIzC $C0/029F 8D 04 43 STA $4304 [$82:4304] A:247E X:0000 Y:0004 P:envMXdIzC $C0/02A2 C8 INY A:247E X:0000 Y:0004 P:envMXdIzC $C0/02A3 B7 3F LDA [$3F],y[$82:8015] A:247E X:0000 Y:0005 P:envMXdIzC $C0/02A5 8D 05 43 STA $4305 [$82:4305] A:2420 X:0000 Y:0005 P:envMXdIzC $C0/02A8 C8 INY A:2420 X:0000 Y:0005 P:envMXdIzC $C0/02A9 B7 3F LDA [$3F],y[$82:8016] A:2420 X:0000 Y:0006 P:envMXdIzC $C0/02AB 8D 06 43 STA $4306 [$82:4306] A:2402 X:0000 Y:0006 P:envMXdIzC $C0/02AE C8 INY A:2402 X:0000 Y:0006 P:envMXdIzC $C0/02AF B7 3F LDA [$3F],y[$82:8017] A:2402 X:0000 Y:0007 P:envMXdIzC $C0/02B1 8D 16 21 STA $2116 [$82:2116] A:2453 X:0000 Y:0007 P:envMXdIzC $C0/02B4 C8 INY A:2453 X:0000 Y:0007 P:envMXdIzC $C0/02B5 B7 3F LDA [$3F],y[$82:8018] A:2453 X:0000 Y:0008 P:envMXdIzC $C0/02B7 8D 17 21 STA $2117 [$82:2117] A:2480 X:0000 Y:0008 P:eNvMXdIzC $C0/02BA C8 INY A:2480 X:0000 Y:0008 P:eNvMXdIzC $C0/02BB B7 3F LDA [$3F],y[$82:8019] A:2480 X:0000 Y:0009 P:envMXdIzC $C0/02BD 8D 15 21 STA $2115 [$82:2115] A:244F X:0000 Y:0009 P:envMXdIzC $C0/02C0 A9 01 LDA #$01 A:244F X:0000 Y:0009 P:envMXdIzC $C0/02C2 8D 0B 42 STA $420B [$82:420B] A:2401 X:0000 Y:0009 P:envMXdIzC $C0/02C5 E8 INX ; Increment Load Index four times to point to the next Pipeline slot $C0/02C6 E8 INX $C0/02C7 E8 INX $C0/02C8 E8 INX $C0/02C9 E0 40 CPX #$40 ; Was the maximum of Pipeline slots reached? $C0/02CB D0 9F BNE $9F ; [$026C] If not, loop $C0/02CD A9 80 LDA #$80 A:2400 X:0040 Y:0009 P:envMXdIZC $C0/02CF 8D 03 21 STA $2103 [$82:2103] A:2480 X:0040 Y:0009 P:eNvMXdIzC $C0/02D2 9C 02 21 STZ $2102 [$82:2102] A:2480 X:0040 Y:0009 P:eNvMXdIzC $C0/02D5 64 AA STZ $AA ; Clear Flag for this work off $C0/02D7 60 RTS
$C0/02D8 Update Scroll Registers
$C0/02D8 A5 61 LDA $61 ; Update BG1 H-Scroll Register $C0/02DA 8D 0D 21 STA $210D $C0/02DD A5 62 LDA $62 $C0/02DF 8D 0D 21 STA $210D $C0/02E2 A5 63 LDA $63 ; Update BG1 V-Scroll Register $C0/02E4 8D 0E 21 STA $210E $C0/02E7 A5 64 LDA $64 $C0/02E9 8D 0E 21 STA $210E $C0/02EC A5 65 LDA $65 ; Update BG2 H-Scroll Register $C0/02EE 8D 0F 21 STA $210F $C0/02F1 A5 66 LDA $66 $C0/02F3 8D 0F 21 STA $210F $C0/02F6 A5 67 LDA $67 ; Update BG2 V-Scroll Register $C0/02F8 8D 10 21 STA $2110 $C0/02FB A5 68 LDA $68 $C0/02FD 8D 10 21 STA $2110 $C0/0300 A5 69 LDA $69 ; Update BG3 H-Scroll Register $C0/0302 8D 11 21 STA $2111 $C0/0305 A5 6A LDA $6A $C0/0307 8D 11 21 STA $2111 $C0/030A A5 6B LDA $6B ; Update BG3 V-Scroll Register $C0/030C 8D 12 21 STA $2112 $C0/030F A5 6C LDA $6C $C0/0311 8D 12 21 STA $2112 $C0/0314 A5 6D LDA $6D ; Update BG4 H-Scroll Register $C0/0316 8D 13 21 STA $2113 $C0/0319 A5 6E LDA $6E $C0/031B 8D 13 21 STA $2113 $C0/031E A5 6F LDA $6F ; Update BG4 V-Scroll Register $C0/0320 8D 14 21 STA $2114 $C0/0323 A5 70 LDA $70 $C0/0325 8D 14 21 STA $2114 $C0/0328 64 AD STZ $AD ; Remove Flag for Scroll Register Update $C0/032A 60 RTS
$C0/032B Update Mode 7 registers
$C0/032B A5 71 LDA $71 [$00:0071] A:8585 X:0001 Y:0000 P:eNvMXdIzC $C0/032D 8D 1A 21 STA $211A [$82:211A] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0330 A5 72 LDA $72 [$00:0072] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0332 8D 1B 21 STA $211B [$82:211B] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0335 A5 73 LDA $73 [$00:0073] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0337 8D 1B 21 STA $211B [$82:211B] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/033A A5 74 LDA $74 [$00:0074] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/033C 8D 1C 21 STA $211C [$82:211C] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/033F A5 75 LDA $75 [$00:0075] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0341 8D 1C 21 STA $211C [$82:211C] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0344 A5 76 LDA $76 [$00:0076] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0346 8D 1D 21 STA $211D [$82:211D] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0349 A5 77 LDA $77 [$00:0077] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/034B 8D 1D 21 STA $211D [$82:211D] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/034E A5 78 LDA $78 [$00:0078] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0350 8D 1E 21 STA $211E [$82:211E] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0353 A5 79 LDA $79 [$00:0079] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0355 8D 1E 21 STA $211E [$82:211E] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0358 A5 7A LDA $7A [$00:007A] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/035A 8D 1F 21 STA $211F [$82:211F] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/035D A5 7B LDA $7B [$00:007B] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/035F 8D 1F 21 STA $211F [$82:211F] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0362 A5 7C LDA $7C [$00:007C] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0364 8D 20 21 STA $2120 [$82:2120] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0367 A5 7D LDA $7D [$00:007D] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/0369 8D 20 21 STA $2120 [$82:2120] A:8500 X:0001 Y:0000 P:envMXdIZC $C0/036C 64 AE STZ $AE ; Remove flag for Mode 7 Register update $C0/036E 60 RTS
$C0/0385 AE D0 01 LDX $01D0 [$82:01D0] A:8001 X:00FF Y:0003 P:envMXdIzC $C0/0388 EC CF 01 CPX $01CF [$82:01CF] A:8001 X:0000 Y:0003 P:envMXdIZC $C0/038B F0 16 BEQ $16 [$03A3] A:8001 X:0000 Y:0003 P:eNvMXdIzc $C0/038D BD 4E 01 LDA $014E,x[$82:014E] A:8001 X:0000 Y:0003 P:eNvMXdIzc $C0/0390 8D 40 21 STA $2140 [$82:2140] A:8002 X:0000 Y:0003 P:envMXdIzc $C0/0393 85 59 STA $59 [$00:0059] A:8002 X:0000 Y:0003 P:envMXdIzc $C0/0395 E8 INX A:8002 X:0000 Y:0003 P:envMXdIzc $C0/0396 8A TXA A:8002 X:0001 Y:0003 P:envMXdIzc $C0/0397 29 1F AND #$1F A:8001 X:0001 Y:0003 P:envMXdIzc $C0/0399 8D D0 01 STA $01D0 [$82:01D0] A:8001 X:0001 Y:0003 P:envMXdIzc $C0/039C A9 05 LDA #$05 A:8001 X:0001 Y:0003 P:envMXdIzc $C0/039E 8D CE 01 STA $01CE [$82:01CE] A:8005 X:0001 Y:0003 P:envMXdIzc $C0/03A1 80 45 BRA $45 ; [$03E8] Update APU register buffers
code is missing here
$C0/03E8 AD 40 21 LDA $2140 ; Update APU register buffers $C0/03EB 85 5D STA $5D $C0/03ED AD 41 21 LDA $2141 $C0/03F0 85 5E STA $5E $C0/03F2 AD 42 21 LDA $2142 $C0/03F5 85 5F STA $5F $C0/03F7 AD 43 21 LDA $2143 $C0/03FA 85 60 STA $60 $C0/03FC 60 RTS
$C0/03FD Buffer Joypad Inputs
$C0/03FD E2 30 SEP #$30 ; A/X/Y = 8 bit $C0/03FF AD 12 42 LDA $4212 ; Wait until Auto Joypad Read is done $C0/0402 29 01 AND #$01 $C0/0404 D0 F9 BNE $F9 ; [$03FF] $C0/0406 C2 20 REP #$20 ; A = 16 bit $C0/0408 A2 00 LDX #$00 ; Transfer Joypad Input into buffer registers at $7E-$81 $C0/040A BD 18 42 LDA $4218,x $C0/040D 95 7E STA $7E,x $C0/040F E8 INX $C0/0410 E8 INX $C0/0411 E0 04 CPX #$04 $C0/0413 D0 F5 BNE $F5 ; [$040A] $C0/0415 E2 20 SEP #$20 $C0/0417 60 RTS
$C0/0418 ?
$C0/0418 A5 BA LDA $BA [$00:00BA] A:0400 X:0087 Y:0003 P:envMXdIZC $C0/041A F0 1C BEQ $1C [$0438] A:0400 X:0087 Y:0003 P:envMXdIZC $C0/041C E6 BB INC $BB [$00:00BB] A:8001 X:0001 Y:0003 P:envMXdIzc $C0/041E A5 BB LDA $BB [$00:00BB] A:8001 X:0001 Y:0003 P:envMXdIzc $C0/0420 C9 01 CMP #$01 A:8001 X:0001 Y:0003 P:envMXdIzc $C0/0422 D0 14 BNE $14 [$0438] A:8001 X:0001 Y:0003 P:envMXdIZC $C0/0424 64 BB STZ $BB [$00:00BB] A:8001 X:0001 Y:0003 P:envMXdIZC $C0/0426 AD 09 01 LDA $0109 [$82:0109] A:8001 X:0001 Y:0003 P:envMXdIZC $C0/0429 18 CLC A:8000 X:0001 Y:0003 P:envMXdIZC $C0/042A 65 BD ADC $BD [$00:00BD] A:8000 X:0001 Y:0003 P:envMXdIZc $C0/042C 29 8F AND #$8F A:8001 X:0001 Y:0003 P:envMXdIzc $C0/042E 85 57 STA $57 [$00:0057] A:8001 X:0001 Y:0003 P:envMXdIzc $C0/0430 E6 AB INC $AB [$00:00AB] A:8001 X:0001 Y:0003 P:envMXdIzc $C0/0432 C6 BC DEC $BC [$00:00BC] A:8001 X:0001 Y:0003 P:envMXdIzc $C0/0434 D0 02 BNE $02 [$0438] A:8001 X:0001 Y:0003 P:envMXdIzc $C0/0436 64 BA STZ $BA [$00:00BA] A:800F X:0000 Y:0003 P:envMXdIZc $C0/0438 A5 B6 LDA $B6 [$00:00B6] A:0400 X:0087 Y:0003 P:envMXdIZC $C0/043A F0 1A BEQ $1A [$0456] A:0400 X:0087 Y:0003 P:envMXdIZC
code is missing here
$C0/0456 60 RTS
$C0/0545 Execute General Updates while VBLANK
This activates NMI while VBLANK, sets the General Update flag and waits for the next VBLANK, so all the updates that were prepared are done. Afterwards, this subroutine clears the General Update flag (but does NOT deactivate NMI!).
$C0/0545 08 PHP ; Buffer Flag register and A on stack $C0/0546 C2 20 REP #$20 $C0/0548 48 PHA $C0/0549 E2 20 SEP #$20 $C0/054B A9 01 LDA #$01 ; Set General Update flag $C0/054D 85 A9 STA $A9 $C0/054F AD 08 01 LDA $0108 ; Activate NMI $C0/0552 09 80 ORA #$80 $C0/0554 8D 00 42 STA $4200 $C0/0557 8D 08 01 STA $0108 $C0/055A 20 9E 05 JSR $059E ; Wait for VBLANK $C0/055D 64 A9 STZ $A9 ; Remove General Update flag $C0/055F C2 20 REP #$20 ; Restore Flag register and A $C0/0561 68 PLA $C0/0562 28 PLP $C0/0563 60 RTS
$C0/0564 Deactivate NMI
$C0/0564 08 PHP ; Buffer Flag register and A on stack $C0/0565 C2 20 REP #$20 $C0/0567 48 PHA $C0/0568 E2 20 SEP #$20 $C0/056A AD 08 01 LDA $0108 ; Clear NMI flag from $4200 and its value buffer $0108 $C0/056D 29 7F AND #$7F $C0/056F 8D 00 42 STA $4200 $C0/0572 8D 08 01 STA $0108 $C0/0575 C2 20 REP #$20 ; Restore Flag register and A $C0/0577 68 PLA $C0/0578 28 PLP $C0/0579 60 RTS
$C0/057A Activate FBLANK
Note that this subroutine does not set the flag for an $2100 update.
$C0/057A 08 PHP ; Buffer Flag register and A on stack $C0/057B C2 20 REP #$20 $C0/057D 48 PHA $C0/057E E2 20 SEP #$20 ; This takes the value that currently is in $2100 ($0109) ... $C0/0580 AD 09 01 LDA $0109 ; ... sets the MSB and stores it in $57, which is the buffer for... $C0/0583 09 80 ORA #$80 ; ... the value to be transfered to $2100. This deactivates the FBLANK $C0/0585 85 57 STA $57 $C0/0587 C2 20 REP #$20 ; Restore Flag register and A $C0/0589 68 PLA $C0/058A 28 PLP $C0/058B 60 RTS
$C0/058C Deactivate FBLANK
Note that this subroutine does not set the flag for an $2100 update.
$C0/058C 08 PHP ; Buffer Flag register and A on stack $C0/058D C2 20 REP #$20 $C0/058F 48 PHA $C0/0590 E2 20 SEP #$20 ; This takes the value that currently is in $2100 ($0109) ... $C0/0592 AD 09 01 LDA $0109 ; ... removes the MSB and stores it in $57, which is the buffer for... $C0/0595 29 7F AND #$7F ; ... the value to be transfered to $2100. This deactivates the FBLANK $C0/0597 85 57 STA $57 $C0/0599 C2 20 REP #$20 ; Restore Flag register and A $C0/059B 68 PLA $C0/059C 28 PLP $C0/059D 60 RTS
$C0/059E Wait for VBLANK
This subroutine waits until the Frame Counter gets incremented (which happens in the NMI handler)
$C0/059E 08 PHP ; Buffer Flag register/A on stack $C0/059F C2 20 REP #$20 $C0/05A1 48 PHA $C0/05A2 E2 20 SEP #$20 $C0/05A4 A5 B4 LDA $B4 $C0/05A6 C5 B4 CMP $B4 $C0/05A8 F0 FC BEQ $FC ; [$05A6] Loop until the Frame Counter has incremented $C0/05AA C2 20 REP #$20 ; Restore Flag register/A $C0/05AC 68 PLA $C0/05AD 28 PLP $C0/05AE 60 RTS
$C0/05EA Which buttons were pushed this frame?
This subroutine determines which buttons were pushed in this frame
$C0/05EA 08 PHP ; Buffer Flag register/A/X on stack $C0/05EB C2 30 REP #$30 $C0/05ED 48 PHA $C0/05EE DA PHX $C0/05EF E2 10 SEP #$10 ; X/Y = 8 bit $C0/05F1 A2 00 LDX #$00 ; Setup Loop Counter / Index $C0/05F3 B5 7E LDA $7E,x ; Load buffered raw Joypad Input of this frame $C0/05F5 55 82 EOR $82,x ; ($82,x contains the raw Joypad Input of last frame) $C0/05F7 35 7E AND $7E,x $C0/05F9 95 86 STA $86,x ; $86,x contains now every button that was pushed in this frame (not held!) $C0/05FB B5 7E LDA $7E,x ; Transfer this frames input in buffer for last frame's input $C0/05FD 95 82 STA $82,x $C0/05FF 74 7E STZ $7E,x ; After this, clear this frame's buffer $C0/0601 E8 INX ; Increment loop counter $C0/0602 E8 INX $C0/0603 E0 04 CPX #$04 $C0/0605 D0 EC BNE $EC ; [$05F3] Repeat this for the second controller, too $C0/0607 C2 30 REP #$30 $C0/0609 FA PLX ; Restore Flag register/A/X $C0/060A 68 PLA $C0/060B 28 PLP $C0/060C 60 RTS
$C0/07AE ?
$C0/07AE 08 PHP ; Buffer Flag register/A on stack $C0/07AF C2 20 REP #$20 $C0/07B1 48 PHA $C0/07B2 20 9E 05 JSR $059E ; Wait for VBLANK $C0/07B5 E2 20 SEP #$20 ; A = 8 bit $C0/07B7 A5 B6 LDA $B6 ; Loop until both $B6 and $BA = #$00 $C0/07B9 05 BA ORA $BA $C0/07BB D0 F5 BNE $F5 ; [$07B2] $C0/07BD 20 9E 05 JSR $059E ; Wait for VBLANK $C0/07C0 C2 20 REP #$20 ; Restore Flag register/A $C0/07C2 68 PLA $C0/07C3 28 PLP $C0/07C4 60 RTS
$C0/07C5 Tool: Set values of a number of registers
This subroutine is useful if you have a number of single byte values that you want to store in registers that are scattered on the same bank. It works off a number of "data sets". These sets consist of three bytes: two bytes address on that particular bank and the value for it. Can be used for WRAM addresses or Registers.
The bytes after the Jump Command to this subroutine are the data for this subroutine:
1st byte: Bank for 24-bit Load address (address of the data sets) 2nd byte: Address Low Byte for 24-bit Load address 3rd byte: Address High Byte for 24-bit Load address 4th byte: Bank for 24-bit Store address (Bank on which the store addresses are) 5th byte: Number of data sets to do, Low Byte 6th byte: Number of data sets to do, High Byte
Please take care that the 24-bit address is not in order: Bank, Low Byte, High Byte.
$C0/07C5 08 PHP ; Buffer Flag register/A/X/Y on stack $C0/07C6 C2 30 REP #$30 $C0/07C8 48 PHA $C0/07C9 DA PHX $C0/07CA 5A PHY $C0/07CB E2 20 SEP #$20 ; A = 8 bit (X/Y = 16 bit) $C0/07CD BA TSX ; Load Return Address from Stack $C0/07CE B5 08 LDA $08,x $C0/07D0 85 00 STA $00 ; Store original Return Address in $00 as 24-bit Load Address $C0/07D2 18 CLC ; Add #$06 to Return Address and store it back on stack $C0/07D3 69 06 ADC #$06 ; (This way, the bytes following the Jump Command are left out) $C0/07D5 95 08 STA $08,x ; (These bytes are data for this subroutine) $C0/07D7 B5 09 LDA $09,x ; Load upper byte of the Return Address from Stack $C0/07D9 85 01 STA $01 ; Store it in $01 as 24-bit Load Address $C0/07DB 69 00 ADC #$00 ; Add Carry (if set) $C0/07DD 95 09 STA $09,x ; Store back for new Return Address $C0/07DF B5 0A LDA $0A,x ; Load Return Address Bank in $02 as 24-bit Load Address $C0/07E1 85 02 STA $02 $C0/07E3 E2 10 SEP #$10 ; Build an 24-bit load address in $03 out of the first three data bytes $C0/07E5 A0 01 LDY #$01 $C0/07E7 B7 00 LDA [$00],y $C0/07E9 85 05 STA $05 $C0/07EB C8 INY $C0/07EC C2 20 REP #$20 $C0/07EE B7 00 LDA [$00],y $C0/07F0 85 03 STA $03 $C0/07F2 C8 INY $C0/07F3 C8 INY $C0/07F4 E2 20 SEP #$20 ; 4th data byte is used as Bank of the 24-bit Store Address in $06-$08 $C0/07F6 B7 00 LDA [$00],y $C0/07F8 85 08 STA $08 $C0/07FA C8 INY $C0/07FB C2 20 REP #$20 ; Next double-byte is loaded and multiplied by 3 $C0/07FD B7 00 LDA [$00],y ; (It's the number of data sets to do. Each data set is 3 bytes in size) $C0/07FF 0A ASL A ; (This way, the number of bytes is stored in $09/$0A) $C0/0800 18 CLC ; (It is used as a Compare Value for the Store Index later) $C0/0801 77 00 ADC [$00],y $C0/0803 85 09 STA $09 $C0/0805 C2 10 REP #$10 ; X/Y = 16 bit (A already is 16 bit) $C0/0807 A0 00 00 LDY #$0000 ; Setup Load Index $C0/080A C2 20 REP #$20 ; A = 16 bit (this is part of a loop, so it's not unnecessary) $C0/080C B7 03 LDA [$03],y ; Load first double-byte of data set $C0/080E 85 06 STA $06 ; Store as part of the 24-bit Store Address $C0/0810 C8 INY ; Increment Load Index twice $C0/0811 C8 INY $C0/0812 E2 20 SEP #$20 ; Transfer data set value to its destination $C0/0814 B7 03 LDA [$03],y $C0/0816 87 06 STA [$06] $C0/0818 C8 INY ; Increment Load Index $C0/0819 C4 09 CPY $09 ; Does the Load Index have reached its limit? $C0/081B D0 ED BNE $ED ; [$080A] Loop if not $C0/081D C2 20 REP #$20 ; Restore Flag register/A/X/Y $C0/081F 7A PLY $C0/0820 FA PLX $C0/0821 68 PLA $C0/0822 28 PLP $C0/0823 6B RTL
$C0/0824 Setup DMA
This subroutine sets up an DMA. The bytes after the Jump Command to this subroutine are the data for this subroutine:
1st byte: No. of the DMA channel to use (0-7) 2nd byte: $43x0 - DMA Settings 3rd byte: $43x1 - I/O-Bus address ($21xx) 4th byte: $43x4 - Bank 5th byte: $43x2 - Address - Low Byte 6th byte: $43x3 - Address - High Byte 7th byte: $43x5 - Number of Bytes to transfer - Low Byte 8th byte: $43x6 - Number of Bytes to transfer - High Byte
This subroutine does not change A/X/Y
$C0/0824 08 PHP ; Buffer Flag register/A/X/Y on stack $C0/0825 C2 30 REP #$30 $C0/0827 48 PHA $C0/0828 DA PHX $C0/0829 5A PHY $C0/082A E2 20 SEP #$20 ; A = 8 bit (X/Y = 16 bit) $C0/082C BA TSX ; Load Return Address from Stack $C0/082D B5 08 LDA $08,x $C0/082F 85 00 STA $00 ; Store original Return Address in $00 as 24-bit Load Address $C0/0831 18 CLC ; Add #$08 to Return Address and store it back on stack $C0/0832 69 08 ADC #$08 ; (This way, the bytes following the Jump Command are left out) $C0/0834 95 08 STA $08,x ; (These bytes are data for this subroutine) $C0/0836 B5 09 LDA $09,x ; Load upper byte of the Return Address from Stack $C0/0838 85 01 STA $01 ; Store it in $01 as 24-bit Load Address $C0/083A 69 00 ADC #$00 ; Add Carry (if set) $C0/083C 95 09 STA $09,x ; Store back for new Return Address $C0/083E B5 0A LDA $0A,x ; Load Return Address Bank in $02 as 24-bit Load Address $C0/0840 85 02 STA $02 $C0/0842 E2 10 SEP #$10 ; X/Y = 8 bit $C0/0844 A0 01 LDY #$01 ; Use Y as Load Counter $C0/0846 B7 00 LDA [$00],y ; Load 1st byte (No. of the DMA Channel to use) $C0/0848 0A ASL A ; No. * #$10 = Store Index $C0/0849 0A ASL A $C0/084A 0A ASL A $C0/084B 0A ASL A $C0/084C AA TAX ; Transfer Store Index in X $C0/084D C8 INY ; Increment Load Index $C0/084E B7 00 LDA [$00],y ; Load 2nd byte $C0/0850 9D 00 43 STA $4300,x ; Set as DMA Settings $C0/0853 C8 INY ; Increment Load Index $C0/0854 B7 00 LDA [$00],y ; Load 3rd byte $C0/0856 9D 01 43 STA $4301,x ; Set as $21xx address $C0/0859 C8 INY ; Increment Load Index $C0/085A B7 00 LDA [$00],y ; Load 4th byte $C0/085C 9D 04 43 STA $4304,x ; Set as Bank $C0/085F C8 INY ; Increment Load Index $C0/0860 B7 00 LDA [$00],y ; Load 5th byte $C0/0862 9D 02 43 STA $4302,x ; Set as address Low Byte $C0/0865 C8 INY ; Increment Load Index $C0/0866 B7 00 LDA [$00],y ; Load 6th byte $C0/0868 9D 03 43 STA $4303,x ; Set as address High Byte $C0/086B C8 INY ; Increment Load Index $C0/086C B7 00 LDA [$00],y ; Load 7th byte $C0/086E 9D 05 43 STA $4305,x ; Set as DMA Size Low Byte $C0/0871 C8 INY ; Increment Load Index $C0/0872 B7 00 LDA [$00],y ; Load 8th byte $C0/0874 9D 06 43 STA $4306,x ; Set as DMA Size High Byte $C0/0877 C2 30 REP #$30 ; Restore Flag register/A/X/Y $C0/0879 7A PLY $C0/087A FA PLX $C0/087B 68 PLA $C0/087C 28 PLP $C0/087D 6B RTL
Probably this subroutine is for clearing sound related registers?
$C0/0AE5 08 PHP ; Buffer Flag Register value on stack $C0/0AE6 E2 30 SEP #$30 ; A/X/Y = 8 bit $C0/0AE8 64 B1 STZ $B1 [$00:00B1] A:0000 X:0000 Y:0000 P:envMXdIZC $C0/0AEA A2 88 LDX #$88 A:0000 X:0000 Y:0000 P:envMXdIZC $C0/0AEC 9E 4E 01 STZ $014E,x[$82:01D6] A:0000 X:0088 Y:0000 P:eNvMXdIzC $C0/0AEF CA DEX A:0000 X:0088 Y:0000 P:eNvMXdIzC $C0/0AF0 10 FA BPL $FA [$0AEC] A:0000 X:0087 Y:0000 P:eNvMXdIzC $C0/0AF2 A9 FF LDA #$FF A:0000 X:0087 Y:0000 P:eNvMXdIzC $C0/0AF4 8D D7 01 STA $01D7 [$82:01D7] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0AF7 8D D8 01 STA $01D8 [$82:01D8] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0AFA 8D D9 01 STA $01D9 [$82:01D9] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0AFD 9C 40 21 STZ $2140 ; Clear APU Registers $C0/0B00 9C 41 21 STZ $2141 $C0/0B03 9C 42 21 STZ $2142 $C0/0B06 9C 43 21 STZ $2143 $C0/0B09 64 59 STZ $59 [$00:0059] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0B0B 64 5D STZ $5D ; Clear $2140 current value buffer (APU buffer) $C0/0B0D 64 5A STZ $5A [$00:005A] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0B0F 64 5E STZ $5E ; Clear $2141 current value buffer (APU buffer) $C0/0B11 64 5B STZ $5B [$00:005B] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0B13 64 5F STZ $5F ; Clear $2142 current value buffer (APU buffer) $C0/0B15 64 5C STZ $5C [$00:005C] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0B17 64 60 STZ $60 ; Clear $2143 current value buffer (APU buffer) $C0/0B19 9C D0 01 STZ $01D0 [$82:01D0] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0B1C 9C CF 01 STZ $01CF [$82:01CF] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0B1F 9C D2 01 STZ $01D2 [$82:01D2] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0B22 9C D1 01 STZ $01D1 [$82:01D1] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0B25 9C D4 01 STZ $01D4 [$82:01D4] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0B28 9C D3 01 STZ $01D3 [$82:01D3] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0B2B 9C D6 01 STZ $01D6 [$82:01D6] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0B2E 9C D5 01 STZ $01D5 [$82:01D5] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0B31 9C DA 01 STZ $01DA [$82:01DA] A:00FF X:0087 Y:0000 P:eNvMXdIzC $C0/0B34 28 PLP ; Restore Flag Register value $C0/0B35 60 RTS
$C0/0B36 08 PHP ; Buffer Flag Register value on stack $C0/0B37 E2 30 SEP #$30 ; A/X/Y = 8 bit $C0/0B39 64 B1 STZ $B1 [$00:00B1] A:00FF X:0087 Y:0000 P:envMXdIZC $C0/0B3B A9 00 LDA #$00 A:00FF X:0087 Y:0000 P:envMXdIZC $C0/0B3D 85 4B STA $4B [$00:004B] A:0000 X:0087 Y:0000 P:envMXdIZC $C0/0B3F A9 CC LDA #$CC A:0000 X:0087 Y:0000 P:envMXdIZC $C0/0B41 85 53 STA $53 [$00:0053] A:00CC X:0087 Y:0000 P:eNvMXdIzC $C0/0B43 A9 FE LDA #$FE A:00CC X:0087 Y:0000 P:eNvMXdIzC $C0/0B45 8D 40 21 STA $2140 [$82:2140] A:00FE X:0087 Y:0000 P:eNvMXdIzC $C0/0B48 C2 20 REP #$20 ; Wait for signal that APU has booted $C0/0B4A A9 AA BB LDA #$BBAA $C0/0B4D CD 40 21 CMP $2140 $C0/0B50 D0 FB BNE $FB ; [$0B4D] $C0/0B52 20 DF 0B JSR $0BDF [$C0:0BDF] A:BBAA X:0087 Y:0000 P:envmXdIZC $C0/0B55 C2 20 REP #$20 A:00FF X:0000 Y:0003 P:envmxdIZC $C0/0B57 AF 11 00 C5 LDA $C50011[$C5:0011] A:00FF X:0000 Y:0003 P:envmxdIZC $C0/0B5B 85 4B STA $4B [$00:004B] A:011D X:0000 Y:0003 P:envmxdIzC $C0/0B5D E2 20 SEP #$20 A:011D X:0000 Y:0003 P:envmxdIzC $C0/0B5F AF 13 00 C5 LDA $C50013[$C5:0013] A:011D X:0000 Y:0003 P:envMxdIzC $C0/0B63 85 4D STA $4D [$00:004D] A:01C5 X:0000 Y:0003 P:eNvMxdIzC $C0/0B65 9C 41 21 STZ $2141 [$82:2141] A:01C5 X:0000 Y:0003 P:eNvMxdIzC $C0/0B68 C2 20 REP #$20 A:01C5 X:0000 Y:0003 P:eNvMxdIzC $C0/0B6A A9 00 05 LDA #$0500 A:01C5 X:0000 Y:0003 P:eNvmxdIzC $C0/0B6D 8D 42 21 STA $2142 [$82:2142] A:0500 X:0000 Y:0003 P:envmxdIzC $C0/0B70 E2 20 SEP #$20 A:0500 X:0000 Y:0003 P:envmxdIzC $C0/0B72 A5 53 LDA $53 [$00:0053] A:0500 X:0000 Y:0003 P:envMxdIzC $C0/0B74 8D 40 21 STA $2140 [$82:2140] A:05E5 X:0000 Y:0003 P:eNvMxdIzC $C0/0B77 CD 40 21 CMP $2140 [$82:2140] A:05E5 X:0000 Y:0003 P:eNvMxdIzC $C0/0B7A D0 FB BNE $FB [$0B77] A:05E5 X:0000 Y:0003 P:envMxdIzC $C0/0B7C E2 20 SEP #$20 ; UNNECESSARY LINE? $C0/0B7E 28 PLP ; Restore Flag Register value $C0/0B7F 60 RTS
$C0/0C95 08 PHP ; Buffer Flag register value on stack $C0/0C96 E2 30 SEP #$30 ; A/X/Y = 8 bit $C0/0C98 64 B1 STZ $B1 [$00:00B1] A:12FF X:0087 Y:0003 P:eNvMXdizc $C0/0C9A 9C 40 21 STZ $2140 [$82:2140] A:12FF X:0087 Y:0003 P:eNvMXdizc $C0/0C9D 9C 41 21 STZ $2141 [$82:2141] A:12FF X:0087 Y:0003 P:eNvMXdizc $C0/0CA0 9C 42 21 STZ $2142 [$82:2142] A:12FF X:0087 Y:0003 P:eNvMXdizc $C0/0CA3 9C 43 21 STZ $2143 [$82:2143] A:12FF X:0087 Y:0003 P:eNvMXdizc $C0/0CA6 A9 FF LDA #$FF A:12FF X:0087 Y:0003 P:eNvMXdizc $C0/0CA8 8D 40 21 STA $2140 [$82:2140] A:12FF X:0087 Y:0003 P:eNvMXdizc $C0/0CAB A9 AA LDA #$AA ; Wait for signals that APU is ready $C0/0CAD CD 40 21 CMP $2140 $C0/0CB0 D0 F4 BNE $F4 ; [$0CA6] $C0/0CB2 A9 BB LDA #$BB $C0/0CB4 CD 41 21 CMP $2141 $C0/0CB7 D0 ED BNE $ED ; [$0CA6] $C0/0CB9 C2 20 REP #$20 A:12BB X:0087 Y:0003 P:envMXdiZC $C0/0CBB A9 30 04 LDA #$0430 A:12BB X:0087 Y:0003 P:envmXdiZC $C0/0CBE 8D 42 21 STA $2142 [$82:2142] A:0430 X:0087 Y:0003 P:envmXdizC $C0/0CC1 E2 20 SEP #$20 A:0430 X:0087 Y:0003 P:envmXdizC $C0/0CC3 A9 FF LDA #$FF A:0430 X:0087 Y:0003 P:envMXdizC $C0/0CC5 8D 41 21 STA $2141 [$82:2141] A:04FF X:0087 Y:0003 P:eNvMXdizC $C0/0CC8 A9 CC LDA #$CC ; Activate Data transfer between CPU and APU $C0/0CCA 8D 40 21 STA $2140 $C0/0CCD CD 40 21 CMP $2140 ; Loop until Command has reached APU $C0/0CD0 D0 FB BNE $FB ; [$0CCD] $C0/0CD2 AD DB 01 LDA $01DB [$82:01DB] A:04CC X:0087 Y:0003 P:envMXdiZC $C0/0CD5 8D 41 21 STA $2141 [$82:2141] A:0400 X:0087 Y:0003 P:envMXdiZC $C0/0CD8 A9 00 LDA #$00 A:0400 X:0087 Y:0003 P:envMXdiZC $C0/0CDA 8D 40 21 STA $2140 [$82:2140] A:0400 X:0087 Y:0003 P:envMXdiZC $C0/0CDD CD 40 21 CMP $2140 [$82:2140] A:0400 X:0087 Y:0003 P:envMXdiZC $C0/0CE0 D0 FB BNE $FB [$0CDD] A:0400 X:0087 Y:0003 P:envMXdizc $C0/0CE2 9C 41 21 STZ $2141 [$82:2141] A:0400 X:0087 Y:0003 P:envMXdiZC $C0/0CE5 A9 02 LDA #$02 A:0400 X:0087 Y:0003 P:envMXdiZC $C0/0CE7 8D 40 21 STA $2140 [$82:2140] A:0402 X:0087 Y:0003 P:envMXdizC $C0/0CEA CD 40 21 CMP $2140 [$82:2140] A:0402 X:0087 Y:0003 P:envMXdizC $C0/0CED D0 F8 BNE $F8 [$0CE7] A:0402 X:0087 Y:0003 P:envMXdizC $C0/0CEF 28 PLP ; Restore Flag register value $C0/0CF0 60 RTS
$C0/0D0D ?
$C0/0D0D E2 20 SEP #$20 A:1201 X:0000 Y:0003 P:envMXdizc $C0/0D0F AD 07 01 LDA $0107 [$82:0107] A:1201 X:0000 Y:0003 P:envMXdizc $C0/0D12 9C 07 01 STZ $0107 [$82:0107] A:1200 X:0000 Y:0003 P:envMXdiZc $C0/0D15 F0 0E BEQ $0E [$0D25] A:1200 X:0000 Y:0003 P:envMXdiZc
code is missing here
$C0/0D25 E2 20 SEP #$20 ; A = 8 bit $C0/0D27 C2 10 REP #$10 ; X/Y = 16 bit $C0/0D29 A5 5D LDA $5D [$00:005D] A:1200 X:0000 Y:0003 P:envMxdiZc $C0/0D2B 29 7F AND #$7F A:1200 X:0000 Y:0003 P:envMxdiZc $C0/0D2D C9 02 CMP #$02 A:1200 X:0000 Y:0003 P:envMxdiZc $C0/0D2F F0 06 BEQ $06 [$0D37] A:1200 X:0000 Y:0003 P:eNvMxdizc $C0/0D31 20 E5 0A JSR $0AE5 [$C0:0AE5] A:1200 X:0000 Y:0003 P:eNvMxdizc $C0/0D34 20 95 0C JSR $0C95 [$C0:0C95] A:12FF X:0087 Y:0003 P:eNvMxdizc $C0/0D37 9C E4 01 STZ $01E4 [$82:01E4] A:0402 X:0087 Y:0003 P:eNvMxdizc $C0/0D3A 9C E5 01 STZ $01E5 [$82:01E5] A:0402 X:0087 Y:0003 P:eNvMxdizc $C0/0D3D 64 AA STZ $AA ; Clear VRAM DMA Pipeline Workoff Flag $C0/0D3F 64 AB STZ $AB ; Clear $2100 Update Flag $C0/0D41 64 AC STZ $AC ; Clear Flag $C0/0D43 64 AD STZ $AD ; Clear Scroll Register Update Flag $C0/0D45 64 AE STZ $AE ; Clear Mode 7 Register Update Flag $C0/0D47 64 AF STZ $AF ; Clear Flag $C0/0D49 64 B0 STZ $B0 ; Clear $420C buffer (HDMA flags) $C0/0D4B 64 B1 STZ $B1 ; Clear Flag $C0/0D4D 64 B2 STZ $B2 ; Clear Joypad Input Flag $C0/0D4F 64 B3 STZ $B3 ; Clear Flag $C0/0D51 9C 0E 01 STZ $010E ; Clear flags of ALL the VRAM DMA Pipeline slots $C0/0D54 9C 12 01 STZ $0112 $C0/0D57 9C 16 01 STZ $0116 $C0/0D5A 9C 1A 01 STZ $011A $C0/0D5D 9C 1E 01 STZ $011E $C0/0D60 9C 22 01 STZ $0122 $C0/0D63 9C 26 01 STZ $0126 $C0/0D66 9C 2A 01 STZ $012A $C0/0D69 9C 2E 01 STZ $012E $C0/0D6C 9C 32 01 STZ $0132 $C0/0D6F 9C 36 01 STZ $0136 $C0/0D72 9C 3A 01 STZ $013A $C0/0D75 9C 3E 01 STZ $013E $C0/0D78 9C 42 01 STZ $0142 $C0/0D7B 9C 46 01 STZ $0146 $C0/0D7E 9C 4A 01 STZ $014A $C0/0D81 20 45 05 JSR $0545 ; Execute General Updates while VBLANK $C0/0D84 20 7A 05 JSR $057A ; Activate FBLANK $C0/0D87 A5 57 LDA $57 ; FBLANK after next VBLANK $C0/0D89 29 80 AND #$80 $C0/0D8B 85 57 STA $57 $C0/0D8D E6 AB INC $AB ; Set $2100 Update flag (for FBLANK) $C0/0D8F 20 9E 05 JSR $059E ; Wait for VBLANK $C0/0D92 20 64 05 JSR $0564 ; Deactivate NMI $C0/0D95 AD 08 01 LDA $0108 ; Deactivate NMI $C0/0D98 29 CF AND #$CF $C0/0D9A 8D 00 42 STA $4200 $C0/0D9D 8D 08 01 STA $0108 $C0/0DA0 22 C5 07 C0 JSL $C007C5 ; Standard Graphic Settings / Set values of a number of registers
Arguments: $C0/0DA4 C0 91 32 00 17 00 ; Transfer #$17 data sets from $C0/3291
$C0/0DAA 20 01 4B JSR $4B01 [$C0:4B01] A:0401 X:0087 Y:0003 P:envMxdizc $C0/0DAD 20 13 83 JSR $8313 [$C0:8313] A:0401 X:0087 Y:0003 P:envMxdizc $C0/0DB0 A9 30 LDA #$30 ; Data to Decompress at: $DF/E230 (Palettes) $C0/0DB2 8D DC 01 STA $01DC $C0/0DB5 A9 E2 LDA #$E2 $C0/0DB7 8D DD 01 STA $01DD $C0/0DBA A9 DF LDA #$DF $C0/0DBC 8D DE 01 STA $01DE $C0/0DBF 20 37 EB JSR $EB37 ; Graphics Decompression to $7F/0000 (Setup A) $C0/0DC2 A9 00 LDA #$00 ; CGRAM write address $C0/0DC4 8D 21 21 STA $2121 $C0/0DC7 22 24 08 C0 JSL $C00824 ; Setup DMA - Transfer Palette
Arguments: $C0/0DCB 00 02 22 7F 00 00 00 02 ; DMA channel 0, to CGRAM, from $7F/0000, 200 Byte
$C0/0DD3 A9 01 LDA #$01 ; Activate DMA $C0/0DD5 8D 0B 42 STA $420B $C0/0DD8 A9 80 LDA #$80 ; VRAM Transfer Settings: 16-bit Transfer $C0/0DDA 8D 15 21 STA $2115 $C0/0DDD A9 00 LDA #$00 ; VRAM Destination: $2000 $C0/0DDF 8D 16 21 STA $2116 $C0/0DE2 A9 20 LDA #$20 $C0/0DE4 8D 17 21 STA $2117 $C0/0DE7 A9 00 LDA #$00 ; Data to Decompress at: $D0/0000 $C0/0DE9 8D DC 01 STA $01DC $C0/0DEC A9 00 LDA #$00 $C0/0DEE 8D DD 01 STA $01DD $C0/0DF1 A9 D0 LDA #$D0 $C0/0DF3 8D DE 01 STA $01DE $C0/0DF6 20 37 EB JSR $EB37 ; Graphics Decompression to $7F/0000 (Setup A) $C0/0DF9 22 24 08 C0 JSL $C00824 ; Setup DMA - Clear whole VRAM
Arguments: $C0/0DFD 00 01 18 7F 00 00 00 80 ; Single Byte DMA, channel 0, to VRAM, from $7F/0000, #$8000 Bytes
$C0/0E05 A9 01 LDA #$01 ; Activate DMA $C0/0E07 8D 0B 42 STA $420B $C0/0E0A A9 4F LDA #$4F ; Data to Decompress at: $DA/F44F $C0/0E0C 8D DC 01 STA $01DC $C0/0E0F A9 F4 LDA #$F4 $C0/0E11 8D DD 01 STA $01DD $C0/0E14 A9 DA LDA #$DA $C0/0E16 8D DE 01 STA $01DE $C0/0E19 20 37 EB JSR $EB37 ; Graphics Decompression to $7F/0000 (Setup A) $C0/0E1C A9 00 LDA #$00 ; Set VRAM Address to $6000 $C0/0E1E 8D 16 21 STA $2116 $C0/0E21 A9 60 LDA #$60 $C0/0E23 8D 17 21 STA $2117 $C0/0E26 22 24 08 C0 JSL $C00824 ; Setup DMA
Arguments: $C0/0DFD 00 01 18 7F 00 00 00 08 ; Single Byte DMA, channel 0, to VRAM, from $7F/0000, #$0800 Bytes
$C0/0E32 A9 01 LDA #$01 ; Activate DMA $C0/0E34 8D 0B 42 STA $420B $C0/0E37 E2 20 SEP #$20 A:8001 X:FFFF Y:0003 P:envMxdizc $C0/0E39 A5 5D LDA $5D [$00:005D] A:8001 X:FFFF Y:0003 P:envMxdizc $C0/0E3B 29 7F AND #$7F A:8000 X:FFFF Y:0003 P:envMxdiZc $C0/0E3D C9 02 CMP #$02 A:8000 X:FFFF Y:0003 P:envMxdiZc $C0/0E3F F0 09 BEQ $09 [$0E4A] A:8000 X:FFFF Y:0003 P:eNvMxdizc $C0/0E41 A9 02 LDA #$02 A:8000 X:FFFF Y:0003 P:eNvMxdizc $C0/0E43 85 4C STA $4C [$00:004C] A:8002 X:FFFF Y:0003 P:envMxdizc $C0/0E45 64 4B STZ $4B [$00:004B] A:8002 X:FFFF Y:0003 P:envMxdizc $C0/0E47 20 7C 0A JSR $0A7C [$C0:0A7C] A:8002 X:FFFF Y:0003 P:envMxdizc $C0/0E4A A9 01 LDA #$01 A:8002 X:FFFF Y:0003 P:envMxdizc $C0/0E4C 8D 2C 21 STA $212C [$82:212C] A:8001 X:FFFF Y:0003 P:envMxdizc $C0/0E4F 20 46 07 JSR $0746 [$C0:0746] A:8001 X:FFFF Y:0003 P:envMxdizc $C0/0E52 20 8C 05 JSR $058C ; Deactivate the FBLANK $C0/0E55 20 45 05 JSR $0545 ; Execute General Updates while VBLANK $C0/0E58 20 AE 07 JSR $07AE [$C0:07AE] A:8001 X:FFFF Y:0003 P:envMxdizc $C0/0E5B 9C D5 02 STZ $02D5 [$82:02D5] A:8001 X:FFFF Y:0003 P:envMxdizc $C0/0E5E A9 0E LDA #$0E A:8001 X:FFFF Y:0003 P:envMxdizc $C0/0E60 8D D6 02 STA $02D6 [$82:02D6] A:800E X:FFFF Y:0003 P:envMxdizc $C0/0E63 A0 40 00 LDY #$0040 ; Wait for 40 frames $C0/0E66 20 9E 05 JSR $059E ; Wait for VBLANK $C0/0E69 C0 00 00 CPY #$0000 $C0/0E6C F0 03 BEQ $03 ; [$0E71] Branch if Frame Counter has run out $C0/0E6E 88 DEY ; If not, decrement Frame Counter and Loop $C0/0E6F 80 F5 BRA $F5 ; [$0E66] $C0/0E71 C2 20 REP #$20 A:800E X:FFFF Y:0000 P:envMxdiZC $C0/0E73 CE D5 02 DEC $02D5 [$82:02D5] A:800E X:FFFF Y:0000 P:envmxdiZC $C0/0E76 D0 1D BNE $1D [$0E95] A:800E X:FFFF Y:0000 P:envmxdizC $C0/0E78 20 54 07 JSR $0754 [$C0:0754] A:8000 X:FFFF Y:0000 P:envmxdiZC $C0/0E7B 20 AE 07 JSR $07AE [$C0:07AE] A:8000 X:FFFF Y:0000 P:envmxdiZC $C0/0E7E 20 2F 09 JSR $092F [$C0:092F] A:8000 X:FFFF Y:0000 P:envmxdiZC $C0/0E81 29 07 00 AND #$0007 A:80B5 X:FFFF Y:0000 P:envmxdiZC $C0/0E84 0A ASL A A:0005 X:FFFF Y:0000 P:envmxdizC $C0/0E85 AA TAX A:000A X:FFFF Y:0000 P:envmxdizc $C0/0E86 BF C8 0E C0 LDA $C00EC8,x[$C0:0ED2] A:000A X:000A Y:0000 P:envmxdizc $C0/0E8A 85 C6 STA $C6 [$00:00C6] A:2C7D X:000A Y:0000 P:envmxdizc $C0/0E8C E2 20 SEP #$20 A:2C7D X:000A Y:0000 P:envmxdizc $C0/0E8E A9 C2 LDA #$C2 A:2C7D X:000A Y:0000 P:envMxdizc $C0/0E90 85 C8 STA $C8 [$00:00C8] A:2CC2 X:000A Y:0000 P:eNvMxdizc $C0/0E92 4C 72 87 JMP $8772 [$C0:8772] A:2CC2 X:000A Y:0000 P:eNvMxdizc $C0/0E95 E2 20 SEP #$20 A:800E X:FFFF Y:0000 P:envmxdizC $C0/0E97 A9 01 LDA #$01 ; Set flag to Update the Joypad Input buffers $C0/0E99 85 B2 STA $B2 $C0/0E9B 20 EA 05 JSR $05EA ; Which buttons were pushed this frame? $C0/0E9E 20 0D 06 JSR $060D [$C0:060D] A:8001 X:FFFF Y:0000 P:envMxdizC $C0/0EA1 20 2F 09 JSR $092F [$C0:092F] A:8001 X:FFFF Y:0000 P:envMxdizC $C0/0EA4 20 9E 05 JSR $059E ; Wait for VBLANK $C0/0EA7 A5 A2 LDA $A2 [$00:00A2] A:80BF X:FFFF Y:0000 P:envMxdizC $C0/0EA9 05 A3 ORA $A3 [$00:00A3] A:8000 X:FFFF Y:0000 P:envMxdiZC $C0/0EAB F0 C4 BEQ $C4 [$0E71] A:8000 X:FFFF Y:0000 P:envMxdiZC
$C0/3291 Standard Graphic Settings (Data)
Graphic settings, executed in $C0/0D0D
$C0/3291 0B 42 00 ; Data Set #$01: Deactivate DMAs $C0/3294 0C 42 00 ; Data Set #$02: Deactivate HDMAs $C0/3297 01 21 00 ; Data Set #$03: Sprites at $0000, 8x8/16x16 $C0/329A 02 21 00 ; Data Set #$04: OAM Address: $00 $C0/329D 03 21 80 ; Data Set #$05: OAM Address: Low Table $C0/32A0 05 21 01 ; Data Set #$06: BG Mode 1 $C0/32A3 07 21 60 ; Data Set #$07: BG1 Tilemap at $6000, no mirroring $C0/32A6 08 21 70 ; Data Set #$08: BG2 Tilemap at $7000, no mirroring $C0/32A9 0B 21 42 ; Data Set #$09: BG1 Tiles at $2000, BG2 Tiles at $4000 $C0/32AC 0C 21 88 ; Data Set #$0A: BG3/4 Tiles at $8000 $C0/32AF 0D 21 00 ; Data Set #$0B: BG1 HScroll #$0000 $C0/32B2 0D 21 00 ; Data Set #$0C: BG1 HScroll #$0000 $C0/32B5 0E 21 00 ; Data Set #$0D: BG1 VScroll #$0000 $C0/32B8 0E 21 00 ; Data Set #$0E: BG1 VScroll #$0000 $C0/32BB 0F 21 00 ; Data Set #$0F: BG2 HScroll #$0000 $C0/32BE 0F 21 00 ; Data Set #$10: BG2 HScroll #$0000 $C0/32C1 10 21 00 ; Data Set #$11: BG2 VScroll #$0000 $C0/32C4 10 21 00 ; Data Set #$12: BG2 VScroll #$0000 $C0/32C7 11 21 00 ; Data Set #$13: BG3 HScroll #$0000 $C0/32CA 11 21 00 ; Data Set #$14: BG3 HScroll #$0000 $C0/32CD 12 21 00 ; Data Set #$15: BG3 VScroll #$0000 $C0/32D0 12 21 00 ; Data Set #$16: BG3 VScroll #$0000 $C0/32D3 2C 21 03 ; Data Set #$17: Show BG1 and 2 on Main Screen
$C0/32D6 ? (Data)
$C0/32D6 0B 42 00 $C0/32D9 0C 42 00 $C0/32DC 01 21 00 $C0/32DF 02 21 00 $C0/32E2 03 21 80 $C0/32E5 05 21 09 $C0/32E8 06 21 00 $C0/32EB 07 21 6C $C0/32EE 08 21 70 $C0/32F1 09 21 74 $C0/32F4 0B 21 33 $C0/32F7 0C 21 82 $C0/32FA 0D 21 00
$C0/4B01 ? (Clear WRAM from $7E/0237 onwards)
$C0/4B01 08 PHP ; Buffer Flag register $C0/4B02 E2 20 SEP #$20 ; A = 8 bit $C0/4B04 C2 10 REP #$10 ; X/Y = 16 bit $C0/4B06 A9 37 LDA #$37 ; Set WRAM write address to $7E/0237 $C0/4B08 8D 81 21 STA $2181 $C0/4B0B A9 02 LDA #$02 $C0/4B0D 8D 82 21 STA $2182 $C0/4B10 A9 7E LDA #$7E $C0/4B12 8D 83 21 STA $2183 $C0/4B15 22 24 08 C0 JSL $C00824 ; Setup DMA
Arguments: $C0/0DFD 00 08 80 C0 28 4B CD 12 ; Fixed DMA, channel 0, to WRAM, from $C0/4B28, #$12CD Bytes
$C0/4B21 A9 01 LDA #$01 ; Activate DMA $C0/4B23 8D 0B 42 STA $420B $C0/4B26 28 PLP ; Restore Flag register $C0/4B27 60 RTS
$C0/4B28 00 00 ; Clear Bytes for DMA
$C0/73F1 ?
$C0/73F1 E2 20 SEP #$20 ; A = 8 bit $C0/73F3 C2 10 REP #$10 ; X/Y = 16 bit $C0/73F5 A0 01 00 LDY #$0001 A:0000 X:0000 Y:0000 P:envMxdiZc $C0/73F8 B7 C6 LDA [$C6],y[$C2:2A01] A:0000 X:0000 Y:0001 P:envMxdizc $C0/73FA 8D CF 04 STA $04CF [$82:04CF] A:0003 X:0000 Y:0001 P:envMxdizc $C0/73FD C9 02 CMP #$02 A:0003 X:0000 Y:0001 P:envMxdizc $C0/73FF D0 03 BNE $03 [$7404] A:0003 X:0000 Y:0001 P:envMxdizC
code is missing here
$C0/7404 64 AA STZ $AA ; Clear VRAM DMA Pipeline Workoff Flag $C0/7406 64 AB STZ $AB ; Clear $2100 Update Flag $C0/7408 64 AC STZ $AC [$00:00AC] A:0003 X:0000 Y:0001 P:envMxdizC $C0/740A 64 AD STZ $AD ; Clear Scroll Register Update Flag $C0/740C 64 AE STZ $AE ; Clear Mode 7 Register Update Flag $C0/740E 64 AF STZ $AF [$00:00AF] A:0003 X:0000 Y:0001 P:envMxdizC $C0/7410 64 B0 STZ $B0 ; Clear HDMA flag buffer $C0/7412 64 B3 STZ $B3 [$00:00B3] A:0003 X:0000 Y:0001 P:envMxdizC $C0/7414 9C 0E 01 STZ $010E ; Clear flags of ALL the VRAM DMA Pipeline slots $C0/7417 9C 12 01 STZ $0112 $C0/741A 9C 16 01 STZ $0116 $C0/741D 9C 1A 01 STZ $011A $C0/7420 9C 1E 01 STZ $011E $C0/7423 9C 22 01 STZ $0122 $C0/7426 9C 26 01 STZ $0126 $C0/7429 9C 2A 01 STZ $012A $C0/742C 9C 2E 01 STZ $012E $C0/742F 9C 32 01 STZ $0132 $C0/7432 9C 36 01 STZ $0136 $C0/7435 9C 3A 01 STZ $013A $C0/7438 9C 3E 01 STZ $013E $C0/743B 9C 42 01 STZ $0142 $C0/743E 9C 46 01 STZ $0146 $C0/7441 9C 4A 01 STZ $014A $C0/7444 E2 20 SEP #$20 A:0003 X:0000 Y:0001 P:envMxdizC $C0/7446 A9 80 LDA #$80 A:0003 X:0000 Y:0001 P:envMxdizC $C0/7448 85 57 STA $57 [$00:0057] A:0080 X:0000 Y:0001 P:eNvMxdizC $C0/744A 64 61 STZ $61 [$00:0061] A:0080 X:0000 Y:0001 P:eNvMxdizC $C0/744C 64 63 STZ $63 [$00:0063] A:0080 X:0000 Y:0001 P:eNvMxdizC $C0/744E 64 65 STZ $65 [$00:0065] A:0080 X:0000 Y:0001 P:eNvMxdizC $C0/7450 64 67 STZ $67 [$00:0067] A:0080 X:0000 Y:0001 P:eNvMxdizC $C0/7452 64 69 STZ $69 [$00:0069] A:0080 X:0000 Y:0001 P:eNvMxdizC $C0/7454 64 6B STZ $6B [$00:006B] A:0080 X:0000 Y:0001 P:eNvMxdizC $C0/7456 9C A8 02 STZ $02A8 [$82:02A8] A:0080 X:0000 Y:0001 P:eNvMxdizC $C0/7459 9C A9 02 STZ $02A9 [$82:02A9] A:0080 X:0000 Y:0001 P:eNvMxdizC $C0/745C 9C AA 02 STZ $02AA [$82:02AA] A:0080 X:0000 Y:0001 P:eNvMxdizC $C0/745F 9C AB 02 STZ $02AB [$82:02AB] A:0080 X:0000 Y:0001 P:eNvMxdizC $C0/7462 A9 01 LDA #$01 $C0/7464 85 AD STA $AD ; Set flag to update $2100 $C0/7466 85 AB STA $AB ; Set flag to update Scroll Registers $C0/7468 20 9E 05 JSR $059E ; Wait for VBLANK $C0/746B 20 64 05 JSR $0564 ; Deactivate NMI $C0/746E AD 08 01 LDA $0108 ; Disable V/H-IRQ $C0/7471 29 CF AND #$CF $C0/7473 8D 00 42 STA $4200 $C0/7476 8D 08 01 STA $0108 $C0/7479 22 C5 07 C0 JSL $C007C5 ; Set values of a number of registers
Arguments: $C0/0DA4 C0 89 7D 00 2D 00 ; Transfer #$2D data sets from $C0/7D89
$C0/7483 20 13 83 JSR $8313 [$C0:8313] A:0001 X:0000 Y:0001 P:envMxdizC $C0/7486 A9 0F LDA #$0F ; Clear flags of ALL the VRAM DMA Pipeline slots (via loop) $C0/7488 85 0F STA $0F $C0/748A A2 00 00 LDX #$0000 $C0/748D 9E 0E 01 STZ $010E,x $C0/7490 E8 INX $C0/7491 E8 INX $C0/7492 E8 INX $C0/7493 E8 INX $C0/7494 C6 0F DEC $0F $C0/7496 D0 F5 BNE $F5 ; [$748D] $C0/7498 A9 01 LDA #$01 A:800F X:003C Y:0001 P:envMxdiZC $C0/749A 85 B2 STA $B2 [$00:00B2] A:8001 X:003C Y:0001 P:envMxdizC $C0/749C A9 B0 LDA #$B0 ; H-IRQ at $00B0 $C0/749E 8D 07 42 STA $4207 $C0/74A1 A9 00 LDA #$00 $C0/74A3 8D 08 42 STA $4208 $C0/74A6 A9 6F LDA #$6F ; V-IRQ at $006F $C0/74A8 8D 09 42 STA $4209 $C0/74AB A9 00 LDA #$00 $C0/74AD 8D 0A 42 STA $420A $C0/74B0 A9 01 LDA #$01 A:8000 X:003C Y:0001 P:envMxdiZC $C0/74B2 8D 47 02 STA $0247 [$82:0247] A:8001 X:003C Y:0001 P:envMxdizC $C0/74B5 A9 18 LDA #$18 A:8001 X:003C Y:0001 P:envMxdizC $C0/74B7 8D 48 02 STA $0248 [$82:0248] A:8018 X:003C Y:0001 P:envMxdizC $C0/74BA A9 7E LDA #$7E A:8018 X:003C Y:0001 P:envMxdizC $C0/74BC 8D 4B 02 STA $024B [$82:024B] A:807E X:003C Y:0001 P:envMxdizC $C0/74BF A9 80 LDA #$80 A:807E X:003C Y:0001 P:envMxdizC $C0/74C1 8D 50 02 STA $0250 [$82:0250] A:8080 X:003C Y:0001 P:eNvMxdizC $C0/74C4 A9 00 LDA #$00 A:8080 X:003C Y:0001 P:eNvMxdizC $C0/74C6 8D 19 01 STA $0119 [$82:0119] A:8000 X:003C Y:0001 P:envMxdiZC $C0/74C9 A9 09 LDA #$09 A:8000 X:003C Y:0001 P:envMxdiZC $C0/74CB 8D 51 02 STA $0251 [$82:0251] A:8009 X:003C Y:0001 P:envMxdizC $C0/74CE A9 18 LDA #$18 A:8009 X:003C Y:0001 P:envMxdizC $C0/74D0 8D 52 02 STA $0252 [$82:0252] A:8018 X:003C Y:0001 P:envMxdizC $C0/74D3 A9 C0 LDA #$C0 A:8018 X:003C Y:0001 P:envMxdizC $C0/74D5 8D 55 02 STA $0255 [$82:0255] A:80C0 X:003C Y:0001 P:eNvMxdizC $C0/74D8 A9 80 LDA #$80 A:80C0 X:003C Y:0001 P:eNvMxdizC $C0/74DA 8D 5A 02 STA $025A [$82:025A] A:8080 X:003C Y:0001 P:eNvMxdizC $C0/74DD A9 00 LDA #$00 A:8080 X:003C Y:0001 P:eNvMxdizC $C0/74DF 8D 1D 01 STA $011D [$82:011D] A:8000 X:003C Y:0001 P:envMxdiZC $C0/74E2 C2 20 REP #$20 A:8000 X:003C Y:0001 P:envMxdiZC $C0/74E4 A9 00 20 LDA #$2000 A:8000 X:003C Y:0001 P:envmxdiZC $C0/74E7 8D 49 02 STA $0249 [$82:0249] A:2000 X:003C Y:0001 P:envmxdizC $C0/74EA A9 40 00 LDA #$0040 A:2000 X:003C Y:0001 P:envmxdizC $C0/74ED 8D 4C 02 STA $024C [$82:024C] A:0040 X:003C Y:0001 P:envmxdizC $C0/74F0 A9 47 02 LDA #$0247 A:0040 X:003C Y:0001 P:envmxdizC $C0/74F3 8D 17 01 STA $0117 [$82:0117] A:0247 X:003C Y:0001 P:envmxdizC $C0/74F6 A9 78 79 LDA #$7978 A:0247 X:003C Y:0001 P:envmxdizC $C0/74F9 8D 53 02 STA $0253 [$82:0253] A:7978 X:003C Y:0001 P:envmxdizC $C0/74FC A9 00 0E LDA #$0E00 A:7978 X:003C Y:0001 P:envmxdizC $C0/74FF 8D 56 02 STA $0256 [$82:0256] A:0E00 X:003C Y:0001 P:envmxdizC $C0/7502 A9 51 02 LDA #$0251 A:0E00 X:003C Y:0001 P:envmxdizC $C0/7505 8D 1B 01 STA $011B [$82:011B] A:0251 X:003C Y:0001 P:envmxdizC $C0/7508 9C 3C 02 STZ $023C [$82:023C] A:0251 X:003C Y:0001 P:envmxdizC $C0/750B 22 24 08 C0 JSL $C00824 ; Setup DMA
Arguments: $C0/750F 00 09 18 C0 78 79 00 1C ; DMA channel 0, to VRAM, DECREMENT ADDRESS, from $C0/7879, 1C00 Byte
$C0/7517 C2 20 REP #$20 A:0251 X:003C Y:0001 P:envmxdizC $C0/7519 A9 00 22 LDA #$2200 A:0251 X:003C Y:0001 P:envmxdizC $C0/751C 8D 16 21 STA $2116 [$82:2116] A:2200 X:003C Y:0001 P:envmxdizC $C0/751F E2 20 SEP #$20 A:2200 X:003C Y:0001 P:envmxdizC $C0/7521 A9 80 LDA #$80 A:2200 X:003C Y:0001 P:envMxdizC $C0/7523 8D 15 21 STA $2115 [$82:2115] A:2280 X:003C Y:0001 P:eNvMxdizC $C0/7526 A9 01 LDA #$01 ; Activate DMA $C0/7528 8D 0B 42 STA $420B $C0/752B 22 24 08 C0 JSL $C00824 ; Setup DMA
Arguments: $C0/750F 00 09 18 C0 78 79 00 08 ; DMA channel 0, to VRAM, DECREMENT ADDRESS, from $C0/7879, 0800 Byte
$C0/7537 C2 20 REP #$20 A:2201 X:003C Y:0001 P:envMxdizC $C0/7539 A9 00 78 LDA #$7800 A:2201 X:003C Y:0001 P:envmxdizC $C0/753C 8D 16 21 STA $2116 [$82:2116] A:7800 X:003C Y:0001 P:envmxdizC $C0/753F E2 20 SEP #$20 A:7800 X:003C Y:0001 P:envmxdizC $C0/7541 A9 80 LDA #$80 A:7800 X:003C Y:0001 P:envMxdizC $C0/7543 8D 15 21 STA $2115 [$82:2115] A:7880 X:003C Y:0001 P:eNvMxdizC $C0/7546 A9 01 LDA #$01 ; Activate DMA $C0/7548 8D 0B 42 STA $420B $C0/754B 22 24 08 C0 JSL $C00824 ; Setup DMA
Arguments: $C0/750F 00 09 18 C0 78 79 00 10 ; DMA channel 0, to VRAM, DECREMENT ADDRESS, from $C0/7879, 1000 Byte
$C0/7557 C2 20 REP #$20 A:7801 X:003C Y:0001 P:envMxdizC $C0/7559 A9 00 6C LDA #$6C00 A:7801 X:003C Y:0001 P:envmxdizC $C0/755C 8D 16 21 STA $2116 [$82:2116] A:6C00 X:003C Y:0001 P:envmxdizC $C0/755F E2 20 SEP #$20 A:6C00 X:003C Y:0001 P:envmxdizC $C0/7561 A9 80 LDA #$80 A:6C00 X:003C Y:0001 P:envMxdizC $C0/7563 8D 15 21 STA $2115 [$82:2115] A:6C80 X:003C Y:0001 P:eNvMxdizC $C0/7566 A9 01 LDA #$01 ; Activate DMA $C0/7568 8D 0B 42 STA $420B $C0/756B C2 20 REP #$20 A:6C01 X:003C Y:0001 P:envMxdizC $C0/756D AD E6 01 LDA $01E6 [$82:01E6] A:6C01 X:003C Y:0001 P:envmxdizC $C0/7570 29 FF 00 AND #$00FF A:0004 X:003C Y:0001 P:envmxdizC $C0/7573 0A ASL A A:0004 X:003C Y:0001 P:envmxdizC $C0/7574 AA TAX A:0008 X:003C Y:0001 P:envmxdizc $C0/7575 BF 06 0C C5 LDA $C50C06,x[$C5:0C0E] A:0008 X:0008 Y:0001 P:envmxdizc $C0/7579 AA TAX A:0CF5 X:0008 Y:0001 P:envmxdizc $C0/757A E2 20 SEP #$20 A:0CF5 X:0CF5 Y:0001 P:envmxdizc $C0/757C BF 00 00 C5 LDA $C50000,x[$C5:0CF5] A:0CF5 X:0CF5 Y:0001 P:envMxdizc $C0/7580 8D DC 01 STA $01DC [$82:01DC] A:0C47 X:0CF5 Y:0001 P:envMxdizc $C0/7583 BF 01 00 C5 LDA $C50001,x[$C5:0CF6] A:0C47 X:0CF5 Y:0001 P:envMxdizc $C0/7587 8D DD 01 STA $01DD [$82:01DD] A:0C57 X:0CF5 Y:0001 P:envMxdizc $C0/758A BF 02 00 C5 LDA $C50002,x[$C5:0CF7] A:0C57 X:0CF5 Y:0001 P:envMxdizc $C0/758E 8D DE 01 STA $01DE [$82:01DE] A:0CDF X:0CF5 Y:0001 P:eNvMxdizc $C0/7591 20 37 EB JSR $EB37 ; Graphics Decompression to $7F/0000 (Setup A) $C0/7594 E2 20 SEP #$20 ; A = 8 bit $C0/7596 A9 00 LDA #$00 ; Prepare DMA: channel 0 from $7F/0000 to CGRAM, $200 byte $C0/7598 8D 02 43 STA $4302 $C0/759B A9 00 LDA #$00 $C0/759D 8D 03 43 STA $4303 $C0/75A0 A9 7F LDA #$7F $C0/75A2 8D 04 43 STA $4304 $C0/75A5 A9 00 LDA #$00 $C0/75A7 8D 05 43 STA $4305 $C0/75AA A9 02 LDA #$02 $C0/75AC 8D 06 43 STA $4306 $C0/75AF A9 00 LDA #$00 $C0/75B1 8D 00 43 STA $4300 $C0/75B4 A9 22 LDA #$22 $C0/75B6 8D 01 43 STA $4301 $C0/75B9 9C 21 21 STZ $2121 ; CGRAM Write address: $00 $C0/75BC A9 01 LDA #$01 ; Activate DMA $C0/75BE 8D 0B 42 STA $420B $C0/75C1 BF 03 00 C5 LDA $C50003,x[$C5:0CF8] A:0C01 X:0CF5 Y:0001 P:envMxdizc $C0/75C5 F0 03 BEQ $03 [$75CA] A:0C00 X:0CF5 Y:0001 P:envMxdiZc
code is missing here
$C0/75CA BF 04 00 C5 LDA $C50004,x[$C5:0CF9] A:0C00 X:0CF5 Y:0001 P:envMxdiZc $C0/75CE D0 03 BNE $03 [$75D3] A:0C00 X:0CF5 Y:0001 P:envMxdiZc $C0/75D0 4C 63 76 JMP $7663 [$C0:7663] A:0C00 X:0CF5 Y:0001 P:envMxdiZc
code is missing here
$C0/7663 E2 20 SEP #$20 A:0C00 X:0CF5 Y:0001 P:envMxdiZc $C0/7665 BF 05 00 C5 LDA $C50005,x[$C5:0CFA] A:0C00 X:0CF5 Y:0001 P:envMxdiZc $C0/7669 8D 38 02 STA $0238 [$82:0238] A:0C00 X:0CF5 Y:0001 P:envMxdiZc $C0/766C BF 06 00 C5 LDA $C50006,x[$C5:0CFB] A:0C00 X:0CF5 Y:0001 P:envMxdiZc $C0/7670 8D 37 02 STA $0237 [$82:0237] A:0C00 X:0CF5 Y:0001 P:envMxdiZc $C0/7673 BF 07 00 C5 LDA $C50007,x[$C5:0CFC] A:0C00 X:0CF5 Y:0001 P:envMxdiZc $C0/7677 8D 3A 02 STA $023A [$82:023A] A:0C00 X:0CF5 Y:0001 P:envMxdiZc $C0/767A BF 08 00 C5 LDA $C50008,x[$C5:0CFD] A:0C00 X:0CF5 Y:0001 P:envMxdiZc $C0/767E 8D 39 02 STA $0239 [$82:0239] A:0C00 X:0CF5 Y:0001 P:envMxdiZc $C0/7681 AD CF 04 LDA $04CF [$82:04CF] A:0C00 X:0CF5 Y:0001 P:envMxdiZc $C0/7684 C9 03 CMP #$03 A:0C03 X:0CF5 Y:0001 P:envMxdizc $C0/7686 D0 01 BNE $01 [$7689] A:0C03 X:0CF5 Y:0001 P:envMxdiZC $C0/7688 60 RTS A:0C03 X:0CF5 Y:0001 P:envMxdiZC
$C0/7D89 Graphic Settings/Data for $C0/73F1
$C0/7D89 0B 42 00 ; Data Set #$01: Deactivate DMAs $C0/7D8C 0C 42 00 ; Data Set #$02: Deactivate HDMAs $C0/7D8F 01 21 00 ; Data Set #$03: Sprites at $0000, 8x8/16x16 $C0/7D92 02 21 00 ; Data Set #$04: OAM Address: $00 $C0/7D95 03 21 00 ; Data Set #$05: OAM Address: Low Table $C0/7D98 05 21 09 ; Data Set #$06: BG Mode 1, BG3 Priority bit $C0/7D9B 06 21 00 ; Data Set #$07: No Mosaic $C0/7D9E 07 21 6C ; Data Set #$08: BG1 Tilemap at $6C00, no mirroring $C0/7DA1 08 21 70 ; Data Set #$09: BG2 Tilemap at $7000, no mirroring $C0/7DA4 09 21 74 ; Data Set #$0A: BG3 Tilemap at $7400, no mirroring $C0/7DA7 0B 21 33 ; Data Set #$0B: BG1/2 Tiles at $3000 $C0/7DAA 0C 21 82 ; Data Set #$0C: BG3 Tiles at $2000, BG4 Tiles at $8000 $C0/7DAD 0D 21 00 ; Data Set #$0D: BG1 HScroll #$0000 $C0/7DB0 0D 21 00 ; Data Set #$0E: BG1 HScroll #$0000 $C0/7DB3 0E 21 00 ; Data Set #$0F: BG1 VScroll #$0000 $C0/7DB6 0E 21 00 ; Data Set #$10: BG1 VScroll #$0000 $C0/7DB9 0F 21 00 ; Data Set #$11: BG2 HScroll #$0000 $C0/7DBC 0F 21 00 ; Data Set #$12: BG2 HScroll #$0000 $C0/7DBF 10 21 00 ; Data Set #$13: BG2 VScroll #$0000 $C0/7DC2 10 21 00 ; Data Set #$14: BG2 VScroll #$0000 $C0/7DC5 11 21 00 ; Data Set #$15: BG3 HScroll #$0000 $C0/7DC8 11 21 00 ; Data Set #$16: BG3 HScroll #$0000 $C0/7DCB 12 21 00 ; Data Set #$17: BG3 VScroll #$0000 $C0/7DCE 12 21 00 ; Data Set #$18: BG3 VScroll #$0000 $C0/7DD1 21 21 00 ; Data Set #$19: CGRAM Address $00 $C0/7DD4 23 21 00 ; Data Set #$1A: Window BG1/BG2 Mask Settings $C0/7DD7 24 21 02 ; Data Set #$1B: Window BG3/BG4 Mask Settings: BG3 Window 1 Outside $C0/7DDA 25 21 00 ; Data Set #$1C: Window OBJ/MATH Mask Settings $C0/7DDD 26 21 FF ; Data Set #$1D: Window 1 Left Position $C0/7DE0 27 21 00 ; Data Set #$1E: Window 1 Right Position $C0/7DE3 28 21 00 ; Data Set #$1F: Window 2 Left Position $C0/7DE6 29 21 FF ; Data Set #$20: Window 2 Right Position $C0/7DE9 2A 21 00 ; Data Set #$21: Window Mask Logic for BGs $C0/7DEC 2B 21 00 ; Data Set #$22: Window Mask Logic for Sprites $C0/7DEF 2C 21 17 ; Data Set #$23: Main Screen Designation: BG1-3 and Sprites $C0/7DF2 2D 21 00 ; Data Set #$24: Subscreen Designation: Nothing $C0/7DF5 2E 21 04 ; Data Set #$25: Disable Main Screen BG3 inside the Window $C0/7DF8 2F 21 00 ; Data Set #$26: Nothing for Subscreen Disabling $C0/7DFB 30 21 00 ; Data Set #$27: Clear Color Math Register A $C0/7DFE 31 21 00 ; Data Set #$28: Clear Color Math Register B $C0/7E01 32 21 00 ; Data Set #$29: Clear Color Math Subscreen Backdrop $C0/7E04 33 21 00 ; Data Set #$2A: Clear Display Control Special function gizmo trickery $C0/7E07 81 21 00 ; Data Set #$2B: Clear WRAM Address $C0/7E0A 82 21 00 ; Data Set #$2C: Clear WRAM Address $C0/7E0D 83 21 00 ; Data Set #$2D: Clear WRAM Address
$C0/8772 ? (Use Jump Table at $C0/87A3)
This subroutine uses the Jump Table $87A3, according to the value in the address in $C6-8.
$C0/8772 E2 20 SEP #$20 ; A = 8 bit $C0/8774 C2 10 REP #$10 ; X/Y = 16 bit $C0/8776 A0 00 00 LDY #$0000 $C0/8779 B7 C6 LDA [$C6],y ; Load byte from $C6-8 (Index for the Jump Table) $C0/877B 85 0F STA $0F ; Buffer Jump Table Index for 16-bit Loading $C0/877D 64 10 STZ $10 ; Clear High Byte for 16-bit Loading $C0/877F C2 20 REP #$20 ; A = 16 bit $C0/8781 A5 0F LDA $0F ; The afforementioned 16-bit loading $C0/8783 0A ASL A ; multiply by 2 (Each Jump Table entry is of course 2 bytes in size) $C0/8784 AA TAX ; Transfer in X as Index for Jump Table $C0/8785 7C A3 87 JMP ($87A3,x)
$C0/8794 Increment Address of the next Jump Table Pointer for $C0/8772
Increments the Address in $C6 and returns to $8772. This way, it changes the next Index for the Jump Table at $87A3.
This subroutine can be entered at different points, depending on how often $C6/$C7 shall be incremented.
$C0/8794 C2 20 REP #$20 $C0/8796 E6 C6 INC $C6 $C0/8798 C2 20 REP #$20 $C0/879A E6 C6 INC $C6 $C0/879C C2 20 REP #$20 $C0/879E E6 C6 INC $C6 $C0/87A0 4C 72 87 JMP $8772
$C0/87A3 Jump Table for $C0/8772
19 88 28 88 37 88 46 88 5F 88 78 88 A5 88 E8 88 09 89 15 89 31 89 C8 89 16 8A 58 8A 7F 8A A6 8A CD 8A F4 8A 1B 8B 42 8B 60 8B
$C0/8819 ?
$C0/8819 E2 20 SEP #$20 A:0000 X:0000 Y:0000 P:envmxdiZc $C0/881B C2 10 REP #$10 A:0000 X:0000 Y:0000 P:envMxdiZc $C0/881D A0 01 00 LDY #$0001 A:0000 X:0000 Y:0000 P:envMxdiZc $C0/8820 B7 C6 LDA [$C6],y[$C2:2C7E] A:0000 X:0000 Y:0001 P:envMxdizc $C0/8822 8D E4 01 STA $01E4 [$82:01E4] A:0000 X:0000 Y:0001 P:envMxdiZc $C0/8825 4C 98 87 JMP $8798 ; Increment $C6 twice and use Jump Table
$C0/8828 ?
$C0/8828 E2 20 SEP #$20 A:0002 X:0002 Y:0000 P:envmxdizc $C0/882A C2 10 REP #$10 A:0002 X:0002 Y:0000 P:envMxdizc $C0/882C A0 01 00 LDY #$0001 A:0002 X:0002 Y:0000 P:envMxdizc $C0/882F B7 C6 LDA [$C6],y[$C2:2C80] A:0002 X:0002 Y:0001 P:envMxdizc $C0/8831 8D E5 01 STA $01E5 [$82:01E5] A:0005 X:0002 Y:0001 P:envMxdizc $C0/8834 4C 98 87 JMP $8798 ; Increment $C6 twice and use Jump Table
$C0/8837 ?
$C0/8837 E2 20 SEP #$20 A:0004 X:0004 Y:0000 P:envmxdizc $C0/8839 C2 10 REP #$10 A:0004 X:0004 Y:0000 P:envMxdizc $C0/883B A0 01 00 LDY #$0001 A:0004 X:0004 Y:0000 P:envMxdizc $C0/883E B7 C6 LDA [$C6],y[$C2:29FF] A:0004 X:0004 Y:0001 P:envMxdizc $C0/8840 8D E6 01 STA $01E6 [$82:01E6] A:0004 X:0004 Y:0001 P:envMxdizc $C0/8843 4C 98 87 JMP $8798 ; Increment $C6 twice and use Jump Table
$C0/8846 ?
$C0/8846 E2 30 SEP #$30 A:0006 X:0006 Y:0000 P:envmxdizc $C0/8848 AD E4 01 LDA $01E4 [$82:01E4] A:0006 X:0006 Y:0000 P:envMXdizc $C0/884B 0A ASL A A:0000 X:0006 Y:0000 P:envMXdiZc $C0/884C AA TAX A:0000 X:0006 Y:0000 P:envMXdiZc $C0/884D FC 53 88 JSR ($8853,x)[$C0:73F1] A:0000 X:0000 Y:0000 P:envMXdiZc $C0/8850 4C 98 87 JMP $8798 ; Increment $C6 twice and use Jump Table
$C0/8853 Jump Table for $C0/8846
$C0/8853 F1 73 $C0/8855 F1 73 $C0/8857 60 87 $C0/8859 83 B6 $C0/885B F1 73 $C0/885D
$C0/8B83 ?
$C0/8B83 E2 30 SEP #$30 A:002C X:002C Y:0000 P:envmxdizc $C0/8B85 A0 01 LDY #$01 A:002C X:002C Y:0000 P:envMXdizc $C0/8B87 B7 C6 LDA [$C6],y[$C2:2C82] A:002C X:002C Y:0001 P:envMXdizc $C0/8B89 AA TAX A:0008 X:002C Y:0001 P:envMXdizc $C0/8B8A C8 INY A:0008 X:0008 Y:0001 P:envMXdizc $C0/8B8B B7 C6 LDA [$C6],y[$C2:2C83] A:0008 X:0008 Y:0002 P:envMXdizc $C0/8B8D 9D CF 04 STA $04CF,x[$82:04D7] A:00FF X:0008 Y:0002 P:eNvMXdizc $C0/8B90 4C 94 87 JMP $8794 ; Increment $C6 thrice and use Jump Table
$C0/AB3F ?
$C0/AB3F E2 20 SEP #$20 ; UNNECESSARY LINE $C0/AB41 C2 10 REP #$10 ; X/Y = 16 bit $C0/AB43 E2 20 SEP #$20 ; A = 8 bit $C0/AB45 A9 00 LDA #$00 A:8B7F X:0028 Y:0001 P:eNvMxdizc $C0/AB47 8D E4 01 STA $01E4 [$82:01E4] A:8B00 X:0028 Y:0001 P:envMxdiZc $C0/AB4A A9 05 LDA #$05 A:8B00 X:0028 Y:0001 P:envMxdiZc $C0/AB4C 8D E5 01 STA $01E5 [$82:01E5] A:8B05 X:0028 Y:0001 P:envMxdizc $C0/AB4F AD D7 04 LDA $04D7 [$82:04D7] A:8B05 X:0028 Y:0001 P:envMxdizc $C0/AB52 48 PHA A:8BFF X:0028 Y:0001 P:eNvMxdizc $C0/AB53 9C D7 04 STZ $04D7 [$82:04D7] A:8BFF X:0028 Y:0001 P:eNvMxdizc $C0/AB56 20 13 83 JSR $8313 [$C0:8313] A:8BFF X:0028 Y:0001 P:eNvMxdizc $C0/AB59 A9 00 LDA #$00 A:8082 X:FFFF Y:0001 P:eNvMxdizc $C0/AB5B 8F 00 00 7F STA $7F0000[$7F:0000] A:8000 X:FFFF Y:0001 P:envMxdiZc $C0/AB5F 8D 02 21 STA $2102 [$82:2102] A:8000 X:FFFF Y:0001 P:envMxdiZc $C0/AB62 8D 03 21 STA $2103 [$82:2103] A:8000 X:FFFF Y:0001 P:envMxdiZc $C0/AB65 22 24 08 C0 JSL $C00824 ; Setup DMA
arguments are missing here
$C0/AB71 A9 01 LDA #$01 ; Activate DMA $C0/AB73 8D 0B 42 STA $420B $C0/AB76 A9 EB LDA #$EB ; Data to Decompress at: $D1/E8EB $C0/AB78 8D DC 01 STA $01DC $C0/AB7B A9 E8 LDA #$E8 $C0/AB7D 8D DD 01 STA $01DD $C0/AB80 A9 D1 LDA #$D1 $C0/AB82 8D DE 01 STA $01DE $C0/AB85 20 37 EB JSR $EB37 ; Graphics Decompression to $7F/0000 (Setup A) $C0/AB88 A9 00 LDA #$00 ; Set VRAM Write Address to $0000 $C0/AB8A 8D 16 21 STA $2116 $C0/AB8D A9 00 LDA #$00 $C0/AB8F 8D 17 21 STA $2117 $C0/AB92 A9 80 LDA #$80 ; 16-bit transfer: Increment VRAM Write address after accessing $2119 $C0/AB94 8D 15 21 STA $2115 $C0/AB97 22 24 08 C0 JSL $C00824 ; Setup DMA
arguments are missing here
$C0/ABA3 A9 01 LDA #$01 ; Activate DMA $C0/ABA5 8D 0B 42 STA $420B $C0/ABA8 A9 00 LDA #$00 ; Set VRAM Write Address to $6000 $C0/ABAA 8D 16 21 STA $2116 $C0/ABAD A9 60 LDA #$60 $C0/ABAF 8D 17 21 STA $2117 $C0/ABB2 A9 80 LDA #$80 ; 16-bit transfer: Increment VRAM Write address after accessing $2119 $C0/ABB4 8D 15 21 STA $2115 $C0/ABB7 22 24 08 C0 JSL $C00824 ; Setup DMA
arguments are missing here
$C0/ABC3 A9 01 LDA #$01 ; Activate DMA $C0/ABC5 8D 0B 42 STA $420B $C0/ABC8 A9 25 LDA #$25 ; Data to Decompress at: $C7/F725 $C0/ABCA 8D DC 01 STA $01DC $C0/ABCD A9 F7 LDA #$F7 $C0/ABCF 8D DD 01 STA $01DD $C0/ABD2 A9 C7 LDA #$C7 $C0/ABD4 8D DE 01 STA $01DE $C0/ABD7 20 37 EB JSR $EB37 ; Graphics Decompression to $7F/0000 (Setup A) $C0/ABDA A9 00 LDA #$00 ; Set VRAM Write Address to $1000 $C0/ABDC 8D 16 21 STA $2116 $C0/ABDF A9 10 LDA #$10 $C0/ABE1 8D 17 21 STA $2117 $C0/ABE4 A9 80 LDA #$80 ; 16-bit transfer: Increment VRAM Write address after accessing $2119 $C0/ABE6 8D 15 21 STA $2115 $C0/ABE9 22 24 08 C0 JSL $C00824 ; Setup DMA
arguments are missing here
$C0/ABF5 A9 01 LDA #$01 ; Activate DMA $C0/ABF7 8D 0B 42 STA $420B $C0/ABFA A9 99 LDA #$99 ; Data to Decompress at: $DF/F099 $C0/ABFC 8D DC 01 STA $01DC $C0/ABFF A9 F0 LDA #$F0 $C0/AC01 8D DD 01 STA $01DD $C0/AC04 A9 DF LDA #$DF $C0/AC06 8D DE 01 STA $01DE $C0/AC09 20 37 EB JSR $EB37 ; Graphics Decompression to $7F/0000 (Setup A) $C0/AC0C A9 00 LDA #$00 ; Set VRAM Write Address to $2000 $C0/AC0E 8D 16 21 STA $2116 $C0/AC11 A9 20 LDA #$20 $C0/AC13 8D 17 21 STA $2117 $C0/AC16 A9 80 LDA #$80 ; 16-bit transfer: Increment VRAM Write address after accessing $2119 $C0/AC18 8D 15 21 STA $2115 $C0/AC1B 22 24 08 C0 JSL $C00824 ; Setup DMA
arguments are missing here
$C0/AC27 A9 01 LDA #$01 ; Activate DMA $C0/AC29 8D 0B 42 STA $420B $C0/AC2C A9 CF LDA #$CF ; Data to Decompress at: $C5/FFCF $C0/AC2E 8D DC 01 STA $01DC $C0/AC31 A9 FF LDA #$FF $C0/AC33 8D DD 01 STA $01DD $C0/AC36 A9 C5 LDA #$C5 $C0/AC38 8D DE 01 STA $01DE $C0/AC3B 20 37 EB JSR $EB37 ; Graphics Decompression to $7F/0000 (Setup A) $C0/AC3E A9 00 LDA #$00 ; Set VRAM Write Address to $5000 $C0/AC40 8D 16 21 STA $2116 $C0/AC43 A9 50 LDA #$50 $C0/AC45 8D 17 21 STA $2117 $C0/AC48 A9 80 LDA #$80 ; 16-bit transfer: Increment VRAM Write address after accessing $2119 $C0/AC4A 8D 15 21 STA $2115 $C0/AC4D 22 24 08 C0 JSL $C00824 ; Setup DMA
arguments are missing here
$C0/AC59 A9 01 LDA #$01 ; Activate DMA $C0/AC5B 8D 0B 42 STA $420B $C0/AC5E A9 00 LDA #$00 ; Set VRAM Write Address to $5C00 $C0/AC60 8D 16 21 STA $2116 $C0/AC63 A9 5C LDA #$5C $C0/AC65 8D 17 21 STA $2117 $C0/AC68 A9 80 LDA #$80 ; 16-bit transfer: Increment VRAM Write address after accessing $2119 $C0/AC6A 8D 15 21 STA $2115 $C0/AC6D 22 24 08 C0 JSL $C00824 ; Setup DMA
arguments are missing here
$C0/AC79 A9 01 LDA #$01 ; Activate DMA $C0/AC7B 8D 0B 42 STA $420B $C0/AC7E A9 5E LDA #$5E ; Data to Decompress at: $DF/DF5E $C0/AC80 8D DC 01 STA $01DC $C0/AC83 A9 DF LDA #$DF $C0/AC85 8D DD 01 STA $01DD $C0/AC88 A9 DF LDA #$DF $C0/AC8A 8D DE 01 STA $01DE $C0/AC8D 20 37 EB JSR $EB37 ; Graphics Decompression to $7F/0000 (Setup A) $C0/AC90 A9 00 LDA #$00 ; Set VRAM Write Address to $4F00 $C0/AC92 8D 16 21 STA $2116 $C0/AC95 A9 4F LDA #$4F $C0/AC97 8D 17 21 STA $2117 $C0/AC9A A9 80 LDA #$80 ; 16-bit transfer: Increment VRAM Write address after accessing $2119 $C0/AC9C 8D 15 21 STA $2115 $C0/AC9F 22 24 08 C0 JSL $C00824 ; Setup DMA
arguments are missing here
$C0/ACAB A9 01 LDA #$01 ; Activate DMA $C0/ACAD 8D 0B 42 STA $420B $C0/ACB0 A9 E0 LDA #$E0 ; Data to Decompress at: $CF/E3E0 $C0/ACB2 8D DC 01 STA $01DC $C0/ACB5 A9 E3 LDA #$E3 $C0/ACB7 8D DD 01 STA $01DD $C0/ACBA A9 CF LDA #$CF $C0/ACBC 8D DE 01 STA $01DE $C0/ACBF 20 37 EB JSR $EB37 ; Graphics Decompression to $7F/0000 (Setup A) $C0/ACC2 A9 80 LDA #$80 ; Set VRAM Write Address to $2080 $C0/ACC4 8D 16 21 STA $2116 $C0/ACC7 A9 20 LDA #$20 $C0/ACC9 8D 17 21 STA $2117 $C0/ACCC A9 80 LDA #$80 ; 16-bit transfer: Increment VRAM Write address after accessing $2119 $C0/ACCE 8D 15 21 STA $2115 $C0/ACD1 22 24 08 C0 JSL $C00824 ; Setup DMA
arguments are missing here
$C0/ACDD A9 01 LDA #$01 ; Activate DMA $C0/ACDF 8D 0B 42 STA $420B $C0/ACE2 C2 20 REP #$20 A:8001 X:FFFF Y:0001 P:envMxdizc $C0/ACE4 A9 00 00 LDA #$0000 A:8001 X:FFFF Y:0001 P:envmxdizc $C0/ACE7 8D ED 02 STA $02ED [$82:02ED] A:0000 X:FFFF Y:0001 P:envmxdiZc $C0/ACEA A9 00 06 LDA #$0600 A:0000 X:FFFF Y:0001 P:envmxdiZc $C0/ACED 8D EF 02 STA $02EF [$82:02EF] A:0600 X:FFFF Y:0001 P:envmxdizc $C0/ACF0 A9 D0 07 LDA #$07D0 A:0600 X:FFFF Y:0001 P:envmxdizc $C0/ACF3 8D F1 02 STA $02F1 [$82:02F1] A:07D0 X:FFFF Y:0001 P:envmxdizc $C0/ACF6 A9 90 08 LDA #$0890 A:07D0 X:FFFF Y:0001 P:envmxdizc $C0/ACF9 8D F3 02 STA $02F3 [$82:02F3] A:0890 X:FFFF Y:0001 P:envmxdizc $C0/ACFC A9 50 09 LDA #$0950 A:0890 X:FFFF Y:0001 P:envmxdizc $C0/ACFF 8D F5 02 STA $02F5 [$82:02F5] A:0950 X:FFFF Y:0001 P:envmxdizc $C0/AD02 A9 80 0E LDA #$0E80 A:0950 X:FFFF Y:0001 P:envmxdizc $C0/AD05 8D F7 02 STA $02F7 [$82:02F7] A:0E80 X:FFFF Y:0001 P:envmxdizc $C0/AD08 C2 20 REP #$20 A:0E80 X:FFFF Y:0001 P:envmxdizc $C0/AD0A 64 61 STZ $61 [$00:0061] A:0E80 X:FFFF Y:0001 P:envmxdizc $C0/AD0C 64 63 STZ $63 [$00:0063] A:0E80 X:FFFF Y:0001 P:envmxdizc $C0/AD0E 64 65 STZ $65 [$00:0065] A:0E80 X:FFFF Y:0001 P:envmxdizc $C0/AD10 64 67 STZ $67 [$00:0067] A:0E80 X:FFFF Y:0001 P:envmxdizc $C0/AD12 E2 20 SEP #$20 A:0E80 X:FFFF Y:0001 P:envmxdizc $C0/AD14 A9 09 LDA #$09 A:0E80 X:FFFF Y:0001 P:envMxdizc $C0/AD16 8D 05 21 STA $2105 [$82:2105] A:0E09 X:FFFF Y:0001 P:envMxdizc $C0/AD19 A9 61 LDA #$61 A:0E09 X:FFFF Y:0001 P:envMxdizc $C0/AD1B 8D 07 21 STA $2107 [$82:2107] A:0E61 X:FFFF Y:0001 P:envMxdizc $C0/AD1E A9 69 LDA #$69 A:0E61 X:FFFF Y:0001 P:envMxdizc $C0/AD20 8D 08 21 STA $2108 [$82:2108] A:0E69 X:FFFF Y:0001 P:envMxdizc $C0/AD23 A9 5C LDA #$5C A:0E69 X:FFFF Y:0001 P:envMxdizc $C0/AD25 8D 09 21 STA $2109 [$82:2109] A:0E5C X:FFFF Y:0001 P:envMxdizc $C0/AD28 A9 11 LDA #$11 A:0E5C X:FFFF Y:0001 P:envMxdizc $C0/AD2A 8D 0B 21 STA $210B [$82:210B] A:0E11 X:FFFF Y:0001 P:envMxdizc $C0/AD2D A9 05 LDA #$05 A:0E11 X:FFFF Y:0001 P:envMxdizc $C0/AD2F 8D 0C 21 STA $210C [$82:210C] A:0E05 X:FFFF Y:0001 P:envMxdizc $C0/AD32 A9 17 LDA #$17 ; BG1-3 + Sprites on Main Screen $C0/AD34 8D 2C 21 STA $212C $C0/AD37 A9 01 LDA #$01 ; Set VRAM DMA Pipeline Workoff Flag $C0/AD39 85 AA STA $AA $C0/AD3B 64 AF STZ $AF [$00:00AF] A:0E01 X:FFFF Y:0001 P:envMxdizc $C0/AD3D 20 8C 05 JSR $058C ; Deactivate FBLANK $C0/AD40 20 46 07 JSR $0746 [$C0:0746] A:0E01 X:FFFF Y:0001 P:envMxdizc $C0/AD43 20 45 05 JSR $0545 [$C0:0545] A:0E01 X:FFFF Y:0001 P:envMxdizc $C0/AD46 20 0E 32 JSR $320E [$C0:320E] A:0E01 X:FFFF Y:0001 P:envMxdizc $C0/AD49 20 AE 07 JSR $07AE [$C0:07AE] A:2400 X:0C62 Y:0000 P:envMxdizc $C0/AD4C 68 PLA A:2400 X:0C62 Y:0000 P:envMxdizc $C0/AD4D 8D D7 04 STA $04D7 [$82:04D7] A:24FF X:0C62 Y:0000 P:eNvMxdizc $C0/AD50 6B RTL A:24FF X:0C62 Y:0000 P:eNvMxdizc
$C0/EB37 Graphics Decompression Setup A
This subroutine decompresses (graphic) data to $7F/0000. There are flags that show if the compressed data can be transfered to $7F/0000 without editing (flag set) or if something of the already decompressed data can be repeated (flag cleared).
If something has to be repeated, the commands are:
1st byte: Address of the first byte to repeat, low byte 2nd byte: Address of the first byte to repeat, high byte 3rd byte: Number of bytes to repeat (minus three, e. g. "#$00" repeats three bytes, "#$04" repeats seven bytes and so on)
It uses several registers:
$0F - "Primary Data Load" Address Low Byte - points to general data at first, later to the compressed data $10 - "Primary Data Load" Address High Byte - points to general data at first, later to the compressed data $11 - "Primary Data Load" Address Bank - points to general data at first, later to the compressed data $12 - Size of the decompressed data (number of bytes to do), Low Byte $13 - Size of the decompressed data (number of bytes to do), High Byte
$15 - "Secondary Data Load" Address Low Byte - points to the decompression flags $16 - "Secondary Data Load" Address High Byte - points to the decompression flags $17 - "Secondary Data Load" Address Bank - points to the decompression flags $18 - Counter of how many decompression flags already have been worked off (valid values: 0-7) $19 - Buffer of the decompression flags, MSB gets worked off first, LSB last
$1E - Buffer for the Repition Load Address, Low Byte $1F - Buffer for the Repition Load Address, High Byte $20 - Buffer for the Repition Load Bank $21 - Buffer for the number of bytes to repeat
Before this subroutine is executed, there has to be a 24-bit address set in $01DC-$01DE that points to the data for this subroutine. This data is structured as follows:
1st byte: Size of the decompressed data (number of bytes to do), Low Byte 2nd byte: Size of the decompressed data (number of bytes to do), High Byte 3rd byte: Offset between decompression flags and compressed data - Low Byte 4th byte: Offset between decompression flags and compressed data - High Byte 5th byte on: Decompression Flags (that is: repition flags) 5th byte + offset: Uncompressed Data / Commands for repition
$C0/EB37 08 PHP ; Buffer Flag register, A/X/Y and Direct Bank on stack $C0/EB38 C2 30 REP #$30 $C0/EB3A 48 PHA $C0/EB3B DA PHX $C0/EB3C 5A PHY $C0/EB3D 8B PHB $C0/EB3E E2 20 SEP #$20 ; Rebuild the brought-in address from $01DC-E in $0F-$11 $C0/EB40 AD DE 01 LDA $01DE ; ($0F-$10 will always be #$0000, the address on the bank is in Y ... $C0/EB43 85 11 STA $11 ; (... and both will be combined in Indexed Loading, see below) $C0/EB45 85 17 STA $17 ; Bank is stored in $17 (for the secondary 24-bit address) $C0/EB47 C2 20 REP #$20 ; A = 16 bit $C0/EB49 AC DC 01 LDY $01DC ; Finish setting up the Address in $0F-$11 + Y $C0/EB4C 64 0F STZ $0F $C0/EB4E 9C DF 01 STZ $01DF ; Clear unused register ($01DF is only important in the other Setup) $C0/EB51 B7 0F LDA [$0F],y ; Load first data double-byte (Decomp. data size = number of bytes to do) $C0/EB53 85 12 STA $12 ; Store it in $12 $C0/EB55 8D E2 01 STA $01E2 [$82:01E2] A:0200 X:FFFF Y:E230 P:envmxdizc $C0/EB58 C8 INY ; Increment Load Index twice $C0/EB59 C8 INY $C0/EB5A B7 0F LDA [$0F],y ; Load next data double-byte $C0/EB5C 85 0F STA $0F ; Store in $0F as new offset of the Data Load Address $C0/EB5E C8 INY ; Increment Load Index twice $C0/EB5F C8 INY $C0/EB60 84 15 STY $15 ; Store Index (i. e. the Address without offset) in $15/6 for 24-bit Address $C0/EB62 9C 81 21 STZ $2181 ; WRAM I/O Address: $0000 (on bank $7F, see below) $C0/EB65 64 1E STZ $1E [$00:001E] A:000D X:FFFF Y:E234 P:eNvmxdizc $C0/EB67 64 21 STZ $21 [$00:0021] A:000D X:FFFF Y:E234 P:eNvmxdizc $C0/EB69 64 18 STZ $18 ; Clear counter for worked off decompression flags $C0/EB6B E2 20 SEP #$20 ; Set #$7F as Direct Bank and as WRAM I/O Address bank ($2183) $C0/EB6D A9 7F LDA #$7F $C0/EB6F 48 PHA $C0/EB70 8D 83 21 STA $2183 $C0/EB73 AB PLB $C0/EB74 4C B5 EB JMP $EBB5 ; Go to the actual Graphics Decompression
$C0/EB77 Graphics Decompression Setup B
This subroutine works basically the same as the one above, a minor difference:
Instead of storing the decompressed data to a fixed address ($7F/0000), you can decompress to a specified address. That address has to be carried into this subroutine in $01DF-$01E1.
Furthermore, the size of the decompressed data gets stored in $01E2.
$C0/EB77 08 PHP ; Buffer Flag register, A/X/Y and Direct Bank on stack $C0/EB78 C2 30 REP #$30 $C0/EB7A 48 PHA $C0/EB7B DA PHX $C0/EB7C 5A PHY $C0/EB7D 8B PHB $C0/EB7E E2 20 SEP #$20 ; Rebuild the brought-in address from $01DC-E in $0F-$11 $C0/EB80 AD DE 01 LDA $01DE ; ($0F-$10 will always be #$0000, the address on the bank is in Y ... $C0/EB83 85 11 STA $11 ; (... and both will be combined in Indexed Loading, see below) $C0/EB85 85 17 STA $17 ; Bank is stored in $17 (for the secondary 24-bit address) $C0/EB87 C2 20 REP #$20 ; A = 16 bit $C0/EB89 AC DC 01 LDY $01DC ; Finish setting up the Address in $0F-$11 + Y $C0/EB8C 64 0F STZ $0F $C0/EB8E B7 0F LDA [$0F],y ; Load first data double-byte (Decomp. data size = number of bytes to do) $C0/EB90 85 12 STA $12 ; Store it in $12 $C0/EB92 8D E2 01 STA $01E2 ; Store it in $01E2 for a latter use $C0/EB95 C8 INY ; Increment Load Index twice $C0/EB96 C8 INY $C0/EB97 B7 0F LDA [$0F],y ; Load next data double-byte $C0/EB99 85 0F STA $0F ; Store in $0F as new offset of the Data Load Address $C0/EB9B C8 INY ; Increment Load Index twice $C0/EB9C C8 INY $C0/EB9D 84 15 STY $15 ; Store Index (i. e. the Address without offset) in $15/6 for 24-bit Address $C0/EB9F AD DF 01 LDA $01DF ; Set destination of the decompressed data in WRAM Address registers $C0/EBA2 8D 81 21 STA $2181 $C0/EBA5 64 1E STZ $1E ; Clear Repition Address storage $C0/EBA7 64 21 STZ $21 ; Clear Repition Byte number storage $C0/EBA9 64 18 STZ $18 ; Clear counter for worked off decompression flags $C0/EBAB E2 20 SEP #$20 ; Set $7F as Direct Bank and as WRAM I/O Address bank ($2183) $C0/EBAD AD E1 01 LDA $01E1 ; Set the missing bank of the decompressed data in WRAM Address registers... $C0/EBB0 48 PHA ; ... and set it as Direct Bank $C0/EBB1 8D 83 21 STA $2183 $C0/EBB4 AB PLB
$C0/EBB5 Graphics Decompression
These are the "guts" of the graphics decompression. This is executed through one of the two preparation subroutines right above.
See the description at $C0/EB37 or $C0/EB77 for more detail
$C0/EBB5 A2 00 00 LDX #$0000 ; Clear X for convenience (after this X isn't used here) $C0/EBB8 80 0C BRA $0C ; [$EBC6] Go to Decompression Main Handler
$C0/EBBA E2 20 SEP #$20 ; Remove worked off flag from decompression flag buffer $C0/EBBC 06 19 ASL $19 $C0/EBBE E6 18 INC $18 ; Increment counter of worked off flags $C0/EBC0 A9 07 LDA #$07 ; Have 8 flags been worked off? $C0/EBC2 25 18 AND $18 $C0/EBC4 D0 0A BNE $0A ; [$EBD0] Branch if not, else: load next flag value into buffer $C0/EBC6 A7 15 LDA [$15] ; Load next decompression flag byte from data and store it in $19 $C0/EBC8 85 19 STA $19 $C0/EBCA C2 20 REP #$20 ; 16-bit INC secondary Load Address after loading $C0/EBCC E6 15 INC $15 $C0/EBCE E2 20 SEP #$20 $C0/EBD0 A5 19 LDA $19 ; Check next decompression flag $C0/EBD2 10 10 BPL $10 ; [$EBE4] Branch if it is not set $C0/EBD4 B7 0F LDA [$0F],y ; If decompression flag is SET, one byte gets transfered to WRAM as it is $C0/EBD6 8F 80 21 00 STA $002180 $C0/EBDA C8 INY ; Increment Load Index $C0/EBDB C2 20 REP #$20 ; Decrement the number of bytes to do $C0/EBDD C6 12 DEC $12 $C0/EBDF D0 D9 BNE $D9 ; [$EBBA] Loop if there is still something left to do $C0/EBE1 4C 1B EC JMP $EC1B ; Exit $C0/EBE4 C2 20 REP #$20 ; This is executed if something has to be repeated $C0/EBE6 B7 0F LDA [$0F],y ; Load first Double Byte (address of the data to repeat) $C0/EBE8 18 CLC $C0/EBE9 6F DF 01 00 ADC $0001DF ; Add offset of the Destination of the Decompressed Data (if Setup B was used) $C0/EBED 85 1E STA $1E ; Store as Load address (for this repition) $C0/EBEF C8 INY ; Increment Load Index (of the data) twice $C0/EBF0 C8 INY $C0/EBF1 B7 0F LDA [$0F],y ; Load third byte (number of bytes to transfer) $C0/EBF3 29 FF 00 AND #$00FF $C0/EBF6 18 CLC $C0/EBF7 69 03 00 ADC #$0003 ; Do 3 more bytes than the byte originally said $C0/EBFA 85 21 STA $21 ; Store this counter value in temp store $C0/EBFC C8 INY ; Increment Load Index (of the data) $C0/EBFD 5A PHY ; Buffer Load Index $C0/EBFE A0 00 00 LDY #$0000 ; Clear Y as new Index for the Repition's Data Loading $C0/EC01 E2 20 SEP #$20 ; A = 8 bit $C0/EC03 B1 1E LDA ($1E),y ; Load data byte $C0/EC05 8F 80 21 00 STA $002180 ; Store it to the decompressed data $C0/EC09 C8 INY ; Increment Load Index (for the repition) $C0/EC0A C2 20 REP #$20 ; A = 16 bit $C0/EC0C C6 21 DEC $21 ; 16-bit DEC number of bytes to repeat $C0/EC0E C6 12 DEC $12 ; 16-bit DEC number of bytes to do (overall) $C0/EC10 F0 08 BEQ $08 ; [$EC1A] Exit if all bytes are done $C0/EC12 A5 21 LDA $21 ; Check if bytes to repeat has run out by now $C0/EC14 10 EB BPL $EB ; [$EC01] Loop if not $C0/EC16 7A PLY ; If it has, restore the Data Load Index... $C0/EC17 4C BA EB JMP $EBBA ; [$C0:EBBA] ... end loop $C0/EC1A 7A PLY ; Pull Data Load index from stack (executed when the decomp ended on a repition) $C0/EC1B AB PLB ; Restore Flag register, A/X/Y and Direct Bank $C0/EC1C C2 30 REP #$30 $C0/EC1E 7A PLY $C0/EC1F FA PLX $C0/EC20 68 PLA $C0/EC21 28 PLP $C0/EC22 60 RTS
$00/FF90 PROGRAM START
$00/FF90 78 SEI ; Disable Interrupts $00/FF91 18 CLC ; Native Mode $00/FF92 FB XCE $00/FF93 D8 CLD ; Deactivate Decimal Mode $00/FF94 5C 00 00 C0 JMP $C00000 ; Go to whole Boot Sequence / FastROM/HiROM
$00/FF98 NMI HANDLER
$00/FF98 5C E7 01 C0 JMP $C001E7 ; Jump to actual NMI Handler / FastROM/HiROM
Internal Data for Snoopy Concert
| |
---|---|