Tactics Ogre:ROM map

From Data Crystal
Revision as of 06:26, 20 May 2016 by Lytron (talk | contribs) (Additions from yesterday)
Jump to: navigation, search

Contents

ROM offsets

These are ROM offsets for the starting points of each section (all in hex), pretty sure it's headerless (latest ROM revision, has Lakmir's translation patch applied to it):

40c33 - Spell Areas
40cc9 - Spell Function Bytes
40fb7 - Spell Accuracy Types (Auto-Hit, Dex-Based, etc.)
4104d - Spell Cost Type (Whether it eats HP or MP, how much, etc.)
41179 - Spell Formula Table
4133B - Spell Elements (Fire, Air, Virtue, etc.)
42703 - Character Sprite pointers
429e3 - Character Name pointers
42ad2 - Job IDs
42bc2 - Starting Elements
42cb0 - Starting Alignments
42dbf - Number of Magic Slots
42ead - Starting Level
42f9b - Starting HP
430bb - HP Growth
4314b - Starting MP
4326b - MP Growth
432fb - Starting Strength
4338b - Strength Growth
4341b - Starting Vitality
434ab - Vitality Growth
4353b - Starting Intelligence
435cb - Intelligence Growth
4365b - Starting Mentality
436eb - Mentality Growth
4377b - Starting Agility
4380b - Agility Growth
4389b - Starting Dexterity
4392b - Dexterity Growth
43a4c - Class Weight Penalties
43add - Physical Resistance
43b6e - Air Resistance
43bff - Fire Resistance
43c90 - Earth Resistance
43d21 - Water Resistance
43db2 - Virtue Resistance
43e43 - Bane Resistance
43ef4 - Attack+ Capability
440b1 - Species Table
441a1 - Basic Indirect Attack Type
442b0 - Magic Set that can be equipped
443a0 - Class Special Attacks (Slot 1)
4448f - Class Special Attacks (Slot 2)
4457e - Class Special Attacks (Slot 3)
4466d - Class Special Attacks (Slot 4)
4475b - Movement Types
44849 - Movement Rates
44937 - Starting Loyalties
44a26 - Weather Tolerance
451da - Item Types
452ca - Item Elements
453ba - Weapon Handedness
454aa - Item Equip Slot Locations (Finger, Head, etc.)
45655 - Item Weights
4572e - Item Strength Modifiers (Atk. Power)
4580e - Item Intelligence Modifiers
458ee - Item Agility Modifiers
459ce - Item Dexterity Modifiers
45aae - Item Vitality Modifiers
45b8e - Item Mentality Modifiers
45c6e - Item Luck Modifiers
45d4e - Item Physical Resistance (Def. Power) (signed)
45e2e - Item Air Resistance (signed)
45f0e - Item Fire Resistance (signed)
45fee - Item Earth Resistance (signed)
460ce - Item Water Resistance (signed)
461ae - Item Virtue Resistance (signed)
4628e - Item Bane Resistance (signed)
4646f - Item Prices (multiplied by 10 in-game)
46612 - Item Strength Raise at Level Up
466e4 - Item Intelligence Raise at Level Up
467b4 - Item Agility Raise at Level Up
46884 - Item Dexterity Raise at Level Up
46956 - Item Vitality Raise at Level Up
46a26 - Item Mentality Raise at Level Up
46af6 - Item Luck Raise at Level Up
46bc6 - Item Special Effects (Stuns on hit, Anti-Dragon, etc.)
46cb6 - Item Special Skills (used in the Item menu)
46d86 - Item Status Guards (immunity to petrification, etc.)
46e76 - Item Passive Effects (wearer can fly, HP regen, etc.)
47047 - Spell MP cost/Targeting Information
47172 - Spell Schools (Hahnela, Ishtar, DragonGod, etc.)
47208 - Spell Ranges
4729e - Special Spell Conditions #1 (Summons, Line-of-sight spells, whether equipment is needed, etc.)
4732f - Spell Prices (multiplied by 10 in-game)
47431 - Spell Set Modifiers
474a1 - How the caster behaves when using the spell/skill. NOTE: Each half of the bytes here specifies one skill.
474f1 - Special Spell Conditions #2 (If equipment is needed, this specifies the type (swords, spears, etc.) NOTE: Each half of the bytes here specifies one skill.
ea0dc - Class Grids (determines what you can change into)
ebba7 - Denim's Base Class
ebca1 - Denim's Initial Equipment (Slot 1)
ebcac - Denim's Initial Equipment (Slot 2)
ebcb7 - Denim's Initial Equipment (Slot 3)
ebcc2 - Denim's Initial Equipment (Slot 4)
ebc94 - Denim's Initial Spells (doesn't insert into Magic menu, need to use a JMP routine to get anything out of it)
ed61e - Item Shop pointers/data
ed6d9 - Magic Shop pointers/data
f3195 - Job Stat Requirements (what's needed to change into that job stat-wise, might also cover alignment but I couldn't tell from a glance).

Bank $80

This is all taken from the Japanese V1.0 version

$80/8000 ROM Start

$00/8000 18          CLC           ; Switch to Native Mode
$00/8001 FB          XCE
$00/8002 78          SEI           ; Disable Interrupts
$00/8003 D8          CLD           ; Deactivate Decimal Mode (if accidentally turned on)
$00/8004 4B          PHK           ; Push Bank Register
$00/8005 AB          PLB           ; Pull Data Bank Register
$00/8006 E2 20       SEP #$20
$00/8008 C2 10       REP #$10
$00/800A A2 FF 1F    LDX #$1FFF    ; Set Stack to $7E:1FFF
$00/800D 9A          TXS
$00/800E F4 00 00    PEA $0000     ; Direct Page Register = #$0000
$00/8011 2B          PLD
$00/8012 9C 00 42    STZ $4200     ; Deactivate NMI / Auto-Joypad
$00/8015 9C AF 05    STZ $05AF     ; Backup for $4200?
$00/8018 20 6A 80    JSR $806A     ; De-activate HDMAs, FBLANK, Clear Screen Destination Registers

Clear $7E:2000 to $7E:FFFF

$00/801B A0 00 E0    LDY #$E000    ; DMA Size: #$E000
$00/801E 8C 05 43    STY $4305
$00/8021 A0 00 20    LDY #$2000    ; WRAM Destination: $(7E)2000
$00/8024 18          CLC           ; WRAM-Destination: Bank $7E
$00/8025 A2 69 80    LDX #$8069    ; DMA Source Address: $00/8069 (ROM: $0000.0069
$00/8028 A9 00       LDA #$00
$00/802A 22 A7 9D 80 JSL $809DA7   ; Long Branch to the DMA setup and activation
$00/802E A9 01       LDA #$01      ; Activate Fast ROM
$00/8030 8D 0D 42    STA $420D
$00/8033 22 00 80 8F JSL $8F8000   ; Jump to ??? (Sound Setup?)

$00/8037 64 59       STZ $59       ; ???
$00/8039 64 EA       STZ $EA
$00/803B C6 EA       DEC $EA       ; ??? ($EA = #$FF)
$00/803D A9 01       LDA #$01
$00/803F 85 51       STA $51       ; ??? ($51 = #$01)
$00/8041 78          SEI           ; Disable Interrupts (again)
$00/8042 D8          CLD           ; Deactivate Decimal Mode (again)
$00/8043 4B          PHK           ; Push Bank Register
$00/8044 AB          PLB           ; Pull Data Bank Register
$00/8045 E2 20       SEP #$20
$00/8047 C2 10       REP #$10
$00/8049 A2 00 02    LDX #$0200
$00/804C 8E 5F 05    STX $055F     ; ???
$00/804F 9C 00 42    STZ $4200     ; Deactivate NMI / Auto-Joypad (again)
$00/8052 9C AF 05    STZ $05AF     ; Backup for $4200?
$00/8055 20 6A 80    JSR $806A     ; De-activate HDMAs, FBLANK, Clear Screen Destination Registers 

$00/8058 A9 01       LDA #$01      ; Activate Fast ROM (again)
$00/805A 8D 0D 42    STA $420D
$00/805D AF F0 FF 00 LDA $00FFF0   ; = #$FF
$00/8061 8F F3 00 00 STA $0000F3   ; ???
$00/8065 5C 91 80 80 JMP $808091   ; Jump to ???

$80/8069 Clear Byte

$00/8069 00                        ; Clear Byte for $80/801B

$80/806A De-activate HDMAs, FBLANK, Clear Screen Destination Registers

$00/806A 9C 0C 42    STZ $420C     ; De-activate HDMAs
$00/806D 9C B0 05    STZ $05B0     ; Backup for $420C?
$00/8070 9C 86 05    STZ $0586     ; Backup for $420C?
$00/8073 A9 80       LDA #$80
$00/8075 8D 00 21    STA $2100     ; FBLANK
$00/8078 8D 87 05    STA $0587     ; Backup for $2100
$00/807B 8D 6A 05    STA $056A     ; Backup for $2100
$00/807E 9C 2C 21    STZ $212C     ; Clear Main Screen Destinations
$00/8081 9C 2D 21    STZ $212D     ; Clear Subscreen Destinations
$00/8084 60          RTS

$80/8085 NMI Handler

$00/8085 5C 7E AF 80 JMP $80AF7E   ; NMI Handler ("Jump to" Fast ROM)

$80/8091 ???

$80/8091 22 4A A1 80 JSL $80A14A   ; Long-Jump to Deactivation of NMI, Auto-Joypad & HDMAs
$80/8095 A2 FF 1F    LDX #$1FFF    ; Set Stack to $7E:1FFF
$80/8098 9A          TXS
$80/8099 F4 00 00    PEA $0000     ; Direct Page Register = #$0000
$80/809C 2B          PLD
$80/809D 4B          PHK           ; Push Bank Register
$80/809E AB          PLB           ; Pull Data Bank Register
$80/809F 22 B6 A1 80 JSL $80A1B6   ; Write Executable Code in WRAM
$80/80A3 A5 51       LDA $51    [$00:0051]   A:A16B X:05DD Y:0004 P:eNvMxdIzC
$80/80A5 F0 0C       BEQ $0C    [$80B3]      A:A101 X:05DD Y:0004 P:envMxdIzC
$80/80A7 C9 02       CMP #$02                A:A101 X:05DD Y:0004 P:envMxdIzC
$80/80A9 F0 04       BEQ $04    [$80AF]      A:A101 X:05DD Y:0004 P:eNvMxdIzc
$80/80AB A9 F8       LDA #$F8                A:A101 X:05DD Y:0004 P:eNvMxdIzc
$80/80AD 80 06       BRA $06    [$80B5]      A:A1F8 X:05DD Y:0004 P:eNvMxdIzc

Code is missing here

$80/80B5 85 F5       STA $F5    [$00:00F5]   A:A1F8 X:05DD Y:0004 P:eNvMxdIzc
$80/80B7 22 28 AF 80 JSL $80AF28[$80:AF28]   A:A1F8 X:05DD Y:0004 P:eNvMxdIzc
$80/80BB 22 14 AF 80 JSL $80AF14[$80:AF14]   A:0000 X:05DD Y:0004 P:eNvMxdIzc
$80/80BF E6 EA       INC $EA    [$00:00EA]   A:00FF X:33CC Y:9E7A P:eNvMxdIzc
$80/80C1 A5 EA       LDA $EA    [$00:00EA]   A:00FF X:33CC Y:9E7A P:envMxdIZc
$80/80C3 C9 05       CMP #$05                A:0000 X:33CC Y:9E7A P:envMxdIZc
$80/80C5 90 02       BCC $02    [$80C9]      A:0000 X:33CC Y:9E7A P:eNvMxdIzc
$80/80C9 20 59 B7    JSR $B759  [$80:B759]   A:0000 X:33CC Y:9E7A P:eNvMxdIzc
$80/80CC 20 73 B6    JSR $B673     ; Clear Registers, clear WRAM Bank $7F
$80/80CF 20 4D B5    JSR $B54D     ; Clear Graphic Setup Registers
$80/80D2 20 CD B5    JSR $B5CD     ; ???
$80/80D5 7B          TDC                     A:E880 X:0320 Y:0000 P:envMxdIzC
$80/80D6 8F 12 BD 7E STA $7EBD12[$7E:BD12]   A:0000 X:0320 Y:0000 P:envMxdIZC
$80/80DA 8F 84 BD 7E STA $7EBD84[$7E:BD84]   A:0000 X:0320 Y:0000 P:envMxdIZC
$80/80DE AF 37 21 00 LDA $002137   ; ??? Makes the current H Counter value appear in $213C?
$80/80E2 AF 3C 21 00 LDA $00213C   ; ??? Current H Counter!?!
$80/80E6 22 65 AD 80 JSL $80AD65[$80:AD65]   A:0080 X:0320 Y:0000 P:eNvMxdIzC
$80/80EA 22 F1 98 80 JSL $8098F1[$80:98F1]   A:0413 X:0021 Y:0000 P:eNvMxdIzC
$80/80EE 9C BD 05    STZ $05BD     ; ??? Some Flag Register?
$80/80F1 9C 38 00    STZ $0038     ; ???
$80/80F4 9C BF 05    STZ $05BF     ; ??? Jump Table Index?
$80/80F7 9C C0 05    STZ $05C0     ; ??? Jump Table Index?
$80/80FA A9 80       LDA #$80      ; Activate FBLANK
$80/80FC 8D 87 05    STA $0587
$80/80FF 9C A6 05    STZ $05A6     ; Remove everything from Main Screen
$80/8102 9C A7 05    STZ $05A7     ; Remove everything from Subscreen
$80/8105 58          CLI           ; Enable Interrupts
$80/8106 20 2F A1    JSR $A12F     ; Activate NMI and Auto-Joypad Read
$80/8109 22 8A A1 80 JSL $80A18A   ; ??? Wait for the next NMI?
$80/810D 22 8A A1 80 JSL $80A18A   ; ??? Wait for the next NMI?
$80/8111 22 8A A1 80 JSL $80A18A   ; ??? Wait for the next NMI?
$80/8115 22 4A A1 80 JSL $80A14A   ; Long Jump to Deactivate NMI, Auto-Joypad and HDMAs
$80/8119 AF F3 00 00 LDA $0000F3[$00:00F3]   A:0080 X:00FF Y:0000 P:eNvMxdizc
$80/811D 89 01       BIT #$01                A:00FF X:00FF Y:0000 P:eNvMxdizc
$80/811F D0 08       BNE $08    [$8129]      A:00FF X:00FF Y:0000 P:eNvMxdizc
$80/8129 58          CLI                     A:00FF X:00FF Y:0000 P:eNvMxdizc
$80/812A 20 2F A1    JSR $A12F     ; Activate NMI and Auto-Joypad Read
$80/812D 22 98 A9 9D JSL $9DA998[$9D:A998]   A:0081 X:00FF Y:0000 P:eNvMxdiZc

$80/8131 Main Loop?

$80/8131 20 92 A1    JSR $A192     ; ??? Wait for the next NMI?
$80/8134 7B          TDC           ; Clear 16-bit A
$80/8135 AD BF 05    LDA $05BF     ; Load Main Jump Table Index and use it
$80/8138 0A          ASL A
$80/8139 AA          TAX
$80/813A FC 42 81    JSR ($8142,x) ; Jump to something on the Main Jump Table
$80/813D 20 72 8D    JSR $8D72     ; Fade Screen In or Out
$80/8140 80 EF       BRA $EF       ; [$8131]

$80/8142 Main Jump Table

67 81   $8167 - Entry #$00
82 81   $8182 - Entry #$01
C5 81   $81C5 - Entry #$02
02 85   $8502 - Entry #$03
F1 88   $88F1 - Entry #$04
66 81   $8166 - Entry #$05 - RTS
22 83   $8322 - Entry #$06
EC 88   $88EC - Entry #$07
C9 9C   $9CC9 - Entry #$08
FD 9C   $9CFD - Entry #$09
66 81   $8166 - Entry #$0A - RTS
66 81   $8166 - Entry #$0B - RTS
2F 84   $842F - Entry #$0C
66 81   $8166 - Entry #$0D - RTS
66 81   $8166 - Entry #$0E - RTS
F6 88   $88F6 - Entry #$10
2E 83   $832E - Entry #$11
8B 81   $818B - Entry #$12

$80/8166 Main Jump Table Entry #$05 - EMPTY

Is just a RTS

$80/8900 Increment Jump Table Index?

$80/8900 EE BF 05    INC $05BF     ; Increment one Jump Table Index...
$80/8903 9C C0 05    STZ $05C0     ; ... and set the other to zero?
$80/8906 60          RTS

$80/89AA BATTLE: Long Jump to Check if the Cursor is in Screen Center

$80/89AA 8B          PHB           ; Buffer Data Bank on Stack
$80/89AB 4B          PHK           ; Set Data Bank to $80
$80/89AC AB          PLB
$80/89AD 20 B2 89    JSR $89B2     ; Check if the Cursor is in Screen Center
$80/89B0 AB          PLB           ; Restore Data Bank
$80/89B1 6B          RTL

$80/89B2 BATTLE: Check if the Cursor is in Screen Center

This checks if the Cursor is in the Center of the Screen.

If A is empty at the end, it is in center, if not, it's off center.

$80/89B2 A2 3C 00    LDX #$003C    ; Index of the Rhomb Marker for the Global Pos List
$80/89B5 A0 00 00    LDY #$0000    ; Clear Signal Register
$80/89B8 C2 20       REP #$20
$80/89BA BD 43 07    LDA $0743,x   ; Load the Global X-Position of the Rhomb Marker
$80/89BD 38          SEC           ; Subtract #$80 (no. of pixels between the screen center and border)
$80/89BE E9 80 00    SBC #$0080
$80/89C1 CD 91 05    CMP $0591     ; Compare with BG1 HScroll
$80/89C4 F0 01       BEQ $01       ; [$89C7] Branch if Cursor is in Center
$80/89C6 C8          INY           ; Set Signal - Not in Center!
$80/89C7 BD 83 07    LDA $0783,x   ; Load the Global Y-Position of the Rhomb Marker
$80/89CA 38          SEC           ; Subtract #$77 (about no. of pixels between the screen center and border)
$80/89CB E9 77 00    SBC #$0077
$80/89CE CD 93 05    CMP $0593     ; Compare with BG1 VScroll
$80/89D1 F0 01       BEQ $01       ; [$89D4] Branch if Cursor is in Center
$80/89D3 C8          INY           ; Set Signal - Not in Center!
$80/89D4 E2 20       SEP #$20
$80/89D6 98          TYA           ; Transfer the "Off-Center-Signal" in A
$80/89D7 60          RTS

$80/8A0A BATTLE: Scroll the Map due to Cursor Movement

$80/8A0A AE 91 05    LDX $0591     ; Copy the current BG1 HScroll value in $05FB
$80/8A0D 8E FB 05    STX $05FB
$80/8A10 AE 93 05    LDX $0593     ; Copy the current BG1 VScroll value in $05FD
$80/8A13 8E FD 05    STX $05FD
$80/8A16 AE 3D 00    LDX $003D  [$80:003D]   A:0E00 X:0048 Y:0014 P:envMxdizC
$80/8A19 10 1E       BPL $1E    [$8A39]      A:0E00 X:FFFF Y:0014 P:eNvMxdizC
$80/8A1B A5 60       LDA $60    [$00:0060]   A:0E00 X:FFFF Y:0014 P:eNvMxdizC
$80/8A1D D0 03       BNE $03    [$8A22]      A:0E01 X:FFFF Y:0014 P:envMxdizC
Code is missing here
$80/8A22 A2 3C 00    LDX #$003C    ; Index for the Rhomb Marker
$80/8A25 C2 20       REP #$20
$80/8A27 BD 43 07    LDA $0743,x   ; Load the Global X-Position of the Rhomb Marker
$80/8A2A 85 00       STA $00       ; Use $00 as Tempstore
$80/8A2C BD 83 07    LDA $0783,x   ; Load the Global Y-Position of the Rhomb Marker
$80/8A2F 38          SEC           ; ??? (Subtract 8 for unknown reasons)
$80/8A30 E9 08 00    SBC #$0008
$80/8A33 85 02       STA $02       ; Use $02 as Tempstore
$80/8A35 E2 20       SEP #$20
$80/8A37 80 0E       BRA $0E       ; [$8A47]
Code is missing here
$80/8A47 A0 00 00    LDY #$0000    ; Clear this Direction Flag Register
$80/8A4A C2 20       REP #$20
$80/8A4C A5 00       LDA $00       ; Load the Global X-Position of the Rhomb Marker
$80/8A4E 38          SEC           ; Subtract BG1 Horizontal Scroll
$80/8A4F ED 91 05    SBC $0591
$80/8A52 38          SEC           ; Subtract #$80 (half of Screen Width)
$80/8A53 E9 80 00    SBC #$0080
$80/8A56 10 05       BPL $05       ; [$8A5D] Branch if the cursor is to the right of the screen center
$80/8A58 49 FF FF    EOR #$FFFF    ; It's left to the center, so it's a negative value in A - turn it positive
$80/8A5B 1A          INC A         ; You have to add 1 after turning positive
$80/8A5C C8          INY           ; ??? Set flag for "it was negative"?
$80/8A5D C9 41 00    CMP #$0041    ; Check if the cursor is further than #$41px away from the center
$80/8A60 90 15       BCC $15       ; [$8A77] If not, branch
$80/8A62 A9 C0 00    LDA #$00C0    ; C0 is the border to the right where scrolling doesn't activate yet
$80/8A65 C0 00 00    CPY #$0000    ; Check if the cursor went out of the focus to the left or the right
$80/8A68 F0 03       BEQ $03       ; [$8A6D] Leave out the next line if it was to the right
$80/8A6A A9 40 00    LDA #$0040    ; Replace it with the address of the left border if it was to the left
$80/8A6D 38          SEC           ; Subtract the Global X-Position of the cursor 
$80/8A6E E5 00       SBC $00
$80/8A70 49 FF FF    EOR #$FFFF    ; Turn the result into a positive number
$80/8A73 1A          INC A
$80/8A74 8D 91 05    STA $0591     ; [$80:0591] Store it as the new BG1 H Scroll value
$80/8A77 A0 00 00    LDY #$0000    ; Clear this Direction Flag Register
$80/8A7A C2 20       REP #$20
$80/8A7C A5 02       LDA $02       ; Load the Global Y-Position of the Rhomb Marker
$80/8A7E 38          SEC           ; Subtract BG1 Vertical Scroll
$80/8A7F ED 93 05    SBC $0593
$80/8A82 38          SEC           ; Subtract #$6F (about half of Screen Height)
$80/8A83 E9 6F 00    SBC #$006F
$80/8A86 10 05       BPL $05       ; [$8A8D] Branch if the cursor is in the lower than the screen center
$80/8A88 49 FF FF    EOR #$FFFF    ; It's above the screen center, so turn the distance into a positive number...
$80/8A8B 1A          INC A
$80/8A8C C8          INY           ; ... and set the flag that it is above the center
$80/8A8D C9 29 00    CMP #$0029    ; Check if the cursor is further than #$29px away from the center
$80/8A90 90 15       BCC $15       ; [$8AA7] If not, branch
Code is missing here
$80/8AA7 AD 91 05    LDA $0591     ; Check if this subroutine changed BG1 HScroll Value
$80/8AAA CD FB 05    CMP $05FB
$80/8AAD D0 2A       BNE $2A       ; [$8AD9] Branch if it has
$80/8AAF AD 91 05    LDA $0591  [$80:0591]   A:0150 X:003C Y:0000 P:envmxdiZC
$80/8AB2 89 0F 00    BIT #$000F              A:0150 X:003C Y:0000 P:envmxdizC
$80/8AB5 F0 1D       BEQ $1D    [$8AD4]      A:0150 X:003C Y:0000 P:envmxdiZC
Code is missing here
$80/8AD4 9C FF 05    STZ $05FF     ; Clear $05FF - no distance to scroll
$80/8AD7 80 0A       BRA $0A       ; [$8AE3]
$80/8AD9 AD 91 05    LDA $0591     ; If the BG1 HScroll value has been changed, calculate the difference
$80/8ADC 38          SEC
$80/8ADD ED FB 05    SBC $05FB
$80/8AE0 8D FF 05    STA $05FF     ; And store it in $05FF (16-bit value, can be negative)
Code is missing here
$80/8AE3 AD 93 05    LDA $0593     ; Check if this subroutine changed BG1 VScroll Value
$80/8AE6 CD FD 05    CMP $05FD
$80/8AE9 D0 2A       BNE $2A       ; [$8B15] Branch if it has
$80/8AEB AD 93 05    LDA $0593  [$80:0593]   A:0048 X:003C Y:0000 P:envmxdiZC
$80/8AEE 89 07 00    BIT #$0007              A:0048 X:003C Y:0000 P:envmxdizC
$80/8AF1 F0 1D       BEQ $1D    [$8B10]      A:0048 X:003C Y:0000 P:envmxdiZC
Code is missing here
$80/8B10 9C 01 06    STZ $0601     ; Clear $0601 - no distance to scroll
$80/8B13 80 0A       BRA $0A       ; [$8B1F] Exit
Code is missing here
$80/8B1F E2 20       SEP #$20
$80/8B21 60          RTS


$80/8D6A Long Jump to Fade Screen In or Out

$80/8D6A 8B          PHB           ; Buffer Program Bank
$80/8D6B 4B          PHK           ; Set $80 as Program Bank
$80/8D6C AB          PLB
$80/8D6D 20 72 8D    JSR $8D72     ; Fade Screen In or Out
$80/8D70 AB          PLB           ; Restore Program Bank
$80/8D71 6B          RTL

$80/8D72 Fade Screen In or Out

$80/8D72 AD C2 05    LDA $05C2     ; Load Fade In/Out Flags
$80/8D75 89 01       BIT #$01      ; Is Fade In Flag set? (Bit 0)
$80/8D77 F0 16       BEQ $16       ; [$8D8F] Branch if not
$80/8D79 AD 87 05    LDA $0587     ; Load $2100 Buffer
$80/8D7C 29 0F       AND #$0F      ; Remove the FBLANK Bit, leave the Screen brightness
$80/8D7E 18          CLC           ; Turn Screen Brightness up by two degrees
$80/8D7F 69 02       ADC #$02
$80/8D81 C9 0F       CMP #$0F      ; Check if it surpassed the maximum
$80/8D83 90 05       BCC $05       ; [$8D8A] Branch if it didn't
$80/8D85 9C C2 05    STZ $05C2     ; Deactivate Fade In/Out Flags
$80/8D88 A9 0F       LDA #$0F      ; If brightness+2 surpasses the limit, set to max brightness
$80/8D8A 8D 87 05    STA $0587     ; Store it in $2100 buffer and then exit
$80/8D8D 80 18       BRA $18       ; [$8DA7] YOU CAN MAKE THIS SHORTER- remove the line above and branch to $8DA4
$80/8D8F 89 02       BIT #$02      ; Is Fade Out Flag set? (Bit 1)
$80/8D91 F0 14       BEQ $14       ; [$8DA7] ??? Exit if not
$80/8D93 AD 87 05    LDA $0587     ; Load $2100 Buffer
$80/8D96 30 07       BMI $07       ; [$8D9F] Branch if FBLANK is active
$80/8D98 38          SEC           ; Turn Brightness down by two degrees
$80/8D99 E9 02       SBC #$02
$80/8D9B F0 02       BEQ $02       ; [$8D9F] Activate FBLANK and exit if we reached 0 (or turned negative)
$80/8D9D 10 05       BPL $05       ; [$8DA4] If still positive, store new Brightness back and exit
$80/8D9F 9C C2 05    STZ $05C2     ; Deactivate Fade In/Out Flags
$80/8DA2 A9 80       LDA #$80      ; Activate FBLANK
$80/8DA4 8D 87 05    STA $0587
$80/8DA7 60          RTS

$80/9A21 Calculate the Global Cursor Position from it's Position on Map

Sorry, my language skills as well as my explanation skills are too limited to explain here how the calculation works, so you/we have to accept that it works.

What this subroutine does, is: It takes the coordinates of the cursor on the grid (you know, the Northeast-Southwest-Axis/Northwest-Southeast-coordinates) and turns it into an actual number of pixel offset.

$80/9A21 A2 3C 00    LDX #$003C    ; Write Index for the second last figure (Rhomb Marker) 
$80/9A24 A0 3E 00    LDY #$003E    ; Write Index for the last figure (Pointing Hand)
$80/9A27 C2 21       REP #$21
$80/9A29 AD CA 16    LDA $16CA     ; Load Width of the Map on the NE-SW-Axis(?)
$80/9A2C 6D 61 00    ADC $0061     ; Add Cursor Position - NW to SE Axis
$80/9A2F 38          SEC
$80/9A30 ED 63 00    SBC $0063     ; Subtract Cursor Position - NE to SW Axis
$80/9A33 0A          ASL A         ; Multiply by #$10 --- #$10 pixels per Rhomb
$80/9A34 0A          ASL A
$80/9A35 0A          ASL A
$80/9A36 0A          ASL A
$80/9A37 9D 43 07    STA $0743,x   ; Store for Rhomb Marker
$80/9A3A 99 43 07    STA $0743,y   ; Store for Pointing Hand
$80/9A3D 38          SEC           ; Set Carry (is a +1 for the next ADC-command)
$80/9A3E AD CC 16    LDA $16CC     ; Load Width of the Map on the NW-SE-Axis(?)
$80/9A41 6D 61 00    ADC $0061     ; Add Cursor Position - NW to SE Axis + 1
$80/9A44 6D 63 00    ADC $0063     ; Add Cursor Position - NE to SW Axis
$80/9A47 38          SEC
$80/9A48 ED 65 00    SBC $0065     ; Subtract the (geographical) Height of the Rhomb
$80/9A4B 0A          ASL A         ; Multiply by #$8 --- #$8 pixels per Rhomb
$80/9A4C 0A          ASL A
$80/9A4D 0A          ASL A
$80/9A4E 09 07 00    ORA #$0007    ; "Add" 7 pixels
$80/9A51 9D 83 07    STA $0783,x   ; Store as Y-Offset for the Rhomb Marker
$80/9A54 38          SEC           ; Subtract #$0018 pixels - the distance between Rhomb Marker and Pointing Hand
$80/9A55 E9 18 00    SBC #$0018
$80/9A58 99 83 07    STA $0783,y   ; Store as Y-Offset of the Pointing Hand
$80/9A5B E2 20       SEP #$20
$80/9A5D 60          RTS

$80/8FA8 ???

$80/8FA8 A9 43       LDA #$43      ; DMA Options: HDMA, write 2 registers twice each
$80/8FAA 8D 70 43    STA $4370
$80/8FAD A9 21       LDA #$21      ; CGRAM Address (+ Data) Register (writes both twice)
$80/8FAF 8D 71 43    STA $4371
$80/8FB2 A2 00 B0    LDX #$B000    ; Source Address: $7E/B000
$80/8FB5 8E 72 43    STX $4372
$80/8FB8 A9 7E       LDA #$7E
$80/8FBA 8D 74 43    STA $4374
$80/8FBD A9 7E       LDA #$7E      ; HDMA Indirect Address Bank: $7E
$80/8FBF 8D 77 43    STA $4377
$80/8FC2 A9 80       LDA #$80      ; Set the bit for this DMA Channel in the HDMA activation flag buffer
$80/8FC4 0C B0 05    TSB $05B0
$80/8FC7 A9 43       LDA #$43      ; DMA Options: HDMA, write 2 registers twice each
$80/8FC9 8D 10 43    STA $4310
$80/8FCC A9 11       LDA #$11      ; BG3 H/V Scroll Registers
$80/8FCE 8D 11 43    STA $4311
$80/8FD1 A2 A0 B0    LDX #$B0A0    ; Source Address: $7E/B0A0
$80/8FD4 8E 12 43    STX $4312
$80/8FD7 A9 7E       LDA #$7E
$80/8FD9 8D 14 43    STA $4314
$80/8FDC A9 00       LDA #$00      ; HDMA Indirect Address Bank: $00
$80/8FDE 8D 17 43    STA $4317
$80/8FE1 A9 02       LDA #$02      ; Set the bit for this DMA Channel in the HDMA activation flag buffer
$80/8FE3 0C B0 05    TSB $05B0
$80/8FE6 A9 43       LDA #$43      ; DMA Options: HDMA, write 2 registers twice each
$80/8FE8 8D 60 43    STA $4360
$80/8FEB A9 0F       LDA #$0F      ; BG2 H/V Scroll Registers
$80/8FED 8D 61 43    STA $4361
$80/8FF0 A2 20 B0    LDX #$B020    ; Source Address: $7E/B020
$80/8FF3 8E 62 43    STX $4362
$80/8FF6 A9 7E       LDA #$7E
$80/8FF8 8D 64 43    STA $4364
$80/8FFB A9 00       LDA #$00      ; HDMA Indirect Address Bank: $00
$80/8FFD 8D 67 43    STA $4367
$80/9000 A9 40       LDA #$40      ; Set the bit for this DMA Channel in the HDMA activation flag buffer
$80/9002 0C B0 05    TSB $05B0
$80/9005 A9 43       LDA #$43      ; DMA Options: HDMA, write 2 registers twice each
$80/9007 8D 50 43    STA $4350
$80/900A A9 0D       LDA #$0D      ; BG1 H/V Scroll Registers
$80/900C 8D 51 43    STA $4351
$80/900F A2 20 B0    LDX #$B020    ; Source Address: $7E/B020
$80/9012 8E 52 43    STX $4352
$80/9015 A9 7E       LDA #$7E
$80/9017 8D 54 43    STA $4354
$80/901A A9 00       LDA #$00      ; HDMA Indirect Address Bank: $00
$80/901C 8D 57 43    STA $4357
$80/901F A9 20       LDA #$20      ; Set the bit for this DMA Channel in the HDMA activation flag buffer
$80/9021 0C B0 05    TSB $05B0
$80/9024 A2 00 B0    LDX #$B000              A:0020 X:B020 Y:001E P:envMxdiZC
$80/9027 8E FC 16    STX $16FC  [$80:16FC]   A:0020 X:B000 Y:001E P:eNvMxdizC
$80/902A A2 20 B0    LDX #$B020              A:0020 X:B000 Y:001E P:eNvMxdizC
$80/902D 8E FE 16    STX $16FE  [$80:16FE]   A:0020 X:B020 Y:001E P:eNvMxdizC
$80/9030 8E 00 17    STX $1700  [$80:1700]   A:0020 X:B020 Y:001E P:eNvMxdizC
$80/9033 A2 A0 B0    LDX #$B0A0              A:0020 X:B020 Y:001E P:eNvMxdizC
$80/9036 8E 02 17    STX $1702  [$80:1702]   A:0020 X:B0A0 Y:001E P:eNvMxdizC
$80/9039 20 BA 96    JSR $96BA  [$80:96BA]   A:0020 X:B0A0 Y:001E P:eNvMxdizC
$80/903C 20 4A 96    JSR $964A  [$80:964A]   A:1700 X:B040 Y:000C P:eNvMxdizC
$80/903F EE FB 16    INC $16FB  [$80:16FB]   A:01A4 X:1744 Y:035C P:envMxdiZC
$80/9042 60          RTS                     A:01A4 X:1744 Y:035C P:envMxdizC

$80/9D32 DMA Subroutine

Destination has to be set before this Subroutine is called

$80/9D32 8D 04 43    STA $4304     ; A: Source Bank (8 bit)
$80/9D35 8E 02 43    STX $4302     ; X: Source Address (16 bit)
$80/9D38 8C 05 43    STY $4305     ; Y: Number of Bytes to transfer
$80/9D3B A9 00       LDA #$00      ; DMA options
$80/9D3D 8D 00 43    STA $4300
$80/9D40 A9 01       LDA #$01      ; Activate DMA
$80/9D42 8D 0B 42    STA $420B
$80/9D45 60          RTS

$80/9D81 Long Jump to VRAM Clear

A: Source Bank of the Clear Byte (8 bit)

X: Source Address of the Clear Byte (16 bit)

Y: Destination VRAM Address (16 bit)

$80/9D81 8B          PHB           ; Buffer Program Bank
$80/9D82 4B          PHK           ; Set $80 as Program Bank
$80/9D83 AB          PLB
$80/9D84 20 89 9D    JSR $9D89     ; VRAM Clear
$80/9D87 AB          PLB           ; Restore Program Bank
$80/9D88 6B          RTL

$80/9D89 VRAM Clear

$80/9D89 8D 04 43    STA $4304     ; A: Source Bank (8 bit)
$80/9D8C 8E 02 43    STX $4302     ; X: Source Address (16 bit)
$80/9D8F 8C 16 21    STY $2116     ; Y: Destination VRAM Address (16 bit)
$80/9D92 A9 80       LDA #$80      ; Increment after writing $2119
$80/9D94 8D 15 21    STA $2115
$80/9D97 A9 09       LDA #$09      ; FIXED TRANSFER, 16 bit Transfer
$80/9D99 8D 00 43    STA $4300
$80/9D9C A9 18       LDA #$18      ; DMA Destination: $2118, VRAM
$80/9D9E 8D 01 43    STA $4301
$80/9DA1 A9 01       LDA #$01      ; Activate DMA
$80/9DA3 8D 0B 42    STA $420B
$80/9DA6 60          RTS

$80/9DA7 Long Jump to the WRAM-Clear-DMA

$80/9DA7 20 AB 9D    JSR $9DAB     ; Setup of the rest of the DMA and activation
$80/9DAA 6B          RTL

$80/9DAB WRAM-Clear-DMA

This Subroutine is half a setup for a DMA and starts the DMA. The first half of the setup has to be done before this Subroutine gets called. A call can be found at $80/801B. This is a fixed Transfer, so it's used for Clear Up DMAs. Furthermore, due to it's construction it is fixed to WRAM addresses. Before this subroutine is called, there are additional values that are loaded into certain registers:

A: Source Bank (8 bit)

X: Source Address (16 bit)

Y: Destination WRAM Address (16 bit)

Carry Bit Set: WRAM Bank $7F / Carry Bit Clear: WRAM Bank $7E

$80/9DAB 8D 04 43    STA $4304     ; A: Source Bank (8 bit)
$80/9DAE 8E 02 43    STX $4302     ; X: Source Address (16 bit)
$80/9DB1 8C 81 21    STY $2181     ; Y: Destination WRAM Address (16 bit)
$80/9DB4 2A          ROL A         ; Roll Carry-Bit in A
$80/9DB5 8D 83 21    STA $2183     ; If carry bit was set: Bank $7F, if clear: $7E
$80/9DB8 A9 08       LDA #$08      ; FIXED TRANSFER
$80/9DBA 8D 00 43    STA $4300
$80/9DBD A9 80       LDA #$80      ; DMA to Register $2180 --> to the WRAM address previously set up
$80/9DBF 8D 01 43    STA $4301
$80/9DC2 A9 01       LDA #$01      ; Activate DMA
$80/9DC4 8D 0B 42    STA $420B
$80/9DC7 60          RTS

$80/9DC8 Long Jump to Write Empty Tilemap in WRAM

$80/9DC8 20 CC 9D    JSR $9DCC     ; Write Empty Tilemap in WRAM
$80/9DCB 6B          RTL

$80/9DCC Write Empty Tilemap in WRAM

This subroutine is used to write the same double-byte over and over into a bigger space. This is used to write empty tilemaps in WRAM.

X contains the number of bytes to do

Y contains the destination address (the destination bank has to be set as Data Bank before this subroutine is called)

A (16-bit) contains the 16-bit value that should be written

This subroutine has to ways of doing this: Either it simply works off $20 byte in one step, or it does less if it has to do less then $20 byte. So, whatever amount you give it, it clears the big bunch in $20 byte steps first and then does the rest in the second way of doing it. The first part of the program is about distinguishing which method is to use.

This subroutine is actually quite well done: At $80/9DE4, it uses the remaining number of bytes to do which is in X as an index for a jump table, the jump table then lets the program jump right into the middle of the whole Store commands that start at $9E0D - that's the reason why it starts at $001E,y and not at $0000,y!

$80/9DCC D4 00       PEI ($00)     ; Buffer $00 on stack
$80/9DCE E0 21 00    CPX #$0021    ; Check if the number of bytes-to-do is more than #$20
$80/9DD1 90 0F       BCC $0F       ; [$9DE2] Branch if not
$80/9DD3 48          PHA           ; Buffer the Write-Byte
$80/9DD4 A9 20 00    LDA #$0020    ; Set Number of Bytes to do in $00
$80/9DD7 85 00       STA $00
$80/9DD9 68          PLA           ; Restore the Write-Byte
$80/9DDA 20 0D 9E    JSR $9E0D  [$80:9E0D]   A:0000 X:0080 Y:BDC4 P:envmxdIZC

$80/9DDD E0 21 00    CPX #$0021    ; Repeat this procedure if there are still more than $20 bytes to do
$80/9DE0 B0 F8       BCS $F8       ; [$9DDA]

$80/9DE2 86 00       STX $00       ; Set the remaining Number of Bytes to do in $00
$80/9DE4 FC EB 9D    JSR ($9DEB,x) ; Jump to the Jump Table which redirects into the part at $9E0D

$80/9DE7 FA          PLX           ; Restore Original $00 and Exit
$80/9DE8 86 00       STX $00
$80/9DEA 60          RTS
Code is missing here
What is missing here is most likely a list of 2-byte-long Branch Commands where the first one branches to $9E3A, the second to $9E3C...
$80/9E0D 99 1E 00    STA $001E,y   ; Write the Write-Byte into it's destination
$80/9E10 99 1C 00    STA $001C,y
$80/9E13 99 1A 00    STA $001A,y
$80/9E16 99 18 00    STA $0018,y
$80/9E19 99 16 00    STA $0016,y
$80/9E1C 99 14 00    STA $0014,y
$80/9E1F 99 12 00    STA $0012,y
$80/9E22 99 10 00    STA $0010,y
$80/9E25 99 0E 00    STA $000E,y
$80/9E28 99 0C 00    STA $000C,y
$80/9E2B 99 0A 00    STA $000A,y
$80/9E2E 99 08 00    STA $0008,y
$80/9E31 99 06 00    STA $0006,y
$80/9E34 99 04 00    STA $0004,y
$80/9E37 99 02 00    STA $0002,y
$80/9E3A 99 00 00    STA $0000,y
$80/9E3D 48          PHA           ; Buffer the Write-Byte
$80/9E3E 8A          TXA           ; Decrease the number of Bytes-to-do according to the number of transfered bytes
$80/9E3F 38          SEC
$80/9E40 E5 00       SBC $00
$80/9E42 AA          TAX
$80/9E43 98          TYA           ; Increase the where-to-write-address according to the number of transfered bytes
$80/9E44 18          CLC
$80/9E45 65 00       ADC $00
$80/9E47 A8          TAY
$80/9E48 68          PLA           ; Restore the Write-Byte
$80/9E49 60          RTS

$80/9E7B Long Jump to Decompress Data and DMA to VRAM

A and X contain 24-bit-Address of the Compressed Data.

Y contains the VRAM Destination

$20-$22 contains a 24-bit-Address where to tempstore the decompressed Data.

$80/9E7B 8B          PHB           ; Preserve Data Bank
$80/9E7C 4B          PHK           ; Change Data Bank to this
$80/9E7D AB          PLB
$80/9E7E 20 83 9E    JSR $9E83     ; Decompress Data and DMA to VRAM
$80/9E81 AB          PLB           ; Restore Data Bank
$80/9E82 6B          RTL

$80/9E83 Decompress Data and DMA to VRAM

A and X contain 24-bit-Address of the Compressed Data.

Y contains the VRAM Destination

$20-$22 contains a 24-bit-Address where to tempstore the decompressed Data.

$80/9E83 5A          PHY           ; Push VRAM Destination on Stack
$80/9E84 22 E5 F9 81 JSL $81F9E5   ; Decompress Data
$80/9E88 A6 0E       LDX $0E       ; Load number of decompressed bytes
$80/9E8A 86 0C       STX $0C       ; Set it as number of bytes to transfer to VRAM
$80/9E8C A9 80       LDA #$80      ; VRAM transfer settings ($2115)
$80/9E8E 85 0E       STA $0E
$80/9E90 A6 20       LDX $20       ; DMA Source Address
$80/9E92 A5 22       LDA $22       ; DMA Source Bank
$80/9E94 7A          PLY           ; VRAM Destination
$80/9E95 4C 2C 9F    JMP $9F2C     ; VRAM DMA - it's JMP, not JSR, so here's no RTS

$80/9E85 Transfer color

This subroutine transfers a part (or all) of the CGRAM buffer to CGRAM.

A contains the CGRAM Destination

X's content doesn't matter, but gets changed during this subroutine

Y contains the number of bytes to transfer

$80/9EB5 8B          PHB           ; Preserve Data Bank
$80/9EB6 4B          PHK           ; Change Data Bank to this
$80/9EB7 AB          PLB
$80/9EB8 48          PHA           ; Buffer Original A value
$80/9EB9 AD 6A 05    LDA $056A     ; Load $2100 Buffer
$80/9EBC 0A          ASL A         ; Roll MSB (FBLANK Flag) in the Carry Bit
$80/9EBD 68          PLA           ; Restore Original A value
$80/9EBE 90 24       BCC $24       ; [$9EE4] Branch if FBLANK isn't active
$80/9EC0 9C 0C 42    STZ $420C     ; Deactivate HDMAs
$80/9EC3 8D 21 21    STA $2121     ; Original A = CGRAM Destination
$80/9EC6 C2 20       REP #$20      ; 16-bit A
$80/9EC8 29 FF 00    AND #$00FF    ; Remove if there was something in the hidden 8-bit
$80/9ECB 0A          ASL A         ; Multiply A by 2 (each color is 2 bytes in size)
$80/9ECC 69 4B 12    ADC #$124B    ; Add the Offset of the CGRAM buffer, so A contains now the WRAM address of the first color
$80/9ECF AA          TAX           ; Transfer to X for the upcoming DMA Setup Subroutine
$80/9ED0 E2 20       SEP #$20
$80/9ED2 A9 22       LDA #$22      ; DMA Destination: $(21)22 = CGRAM
$80/9ED4 8D 01 43    STA $4301
$80/9ED7 A9 00       LDA #$00      ; DMA Source Bank: $00
$80/9ED9 20 32 9D    JSR $9D32     ; Setup and Execute DMA to CGRAM
$80/9EDC AD 86 05    LDA $0586     ; Reactivate HDMAs
$80/9EDF 8D 0C 42    STA $420C
$80/9EE2 80 05       BRA $05       ; [$9EE9] Exit

Code is missing here

$80/9EE9 AB          PLB           ; Restore Data Bank
$80/9EEA 6B          RTL

$80/9EEB VRAM DMA with accompanying Data Bytes

Important: Whenever and from wherever this subroutine is called, the next few bytes AFTER the JSL $809EEB is Data for this subroutine. So, the first part of this subroutine is changing the Jump-Back-Address on stack so the program does not accidentally try to interpret these data bytes as code, but skip them.

The rest is the regular VRAM DMA subroutine at $80/9F2C

The Data following this Subroutine's called are structured as follows:

2 Bytes - DMA Source Address

1 Byte - DMA Source Bank

2 Bytes - VRAM Destination Address

2 Bytes - Number of Bytes

$80/9EEB 8B          PHB           ; Push Program Bank
$80/9EEC C2 21       REP #$21      ; 16 bit A, clear Carry
$80/9EEE A3 02       LDA $02,s     ; Load the address from stack, where to return when the program reaches a RTL
$80/9EF0 AA          TAX           ; Copy it into X
$80/9EF1 69 07 00    ADC #$0007    ; Add 7 to the return address - skip 7 bytes
$80/9EF4 83 02       STA $02,s     ; Store it back on stack
$80/9EF6 E2 20       SEP #$20      ; 8 bit A
$80/9EF8 A3 04       LDA $04,s     ; Load the Bank Byte from the Return address
$80/9EFA 48          PHA           ; Set it as Program Bank for now
$80/9EFB AB          PLB
$80/9EFC D4 0C	PEI ($0C)          ; Preserve current values in $0C-$0F on Stack
$80/9EFE D4 0E	PEI ($0E)
$80/9F00 A9 80       LDA #$80      ; VRAM settings (for $2115)
$80/9F02 85 0E       STA $0E
$80/9F04 BD 03 00    LDA $0003,x   ; DMA Source Bank
$80/9F07 48          PHA           ; Push it on stack, it gets pulled right before the Subroutine Jump
$80/9F08 C2 20       REP #$20
$80/9F0A BD 06 00    LDA $0006,x   ; Number of Bytes to transfer
$80/9F0D 85 0C       STA $0C
$80/9F0F BC 04 00    LDY $0004,x   ; VRAM Destination Address
$80/9F12 BD 01 00    LDA $0001,x   ; DMA Source Address
$80/9F15 AA          TAX
$80/9F16 E2 20       SEP #$20
$80/9F18 68          PLA           ; Pull Source Bank
$80/9F19 20 2C 9F    JSR $9F2C     ; VRAM DMA
$80/9F1C FA          PLX           ; Restore old values of $0C-$0F
$80/9F1D 86 0E       STX $0E
$80/9F1F FA          PLX
$80/9F20 86 0C       STX $0C
$80/9F22 AB          PLB           ; Pull Program Bank
$80/9F23 6B          RTL

$80/9F24 Long Jump to VRAM DMA

This jumps to the VRAM DMA subroutine, but stores the current program bank on stack and restores the old one afterwards.

$80/9F24 8B          PHB
$80/9F25 4B          PHK
$80/9F26 AB          PLB
$80/9F27 20 2C 9F    JSR $9F2C     ; VRAM DMA
$80/9F2A AB          PLB
$80/9F2B 6B          RTL

$80/9F2C VRAM DMA

This Subroutine executes an DMA to VRAM.

First it checks if currently FBLANK is active. Then it checks if a HDMA is active. If it is, it pauses the HDMA for the time the DMA gets prepared and executed. The following preparations have been made in order to make this subroutine work properly:

A contains the DMA Source Bank

X contains the DMA Source Address

Y contains the VRAM Destination Address

$0C/$0D contain the number of bytes to transfer

$0E contains the VRAM settings (for register $2115)

$80/9F2C 48          PHA           ; Preserve the Original A content on Stack
$80/9F2D AD 6A 05    LDA $056A     ; Is currently a FBLANK active?
$80/9F30 10 38       BPL $38       ; [$9F6A] branch if not - If not, don't execute the DMA NOW, but put it in Pipeline
$80/9F32 68          PLA           ; Restore Original A content...
$80/9F33 EB          XBA           ; ... and put it in the other half of the Accumulator
$80/9F34 AD 86 05    LDA $0586     ; Are any HDMAs active/planned?
$80/9F37 F0 0D       BEQ $0D       ; [$9F46] If not, skip the next part - immediate execution of the DMA
$80/9F39 9C 0C 42    STZ $420C     ; Remove HDMA activation flags
$80/9F3C 20 46 9F    JSR $9F46     ; Execute the stuff you were branched to before as a subroutine now
$80/9F3F AD 86 05    LDA $0586     ; ... afterwards, restore the HDMA-Flags again
$80/9F42 8D 0C 42    STA $420C
$80/9F45 60          RTS
$80/9F46 A9 01       LDA #$01      ; DMA Settings
$80/9F48 8D 00 43    STA $4300
$80/9F4B A9 18       LDA #$18      ; Destination: $2118 - VRAM
$80/9F4D 8D 01 43    STA $4301
$80/9F50 EB          XBA           ; Restore Original A value
$80/9F51 8C 16 21    STY $2116     ; Original Y Value: VRAM Address
$80/9F54 8E 02 43    STX $4302     ; Original X Value: Source Address
$80/9F57 8D 04 43    STA $4304     ; Original A Value: Source Bank
$80/9F5A A6 0C       LDX $0C       ; $0C contains the number of bytes to transfer
$80/9F5C 8E 05 43    STX $4305
$80/9F5F A5 0E       LDA $0E       ; $0E contains the VRAM transfer settings
$80/9F61 8D 15 21    STA $2115
$80/9F64 A9 01       LDA #$01      ; Activate DMA
$80/9F66 8D 0B 42    STA $420B
$80/9F69 60          RTS
$80/9F6A A3 01       LDA $01,s     ; Load the last byte on stack (Original A) without removing it from stack
$80/9F6C C9 7E       CMP #$7E      ; is the DMA source Bank $7E?
$80/9F6E D0 18       BNE $18       ; [$9F88] branch if not
$80/9F70 E4 5C       CPX $5C       ; ???
$80/9F72 90 14       BCC $14       ; [$9F88]
$80/9F74 E4 5E       CPX $5E       ; ???
$80/9F76 B0 10       BCS $10       ; [$9F88]
$80/9F78 C2 21       REP #$21      ; A = 16 bit, Carry cleared
$80/9F7A 8A          TXA           ; DMA Source Address is now in A
$80/9F7B 65 0C       ADC $0C       ; Add the number of Bytes transfered
$80/9F7D 3A          DEC A         ; Decrement it by one
$80/9F7E C5 5E       CMP $5E       ; ???
$80/9F80 90 03       BCC $03       ; [$9F85]

Code is missing here

$80/9F85 1A          INC A         ; ???
$80/9F86 85 5C       STA $5C       ; ???
$80/9F88 C2 21       REP #$21      ; A = 16 bit, Carry cleared
$80/9F8A AD C5 0E    LDA $0EC5     ; ???
$80/9F8D 65 0C       ADC $0C       ; ???
$80/9F8F 8D C5 0E    STA $0EC5     ; ???
$80/9F92 DA          PHX           ; Push DMA Source Address from Stack
$80/9F93 AD C7 0E    LDA $0EC7     ; Load Number of already occupied Pipeline Slots
$80/9F96 29 FF 00    AND #$00FF    ; This Number is 8 bit in size
$80/9F99 0A          ASL A         ; multiply by 2 - each pipeline entry is 2 bytes in size
$80/9F9A AA          TAX           ; Transfer in X as Index
$80/9F9B 98          TYA           ; Y still held the VRAM Destination
$80/9F9C 9D 49 10    STA $1049,x   ; Put in Pipeline - VRAM Destination ($2116)
$80/9F9F A5 0C       LDA $0C
$80/9FA1 9D C9 0E    STA $0EC9,x   ; Put in Pipeline - Data Size ($4305)
$80/9FA4 68          PLA           ; Get DMA Source Address (see $80/9F92)
$80/9FA5 9D 89 0F    STA $0F89,x   ; Put in Pipeline - Source Address ($4302)
$80/9FA8 E2 20       SEP #$20
$80/9FAA 68          PLA
$80/9FAB 9D 0A 11    STA $110A,x   ; Put in Pipeline - Source Bank ($4304)
$80/9FAE A5 0E       LDA $0E
$80/9FB0 9D 09 11    STA $1109,x   ; Put in Pipeline - VRAM Settings ($2115)
$80/9FB3 EE C7 0E    INC $0EC7     ; Increment Number of occupied Pipeline Slots
$80/9FB6 60          RTS

$80/9FB7 ?

$80/9FB7 8B          PHB           ; Buffer Program Bank
$80/9FB8 4B          PHK           ; Change Program Bank
$80/9FB9 AB          PLB
$80/9FBA 48          PHA           ; Buffer A
$80/9FBB AD 6A 05    LDA $056A     ; $2100 Buffer - FBLANK / Screen Brightness
$80/9FBE 10 34       BPL $34       ; [$9FF4] Branch if there's no FBLANK active
$80/9FC0 68          PLA           ; Put A where the coming subroutine can use it as Source Bank
$80/9FC1 EB          XBA
$80/9FC2 9C 0C 42    STZ $420C     ; Deactivate HDMA for now
$80/9FC5 20 D0 9F    JSR $9FD0     ; VRAM DMA
$80/9FC8 AD 86 05    LDA $0586     ; Reactivate HDMA
$80/9FCB 8D 0C 42    STA $420C
$80/9FCE 80 54       BRA $54       ; [$A024] CLC, PLB, RTL

$80/9FD0 VRAM DMA

Y: VRAM Destination $2116

X: Source Address

B (hidden 8bit of A): Source Bank

$0C: Number of bytes

$80/9FD0 A9 01       LDA #$01      ; DMA Transfer style
$80/9FD2 8D 00 43    STA $4300
$80/9FD5 A9 18       LDA #$18      ; DMA Destination: $2118 VRAM
$80/9FD7 8D 01 43    STA $4301
$80/9FDA EB          XBA           ; Source Bank is in the hidden 8 bit part of Accumulator
$80/9FDB 8C 16 21    STY $2116     ; Y: VRAM Destination
$80/9FDE 8E 02 43    STX $4302     ; X: Source Address
$80/9FE1 8D 04 43    STA $4304     ; Source Bank
$80/9FE4 A6 0C       LDX $0C       ; Number of Bytes to transfer
$80/9FE6 8E 05 43    STX $4305
$80/9FE9 A9 80       LDA #$80      ; VRAM transfer settings
$80/9FEB 8D 15 21    STA $2115
$80/9FEE A9 01       LDA #$01      ; Activate DMA
$80/9FF0 8D 0B 42    STA $420B
$80/9FF3 60          RTS

$80/9FF4 ?

$80/9FF4 AD C9 11    LDA $11C9  [$80:11C9]   A:B803 X:B880 Y:4440 P:envMxdizc
$80/9FF7 1A          INC A                   A:B81A X:B880 Y:4440 P:envMxdizc
$80/9FF8 29 1F       AND #$1F                A:B81B X:B880 Y:4440 P:envMxdizc
$80/9FFA CD CA 11    CMP $11CA  [$80:11CA]   A:B81B X:B880 Y:4440 P:envMxdizc
$80/9FFD F0 28       BEQ $28    [$A027]      A:B81B X:B880 Y:4440 P:envMxdizC
$80/9FFF 7B          TDC                     A:B81B X:B880 Y:4440 P:envMxdizC
$80/A000 AD C9 11    LDA $11C9  [$80:11C9]   A:0000 X:B880 Y:4440 P:envMxdiZC
$80/A003 C2 21       REP #$21                A:001A X:B880 Y:4440 P:envMxdizC
$80/A005 DA          PHX                     A:001A X:B880 Y:4440 P:envmxdizc
$80/A006 0A          ASL A                   A:001A X:B880 Y:4440 P:envmxdizc
$80/A007 AA          TAX                     A:0034 X:B880 Y:4440 P:envmxdizc
$80/A008 98          TYA                     A:0034 X:0034 Y:4440 P:envmxdizc
$80/A009 9D C9 10    STA $10C9,x[$80:10FD]   A:4440 X:0034 Y:4440 P:envmxdizc
$80/A00C A5 0C       LDA $0C    [$00:000C]   A:4440 X:0034 Y:4440 P:envmxdizc
$80/A00E 9D 49 0F    STA $0F49,x[$80:0F7D]   A:0040 X:0034 Y:4440 P:envmxdizc
$80/A011 68          PLA                     A:0040 X:0034 Y:4440 P:envmxdizc
$80/A012 9D 09 10    STA $1009,x[$80:103D]   A:B880 X:0034 Y:4440 P:eNvmxdizc
$80/A015 E2 20       SEP #$20                A:B880 X:0034 Y:4440 P:eNvmxdizc
$80/A017 68          PLA                     A:B880 X:0034 Y:4440 P:eNvMxdizc
$80/A018 9D 8A 11    STA $118A,x[$80:11BE]   A:B8B9 X:0034 Y:4440 P:eNvMxdizc
$80/A01B AD C9 11    LDA $11C9  [$80:11C9]   A:B8B9 X:0034 Y:4440 P:eNvMxdizc
$80/A01E 1A          INC A                   A:B81A X:0034 Y:4440 P:envMxdizc
$80/A01F 29 1F       AND #$1F                A:B81B X:0034 Y:4440 P:envMxdizc
$80/A021 8D C9 11    STA $11C9  [$80:11C9]   A:B81B X:0034 Y:4440 P:envMxdizc
$80/A024 18          CLC
$80/A025 AB          PLB           ; Pull Original Data Bank Register
$80/A026 6B          RTL

$80/A127 Long Jump to Activate NMI and Auto-Joypad Read

$80/A127 8B          PHB           ; Buffer Data Bank Register on Stack
$80/A128 4B          PHK           ; Set Bank Register as Data Bank Register
$80/A129 AB          PLB
$80/A12A 20 2F A1    JSR $A12F     ; Activate NMI and Auto-Joypad Read
$80/A12D AB          PLB           ; Pull Original Data Bank Register
$80/A12E 6B          RTL

$80/A12F Activate NMI and Auto-Joypad Read

$80/A12F AD 10 42    LDA $4210     ; Load (and thus, remove) the NMI Flag
$80/A132 A9 81       LDA #$81      ; Activate NMI and Auto-Joypad Read
$80/A134 8D 00 42    STA $4200
$80/A137 0C AF 05    TSB $05AF     ; Update Buffer accordingly
$80/A13A 60          RTS

$80/A14A Long Jump to Deactivate NMI, Auto-Joypad and HDMAs

$80/A14A 8B          PHB           ; Buffer Data Bank Register on Stack
$80/A14B 4B          PHK           ; Set Bank Register as Data Bank Register
$80/A14C AB          PLB
$80/A14D 20 52 A1    JSR $A152     ; Jump to Deactivation of NMI, Auto-Joypad & HDMAs
$80/A150 AB          PLB           ; Pull Original Data Bank Register
$80/A151 6B          RTL

$80/A152 Deactivate NMI, Auto-Joypad and HDMAs

$80/A152 9C 00 42    STZ $4200     ; Deactivate NMI / Auto-Joypad
$80/A155 9C AF 05    STZ $05AF     ; Backup for $4200?
$80/A158 9C 0C 42    STZ $420C     ; De-activate HDMAs
$80/A15B 9C B0 05    STZ $05B0     ; Backup for $420C?
$80/A15E 9C 86 05    STZ $0586     ; Backup for $420C?
$80/A161 60          RTS

$80/A162 Long Jump to Enable VBLANK IRQ

$80/A162 8B          PHB           ; Buffer Data Bank Register on Stack
$80/A163 4B          PHK           ; Set Bank Register as Data Bank Register
$80/A164 AB          PLB
$80/A165 20 6A A1    JSR $A16A     ; Enable VBLANK IRQ
$80/A168 AB          PLB           ; Pull Original Data Bank Register
$80/A169 6B          RTL

$80/A16A Enable VBLANK IRQ

$80/A16A A9 20       LDA #$20
$80/A16C 0C AF 05    TSB $05AF
$80/A16F 60          RTS

$80/A170 Long Jump to Disable IRQ

$80/A170 8B          PHB           ; Buffer Data Bank Register on Stack
$80/A171 4B          PHK           ; Set Bank Register as Data Bank Register
$80/A172 AB          PLB
$80/A173 20 78 A1    JSR $A178     ; Disable IRQ
$80/A176 AB          PLB           ; Pull Original Data Bank Register
$80/A177 6B          RTL

$80/A178 Disable IRQ

$80/A178 A9 30       LDA #$30      ; TRB removes the set bits in the Accumulator from...
$80/A17A 1C AF 05    TRB $05AF     ; ... the value in the memory address ($05AF = $4200 Buffer)
$80/A17D 60          RTS

$80/A18A ?

$80/A18A 8B          PHB           ; Buffer Data Bank Register on Stack
$80/A18B 4B          PHK           ; Set Data Bank to $80
$80/A18C AB          PLB
$80/A18D 20 92 A1    JSR $A192     ; ??? (Wait for NMI)
$80/A190 AB          PLB           ; Restore Data Bank
$80/A191 6B          RTL

$80/A192 ?

$80/A192 A9 80       LDA #$80      ; ??? (Sets bit 7 in $05BD)
$80/A194 1C BD 05    TRB $05BD
$80/A197 AD B9 05    LDA $05B9     ; ??? (Load Framecounter?)
$80/A19A CD B9 05    CMP $05B9     ; Wait for the next NMI
$80/A19D F0 FB       BEQ $FB       ; [$A19A] 

After this, the next subroutine gets executed, too.

$80/A19F Execute code built in WRAM

$80/A19F A9 80       LDA #$80      ; ??? (Sets bit 7 in $05BD)
$80/A1A1 0C BD 05    TSB $05BD
$80/A1A4 22 D9 05 00 JSL $0005D9   ; Jump and execute the code built in WRAM
$80/A1A8 60          RTS

$80/A1B6 Write Executable Code in WRAM

This Subroutine writes executable Code in WRAM, starting at $05D9.

It writes 22 E4 A1 80 ("JSL $80A1E4") five times one after another with a final $6B ("RTL").

$80/A1B6 8B          PHB           ; Buffer Data Bank Register on Stack
$80/A1B7 F4 00 00    PEA $0000     ; Set Data Bank Register to $00
$80/A1BA AB          PLB
$80/A1BB AB          PLB
$80/A1BC A2 D9 05    LDX #$05D9    ; Start writing at $0005D9
$80/A1BF A0 05 00    LDY #$0005    ; ??? (Sets up some counter)
$80/A1C2 A9 22       LDA #$22      ; #$22 = "JSL"
$80/A1C4 9D 00 00    STA $0000,x   ; Store in WRAM
$80/A1C7 C2 20       REP #$20
$80/A1C9 A9 E4 A1    LDA #$A1E4    ; Store the Address
$80/A1CC 9D 01 00    STA $0001,x   ; Store in WRAM
$80/A1CF E2 20       SEP #$20
$80/A1D1 A9 80       LDA #$80      ; Store the Bank-part of the Address
$80/A1D3 9D 03 00    STA $0003,x   ; Store in WRAM
$80/A1D6 E8          INX           ; Increment the Store Index
$80/A1D7 E8          INX
$80/A1D8 E8          INX
$80/A1D9 E8          INX
$80/A1DA 88          DEY           ; Decrement loop counter
$80/A1DB D0 E5       BNE $E5       ; [$A1C2]
$80/A1DD A9 6B       LDA #$6B      ; Store the final #$6B (RTL)
$80/A1DF 9D 00 00    STA $0000,x
$80/A1E2 AB          PLB           ; Pull Original Data Bank Register
$80/A1E3 6B          RTL

$80/A1E4 RTL

$80/A19F can jump here (via $0005D9). A standard "do nothing, just exit right away"

$80/A1E4 6B          RTL

$80/A405 Long Jump to the Tilemap Rectangle Writer

If this subroutine should be used while the program pointer is currently on a different bank

$80/A405 20 09 A4    JSR $A409     ; See below
$80/A408 6B          RTL


$80/A409 Tilemap Rectangle Writer

This subroutine transfers a line of tilemap entries into a rectangle inside the tilemap buffer.

$00 contains the rectangle's number of columns

$01 is used as counter for the current column

$02 contains the rectangle's number of rows

$03 is used as counter for the current row

X contains the Index to the Load Address (the Bank has to be adjusted before this subroutine is called)

Y Contains the Index where to write - the rest of the write address has to be set up in $20-$22


$80/A409 A5 02       LDA $02       ; Copy Row/Column number into counter registers that can be decremented
$80/A40B 85 03       STA $03
$80/A40D A5 00       LDA $00
$80/A40F 85 01       STA $01
$80/A411 5A          PHY           ; Push the write index on Stack (the starting point of a new line of the rectangle)
$80/A412 C2 20       REP #$20
$80/A414 BD 00 00    LDA $0000,x   ; Read Byte
$80/A417 C9 FF FF    CMP #$FFFF    ; If in the read data is a #$FFFF, it does not overwrite that tile
$80/A41A F0 02       BEQ $02       ; [$A41E] Leave out the write command if 
$80/A41C 97 20       STA [$20],y   ; Write into the Tilemap Buffer
$80/A41E E2 20       SEP #$20
$80/A420 E8          INX           ; Increment Read & Write Index
$80/A421 E8          INX
$80/A422 C8          INY
$80/A423 C8          INY
$80/A424 C6 01       DEC $01       ; Decrement column/(=tile) counter
$80/A426 D0 EA       BNE $EA       ; [$A412] Loop if not all tiles in that row are done yet
$80/A428 C2 21       REP #$21      ; 16-bit A + Clear Carry
$80/A42A 68          PLA           ; Pull the starting point of the rectangle's new line from stack
$80/A42B 69 40 00    ADC #$0040    ; Add #$40 - move one line down
$80/A42E A8          TAY           ; Transfer new starting point into Y (so it can be used + Pushed on stack again)
$80/A42F E2 20       SEP #$20
$80/A431 C6 03       DEC $03       ; Decrement Row Counter
$80/A433 D0 D8       BNE $D8       ; [$A40D] Loop if not all rows are done yet
$80/A435 60          RTS

$80/ADCB Calculate Address in Tilemap

This seems to be about calculation of an Address in a Tilemap. You put the number of a tile's row number in A and the columns number in X, and it calculates the actual offset for it. The mathmatical formula is:

New A and New X = Old A * #$40 + Old X

$80/ADCB DA          PHX           ; Push the Column number on stack for now
$80/ADCC C2 20       REP #$20      ; Make Accumuleta great again
$80/ADCE 29 FF 00    AND #$00FF    ; Remove whatever was still in the hidden 8-bit of the Accumulator
$80/ADD1 EB          XBA           ; A * #$40 (sixty-four)
$80/ADD2 4A          LSR A
$80/ADD3 4A          LSR A
$80/ADD4 63 01       ADC $01,s     ; Add Column number (that is on stack)
$80/ADD6 FA          PLX           ; Remove Column number from stack (not needed any more)
$80/ADD7 AA          TAX           ; Replace it with the calculation's result
$80/ADD8 E2 20       SEP #$20
$80/ADDA 6B          RTL

$80/AEF2 Load Music?

Replacing the A5 59 ("LDA $59") at $AF03 with A9 10 ("LDA #$10"), this loaded a different song in the Title Demo and other scenes in the game.

$80/AEF2 8B          PHB                     A:000D X:905F Y:000D P:envMxdizc
$80/AEF3 4B          PHK                     A:000D X:905F Y:000D P:envMxdizc
$80/AEF4 AB          PLB                     A:000D X:905F Y:000D P:envMxdizc
$80/AEF5 85 59       STA $59    [$00:0059]   A:000D X:905F Y:000D P:eNvMxdizc
$80/AEF7 20 4C AF    JSR $AF4C  [$80:AF4C]   A:000D X:905F Y:000D P:eNvMxdizc
$80/AEFA 90 07       BCC $07    [$AF03]      A:000D X:905F Y:000D P:envMxdizc

Code is left out here

$80/AF03 A5 59       LDA $59    [$00:0059]   A:000D X:905F Y:000D P:envMxdizc
$80/AF05 F0 0B       BEQ $0B    [$AF12]      A:000D X:905F Y:000D P:envMxdizc
$80/AF07 22 03 80 8F JSL $8F8003[$8F:8003]   A:000D X:905F Y:000D P:envMxdizc
$80/AF0B A9 01       LDA #$01                A:0002 X:33CC Y:D686 P:envMxdizc
$80/AF0D 85 F5       STA $F5    [$00:00F5]   A:0001 X:33CC Y:D686 P:envMxdizc
$80/AF0F 20 30 AF    JSR $AF30  [$80:AF30]   A:0001 X:33CC Y:D686 P:envMxdizc
$80/AF12 AB          PLB                     A:0000 X:33CC Y:D686 P:envMxdiZc
$80/AF13 6B          RTL                     A:0000 X:33CC Y:D686 P:envMxdizc

$80/AF7E Actual NMI Handler

$80/AF7E C2 30       REP #$30      ; A/X/Y = 16 bit (to make sure everything is put on stack)
$80/AF80 48          PHA
$80/AF81 8B          PHB
$80/AF82 0B          PHD
$80/AF83 DA          PHX
$80/AF84 5A          PHY
$80/AF85 4B          PHK
$80/AF86 AB          PLB
$80/AF87 A9 00 00    LDA #$0000
$80/AF8A 5B          TCD
$80/AF8B E2 20       SEP #$20
$80/AF8D AD 10 42    LDA $4210     ; Remove NMI Flag
$80/AF90 A9 80       LDA #$80
$80/AF92 8D 00 21    STA $2100     ; FBLANK
$80/AF95 AD BD 05    LDA $05BD     ; ???
$80/AF98 10 03       BPL $03       ; ???
$80/AF9A 4C D2 B0    JMP $B0D2     ; ???
$80/AF9D 20 C2 B2    JSR $B2C2     ; ???

OAM Update

$80/AFA0 AD B0 05    LDA $05B0     ; ???
$80/AFA3 8D 86 05    STA $0586
$80/AFA6 9C 0C 42    STZ $420C     ; Deactivate HDMAs
$80/AFA9 AD 40 05    LDA $0540     ; If $0540 is empty, don't update OAM?
$80/AFAC F0 29       BEQ $29       ; [$AFD7]
$80/AFAE A2 00 00    LDX #$0000    ; OAM Address
$80/AFB1 8E 02 21    STX $2102
$80/AFB4 9C 04 43    STZ $4304     ; Source Bank: $00
$80/AFB7 AE 45 05    LDX $0545
$80/AFBA 8E 02 43    STX $4302     ; Source Address: $0545
$80/AFBD A9 04       LDA #$04      ; DMA Destination: $2104 (OAM)
$80/AFBF 8D 01 43    STA $4301
$80/AFC2 A2 20 02    LDX #$0220    ; Transfer $220 Bytes - both OAM Tables
$80/AFC5 8E 05 43    STX $4305
$80/AFC8 A9 00       LDA #$00      ; DMA Transfer settings
$80/AFCA 8D 00 43    STA $4300
$80/AFCD A9 01       LDA #$01      ; Activate DMA
$80/AFCF 8D 0B 42    STA $420B
$80/AFD2 9C 40 05    STZ $0540     ; Clear OAM Update Flag
$80/AFD5 80 03       BRA $03       ; [$AFDA] --- ???
$80/AFD7 20 01 B1    JSR $B101     ; ???
$80/AFDA 20 35 B1    JSR $B135     ; ???
$80/AFDD 20 D8 B3    JSR $B3D8     ; CGRAM Update
$80/AFE0 20 2B B3    JSR $B32B     ; VRAM DMA Pipeline
$80/AFE3 20 7B B3    JSR $B37B     ; ???
$80/AFE6 AD 86 05    LDA $0586     ; Reactivate HDMAs
$80/AFE9 8D 0C 42    STA $420C
$80/AFEC 20 6D B2    JSR $B26D     ; Update Graphic Setup Registers
$80/AFEF AD 6A 05    LDA $056A     ; Load the (old) Screen Settings
$80/AFF2 2C 12 42    BIT $4212     ; Wait for the next HBLANK to end
$80/AFF5 70 FB       BVS $FB       ; [$AFF2]
$80/AFF7 2C 12 42    BIT $4212
$80/AFFA 50 FB       BVC $FB       ; [$AFF7]
$80/AFFC 8D 00 21    STA $2100     ; Update Screen brightness
$80/AFFF 20 0B B4    JSR $B40B     ; Joypad Data Fetching
$80/B002 22 61 80 88 JSL $888061   ; ???
$80/B006 22 00 80 88 JSL $888000   ; ???
$80/B00A 22 18 81 88 JSL $888118   ; ???
$80/B00E AD BA 05    LDA $05BA
$80/B011 F0 04       BEQ $04       ; [$B017]

Missing Code

$80/B017 AE BB 05    LDX $05BB
$80/B01A F0 04       BEQ $04       ; [$B020]

Missing Code

$80/B020 20 40 B2    JSR $B240     ; ???
$80/B023 22 73 81 88 JSL $888173   ; ???
$80/B027 A6 32       LDX $32       ; ???
$80/B029 86 34       STX $34       ; ???
$80/B02B AE F0 05    LDX $05F0     ; Update V Timer - At which Scan Line an IRQ should come
$80/B02E 8E 09 42    STX $4209
$80/B031 AD 11 42    LDA $4211     ; Load (and remove) IRQ Flag
$80/B034 AD AF 05    LDA $05AF     ; Update NMI/IRQ/Auto-Joypad Flags
$80/B037 8D 00 42    STA $4200
$80/B03A EE B9 05    INC $05B9     ; ??? (Frame counter!? Flag register?)
$80/B03D AD BD 05    LDA $05BD     ; ??? (Check Flag register?)
$80/B040 89 C0       BIT #$C0      ; ??? (If bit 6 is set, CGRAM needs an update; bit 7 yet unknown)
$80/B042 D0 1C       BNE $1C       ; [$B060]
$80/B044 AD 38 00    LDA $0038     ; ???
$80/B047 F0 17       BEQ $17       ; [$B060]

Missing Code

$80/B060 A5 37       LDA $37    [$00:0037]   A:0000 X:00DB Y:0000 P:envMxdIZc
$80/B062 F0 62       BEQ $62    [$B0C6]      A:0003 X:00DB Y:0000 P:envMxdIzc
$80/B064 AD BD 05    LDA $05BD  [$80:05BD]   A:0003 X:00DB Y:0000 P:envMxdIzc
$80/B067 89 40       BIT #$40                A:0000 X:00DB Y:0000 P:envMxdIZc
$80/B069 D0 5B       BNE $5B    [$B0C6]      A:0000 X:00DB Y:0000 P:envMxdIZc
$80/B06B D4 00       PEI ($00)     ; Buffer $00-$0F and $20-$2B on stack
$80/B06D D4 02       PEI ($02)
$80/B06F D4 04       PEI ($04)
$80/B071 D4 06       PEI ($06)
$80/B073 D4 08       PEI ($08)
$80/B075 D4 0A       PEI ($0A)
$80/B077 D4 0C       PEI ($0C)
$80/B079 D4 0E       PEI ($0E)
$80/B07B D4 20       PEI ($20)
$80/B07D D4 22       PEI ($22)
$80/B07F D4 24       PEI ($24)
$80/B081 D4 26       PEI ($26)
$80/B083 D4 28       PEI ($28)
$80/B085 D4 2A       PEI ($2A)
$80/B087 58          CLI                     A:0000 X:00DB Y:0000 P:envMxdIZc
$80/B088 A5 37       LDA $37    [$00:0037]   A:0000 X:00DB Y:0000 P:envMxdiZc
$80/B08A 89 01       BIT #$01                A:0003 X:00DB Y:0000 P:envMxdizc
$80/B08C F0 04       BEQ $04    [$B092]      A:0003 X:00DB Y:0000 P:envMxdizc
$80/B08E 22 5F 80 84 JSL $84805F[$84:805F]   A:0003 X:00DB Y:0000 P:envMxdizc

Missing Code

$80/B09C FA          PLX           ; Restore $00-$0F and $20-$2B from stack
$80/B09D 86 2A       STX $2A
$80/B09F FA          PLX
$80/B0A0 86 28       STX $28
$80/B0A2 FA          PLX
$80/B0A3 86 26       STX $26
$80/B0A5 FA          PLX
$80/B0A6 86 24       STX $24
$80/B0A8 FA          PLX
$80/B0A9 86 22       STX $22
$80/B0AB FA          PLX
$80/B0AC 86 20       STX $20
$80/B0AE FA          PLX
$80/B0AF 86 0E       STX $0E
$80/B0B1 FA          PLX
$80/B0B2 86 0C       STX $0C
$80/B0B4 FA          PLX
$80/B0B5 86 0A       STX $0A
$80/B0B7 FA          PLX
$80/B0B8 86 08       STX $08
$80/B0BA FA          PLX
$80/B0BB 86 06       STX $06
$80/B0BD FA          PLX
$80/B0BE 86 04       STX $04
$80/B0C0 FA          PLX
$80/B0C1 86 02       STX $02
$80/B0C3 FA          PLX
$80/B0C4 86 00       STX $00
$80/B0C6 22 0C 80 8F JSL $8F800C[$8F:800C]   A:0000 X:0000 Y:000C P:envMxdiZc

Missing Code

$80/B0CA C2 30       REP #$30      ; Restore everything from Stack
$80/B0CC 7A          PLY
$80/B0CD FA          PLX
$80/B0CE 2B          PLD
$80/B0CF AB          PLB
$80/B0D0 68          PLA
$80/B0D1 40          RTI           ; End Interrupt Handler

$80/B135 Update Graphics Settings Buffer Registers

I'm not sure, but it looks like you can buffer values for the screen settings in buffer registers, so that they get transfered in the next frame to their destination. Because this seems to be the subroutine that makes these values step up in queue.

$80/B135 AE 91 05    LDX $0591     ; Update $210D Buffer
$80/B138 8E 71 05    STX $0571
$80/B13B AE 93 05    LDX $0593     ; Update $210E Buffer
$80/B13E 8E 73 05    STX $0573
$80/B141 AE 95 05    LDX $0595     ; Update $210F Buffer
$80/B144 8E 75 05    STX $0575
$80/B147 AE 97 05    LDX $0597     ; Update $2110 Buffer
$80/B14A 8E 77 05    STX $0577
$80/B14D AE 99 05    LDX $0599     ; Update $2111 Buffer
$80/B150 8E 79 05    STX $0579
$80/B153 AE 9B 05    LDX $059B     ; Update $2112 Buffer
$80/B156 8E 7B 05    STX $057B
$80/B159 AE 9D 05    LDX $059D     ; Update $2113 Buffer
$80/B15C 8E 7D 05    STX $057D
$80/B15F AE 9F 05    LDX $059F     ; Update $2114 Buffer
$80/B162 8E 7F 05    STX $057F
$80/B165 AE 8B 05    LDX $058B     ; Update $2107/8 Buffer
$80/B168 8E 6D 05    STX $056D
$80/B16B AE 8D 05    LDX $058D     ; Update $2109/A Buffer
$80/B16E 8E 6F 05    STX $056F
$80/B171 AD 87 05    LDA $0587     ; Update $2100 Buffer
$80/B174 8D 6A 05    STA $056A
$80/B177 AD 89 05    LDA $0589     ; Update $2105 Buffer
$80/B17A 8D 6B 05    STA $056B
$80/B17D AD 88 05    LDA $0588     ; Update $2101 Buffer
$80/B180 8D 6C 05    STA $056C
$80/B183 AE AC 05    LDX $05AC     ; Update $2132 Buffer - R?/G?
$80/B186 8E 83 05    STX $0583
$80/B189 AD AE 05    LDA $05AE     ; Update $2132 Buffer - V?
$80/B18C 8D 85 05    STA $0585
$80/B18F AD AA 05    LDA $05AA     ; Update $2130 Buffer
$80/B192 8D 81 05    STA $0581
$80/B195 AD AB 05    LDA $05AB     ; ???
$80/B198 8D 82 05    STA $0582     ; ???
$80/B19B AE EE 05    LDX $05EE     ; Update $4209/A Buffer
$80/B19E 8E F0 05    STX $05F0
$80/B1A1 AD 8A 05    LDA $058A     ; Update $2106
$80/B1A4 8D 06 21    STA $2106
$80/B1A7 AD 5F 17    LDA $175F  [$80:175F]   A:0000 X:00DC Y:0000 P:envMxdIZC
$80/B1AA F0 43       BEQ $43    [$B1EF]      A:0000 X:00DC Y:0000 P:envMxdIZC

Code is missing here

$80/B1EF AD FB 16    LDA $16FB  [$80:16FB]   A:0000 X:00DC Y:0000 P:envMxdIZC
$80/B1F2 F0 18       BEQ $18    [$B20C]      A:0055 X:00DC Y:0000 P:envMxdIzC
$80/B1F4 AE FC 16    LDX $16FC  [$80:16FC]   A:0055 X:00DC Y:0000 P:envMxdIzC
$80/B1F7 8E 72 43    STX $4372  [$80:4372]   A:0055 X:5555 Y:0000 P:envMxdIzC
$80/B1FA AE 02 17    LDX $1702  [$80:1702]   A:0055 X:5555 Y:0000 P:envMxdIzC
$80/B1FD 8E 12 43    STX $4312  [$80:4312]   A:0055 X:5555 Y:0000 P:envMxdIzC
$80/B200 AE FE 16    LDX $16FE  [$80:16FE]   A:0055 X:5555 Y:0000 P:envMxdIzC
$80/B203 8E 62 43    STX $4362  [$80:4362]   A:0055 X:5555 Y:0000 P:envMxdIzC
$80/B206 AE 00 17    LDX $1700  [$80:1700]   A:0055 X:5555 Y:0000 P:envMxdIzC
$80/B209 8E 52 43    STX $4352  [$80:4352]   A:0055 X:5555 Y:0000 P:envMxdIzC
$80/B20C AF 87 BE 7E LDA $7EBE87[$7E:BE87]   A:0055 X:5555 Y:0000 P:envMxdIzC
$80/B210 10 29       BPL $29    [$B23B]      A:0000 X:5555 Y:0000 P:envMxdIZC

Code is missing here

$80/B23B A5 36       LDA $36    [$00:0036]   A:0000 X:5555 Y:0000 P:envMxdIZC
$80/B23D 85 37       STA $37    [$00:0037]   A:0000 X:5555 Y:0000 P:envMxdIZC
$80/B23F 60          RTS

$80/B26D Update Graphic Setup Registers

$80/B26D AD 6B 05    LDA $056B     ; BG Mode
$80/B270 8D 05 21    STA $2105
$80/B273 AD 6C 05    LDA $056C     ; Sprite sizes
$80/B276 8D 01 21    STA $2101
$80/B279 AE A6 05    LDX $05A6     ; Main Screen/Subscreen Destination (16 bit!)
$80/B27C 8E 2C 21    STX $212C
$80/B27F AE 8F 05    LDX $058F     ; BG1-4 Tileset Addresses (16 bit!)
$80/B282 8E 0B 21    STX $210B
$80/B285 AE 6D 05    LDX $056D     ; BG1/2 Tilemap Address
$80/B288 8E 07 21    STX $2107
$80/B28B AE 6F 05    LDX $056F     ; BG3/4 Tilemap Address
$80/B28E 8E 09 21    STX $2109
$80/B291 AE 81 05    LDX $0581     ; Color Addition Select
$80/B294 8E 30 21    STX $2130
$80/B297 AD 85 05    LDA $0585     ; Fixed Color Data
$80/B29A 8D 32 21    STA $2132
$80/B29D AD 84 05    LDA $0584     ; Fixed Color Data
$80/B2A0 8D 32 21    STA $2132
$80/B2A3 AD 83 05    LDA $0583     ; Fixed Color Data
$80/B2A6 8D 32 21    STA $2132
$80/B2A9 A0 00 00    LDY #$0000    ; Update the BG Scroll registers
$80/B2AC A2 71 05    LDX #$0571
$80/B2AF B5 00       LDA $00,x
$80/B2B1 99 0D 21    STA $210D,y
$80/B2B4 B5 01       LDA $01,x
$80/B2B6 99 0D 21    STA $210D,y
$80/B2B9 E8          INX
$80/B2BA E8          INX
$80/B2BB C8          INY
$80/B2BC C0 08 00    CPY #$0008
$80/B2BF D0 EE       BNE $EE       ; [$B2AF]
$80/B2C1 60          RTS

$80/B32B VRAM DMA Pipeline

$80/B32B AD C7 0E    LDA $0EC7     ; Are there any VRAM DMAs in the pipeline?
$80/B32E F0 44       BEQ $44       ; [$B374] If not, exit
$80/B330 A9 01       LDA #$01      ; DMA Settings
$80/B332 8D 00 43    STA $4300
$80/B335 A9 18       LDA #$18      ; DMA Destination: $2118
$80/B337 8D 01 43    STA $4301
$80/B33A A0 00 00    LDY #$0000
$80/B33D BE C9 0E    LDX $0EC9,y   ; DMA Data Size
$80/B340 8E 05 43    STX $4305
$80/B343 BE 89 0F    LDX $0F89,y   ; DMA Adress
$80/B346 8E 02 43    STX $4302
$80/B349 B9 0A 11    LDA $110A,y   ; DMA Bank
$80/B34C 8D 04 43    STA $4304
$80/B34F B9 09 11    LDA $1109,y   ; VRAM Transfer Setting
$80/B352 8D 15 21    STA $2115
$80/B355 BE 49 10    LDX $1049,y   ; VRAM Destination
$80/B358 8E 16 21    STX $2116
$80/B35B A9 01       LDA #$01      ; Activate DMA
$80/B35D 8D 0B 42    STA $420B
$80/B360 C8          INY           ; Increment Index
$80/B361 C8          INY
$80/B362 CE C7 0E    DEC $0EC7     ; Decrement number of occupied Pipelines entries
$80/B365 D0 D6       BNE $D6       ; [$B33D] Loop until all are done
$80/B367 A2 00 00    LDX #$0000
$80/B36A 8E D6 16    STX $16D6     ; ???
$80/B36D 8E D8 16    STX $16D8     ; ???
$80/B370 A6 5A       LDX $5A       ; ???
$80/B372 86 5C       STX $5C       ; ???
$80/B374 A2 00 00    LDX #$0000    ; ???
$80/B377 8E C5 0E    STX $0EC5     ; ???
$80/B37A 60          RTS

$80/B3D8 ?

$80/B3D8 AD BD 05    LDA $05BD     ; ???
$80/B3DB 89 40       BIT #$40      ; ??? If bit 6 in $05BD is set, this forces a CGRAM update
$80/B3DD D0 05       BNE $05       ; [$B3E4] $80/B3DF AD 49 12    LDA $1249     ; Is "Update CGRAM" Flag set?
$80/B3E2 F0 26       BEQ $26       ; [$B40A] Exit if not
$80/B3E4 9C 21 21    STZ $2121     ; CGRAM Destination: $00
$80/B3E7 A9 22       LDA #$22      ; DMA Destination: $2122 (= CGRAM)
$80/B3E9 8D 01 43    STA $4301
$80/B3EC A2 00 02    LDX #$0200    ; Transfer #$200 Byte
$80/B3EF 8E 05 43    STX $4305
$80/B3F2 A2 4B 12    LDX #$124B    ; Source: $00124B (CGRAM Buffer)
$80/B3F5 8E 02 43    STX $4302
$80/B3F8 A9 00       LDA #$00
$80/B3FA 8D 04 43    STA $4304
$80/B3FD A9 00       LDA #$00      ; DMA Settings
$80/B3FF 8D 00 43    STA $4300
$80/B402 A9 01       LDA #$01      ; Activate DMA
$80/B404 8D 0B 42    STA $420B
$80/B407 9C 49 12    STZ $1249     ; Clear "Update CGRAM" Flag
$80/B40A 60          RTS

$80/B40B Joypad Data Fetching

$80/B40B AD 12 42    LDA $4212     ; Load PPU-Status
$80/B40E 4A          LSR A         ; Move Bit 0 (Auto-Joypad Status) into Carry
$80/B40F B0 FA       BCS $FA       ; [$B40B] Loop until Auto-Joypad Read is done
$80/B411 A0 00 00    LDY #$0000
$80/B414 A2 00 00    LDX #$0000
$80/B417 B9 18 42    LDA $4218,y
$80/B41A 29 0F       AND #$0F
$80/B41C D0 40       BNE $40       ; [$B45E] I think this is a security measure; if this isn't 0, something's wrong
$80/B41E BF 16 40 00 LDA $004016,x ; ???
$80/B422 29 01       AND #$01
$80/B424 F0 38       BEQ $38       ; [$B45E] Another security measure?
$80/B426 BD 47 05    LDA $0547,x   ; ???
$80/B429 F0 1B       BEQ $1B       ; [$B446]
$80/B42B C2 20       REP #$20
$80/B42D B9 49 05    LDA $0549,y   ; Load Joypad Data from the last frame, store it in $0551,y and push it on stack
$80/B430 99 51 05    STA $0551,y
$80/B433 48          PHA
$80/B434 B9 18 42    LDA $4218,y   ; Load Joypad-Input and store it in $0549-054C
$80/B437 99 49 05    STA $0549,y
$80/B43A 68          PLA
$80/B43B 39 49 05    AND $0549,y   ; Calculate, which buttons are held from the last frame, and store them in $054D,y
$80/B43E 59 49 05    EOR $0549,y
$80/B441 99 4D 05    STA $054D,y
$80/B444 80 26       BRA $26       ; [$B46C] Leave out the "other" Fetching method
$80/B446 A9 01       LDA #$01      ; ???
$80/B448 9D 47 05    STA $0547,x
$80/B44B C2 20       REP #$20
$80/B44D B9 18 42    LDA $4218,y   ; Load Joypad-Input and store it in $0549-054C
$80/B450 99 49 05    STA $0549,y
$80/B453 A9 00 00    LDA #$0000    ; 
$80/B456 99 4D 05    STA $054D,y   ; Clear held buttons
$80/B459 99 51 05    STA $0551,y   ; Clear last frame's Joypad input
$80/B45C 80 0E       BRA $0E       ; [$B46C]
$80/B46C E2 20       SEP #$20
$80/B46E A5 F9       LDA $F9       ; ???
$80/B470 30 12       BMI $12       ; [$B484] If $F9 is negative, no Soft Reset is accepted?
$80/B472 C2 20       REP #$20
$80/B474 B9 49 05    LDA $0549,y   ; Check newly fetched Joypad data
$80/B477 C9 30 30    CMP #$3030    ; Is Start, Select, L + R pressed?
$80/B47A D0 08       BNE $08       ; [$B484]

Code is missing here

$80/B484 E2 20       SEP #$20
$80/B486 C8          INY           ; Increment index registers
$80/B487 C8          INY
$80/B488 E8          INX
$80/B489 E0 02 00    CPX #$0002
$80/B48C 90 89       BCC $89       ; [$B417] Repeat this for the second controller
$80/B48E 60          RTS

$80/B4C8 An IRQ-Handler

This is an IRQ Handler. In Battle. With Battle Stats Menu on.

$80/B4C8 E2 20       SEP #$20
$80/B4CA 48          PHA           ; Buffer A value on stack
$80/B4CB AF 11 42 00 LDA $004211   ; Check if the IRQ flag is set
$80/B4CF 10 72       BPL $72       ; [$B543] If not, branch, pull A from Stack and exit
$80/B4D1 8B          PHB           ; Else, buffer the current Program bank and change  it
$80/B4D2 4B          PHK
$80/B4D3 AB          PLB
$80/B4D4 6C 34 00    JMP ($0034)   ; Jump to the IRQ Handler [$80:B4D7]

$80/B4D7 Possibility where IRQ-Handler $80/B4C8 can jump to

A possibility where $80/B4C8 can jump to

$80/B4D7 AD F0 05    LDA $05F0     ; ???
$80/B4DA C9 DA       CMP #$DA      ; ???
$80/B4DC B0 4F       BCS $4F       ; [$B52D] ??? Branch is taken if A is higher
$80/B4DE C2 10       REP #$10      ; ???
$80/B4E0 DA          PHX           ; ???
$80/B4E1 5A          PHY           ; ???
$80/B4E2 0B          PHD           ; ???
$80/B4E3 A2 00 21    LDX #$2100    ; This sets the direc bank to $2100, so every two-digit register is a $21xx register!
$80/B4E6 DA          PHX           ; I guess this is done so the HBLANKs are optimally used
$80/B4E7 2B          PLD
$80/B4E8 A9 09       LDA #$09      ; Prepare value so it can be stored right after the HBLANK
$80/B4EA 2C 12 42    BIT $4212     ; V/HBLANK-Flag register
$80/B4ED 70 FB       BVS $FB       ; [$B4EA] Loop until flag is set (HBLANK begins)
$80/B4EF 2C 12 42    BIT $4212
$80/B4F2 50 FB       BVC $FB       ; [$B4EF] Loop until flag is cleared, HBLANK has just ended
$80/B4F4 64 00       STZ $00       ; $2100 - turn down the Brightness
$80/B4F6 85 05       STA $05       ; $2105 - BG mode 1 with priority bit
$80/B4F8 64 31       STZ $31       ; $2131 - Deactivate color math
$80/B4FA A0 07 00    LDY #$0007    ; Load next bunch of values
$80/B4FD A2 38 38    LDX #$3838
$80/B500 A9 34       LDA #$34
$80/B502 2C 12 42    BIT $4212     ; Wait for the next passing of a HBLANK
$80/B505 70 FB       BVS $FB       ; [$B502]
$80/B507 2C 12 42    BIT $4212
$80/B50A 50 FB       BVC $FB       ; [$B507]
$80/B50C 84 2C       STY $2C       ; $212C - BG1/2/3 (No sprites!) on Main Screen, nothing on subscreen
$80/B50E 86 08       STX $08       ; BG2/3 Tilemap at $3800 in VRAM
$80/B510 85 07       STA $07       ; BG1 Tilemap at $3400
$80/B512 A9 02       LDA #$02      ; BG1 Tiles at $2000
$80/B514 85 0B       STA $0B
$80/B516 AD 6A 05    LDA $056A     ; Restore old brightness settings
$80/B519 85 00       STA $00
$80/B51B 2B          PLD           ; Restore old Direct Bank
$80/B51C A2 2D B5    LDX #$B52D    ; Setting up the Address of the IRQ Handler
$80/B51F 86 34       STX $34       ; For the last part, the IRQ Handler now jumps to $80/B52D
$80/B521 A2 DC 00    LDX #$00DC    ; V Timer on #$DC = (#220, the bottom line) - once executed is enough?
$80/B524 8E 09 42    STX $4209
$80/B527 7A          PLY           ; Restore Y, X and Program Bank
$80/B528 FA          PLX
$80/B529 AB          PLB
$80/B52A 4C 43 B5    JMP $B543     ; Pull A from Stack and RTI

$80/B52D 2C 12 42    BIT $4212     ; V/HBLANK-Flag register
$80/B530 70 FB       BVS $FB       ; [$B52D] Loop until flag is set (HBLANK begins)
$80/B532 2C 12 42    BIT $4212
$80/B535 50 FB       BVC $FB       ; [$B532] Loop until flag is cleared, HBLANK has just ended
$80/B537 9C 00 21    STZ $2100     ; No FBLANK, but screen brightness = 0
$80/B53A AD AF 05    LDA $05AF     ; Deactivate(?) HBLANK
$80/B53D 29 CF       AND #$CF
$80/B53F 8D 00 42    STA $4200
$80/B542 AB          PLB           ; Restore Program Bank and A
$80/B543 68          PLA
$80/B544 40          RTI

$80/B545 Long Jump to Clear Graphic Setup Registers

$80/B545 8B          PHB           ; Buffer Program Bank
$80/B546 4B          PHK           ; Set Program Bank to $80
$80/B547 AB          PLB
$80/B548 20 4D B5    JSR $B54D     ; Clear Graphic Setup Registers
$80/B54B AB          PLB           ; Restore Program Bank
$80/B54C 6B          RTL

$80/B54D Clear Graphic Setup Registers

$80/B54D 9C 33 21    STZ $2133
$80/B550 A9 02       LDA #$02      ; 8x8 and 32x32 sprites
$80/B552 8D 01 21    STA $2101
$80/B555 8D 88 05    STA $0588
$80/B558 A9 09       LDA #$09      ; Mode 1, Priority Bit
$80/B55A 8D 05 21    STA $2105
$80/B55D 8D 89 05    STA $0589
$80/B560 A9 71       LDA #$71      ; BG1 Tilemap at $7000 in VRAM, h mirroring
$80/B562 8D 07 21    STA $2107
$80/B565 8D 8B 05    STA $058B
$80/B568 A9 79       LDA #$79      ; BG2 Tilemap at $7000 in VRAM, h/v mirroring
$80/B56A 8D 08 21    STA $2108
$80/B56D 8D 8C 05    STA $058C
$80/B570 A9 3C       LDA #$3C      ; BG3 Tilemap at $3C00 in VRAM
$80/B572 8D 09 21    STA $2109
$80/B575 8D 8D 05    STA $058D
$80/B578 A9 3C       LDA #$3C      ; BG3 Tilemap at $3C00 in VRAM
$80/B57A 8D 0A 21    STA $210A
$80/B57D 8D 8E 05    STA $058E
$80/B580 A9 00       LDA #$00      ; BG1/2 Tiles at $0000 in VRAM
$80/B582 8D 0B 21    STA $210B
$80/B585 8D 8F 05    STA $058F
$80/B588 A9 55       LDA #$55      ; BG3/4 Tiles at $5000 in VRAM
$80/B58A 8D 0C 21    STA $210C
$80/B58D 8D 90 05    STA $0590
$80/B590 A9 17       LDA #$17      ; BG1-3 and Sprites for Main Screen
$80/B592 8D 2C 21    STA $212C
$80/B595 8D A6 05    STA $05A6
$80/B598 A9 04       LDA #$04      ; BG4 for Subscreen
$80/B59A 8D 2D 21    STA $212D
$80/B59D 8D A7 05    STA $05A7
$80/B5A0 9C A8 05    STZ $05A8     ; Window Mask Registers
$80/B5A3 9C 2E 21    STZ $212E
$80/B5A6 9C A9 05    STZ $05A9
$80/B5A9 9C 2F 21    STZ $212F
$80/B5AC A9 02       LDA #$02
$80/B5AE 8D AA 05    STA $05AA     ; $2130 Buffer - Add subscreen
$80/B5B1 A9 23       LDA #$23
$80/B5B3 8D AB 05    STA $05AB     ; ???
$80/B5B6 A9 E0       LDA #$E0
$80/B5B8 8D AC 05    STA $05AC     ; $2132 Buffer?
$80/B5BB 8D AD 05    STA $05AD     ; $2132 Buffer?
$80/B5BE 8D AE 05    STA $05AE     ; $2132 Buffer?
$80/B5C1 9C 8A 05    STZ $058A     ; Clear $2106 (Mosaic Register)
$80/B5C4 60          RTS

$80/B5C5 ?

$80/B5C5 8B          PHB           ; Buffer Program Bank
$80/B5C6 4B          PHK           ; Set Program Bank to $80
$80/B5C7 AB          PLB
$80/B5C8 20 CD B5    JSR $B5CD  [$80:B5CD]   A:0000 X:0000 Y:0000 P:eNvMxdizc

$80/B5CD ?

This is executed when loading a new map

$80/B5CD 64 36       STZ $36    [$00:0036]   A:0000 X:0000 Y:0000 P:eNvMxdizc
$80/B5CF 64 37       STZ $37    [$00:0037]   A:0000 X:0000 Y:0000 P:eNvMxdizc
$80/B5D1 64 59       STZ $59    [$00:0059]   A:0000 X:0000 Y:0000 P:eNvMxdizc
$80/B5D3 64 A2       STZ $A2    [$00:00A2]   A:0000 X:0000 Y:0000 P:eNvMxdizc
$80/B5D5 64 A1       STZ $A1    [$00:00A1]   A:0000 X:0000 Y:0000 P:eNvMxdizc
$80/B5D7 64 ED       STZ $ED    [$00:00ED]   A:0000 X:0000 Y:0000 P:eNvMxdizc
$80/B5D9 64 8E       STZ $8E    [$00:008E]   A:0000 X:0000 Y:0000 P:eNvMxdizc
$80/B5DB A2 FF FF    LDX #$FFFF              A:0000 X:0000 Y:0000 P:eNvMxdizc
$80/B5DE 86 8F       STX $8F    [$00:008F]   A:0000 X:FFFF Y:0000 P:eNvMxdizc
$80/B5E0 A2 DC 00    LDX #$00DC              A:0000 X:FFFF Y:0000 P:eNvMxdizc
$80/B5E3 8E EE 05    STX $05EE  [$80:05EE]   A:0000 X:00DC Y:0000 P:envMxdizc
$80/B5E6 8E F0 05    STX $05F0  [$80:05F0]   A:0000 X:00DC Y:0000 P:envMxdizc
$80/B5E9 9C B9 05    STZ $05B9  [$80:05B9]   A:0000 X:00DC Y:0000 P:envMxdizc
$80/B5EC 9C BA 05    STZ $05BA  [$80:05BA]   A:0000 X:00DC Y:0000 P:envMxdizc
$80/B5EF 9C BE 05    STZ $05BE  [$80:05BE]   A:0000 X:00DC Y:0000 P:envMxdizc
$80/B5F2 9C BF 05    STZ $05BF  [$80:05BF]   A:0000 X:00DC Y:0000 P:envMxdizc
$80/B5F5 9C C0 05    STZ $05C0  [$80:05C0]   A:0000 X:00DC Y:0000 P:envMxdizc
$80/B5F8 9C C1 05    STZ $05C1  [$80:05C1]   A:0000 X:00DC Y:0000 P:envMxdizc
$80/B5FB 9C 49 12    STZ $1249     ; Remove Flag for CGRAM Update
$80/B5FE A9 00       LDA #$00                A:0000 X:00DC Y:0000 P:envMxdizc
$80/B600 8F 87 BE 7E STA $7EBE87[$7E:BE87]   A:0000 X:00DC Y:0000 P:envMxdiZc
$80/B604 A9 08       LDA #$08                A:0000 X:00DC Y:0000 P:envMxdiZc
$80/B606 85 67       STA $67    [$00:0067]   A:0008 X:00DC Y:0000 P:envMxdizc
$80/B608 22 36 E8 81 JSL $81E836[$81:E836]   A:0008 X:00DC Y:0000 P:envMxdizc
$80/B60C 22 49 E8 81 JSL $81E849[$81:E849]   A:0008 X:FFFF Y:0000 P:eNvMxdizc
$80/B610 22 C8 8A 81 JSL $818AC8[$81:8AC8]   A:0010 X:00FF Y:00FF P:envMxdiZc
$80/B614 9C CB 11    STZ $11CB  [$80:11CB]   A:00B8 X:0001 Y:00FF P:eNvMxdiZc
$80/B617 9C 69 05    STZ $0569  [$80:0569]   A:00B8 X:0001 Y:00FF P:eNvMxdiZc
$80/B61A C2 20       REP #$20                A:00B8 X:0001 Y:00FF P:eNvMxdiZc
$80/B61C 9C CE 11    STZ $11CE  [$80:11CE]   A:00B8 X:0001 Y:00FF P:eNvmxdiZc
$80/B61F 9C 47 05    STZ $0547  [$80:0547]   A:00B8 X:0001 Y:00FF P:eNvmxdiZc
$80/B622 9C 5B 05    STZ $055B  [$80:055B]   A:00B8 X:0001 Y:00FF P:eNvmxdiZc
$80/B625 A9 00 02    LDA #$0200              A:00B8 X:0001 Y:00FF P:eNvmxdiZc
$80/B628 8D 5D 05    STA $055D  [$80:055D]   A:0200 X:0001 Y:00FF P:envmxdizc
$80/B62B 9C C7 0E    STZ $0EC7  [$80:0EC7]   A:0200 X:0001 Y:00FF P:envmxdizc
$80/B62E 9C C9 11    STZ $11C9  [$80:11C9]   A:0200 X:0001 Y:00FF P:envmxdizc
$80/B631 9C C5 0E    STZ $0EC5  [$80:0EC5]   A:0200 X:0001 Y:00FF P:envmxdizc
$80/B634 9C BB 05    STZ $05BB  [$80:05BB]   A:0200 X:0001 Y:00FF P:envmxdizc
$80/B637 9C C3 05    STZ $05C3  [$80:05C3]   A:0200 X:0001 Y:00FF P:envmxdizc
$80/B63A 9C D6 16    STZ $16D6  [$80:16D6]   A:0200 X:0001 Y:00FF P:envmxdizc
$80/B63D 9C D8 16    STZ $16D8  [$80:16D8]   A:0200 X:0001 Y:00FF P:envmxdizc
$80/B640 A9 00 20    LDA #$2000              A:0200 X:0001 Y:00FF P:envmxdizc
$80/B643 85 5A       STA $5A    [$00:005A]   A:2000 X:0001 Y:00FF P:envmxdizc
$80/B645 85 5C       STA $5C    [$00:005C]   A:2000 X:0001 Y:00FF P:envmxdizc
$80/B647 A9 00 A8    LDA #$A800              A:2000 X:0001 Y:00FF P:envmxdizc
$80/B64A 85 5E       STA $5E    [$00:005E]   A:A800 X:0001 Y:00FF P:eNvmxdizc
$80/B64C A2 00 00    LDX #$0000    ; Setup Loop Counter
$80/B64F 9E 91 05    STZ $0591,x   ; Clear all the BG Scroll Register Buffers
$80/B652 E8          INX
$80/B653 E8          INX
$80/B654 E0 10 00    CPX #$0010
$80/B657 D0 F6       BNE $F6       ; [$B64F]
$80/B659 A2 00 00    LDX #$0000    ; Setup Loop Counter
$80/B65C 9E 71 05    STZ $0571,x   ; Clear all the other BG Scroll Register Buffers
$80/B65F E8          INX
$80/B660 E8          INX
$80/B661 E0 10 00    CPX #$0010
$80/B664 D0 F6       BNE $F6       ; [$B65C]
$80/B666 E2 20       SEP #$20
$80/B668 4C FA B6    JMP $B6FA     ; Clear OAM Buffers


$80/B66B Long Jump to Clear Registers, clear WRAM Bank $7F

$80/B66B 8B          PHB           ; Buffer Program Bank
$80/B66C 4B          PHK           ; Set Program Bank to $80
$80/B66D AB          PLB
$80/B66E 20 73 B6    JSR $B673     ; Clear Registers, clear WRAM Bank $7F
$80/B671 AB          PLB           ; Restore Program Bank
$80/B672 6B          RTL

$80/B673 Clear Registers, clear WRAM Bank $7F

$80/B673 A2 02 42    LDX #$4202    ; Clear $4202 to $420C
$80/B676 A9 0B       LDA #$0B
$80/B678 74 00       STZ $00,x
$80/B67A E8          INX
$80/B67B 3A          DEC A
$80/B67C D0 FA       BNE $FA    [$B678]
$80/B67E A9 FF       LDA #$FF      ; "Programmable I/O Port"
$80/B680 8D 01 42    STA $4201
$80/B683 A2 06 21    LDX #$2106    ; Clear $2106 to $2114
$80/B686 A9 0F       LDA #$0F
$80/B688 74 00       STZ $00,x
$80/B68A 74 00       STZ $00,x
$80/B68C E8          INX
$80/B68D 3A          DEC A
$80/B68E D0 F8       BNE $F8
$80/B690 A9 80       LDA #$80
$80/B692 95 00       STA $00,x  [$00:2115]
$80/B694 A9 01       LDA #$01
$80/B696 A2 1A 21    LDX #$211A    ; Mode 7 Settings
$80/B699 74 00       STZ $00,x     ; Clear a lot of Mode 7 Registers
$80/B69B 74 01       STZ $01,x
$80/B69D 95 01       STA $01,x
$80/B69F 74 02       STZ $02,x
$80/B6A1 74 02       STZ $02,x
$80/B6A3 74 03       STZ $03,x
$80/B6A5 74 03       STZ $03,x
$80/B6A7 74 04       STZ $04,x
$80/B6A9 95 04       STA $04,x
$80/B6AB 74 05       STZ $05,x
$80/B6AD 74 05       STZ $05,x
$80/B6AF 74 06       STZ $06,x
$80/B6B1 74 06       STZ $06,x
$80/B6B3 A2 23 21    LDX #$2123    ; Clear $2123 to $212E
$80/B6B6 A9 0C       LDA #$0C
$80/B6B8 74 00       STZ $00,x
$80/B6BA E8          INX
$80/B6BB 3A          DEC A
$80/B6BC D0 FA       BNE $FA    [$B6B8]
$80/B6BE A2 30 21    LDX #$2130
$80/B6C1 A9 30       LDA #$30
$80/B6C3 95 00       STA $00,x     ; $2130 - Color Addition
$80/B6C5 74 01       STZ $01,x     ; $2131 - Color Subtraction
$80/B6C7 A9 E0       LDA #$E0
$80/B6C9 95 02       STA $02,x     ; $2132 - Fixed Color Data
$80/B6CB 74 03       STZ $03,x     ; $2133 - Screen Mode/Video Select

And then proceeds on the next part

$80/B6CD Set up $7F Clear DMA

$80/B6CD A0 00 00    LDY #$0000    ; Transfer $10000 Byte
$80/B6D0 8C 05 43    STY $4305
$80/B6D3 A0 00 00    LDY #$0000    ; Destination: #$7F:0000
$80/B6D6 38          SEC
$80/B6D7 A2 F1 B6    LDX #$B6F1    ; Position of the Clear Byte: $80/B6F1
$80/B6DA A9 80       LDA #$80
$80/B6DC 20 AB 9D    JSR $9DAB     ; Fixed WRAM Clear DMA

$80/B6DF Set up VRAM Clear DMA

$80/B6DF A0 00 00    LDY #$0000    ; Transfer $10000 Byte
$80/B6E2 8C 05 43    STY $4305
$80/B6E5 A0 00 00    LDY #$0000    ; (VRAM-)Destination: #0000
$80/B6E8 A2 F1 B6    LDX #$B6F1    ; Position of the Clear Byte: $80/B6F1
$80/B6EB A9 80       LDA #$80
$80/B6ED 20 89 9D    JSR $9D89     ; Fixed VRAM Clear DMA
$80/B6F0 60          RTS

$80/B6FA Clear OAM Buffers

$80/B6FA C2 20       REP #$20
$80/B6FC A9 00 E8    LDA #$E800    ; Clear Value for OAM Low Table Buffer
$80/B6FF A2 00 01    LDX #$0100    ; Start Address of the Low Table of OAM Buffer 1
$80/B702 A0 80 00    LDY #$0080    ; Number of Sprites - All Sprites
$80/B705 95 00       STA $00,x     ; Clear OAM Buffer 1 Low Table
$80/B707 E8          INX
$80/B708 E8          INX
$80/B709 74 00       STZ $00,x
$80/B70B E8          INX
$80/B70C E8          INX
$80/B70D 88          DEY           ; Decrement Loop Counter
$80/B70E D0 F5       BNE $F5       ; [$B705] Loop
$80/B710 E2 20       SEP #$20
$80/B712 A2 00 03    LDX #$0300    ; Start Address of the High Table of OAM Buffer 1
$80/B715 A0 20 00    LDY #$0020    ; Number of Bytes to do / High Table Size
$80/B718 74 00       STZ $00,x     ; Clear OAM Buffer 1 High Table
$80/B71A E8          INX
$80/B71B 88          DEY
$80/B71C D0 FA       BNE $FA       ; [$B718]
$80/B71E C2 20       REP #$20
$80/B720 A9 00 E8    LDA #$E800    ; Clear Value for OAM Low Table Buffer
$80/B723 A2 20 03    LDX #$0320    ; Start Address of the Low Table of OAM Buffer 2
$80/B726 A0 80 00    LDY #$0080
$80/B729 95 00       STA $00,x     ; Clear OAM Buffer 2 Low Table
$80/B72B E8          INX
$80/B72C E8          INX
$80/B72D 74 00       STZ $00,x
$80/B72F E8          INX
$80/B730 E8          INX
$80/B731 88          DEY
$80/B732 D0 F5       BNE $F5       ; [$B729]
$80/B734 E2 20       SEP #$20
$80/B736 A2 20 05    LDX #$0520    ; Start Address of the High Table of OAM Buffer 2
$80/B739 A0 20 00    LDY #$0020
$80/B73C 74 00       STZ $00,x     ; Clear OAM Buffer 2 High Table
$80/B73E E8          INX
$80/B73F 88          DEY
$80/B740 D0 FA       BNE $FA       ; [$B73C]
$80/B742 A9 01       LDA #$01      ; Set Flag for an OAM Update
$80/B744 8D 40 05    STA $0540
$80/B747 A9 80       LDA #$80      ; Number of Free sprites in $320(?)
$80/B749 8D 41 05    STA $0541
$80/B74C A2 20 00    LDX #$0020    ; ??? Number of used Sprites in $0100 = $20, $0320 = $00???
$80/B74F 8E 43 05    STX $0543
$80/B752 A2 20 03    LDX #$0320    ; Set the OAM buffer to $0320
$80/B755 8E 45 05    STX $0545
$80/B758 60          RTS

$80/F6DF BATTLE: Set the Cursor's Sprites to it's new position?

$80/F6DF 20 34 F7    JSR $F734     ; Get the Height's Map Address of the rhomb the Cursor points to
$80/F6E2 BF 00 D8 7F LDA $7FD800,x ; Load the height of the rhomb the cursor points on
$80/F6E6 F0 01       BEQ $01       ; [$F6E9] Decrement the value if it isn't zero
$80/F6E8 3A          DEC A
$80/F6E9 85 65       STA $65       ; Store in $65 ("Cursor Height" storage)
$80/F6EB 64 66       STZ $66       ; Clear $66 (only used in 16-bit calculation with $65?)
$80/F6ED A2 3C 00    LDX #$003C              A:0006 X:002B Y:0009 P:envMxdizc
$80/F6F0 A0 3E 00    LDY #$003E              A:0006 X:003C Y:0009 P:envMxdizc
$80/F6F3 A9 7F       LDA #$7F                A:0006 X:003C Y:003E P:envMxdizc
$80/F6F5 9D 03 0A    STA $0A03,x[$80:0A3F]   A:007F X:003C Y:003E P:envMxdizc
$80/F6F8 99 03 0A    STA $0A03,y[$80:0A41]   A:007F X:003C Y:003E P:envMxdizc
$80/F6FB 9D 43 0A    STA $0A43,x[$80:0A7F]   A:007F X:003C Y:003E P:envMxdizc
$80/F6FE 99 43 0A    STA $0A43,y[$80:0A81]   A:007F X:003C Y:003E P:envMxdizc
$80/F701 A9 00       LDA #$00                A:007F X:003C Y:003E P:envMxdizc
$80/F703 9D 83 0A    STA $0A83,x[$80:0ABF]   A:0000 X:003C Y:003E P:envMxdiZc
$80/F706 99 83 0A    STA $0A83,y[$80:0AC1]   A:0000 X:003C Y:003E P:envMxdiZc
$80/F709 A5 61       LDA $61    [$00:0061]   A:0000 X:003C Y:003E P:envMxdiZc
$80/F70B 9D 04 0A    STA $0A04,x[$80:0A40]   A:000B X:003C Y:003E P:envMxdizc
$80/F70E 99 04 0A    STA $0A04,y[$80:0A42]   A:000B X:003C Y:003E P:envMxdizc
$80/F711 9D 43 09    STA $0943,x[$80:097F]   A:000B X:003C Y:003E P:envMxdizc
$80/F714 99 43 09    STA $0943,y[$80:0981]   A:000B X:003C Y:003E P:envMxdizc
$80/F717 A5 63       LDA $63    [$00:0063]   A:000B X:003C Y:003E P:envMxdizc
$80/F719 9D 44 0A    STA $0A44,x[$80:0A80]   A:0001 X:003C Y:003E P:envMxdizc
$80/F71C 99 44 0A    STA $0A44,y[$80:0A82]   A:0001 X:003C Y:003E P:envMxdizc
$80/F71F 9D 44 09    STA $0944,x[$80:0980]   A:0001 X:003C Y:003E P:envMxdizc
$80/F722 99 44 09    STA $0944,y[$80:0982]   A:0001 X:003C Y:003E P:envMxdizc
$80/F725 A5 65       LDA $65    [$00:0065]   A:0001 X:003C Y:003E P:envMxdizc
$80/F727 0A          ASL A                   A:0006 X:003C Y:003E P:envMxdizc
$80/F728 9D 84 0A    STA $0A84,x[$80:0AC0]   A:000C X:003C Y:003E P:envMxdizc
$80/F72B 69 06       ADC #$06                A:000C X:003C Y:003E P:envMxdizc
$80/F72D 99 84 0A    STA $0A84,y[$80:0AC2]   A:0012 X:003C Y:003E P:envMxdizc
$80/F730 20 21 9A    JSR $9A21     ; Calculate the Global Cursor Position from it's Position on Map
$80/F733 60          RTS

$80/F3C4 BATTLE: Get the Height's Map Address of the Rhomb the Cursor points to

If you enter Battle, the program sets up the Height Map at $7F/D800. This is the map where the height of each Rhomb on the Battle Map is stored.

This subroutine turns the current position of the cursor into the offset for the corresponding entry on the Height Map. This is used for positioning the cursor on screen - depending on the Rhomb's height, the cursor has to be higher or lower on the screen.

The Height Map has Rows and Columns. Each Row is $20 bytes long and contains all Rhombs with the same position on the NE-SW-Axis. This is why the calculation takes the NE-SW-Axis position and multiplies it by 20.

X will contain the result in the end.

$80/F734 7B          TDC           ; Clear 16-bit A
$80/F735 A5 63       LDA $63       ; Load Cursor Position (NE-SW-Axis)
$80/F737 C2 20       REP #$20      ; A = 16-bit
$80/F739 EB          XBA           ; Multiply by 20
$80/F73A 4A          LSR A
$80/F73B 4A          LSR A
$80/F73C 4A          LSR A
$80/F73D E2 20       SEP #$20      ; A = 8-bit
$80/F73F 05 61       ORA $61       ; Add the Cursor Position on the NW-SE-Axis
$80/F741 AA          TAX           ; Transfer the result in X
$80/F742 60          RTS

$80/F84F BATTLE: Changing Cursor Position something something

Part to F84C (including that line) is executed when Cursor is idle The other stuff is executed when moved

$80/F844 7B          TDC                     A:0001 X:0000 Y:000A P:envMxdizc
$80/F845 AD 68 05    LDA $0568  [$80:0568]   A:0000 X:0000 Y:000A P:envMxdiZc
$80/F848 29 0F       AND #$0F                A:0000 X:0000 Y:000A P:envMxdiZc
$80/F84A D0 03       BNE $03    [$F84F]      A:0000 X:0000 Y:000A P:envMxdiZc
$80/F84C 4C E4 F8    JMP $F8E4  [$80:F8E4]   A:0000 X:0000 Y:000A P:envMxdiZc
$80/F84F A8          TAY                     A:0008 X:0000 Y:000A P:envMxdizc
$80/F850 A5 63       LDA $63       ; 16-bit A contains the current cursors position after this
$80/F852 EB          XBA           ; High Byte: Position on the NE-SW-Axis
$80/F853 A5 61       LDA $61       ;  Low Byte: Position on the NW-SE-Axis
$80/F855 AA          TAX           ; Transfer it to X
$80/F856 DA          PHX           ; ... and BUFFER IT ON STACK (gets important later)
$80/F857 7B          TDC           ; Clear 16-bit-A
$80/F858 A5 48       LDA $48    [$00:0048]   A:0000 X:020B Y:0008 P:envMxdiZc
$80/F85A 29 03       AND #$03                A:0001 X:020B Y:0008 P:envMxdizc
$80/F85C 0A          ASL A                   A:0001 X:020B Y:0008 P:envMxdizc
$80/F85D AA          TAX                     A:0002 X:020B Y:0008 P:envMxdizc
$80/F85E 7C 61 F8    JMP ($F861,x)[$80:F869] A:0002 X:0002 Y:0008 P:envMxdizc

$80/F869 BATTLE: Changing Cursor Position something something

$80/F869 B9 12 F9    LDA $F912,y[$80:F91A]   A:0002 X:0002 Y:0008 P:envMxdizc
$80/F86C A8          TAY                     A:0009 X:0002 Y:0008 P:envMxdizc
$80/F86D 80 2A       BRA $2A    [$F899]      A:0009 X:0002 Y:0009 P:envMxdizc
Code is missing here
$80/F899 84 00       STY $00    [$00:0000]   A:0009 X:0002 Y:0009 P:envMxdizc
$80/F89B A4 00       LDY $00    [$00:0000]   A:0009 X:0002 Y:0009 P:envMxdizc
$80/F89D B9 F2 F8    LDA $F8F2,y[$80:F8FB]   A:0009 X:0002 Y:0009 P:envMxdizc
$80/F8A0 18          CLC                     A:0000 X:0002 Y:0009 P:envMxdiZc
$80/F8A1 65 61       ADC $61    [$00:0061]   A:0000 X:0002 Y:0009 P:envMxdiZc
$80/F8A3 F0 07       BEQ $07    [$F8AC]      A:000B X:0002 Y:0009 P:envMxdizc
$80/F8A5 CD C8 16    CMP $16C8     ; Compare to the NW-SE-Width of the Map
$80/F8A8 B0 02       BCS $02       ; [$F8AC] Don't replace the Cursor Position if the new Position is offlimits
$80/F8AA 85 61       STA $61       ; Update Position on the NW-SE-Axis
$80/F8AC B9 02 F9    LDA $F902,y[$80:F90B]   A:000B X:0002 Y:0009 P:eNvMxdizc
$80/F8AF 18          CLC                     A:00FF X:0002 Y:0009 P:eNvMxdizc
$80/F8B0 65 63       ADC $63    [$00:0063]   A:00FF X:0002 Y:0009 P:eNvMxdizc
$80/F8B2 F0 07       BEQ $07    [$F8BB]      A:0001 X:0002 Y:0009 P:envMxdizC
$80/F8B4 CD CA 16    CMP $16CA  [$80:16CA]   A:0001 X:0002 Y:0009 P:envMxdizC
$80/F8B7 B0 02       BCS $02    [$F8BB]      A:0001 X:0002 Y:0009 P:eNvMxdizc
$80/F8B9 85 63       STA $63    [$00:0063]   A:0001 X:0002 Y:0009 P:eNvMxdizc
$80/F8BB 20 DF F6    JSR $F6DF  [$80:F6DF]   A:0001 X:0002 Y:0009 P:eNvMxdizc
$80/F8BE FA          PLX           ; Pull the old Cursor Position from Stack (see $80/F850)
$80/F8BF 86 00       STX $00       ; Temp-Store it in $00
$80/F8C1 A5 63       LDA $63       ; Calculate the current Cursor Position according to the same pattern
$80/F8C3 EB          XBA
$80/F8C4 A5 61       LDA $61
$80/F8C6 AA          TAX           ; Transfer it to X
$80/F8C7 E4 00       CPX $00       ; Compare Old and New Position
$80/F8C9 F0 19       BEQ $19       ; [$F8E4] ? Branch if they're the same
$80/F8CB A5 47       LDA $47    [$00:0047]   A:010B X:010B Y:003E P:eNvMxdizc
$80/F8CD 0D F4 16    ORA $16F4  [$80:16F4]   A:0100 X:010B Y:003E P:envMxdiZc
$80/F8D0 F0 12       BEQ $12    [$F8E4]      A:0100 X:010B Y:003E P:envMxdiZc

$80/F8E4 BATTLE: Changing Cursor Position something something

Executed when Cursor is idle, too

$80/F8E4 A2 3E 00    LDX #$003E              A:0000 X:0000 Y:000A P:envMxdiZc
$80/F8E7 86 3B       STX $3B    [$00:003B]   A:0000 X:003E Y:000A P:envMxdizc
$80/F8E9 22 4C 96 84 JSL $84964C[$84:964C]   A:0000 X:003E Y:000A P:envMxdizc
$80/F8ED 22 F3 BB 82 JSL $82BBF3[$82:BBF3]   A:0005 X:003E Y:000A P:eNvMxdizc
$80/F8F1 60          RTS                     A:0000 X:003E Y:000A P:eNvMxdizc

Bank $81

$81/EF8F ?

$81/EF8F 8B          PHB                     A:0099 X:905E Y:000D P:eNvMxdizc
$81/EF90 48          PHA                     A:0099 X:905E Y:000D P:eNvMxdizc
$81/EF91 AB          PLB                     A:0099 X:905E Y:000D P:eNvMxdizc
$81/EF92 C2 20       REP #$20                A:0099 X:905E Y:000D P:eNvMxdizc
$81/EF94 98          TYA                     A:0099 X:905E Y:000D P:eNvmxdizc
$81/EF95 4A          LSR A                   A:000D X:905E Y:000D P:envmxdizc
$81/EF96 4A          LSR A                   A:0006 X:905E Y:000D P:envmxdizC
$81/EF97 4A          LSR A                   A:0003 X:905E Y:000D P:envmxdizc
$81/EF98 48          PHA                     A:0001 X:905E Y:000D P:envmxdizC
$81/EF99 8A          TXA                     A:0001 X:905E Y:000D P:envmxdizC
$81/EF9A 18          CLC                     A:905E X:905E Y:000D P:eNvmxdizC
$81/EF9B 63 01       ADC $01,s  [$00:1FE7]   A:905E X:905E Y:000D P:eNvmxdizc
$81/EF9D 83 01       STA $01,s  [$00:1FE7]   A:905F X:905E Y:000D P:eNvmxdizc
$81/EF9F E2 20       SEP #$20                A:905F X:905E Y:000D P:eNvmxdizc
$81/EFA1 7B          TDC                     A:905F X:905E Y:000D P:eNvMxdizc
$81/EFA2 98          TYA                     A:0000 X:905E Y:000D P:envMxdiZc
$81/EFA3 29 07       AND #$07                A:000D X:905E Y:000D P:envMxdizc
$81/EFA5 AA          TAX                     A:0005 X:905E Y:000D P:envMxdizc
$81/EFA6 BF B6 EF 81 LDA $81EFB6,x[$81:EFBB] A:0005 X:0005 Y:000D P:envMxdizc
$81/EFAA FA          PLX                     A:0020 X:0005 Y:000D P:envMxdizc
$81/EFAB 48          PHA                     A:0020 X:905F Y:000D P:eNvMxdizc
$81/EFAC BD 00 00    LDA $0000,x[$99:905F]   A:0020 X:905F Y:000D P:eNvMxdizc
$81/EFAF 23 01       AND $01,s  [$00:1FE8]   A:0000 X:905F Y:000D P:envMxdiZc
$81/EFB1 C9 01       CMP #$01                A:0000 X:905F Y:000D P:envMxdiZc
$81/EFB3 68          PLA                     A:0000 X:905F Y:000D P:eNvMxdizc
$81/EFB4 AB          PLB                     A:0020 X:905F Y:000D P:envMxdizc
$81/EFB5 6B          RTL                     A:0020 X:905F Y:000D P:envMxdizc

$81/F3C4 Fade Screen Out

$81/F3C4 A9 02       LDA #$02      ; Set Screen Fade Out flag
$81/F3C6 8D C2 05    STA $05C2
$81/F3C9 22 6A 8D 80 JSL $808D6A   ; Do the Fade Out
$81/F3CD 22 8A A1 80 JSL $80A18A   ; ??? Wait for NMI?
$81/F3D1 AD 87 05    LDA $0587     ; Check if Screen has faded out and FBLANK is active
$81/F3D4 10 F3       BPL $F3       ; [$F3C9] Loop if not
$81/F3D6 6B          RTL

$81/F9E5 Decompression subroutine

During the new game creation process, this is executed when one of these artworks gets loaded

This subroutine builds an MVN command (which moves normally big chunks of data from one address to WRAM) in WRAM and then jumps to it.

MVN: X is source, Y is destination, C number of bytes minus one (C=#$0005, six bytes will be moved)

The arguments are transfered to it as follows:

$0C contains the number of bytes to transfer minus one (if $0C = #$05, six bytes will be moved)

$0E will contain the size of the decompressed data when this subroutine is left

$20 contains the destination address for the MVN-command

$22 contains the source bank for the MVN-command (and destination bank, in many cases)

X and A contain a 24-bit address; this is an address to the compressed data.

$81/F9E5 8B          PHB           ; Preserve Program Bank
$81/F9E6 85 25       STA $25       ; Store the brought-in bank to the where-to-read address buffer
$81/F9E8 A5 22       LDA $22       ; For the MVN-command, load the Destination bank and set it up in WRAM
$81/F9EA 85 AD       STA $AD
$81/F9EC 48          PHA           ; Set up the same bank as Program Bank
$81/F9ED AB          PLB
$81/F9EE A9 54       LDA #$54      ; #$54 is "MVN" when interpreted as code
$81/F9F0 85 AC       STA $AC
$81/F9F2 A9 60       LDA #$60      ; #$60 is "RTS" when interpreted as code
$81/F9F4 85 AF       STA $AF
$81/F9F6 A4 20       LDY $20       ; Load the MVN-destination address in Y
$81/F9F8 C2 21       REP #$21      ; 16-bit A, Clear Carry
$81/F9FA 86 23       STX $23       ; Setup the load address (for the compressed data)
$81/F9FC A7 23       LDA [$23]     ; Load first two bytes (Size of the decompressed data)
$81/F9FE 85 0E       STA $0E       ; Store the size of the decompressed data in $0E
$81/FA00 65 20       ADC $20       ; Calculate the Y value when this data is completely decompressed
$81/FA02 85 0A       STA $0A       ; Store that as comparison value in $0A
$81/FA04 E8          INX           ; After the first two bytes are read, increment the pointer to the next unread byte
$81/FA05 E8          INX
$81/FA06 E2 20       SEP #$20
$81/FA08 80 31       BRA $31       ; [$FA3B] Go to the main decompression case handler

$81/FA0A E6 25       INC $25       ; Increment Compressed Data Address Bank
$81/FA0C A2 00 80    LDX #$8000    ; Set Compressed Data Address Pointer back to $8000
$81/FA0F 80 2A       BRA $2A       ; [$FA3B] Go on

$81/FA11 29 78       AND #$78      ; Remove the MSB from the Data byte
$81/FA13 4A          LSR A         ; A = A/8 + 2
$81/FA14 4A          LSR A         ; Note that the division by eight removes bits 0 to 2, too
$81/FA15 4A          LSR A         ; (And now, please read the last line's comment out loud)
$81/FA16 1A          INC A
$81/FA17 1A          INC A
$81/FA18 85 0C       STA $0C       ; A is the number of bytes to transfer
$81/FA1A A5 22       LDA $22       ; In this case, $22 is the second argument for the MVN command, too
$81/FA1C 85 AE       STA $AE       ; So this is always a movement on the same bank
$81/FA1E C2 21       REP #$21      ; 16 bit A, Clear Carry
$81/FA20 A7 23       LDA [$23]     ; Load two bytes from compressed data
$81/FA22 EB          XBA           ; Please note that the already-loaded byte gets loaded again
$81/FA23 29 FF 07    AND #$07FF    ; but this time, all the bits that were used here before are removed
$81/FA26 1A          INC A         ; What is now in A is the number of bytes to move backwards minus one
$81/FA27 85 08       STA $08       ; This decompression function repeats already decompressed lines
$81/FA29 98          TYA           ; Here, the program takes the current where-to-write pointer...
$81/FA2A 38          SEC           ; ... and subtracts the loaded number of bytes to form the new read-pointer
$81/FA2B E5 08       SBC $08       ; The "INC A" makes the program move one byte more back than in the loaded value
$81/FA2D E8          INX           ; Increment the Compressed Data Load address
$81/FA2E E8          INX
$81/FA2F DA          PHX           ; Push the Compressed Data Load address on stack, ...
$81/FA30 AA          TAX           ; ... because X has to contain the Read-Pointer for the upcoming MVN
$81/FA31 A5 0C       LDA $0C       ; Load number of bytes to transfer
$81/FA33 20 AC 00    JSR $00AC     ; Jump to the self-written MVN command
$81/FA36 FA          PLX           ; Get the Compressed Data Load Address back from stack
$81/FA37 E2 20       SEP #$20
$81/FA39 80 00       BRA $00       ; [$FA3B] Go on with the decompression - this line could be removed

$81/FA3B C4 0A       CPY $0A       ; Is the end point of the decompression reached? (= Is everything decompressed?)
$81/FA3D F0 14       BEQ $14       ; [$FA53] Exit if it is
$81/FA3F 64 0D       STZ $0D       ; Clear the upper byte of the bytes-to-transfer buffer register
$81/FA41 86 23       STX $23       ; Update the compressed data read-address
$81/FA43 A7 23       LDA [$23]     ; Load next byte (8 bit A!)
$81/FA45 30 CA       BMI $CA       ; [$FA11] Branch if MSB is set - Repeat already decompressed bytes
$81/FA47 F0 C1       BEQ $C1       ; [$FA0A] Branch if byte is empty - Compressed data is on the next bank
$81/FA49 89 40       BIT #$40
$81/FA4B D0 20       BNE $20       ; [$FA6D] Branch if Bit 6 is set - Copy directly from compressed data
$81/FA4D 89 20       BIT #$20
$81/FA4F D0 04       BNE $04       ; [$FA55] Branch if Bit 5 is set - write empty bytes into decompressed data
$81/FA51 80 2B       BRA $2B       ; [$FA7E] Branch if Bit 5 is clear - Copy decompressed data - long and/or far back

$81/FA53 AB          PLB           ; THE END: Restore Original Program Bank and exit
$81/FA54 6B          RTL

$81/FA55 29 1F       AND #$1F      ; The lower bits of this byte are the number of bytes to do (minus one)
$81/FA57 85 0C       STA $0C
$81/FA59 E8          INX           ; Increment Read Pointer and store it on Stack
$81/FA5A DA          PHX
$81/FA5B 7B          TDC           ; Clear 16-bit A
$81/FA5C 99 00 00    STA $0000,y   ; Write an empty byte into the decompressed data
$81/FA5F BB          TYX           ; Set read address to this byte
$81/FA60 C8          INY           ; Increment write address
$81/FA61 A5 22       LDA $22       ; Set the MVN destination bank to the same as the source bank
$81/FA63 85 AE       STA $AE
$81/FA65 A5 0C       LDA $0C       ; Load number of bytes to transfer
$81/FA67 20 AC 00    JSR $00AC     ; Jump to the self-written MVN command
$81/FA6A FA          PLX           ; Pull Compressed Data Read Pointer from Stack
$81/FA6B 80 CE       BRA $CE       ; [$FA3B] Go on with the decompression

$81/FA6D 29 3F       AND #$3F      ; The other bits in this command-byte are the number of bytes minus one
$81/FA6F 85 0C       STA $0C
$81/FA71 E8          INX           ; Increment read address
$81/FA72 A5 25       LDA $25       ; Source Bank is the same as the 24-bit-read address bank (of course)
$81/FA74 85 AE       STA $AE
$81/FA76 7B          TDC           ; Clear 16-bit A
$81/FA77 A5 0C       LDA $0C       ; Load the number of bytes to do minus one
$81/FA79 20 AC 00    JSR $00AC     ; Jump to the self-written MVN command
$81/FA7C 80 BD       BRA $BD       ; [$FA3B] Go on with the decompression

$81/FA7E 29 0F       AND #$0F      ; Lower part of the command byte is PART of the number of bytes to transfer
$81/FA80 85 0C       STA $0C
$81/FA82 E8          INX           ; Increment Read address
$81/FA83 86 23       STX $23
$81/FA85 A7 23       LDA [$23]     ; Read next Byte from Compressed Data
$81/FA87 29 C0       AND #$C0      ; the two most significant bits are part of the number of bytes to transfer
$81/FA89 4A          LSR A
$81/FA8A 4A          LSR A
$81/FA8B 05 0C       ORA $0C
$81/FA8D 18          CLC           ; Add three additional bytes to the number of bytes to transfer
$81/FA8E 69 03       ADC #$03
$81/FA90 85 0C       STA $0C
$81/FA92 A5 22       LDA $22       ; Source Bank is the same as Destination address
$81/FA94 85 AE       STA $AE
$81/FA96 C2 21       REP #$21      ; 16 bit A, clear Carry
$81/FA98 A7 23       LDA [$23]     ; Load next two bytes
$81/FA9A EB          XBA
$81/FA9B 29 FF 3F    AND #$3FFF    ; This value is the number of bytes to move backwards
$81/FA9E 1A          INC A         ; Move another byte backwards
$81/FA9F 85 08       STA $08       ; Temp store
$81/FAA1 98          TYA           ; Copy the write address
$81/FAA2 38          SEC
$81/FAA3 E5 08       SBC $08       ; Subtract the number of bytes to go back
$81/FAA5 E8          INX           ; Increment Compressed Data Read Pointer
$81/FAA6 E8          INX
$81/FAA7 DA          PHX           ; Buffer Compressed Data Read Pointer
$81/FAA8 AA          TAX
$81/FAA9 A5 0C       LDA $0C       ; Load number of bytes to transfer
$81/FAAB 20 AC 00    JSR $00AC     ; Jump to the self-written MVN command
$81/FAAE FA          PLX           ; Restore Compressed Data Read Pointer
$81/FAAF E2 20       SEP #$20
$81/FAB1 80 88       BRA $88       ; [$FA3B] Go on with the decompression

Bank $82

$82/98AA Battle Stats Menu - Buffer Character's data

When you open the Stats Menu in Battle (the one in the bottom part of the menu), this subroutine collects all the stats values and puts them in a number of buffer registers.

$82/98AA 8B          PHB           ; Buffer Data Bank Register on stack
$82/98AB 4B          PHK
$82/98AC AB          PLB
$82/98AD A6 39       LDX $39       ; Character number as Index
$82/98AF BD AE 17    LDA $17AE,x   ; Character graphic
$82/98B2 8D 9F 1E    STA $1E9F
$82/98B5 BD AF 17    LDA $17AF,x   ; ???
$82/98B8 8D 66 1E    STA $1E66
$82/98BB BD D7 17    LDA $17D7,x   ; Character Element
$82/98BE 8D 67 1E    STA $1E67
$82/98C1 BD FE 17    LDA $17FE,x   ; Level
$82/98C4 8D 68 1E    STA $1E68
$82/98C7 BD FF 17    LDA $17FF,x   ; Exp
$82/98CA 8D 69 1E    STA $1E69
$82/98CD BD B6 19    LDA $19B6,x   ; LUK
$82/98D0 8D 7E 1E    STA $1E7E
$82/98D3 BD D6 17    LDA $17D6,x   ; ???
$82/98D6 8D 7F 1E    STA $1E7F
$82/98D9 BD DE 19    LDA $19DE,x   ; ??? (Status Effects?)
$82/98DC 8D 80 1E    STA $1E80
$82/98DF BD DF 19    LDA $19DF,x   ; ???
$82/98E2 8D A0 1E    STA $1EA0
$82/98E5 BD 2E 1A    LDA $1A2E,x   ; ???
$82/98E8 8D 81 1E    STA $1E81
$82/98EB BD 2F 1A    LDA $1A2F,x   ; ???
$82/98EE 8D 82 1E    STA $1E82
$82/98F1 BD 56 1A    LDA $1A56,x   ; ???
$82/98F4 8D 8F 1E    STA $1E8F
$82/98F7 BD 57 1A    LDA $1A57,x   ; ???
$82/98FA 8D 90 1E    STA $1E90
$82/98FD BD 6E 1B    LDA $1B6E,x   ; ???
$82/9900 8D 91 1E    STA $1E91
$82/9903 BD C7 1D    LDA $1DC7,x   ; ???
$82/9906 8D 96 1E    STA $1E96
$82/9909 BD EE 1D    LDA $1DEE,x   ; Number of Moves
$82/990C 8D 97 1E    STA $1E97
$82/990F BD B7 19    LDA $19B7,x   ; ???
$82/9912 8D 9D 1E    STA $1E9D
$82/9915 BD 26 1D    LDA $1D26,x   ; ???
$82/9918 8D 9E 1E    STA $1E9E
$82/991B C2 20       REP #$20      ; 16 bit values ahead
$82/991D BD 26 18    LDA $1826,x   ; Current HP
$82/9920 8D 6A 1E    STA $1E6A
$82/9923 BD 4E 18    LDA $184E,x   ; Max HP
$82/9926 8D 6C 1E    STA $1E6C
$82/9929 BD 76 18    LDA $1876,x   ; Current MP
$82/992C 8D 6E 1E    STA $1E6E
$82/992F BD 9E 18    LDA $189E,x   ; Max MP
$82/9932 8D 70 1E    STA $1E70
$82/9935 BD C6 18    LDA $18C6,x   ; STR
$82/9938 8D 72 1E    STA $1E72
$82/993B BD EE 18    LDA $18EE,x   ; INT
$82/993E 8D 74 1E    STA $1E74
$82/9941 BD 16 19    LDA $1916,x   ; AGI
$82/9944 8D 76 1E    STA $1E76
$82/9947 BD 3E 19    LDA $193E,x   ; DEX
$82/994A 8D 78 1E    STA $1E78
$82/994D BD 66 19    LDA $1966,x   ; VIT
$82/9950 8D 7A 1E    STA $1E7A
$82/9953 BD 8E 19    LDA $198E,x   ; MEN
$82/9956 8D 7C 1E    STA $1E7C
$82/9959 BD 7E 1A    LDA $1A7E,x   ; ???
$82/995C 8D 83 1E    STA $1E83
$82/995F BD A6 1A    LDA $1AA6,x   ; ???
$82/9962 8D 85 1E    STA $1E85
$82/9965 BD CE 1A    LDA $1ACE,x   ; ???
$82/9968 8D 87 1E    STA $1E87
$82/996B BD F6 1A    LDA $1AF6,x   ; ???
$82/996E 8D 89 1E    STA $1E89
$82/9971 BD 1E 1B    LDA $1B1E,x   ; ???
$82/9974 8D 8B 1E    STA $1E8B
$82/9977 BD 46 1B    LDA $1B46,x   ; ???
$82/997A 8D 8D 1E    STA $1E8D
$82/997D BD 96 1B    LDA $1B96,x   ; ???
$82/9980 8D 92 1E    STA $1E92
$82/9983 BD 9E 1D    LDA $1D9E,x   ; 16-bit Address (on WRAM bank $7E) of the Character's name, class etc.
$82/9986 8D 94 1E    STA $1E94
$82/9989 E2 20       SEP #$20
$82/998B BD 3E 1E    LDA $1E3E,x   ; ???
$82/998E 8D 98 1E    STA $1E98
$82/9991 A6 39       LDX $39       ; Load Character's number (again)
$82/9993 AB          PLB           ; Restore Data Bank Register
$82/9994 6B          RTL

$82/9BC8 ?

$82/9BC8 8B          PHB           ; Buffer Data Bank
$82/9BC9 4B          PHK           ; Set Data Bank to $82
$82/9BCA AB          PLB
$82/9BCB 9C F4 16    STZ $16F4     ; ???
$82/9BCE 9C F5 16    STZ $16F5     ; ???
$82/9BD1 9C F6 16    STZ $16F6     ; ???
$82/9BD4 9C F7 16    STZ $16F7     ; ???
$82/9BD7 9C F8 16    STZ $16F8     ; ???
$82/9BDA 9C F9 16    STZ $16F9     ; ???
$82/9BDD 9C FA 16    STZ $16FA     ; ???
$82/9BE0 A9 04       LDA #$04      ; ???
$82/9BE2 85 96       STA $96       ; ???
$82/9BE4 64 97       STZ $97       ; ???
$82/9BE6 A2 00 04    LDX #$0400    ; Size of the Tilemaps to be created (in $B206)
$82/9BE9 86 0C       STX $0C       ; Store as Number of Bytes to transfer (in $B235)
$82/9BEB 20 06 B2    JSR $B206     ; Create Clear Tilemaps (for Battle Stats Menu)
$82/9BEE 20 35 B2    JSR $B235     ; Battle Stats Menu - transfer the buffered tilemaps into VRAM
$82/9BF1 22 DA B1 82 JSL $82B1DA   ; Clear BG3 Tilemap
$82/9BF5 9C 60 00    STZ $0060     ; ???
$82/9BF8 AB          PLB           ; Restore Data Bank
$82/9BF9 6B          RTL

$82/AE91 Battle Stats Menu - Tilemap builder

This subroutine is called when the game has to build the status menu at the bottom of the battle screen. It builds some tiles into the tilemap - it is used quite often. This writes a rectangle shape into the tilemap, you have to give it the number of columns and rows it has to span.

Before it is called, certain values have to be set up.

X contains the 16-bit address where to read the tile data that has to be implemented into the tilemap.

$0A/B and $98/9 contain adress data that, together, form another part of the offset for the write address. Not sure what component each one brings in.

$0C contains what has to be added to the ROM read data before it is added to the tilemap, i. e. flipping or palette stuff.

$0E contains the number of rows this should edit, $0F the number of lines; these get transfered to $00/$01

$2C contains the 24-bit address of the tilemap buffer.

$82/AE91 C2 21       REP #$21
$82/AE93 A5 0A       LDA $0A       ; ??? This forms the where-to-write starting address
$82/AE95 65 98       ADC $98       ; ??? Dunno what each part of this addition means singularly, though
$82/AE97 A8          TAY           ; Transfer where-to-write index in Y
$82/AE98 E2 20       SEP #$20
$82/AE9A A5 0F       LDA $0F       ; Transfer row count into the loop counter
$82/AE9C 85 01       STA $01
$82/AE9E A5 0E       LDA $0E       ; Transfer column count into the loop counter
$82/AEA0 85 00       STA $00
$82/AEA2 5A          PHY           ; Push the start of this line on stack
$82/AEA3 C2 21       REP #$21
$82/AEA5 BD 00 00    LDA $0000,x   ; Load the tilemap entry from ROM
$82/AEA8 65 0C       ADC $0C       ; Add additional information to it if there is some
$82/AEAA 97 2C       STA [$2C],y   ; Write it in the buffered tilemap
$82/AEAC E2 20       SEP #$20
$82/AEAE C8          INY           ; Increment read and write counters
$82/AEAF C8          INY
$82/AEB0 E8          INX
$82/AEB1 E8          INX
$82/AEB2 C6 00       DEC $00       ; Decrement inner loop counter (columns)
$82/AEB4 D0 ED       BNE $ED       ; [$AEA3] Loop if it isn't depleted
$82/AEB6 C2 21       REP #$21
$82/AEB8 68          PLA           ; Pull the address of the start of the row from stack
$82/AEB9 69 40 00    ADC #$0040    ; Calculate the address of the start of the next row
$82/AEBC A8          TAY           ; Transfer in Y (so it gets pushed on stack at $AEA2 after looping)
$82/AEBD E2 20       SEP #$20
$82/AEBF C6 01       DEC $01       ; Decrement outer loop counter (rows)
$82/AEC1 D0 DB       BNE $DB       ; [$AE9E] Loop if it isn't depleted
$82/AEC3 60          RTS

$82/B1DA Clear BG3 Tilemap

This subroutine writes an empty tilemap for BG3 in WRAM and transfers it to VRAM. It writes at 7E/A800 "$03EE" for $800 bytes and transfers this to VRAM at $3C00, where the BG3 Tilemap in many/most of the cases is located. "$03EE" is of course an empty tile - "$0000" is used by some sprite tiles.

$82/B1DA 8B          PHB           ; Buffer Data Bank
$82/B1DB A9 7E       LDA #$7E      ; Set Data Bank to $7E
$82/B1DD 48          PHA
$82/B1DE AB          PLB
$82/B1DF C2 20       REP #$20
$82/B1E1 A2 00 08    LDX #$0800    ; Write "$03EE" at $7E/A800 and onwards for #$0800 times
$82/B1E4 A0 00 A8    LDY #$A800
$82/B1E7 A9 EE 03    LDA #$03EE
$82/B1EA 22 C8 9D 80 JSL $809DC8   ; Write Empty Tilemap
$82/B1EE E2 20       SEP #$20
$82/B1F0 AB          PLB           ; Restore Original Data Bank
$82/B1F1 A2 00 00    LDX #$0000    ; Set BG3 Scroll Registers to 0
$82/B1F4 8E 99 05    STX $0599
$82/B1F7 8E 9B 05    STX $059B
$82/B1FA 22 EB 9E 80 JSL $809EEB   ; VRAM DMA of the following data:
$82/B1FE 00 A8 7E    Address:      $7E/A800
$82/B201 00 3C       VRAM Address:    $3C00 (BG3 Tilemap)
$82/B203 00 08       Transfer         $0800 Bytes
$82/B205 6B          RTL

$82/B206 Create Clear Tilemaps (for Battle Stats Menu?)

$82/B206 8B          PHB           ; Buffer Data Bank
$82/B207 A9 7F       LDA #$7F      ; Set Data Bank to $7F
$82/B209 48          PHA
$82/B20A AB          PLB
$82/B20B C2 20       REP #$20
$82/B20D 86 00       STX $00       ; Buffer the Number of Bytes to do
$82/B20F A0 00 14    LDY #$1400    ; Write to $7F/1400
$82/B212 A9 80 00    LDA #$0080    ; The value to write
$82/B215 22 C8 9D 80 JSL $809DC8   ; Long Jump to Write Empty Tilemap in WRAM
$82/B219 A6 00       LDX $00       ; Restore the Number of Bytes to do
$82/B21B A0 00 18    LDY #$1800    ; Write to $7F/1800
$82/B21E A9 80 02    LDA #$0280    ; The value to write
$82/B221 22 C8 9D 80 JSL $809DC8   ; Long Jump to Write Empty Tilemap in WRAM
$82/B225 A6 00       LDX $00       ; Restore the Number of Bytes to do
$82/B227 A0 00 1C    LDY #$1C00    ; Write to $7F/1C00
$82/B22A A9 EE 03    LDA #$03EE    ; The value to write
$82/B22D 22 C8 9D 80 JSL $809DC8   ; Long Jump to Write Empty Tilemap in WRAM
$82/B231 E2 20       SEP #$20
$82/B233 AB          PLB           ; Restore Data Bank
$82/B234 60          RTS

$82/B235 Battle Stats Menu - transfer the buffered tilemaps into VRAM

This simple subroutine transfers the three buffered BG1 to BG3 tilemaps for the menu to VRAM.

$82/B235 A9 80       LDA #$80      ; VRAM transfer settings (for $2115)
$82/B237 85 0E       STA $0E
$82/B239 A0 00 36    LDY #$3600    ; BG1 tilemap: VRAM destination
$82/B23C A2 00 14    LDX #$1400    ; BG1 tilemap: Source Data Position: $7F/1400
$82/B23F A9 7F       LDA #$7F
$82/B241 22 24 9F 80 JSL $809F24   ; BG1 tilemap: VRAM DMA
$82/B245 A0 00 3A    LDY #$3A00    ; BG2 tilemap: VRAM destination
$82/B248 A2 00 18    LDX #$1800    ; BG2 tilemap: Source Data Position: $7F/1800
$82/B24B A9 7F       LDA #$7F
$82/B24D 22 24 9F 80 JSL $809F24   ; BG2 tilemap: VRAM DMA
$82/B251 A0 00 38    LDY #$3800    ; BG3 tilemap: VRAM destination
$82/B254 A2 00 1C    LDX #$1C00    ; BG3 tilemap: Source Data Position: $7F/1C00
$82/B257 A9 7F       LDA #$7F
$82/B259 22 24 9F 80 JSL $809F24   ; BG3 tilemap: VRAM DMA
$82/B25D 60          RTS

$82/DE25 Load new Map?

$82/DE25 8B          PHB           ; Buffer Data Bank on Stack
$82/DE26 A9 8B       LDA #$8B      ; Set Data Bank to $8B
$82/DE28 48          PHA
$82/DE29 AB          PLB
$82/DE2A A2 00 00    LDX #$0000    ; Setup $7F/0000 as 24-bit address in $20
$82/DE2D A9 7F       LDA #$7F
$82/DE2F 86 20       STX $20
$82/DE31 85 22       STA $22
$82/DE33 AE BE 16    LDX $16BE  [$8B:16BE]   A:007F X:0000 Y:2141 P:envMxdizc
$82/DE36 7B          TDC                     A:007F X:0003 Y:2141 P:envMxdizc
$82/DE37 18          CLC                     A:0000 X:0003 Y:2141 P:envMxdiZc
$82/DE38 BD DD 82    LDA $82DD,x[$8B:82E0]   A:0000 X:0003 Y:2141 P:envMxdiZc
$82/DE3B 6D C0 16    ADC $16C0  [$8B:16C0]   A:0019 X:0003 Y:2141 P:envMxdizc
$82/DE3E 8D C4 16    STA $16C4  [$8B:16C4]   A:001A X:0003 Y:2141 P:envMxdizc
$82/DE41 9C C5 16    STZ $16C5  [$8B:16C5]   A:001A X:0003 Y:2141 P:envMxdizc
$82/DE44 AE BE 16    LDX $16BE  [$8B:16BE]   A:001A X:0003 Y:2141 P:envMxdizc
$82/DE47 7B          TDC                     A:001A X:0003 Y:2141 P:envMxdizc
$82/DE48 18          CLC                     A:0000 X:0003 Y:2141 P:envMxdiZc
$82/DE49 BF 07 84 8B LDA $8B8407,x[$8B:840A] A:0000 X:0003 Y:2141 P:envMxdiZc
$82/DE4D 6D C0 16    ADC $16C0  [$8B:16C0]   A:0019 X:0003 Y:2141 P:envMxdizc
$82/DE50 AA          TAX                     A:001A X:0003 Y:2141 P:envMxdizc
$82/DE51 A9 20       LDA #$20                A:001A X:001A Y:2141 P:envMxdizc
$82/DE53 8D 02 42    STA $4202  [$8B:4202]   A:0020 X:001A Y:2141 P:envMxdizc
$82/DE56 BD 1F 84    LDA $841F,x[$8B:8439]   A:0020 X:001A Y:2141 P:envMxdizc
$82/DE59 8D 03 42    STA $4203  [$8B:4203]   A:0004 X:001A Y:2141 P:envMxdizc
$82/DE5C EA          NOP           ; Wait for the Multiplication to be done
$82/DE5D EA          NOP
$82/DE5E EA          NOP
$82/DE5F EA          NOP
$82/DE60 AC 16 42    LDY $4216  [$8B:4216]   A:0004 X:001A Y:2141 P:envMxdizc
$82/DE63 8C C6 16    STY $16C6  [$8B:16C6]   A:0004 X:001A Y:0080 P:envMxdizc
$82/DE66 AD BE 16    LDA $16BE  [$8B:16BE]   A:0004 X:001A Y:0080 P:envMxdizc
$82/DE69 0A          ASL A                   A:0003 X:001A Y:0080 P:envMxdizc
$82/DE6A AA          TAX                     A:0006 X:001A Y:0080 P:envMxdizc
$82/DE6B DA          PHX                     A:0006 X:0006 Y:0080 P:envMxdizc
$82/DE6C 4B          PHK           ; Set Data Bank to $82
$82/DE6D AB          PLB
$82/DE6E C2 20       REP #$20                A:0006 X:0006 Y:0080 P:eNvMxdizc
$82/DE70 BF 00 80 A2 LDA $A28000,x[$A2:8006] A:0006 X:0006 Y:0080 P:eNvmxdizc
$82/DE74 AA          TAX                     A:894F X:0006 Y:0080 P:eNvmxdizc
$82/DE75 E2 20       SEP #$20                A:894F X:894F Y:0080 P:eNvmxdizc
$82/DE77 A9 A2       LDA #$A2      ; Bank of the Compressed Data
$82/DE79 22 E5 F9 81 JSL $81F9E5   ; Decompression Subroutine
$82/DE7D FA          PLX                     A:FFFF X:8CB6 Y:0AC0 P:eNvMxdizC
$82/DE7E C2 21       REP #$21                A:FFFF X:0006 Y:0AC0 P:envMxdizC
$82/DE80 AF 00 00 7F LDA $7F0000[$7F:0000]   A:FFFF X:0006 Y:0AC0 P:envmxdizc
$82/DE84 85 A6       STA $A6    [$00:00A6]   A:0444 X:0006 Y:0AC0 P:envmxdizc
$82/DE86 AF 02 00 7F LDA $7F0002[$7F:0002]   A:0444 X:0006 Y:0AC0 P:envmxdizc
$82/DE8A 85 A8       STA $A8    [$00:00A8]   A:0844 X:0006 Y:0AC0 P:envmxdizc
$82/DE8C A9 00 00    LDA #$0000              A:0844 X:0006 Y:0AC0 P:envmxdizc
$82/DE8F 65 0E       ADC $0E    [$00:000E]   A:0000 X:0006 Y:0AC0 P:envmxdiZc
$82/DE91 85 20       STA $20    [$00:0020]   A:0AC0 X:0006 Y:0AC0 P:envmxdizc
$82/DE93 85 AA       STA $AA    [$00:00AA]   A:0AC0 X:0006 Y:0AC0 P:envmxdizc
$82/DE95 BF 2E A9 A4 LDA $A4A92E,x[$A4:A934] A:0AC0 X:0006 Y:0AC0 P:envmxdizc
$82/DE99 AA          TAX                     A:ABFA X:0006 Y:0AC0 P:eNvmxdizc
$82/DE9A A9 1F 9C    LDA #$9C1F              A:ABFA X:ABFA Y:0AC0 P:eNvmxdizc
$82/DE9D 85 23       STA $23    [$00:0023]   A:9C1F X:ABFA Y:0AC0 P:eNvmxdizc
$82/DE9F E2 20       SEP #$20                A:9C1F X:ABFA Y:0AC0 P:eNvmxdizc
$82/DEA1 A9 A5       LDA #$A5                A:9C1F X:ABFA Y:0AC0 P:eNvMxdizc
$82/DEA3 85 25       STA $25    [$00:0025]   A:9CA5 X:ABFA Y:0AC0 P:eNvMxdizc
$82/DEA5 A9 A4       LDA #$A4                A:9CA5 X:ABFA Y:0AC0 P:eNvMxdizc
$82/DEA7 22 CC F7 81 JSL $81F7CC[$81:F7CC]   A:9CA4 X:ABFA Y:0AC0 P:eNvMxdizc
$82/DEAB A9 7E       LDA #$7E                A:0400 X:AC89 Y:0400 P:eNvMxdizC
$82/DEAD 85 22       STA $22    [$00:0022]   A:047E X:AC89 Y:0400 P:envMxdizC
$82/DEAF C2 20       REP #$20                A:047E X:AC89 Y:0400 P:envMxdizC
$82/DEB1 A5 5C       LDA $5C    [$00:005C]   A:047E X:AC89 Y:0400 P:envmxdizC
$82/DEB3 85 20       STA $20    [$00:0020]   A:2000 X:AC89 Y:0400 P:envmxdizC
$82/DEB5 AD C4 16    LDA $16C4  [$82:16C4]   A:2000 X:AC89 Y:0400 P:envmxdizC
$82/DEB8 0A          ASL A                   A:001A X:AC89 Y:0400 P:envmxdizC
$82/DEB9 6D C4 16    ADC $16C4  [$82:16C4]   A:0034 X:AC89 Y:0400 P:envmxdizc
$82/DEBC AA          TAX                     A:004E X:AC89 Y:0400 P:envmxdizc
$82/DEBD BF 7E BB A6 LDA $A6BB7E,x[$A6:BBCC] A:004E X:004E Y:0400 P:envmxdizc
$82/DEC1 A8          TAY                     A:B7F4 X:004E Y:0400 P:eNvmxdizc
$82/DEC2 E2 20       SEP #$20                A:B7F4 X:004E Y:B7F4 P:eNvmxdizc
$82/DEC4 BF 80 BB A6 LDA $A6BB80,x[$A6:BBCE] A:B7F4 X:004E Y:B7F4 P:eNvMxdizc
$82/DEC8 BB          TYX                     A:B7A5 X:004E Y:B7F4 P:eNvMxdizc
$82/DEC9 22 83 FB 81 JSL $81FB83[$81:FB83]   A:B7A5 X:B7F4 Y:B7F4 P:eNvMxdizc
$82/DECD A5 22       LDA $22    [$00:0022]   A:0006 X:270B Y:271B P:eNvMxdizC
$82/DECF 85 25       STA $25    [$00:0025]   A:007E X:270B Y:271B P:envMxdizC
$82/DED1 A9 7F       LDA #$7F      ; Set Data Bank to $7F
$82/DED3 48          PHA
$82/DED4 AB          PLB
$82/DED5 C2 20       REP #$20
$82/DED7 A9 FF FF    LDA #$FFFF    ; Write "#$FFFF" at $7F/C800 to $7F/BFFF
$82/DEDA A2 00 04    LDX #$0400
$82/DEDD A0 00 C8    LDY #$C800
$82/DEE0 22 C8 9D 80 JSL $809DC8
$82/DEE4 7B          TDC           ; Write "#$0000" at $7F/C000 to $7F/FFFF
$82/DEE5 A2 00 04    LDX #$0400
$82/DEE8 A0 00 CC    LDY #$CC00
$82/DEEB 22 C8 9D 80 JSL $809DC8
$82/DEEF 7B          TDC           ; Write "#$0000" at $7F/D800 to $7F/DFFF
$82/DEF0 A2 00 04    LDX #$0400    ; This is going to be the Height Map
$82/DEF3 A0 00 D8    LDY #$D800
$82/DEF6 22 C8 9D 80 JSL $809DC8
$82/DEFA E2 20       SEP #$20
$82/DEFC 4B          PHK           ; Set Data Bank to $82
$82/DEFD AB          PLB
$82/DEFE 7B          TDC           ; Clear 16-bit A
$82/DEFF A8          TAY           ; Clear Y as Load Index
$82/DF00 B7 20       LDA [$20],y   ; Load 1st byte
$82/DF02 8D C8 16    STA $16C8     ; Store as Width of the Map on the NW-SE-Axis
$82/DF05 9C C9 16    STZ $16C9     ; Clear High Byte
$82/DF08 8D 02 42    STA $4202     ; Store in Multiplication Register
$82/DF0B C8          INY           ; Increment Data Load Index
$82/DF0C B7 20       LDA [$20],y   ; Load 2nd byte
$82/DF0E 8D CA 16    STA $16CA     ; Store as Width of the Map on the NE-SW-Axis?
$82/DF11 9C CB 16    STZ $16CB     ; Clear High Byte
$82/DF14 8D 03 42    STA $4203     ; Store in Multiplication Register
$82/DF17 C8          INY           ; Increment Data Load Index
$82/DF18 B7 20       LDA [$20],y   ; Load 3rd byte
$82/DF1A 8D CC 16    STA $16CC     ; Store as Width of the Map on the NW-SE-Axis!?!?!?!?!
$82/DF1D 9C CD 16    STZ $16CD     ; Clear High Byte
$82/DF20 C8          INY           ; Increment Data Load Index
$82/DF21 C2 21       REP #$21      ; 16-bit A, clear Carry
$82/DF23 AD 16 42    LDA $4216     ; Load Multiplication Result (Size of the Map)
$82/DF26 65 20       ADC $20       ; Add to the Offset the Data Address
$82/DF28 85 23       STA $23       ; $23 contains the Address of the Data AFTER the Height Map
$82/DF2A E2 20       SEP #$20      ; This line could be removed?
$82/DF2C C2 21       REP #$21      ; Clear Carry
$82/DF2E AD C6 16    LDA $16C6  [$82:16C6]   A:2384 X:2000 Y:0003 P:envmxdizc
$82/DF31 69 5D 87    ADC #$875D              A:0080 X:2000 Y:0003 P:envmxdizc
$82/DF34 85 26       STA $26    [$00:0026]   A:87DD X:2000 Y:0003 P:eNvmxdizc
$82/DF36 E2 20       SEP #$20                A:87DD X:2000 Y:0003 P:eNvmxdizc
$82/DF38 A9 8B       LDA #$8B                A:87DD X:2000 Y:0003 P:eNvMxdizc
$82/DF3A 85 28       STA $28    [$00:0028]   A:878B X:2000 Y:0003 P:eNvMxdizc
$82/DF3C AD CA 16    LDA $16CA  [$82:16CA]   A:878B X:2000 Y:0003 P:eNvMxdizc
$82/DF3F 85 00       STA $00    [$00:0000]   A:871E X:2000 Y:0003 P:envMxdizc
$82/DF41 A2 21 00    LDX #$0021              A:871E X:2000 Y:0003 P:envMxdizc
$82/DF44 AD C8 16    LDA $16C8  [$82:16C8]   A:871E X:0021 Y:0003 P:envMxdizc
$82/DF47 85 01       STA $01    [$00:0001]   A:871E X:0021 Y:0003 P:envMxdizc
$82/DF49 DA          PHX                     A:871E X:0021 Y:0003 P:envMxdizc
$82/DF4A 7B          TDC                     A:871E X:0021 Y:0003 P:envMxdizc
$82/DF4B B7 23       LDA [$23],y[$7E:2387]   A:0000 X:0021 Y:0003 P:envMxdiZc
$82/DF4D C9 E0       CMP #$E0                A:0003 X:0021 Y:0003 P:envMxdizc
$82/DF4F 90 24       BCC $24    [$DF75]      A:0003 X:0021 Y:0003 P:envMxdizc
Code is missing here
$82/DF75 B7 20       LDA [$20],y[$7E:2003]   A:0003 X:0021 Y:0003 P:envMxdizc
$82/DF77 9F 00 C8 7F STA $7FC800,x[$7F:C821] A:001F X:0021 Y:0003 P:envMxdizc
$82/DF7B 10 01       BPL $01    [$DF7E]      A:001F X:0021 Y:0003 P:envMxdizc
Code is missing here
$82/DF7E 9F 00 D8 7F STA $7FD800,x[$7F:D821] A:001F X:0021 Y:0003 P:envMxdizc
$82/DF82 7B          TDC                     A:001F X:0021 Y:0003 P:envMxdizc
$82/DF83 B7 23       LDA [$23],y[$7E:2387]   A:0000 X:0021 Y:0003 P:envMxdiZc
$82/DF85 9F 00 D0 7F STA $7FD000,x[$7F:D021] A:0003 X:0021 Y:0003 P:envMxdizc
$82/DF89 29 1F       AND #$1F                A:0003 X:0021 Y:0003 P:envMxdizc
$82/DF8B 9F 00 D4 7F STA $7FD400,x[$7F:D421] A:0003 X:0021 Y:0003 P:envMxdizc
$82/DF8F 5A          PHY                     A:0003 X:0021 Y:0003 P:envMxdizc
$82/DF90 A8          TAY                     A:0003 X:0021 Y:0003 P:envMxdizc
$82/DF91 B7 26       LDA [$26],y[$8B:87E0]   A:0003 X:0021 Y:0003 P:envMxdizc
$82/DF93 7A          PLY                     A:0017 X:0021 Y:0003 P:envMxdizc
$82/DF94 9F 00 CC 7F STA $7FCC00,x[$7F:CC21] A:0017 X:0021 Y:0003 P:envMxdizc
$82/DF98 C8          INY                     A:0017 X:0021 Y:0003 P:envMxdizc
$82/DF99 E8          INX                     A:0017 X:0021 Y:0004 P:envMxdizc
$82/DF9A C6 01       DEC $01    [$00:0001]   A:0017 X:0022 Y:0004 P:envMxdizc
$82/DF9C D0 AC       BNE $AC    [$DF4A]      A:0017 X:0022 Y:0004 P:envMxdizc
$82/DF51 7B          TDC                     A:00E2 X:0023 Y:0005 P:envMxdizC
$82/DF52 9F 00 C8 7F STA $7FC800,x[$7F:C823] A:0000 X:0023 Y:0005 P:envMxdiZC
$82/DF56 B7 20       LDA [$20],y[$7E:2005]   A:0000 X:0023 Y:0005 P:envMxdiZC
$82/DF58 10 01       BPL $01    [$DF5B]      A:001D X:0023 Y:0005 P:envMxdizC
$82/DF5B 9F 00 D8 7F STA $7FD800,x[$7F:D823] A:001D X:0023 Y:0005 P:envMxdizC
$82/DF5F 7B          TDC                     A:001D X:0023 Y:0005 P:envMxdizC
$82/DF60 9F 00 D0 7F STA $7FD000,x[$7F:D023] A:0000 X:0023 Y:0005 P:envMxdiZC
$82/DF64 9F 00 D4 7F STA $7FD400,x[$7F:D423] A:0000 X:0023 Y:0005 P:envMxdiZC
$82/DF68 B7 23       LDA [$23],y[$7E:2389]   A:0000 X:0023 Y:0005 P:envMxdiZC
$82/DF6A 29 03       AND #$03                A:00E2 X:0023 Y:0005 P:eNvMxdizC
$82/DF6C 18          CLC                     A:0002 X:0023 Y:0005 P:envMxdizC
$82/DF6D 69 18       ADC #$18                A:0002 X:0023 Y:0005 P:envMxdizc
$82/DF6F 9F 00 CC 7F STA $7FCC00,x[$7F:CC23] A:001A X:0023 Y:0005 P:envMxdizc
$82/DF73 80 23       BRA $23    [$DF98]      A:001A X:0023 Y:0005 P:envMxdizc
$82/DF9E C2 21       REP #$21                A:0001 X:003F Y:0021 P:envMxdiZc
$82/DFA0 68          PLA                     A:0001 X:003F Y:0021 P:envmxdiZc
$82/DFA1 69 20 00    ADC #$0020              A:0021 X:003F Y:0021 P:envmxdizc
$82/DFA4 AA          TAX                     A:0041 X:003F Y:0021 P:envmxdizc
$82/DFA5 E2 20       SEP #$20                A:0041 X:0041 Y:0021 P:envmxdizc
$82/DFA7 C6 00       DEC $00    [$00:0000]   A:0041 X:0041 Y:0021 P:envMxdizc
$82/DFA9 D0 99       BNE $99    [$DF44]      A:0041 X:0041 Y:0021 P:envMxdizc
$82/DFAB EE C8 16    INC $16C8  [$82:16C8]   A:03E1 X:03E1 Y:0387 P:envMxdiZc
$82/DFAE EE CA 16    INC $16CA  [$82:16CA]   A:03E1 X:03E1 Y:0387 P:envMxdizc
$82/DFB1 C2 20       REP #$20                A:03E1 X:03E1 Y:0387 P:envMxdizc
$82/DFB3 A9 A0 FF    LDA #$FFA0              A:03E1 X:03E1 Y:0387 P:envmxdizc
$82/DFB6 85 00       STA $00    [$00:0000]   A:FFA0 X:03E1 Y:0387 P:eNvmxdizc
$82/DFB8 18          CLC                     A:FFA0 X:03E1 Y:0387 P:eNvmxdizc
$82/DFB9 AD C8 16    LDA $16C8  [$82:16C8]   A:FFA0 X:03E1 Y:0387 P:eNvmxdizc
$82/DFBC 6D CA 16    ADC $16CA  [$82:16CA]   A:001F X:03E1 Y:0387 P:envmxdizc
$82/DFBF 0A          ASL A                   A:003E X:03E1 Y:0387 P:envmxdizc
$82/DFC0 0A          ASL A                   A:007C X:03E1 Y:0387 P:envmxdizc
$82/DFC1 0A          ASL A                   A:00F8 X:03E1 Y:0387 P:envmxdizc
$82/DFC2 48          PHA                     A:01F0 X:03E1 Y:0387 P:envmxdizc
$82/DFC3 0A          ASL A                   A:01F0 X:03E1 Y:0387 P:envmxdizc
$82/DFC4 38          SEC                     A:03E0 X:03E1 Y:0387 P:envmxdizc
$82/DFC5 E9 A0 00    SBC #$00A0              A:03E0 X:03E1 Y:0387 P:envmxdizC
$82/DFC8 85 02       STA $02    [$00:0002]   A:0340 X:03E1 Y:0387 P:envmxdizC
$82/DFCA A9 A8 FF    LDA #$FFA8              A:0340 X:03E1 Y:0387 P:envmxdizC
$82/DFCD 85 04       STA $04    [$00:0004]   A:FFA8 X:03E1 Y:0387 P:eNvmxdizC
$82/DFCF 68          PLA                     A:FFA8 X:03E1 Y:0387 P:eNvmxdizC
$82/DFD0 85 06       STA $06    [$00:0006]   A:01F0 X:03E1 Y:0387 P:envmxdizC
$82/DFD2 AD CC 16    LDA $16CC  [$82:16CC]   A:01F0 X:03E1 Y:0387 P:envmxdizC
$82/DFD5 0A          ASL A                   A:001E X:03E1 Y:0387 P:envmxdizC
$82/DFD6 0A          ASL A                   A:003C X:03E1 Y:0387 P:envmxdizc
$82/DFD7 0A          ASL A                   A:0078 X:03E1 Y:0387 P:envmxdizc
$82/DFD8 65 06       ADC $06    [$00:0006]   A:00F0 X:03E1 Y:0387 P:envmxdizc
$82/DFDA 38          SEC                     A:02E0 X:03E1 Y:0387 P:envmxdizc
$82/DFDB E9 78 00    SBC #$0078              A:02E0 X:03E1 Y:0387 P:envmxdizC
$82/DFDE 85 06       STA $06    [$00:0006]   A:0268 X:03E1 Y:0387 P:envmxdizC
$82/DFE0 AD CA 16    LDA $16CA  [$82:16CA]   A:0268 X:03E1 Y:0387 P:envmxdizC
$82/DFE3 3A          DEC A                   A:001F X:03E1 Y:0387 P:envmxdizC
$82/DFE4 85 0C       STA $0C    [$00:000C]   A:001E X:03E1 Y:0387 P:envmxdizC
$82/DFE6 85 0A       STA $0A    [$00:000A]   A:001E X:03E1 Y:0387 P:envmxdizC
$82/DFE8 A9 01 00    LDA #$0001              A:001E X:03E1 Y:0387 P:envmxdizC
$82/DFEB 85 08       STA $08    [$00:0008]   A:0001 X:03E1 Y:0387 P:envmxdizC
$82/DFED A5 0A       LDA $0A    [$00:000A]   A:0001 X:03E1 Y:0387 P:envmxdizC
$82/DFEF EB          XBA                     A:001E X:03E1 Y:0387 P:envmxdizC
$82/DFF0 4A          LSR A                   A:1E00 X:03E1 Y:0387 P:envmxdiZC
$82/DFF1 4A          LSR A                   A:0F00 X:03E1 Y:0387 P:envmxdizc
$82/DFF2 4A          LSR A                   A:0780 X:03E1 Y:0387 P:envmxdizc
$82/DFF3 05 08       ORA $08    [$00:0008]   A:03C0 X:03E1 Y:0387 P:envmxdizc
$82/DFF5 AA          TAX                     A:03C1 X:03E1 Y:0387 P:envmxdizc
$82/DFF6 7B          TDC                     A:03C1 X:03C1 Y:0387 P:envmxdizc
$82/DFF7 E2 20       SEP #$20                A:0000 X:03C1 Y:0387 P:envmxdiZc
$82/DFF9 BF 00 C8 7F LDA $7FC800,x[$7F:CBC1] A:0000 X:03C1 Y:0387 P:envMxdiZc
$82/DFFD C2 20       REP #$20                A:000A X:03C1 Y:0387 P:envMxdizc
$82/DFFF C9 00 00    CMP #$0000              A:000A X:03C1 Y:0387 P:envmxdizc
$82/E002 F0 05       BEQ $05    [$E009]      A:000A X:03C1 Y:0387 P:envmxdizC
$82/E004 C9 FF 00    CMP #$00FF              A:000A X:03C1 Y:0387 P:envmxdizC
$82/E007 D0 21       BNE $21    [$E02A]      A:000A X:03C1 Y:0387 P:eNvmxdizc
$82/E02A AD C8 16    LDA $16C8  [$82:16C8]   A:000A X:03C1 Y:0387 P:eNvmxdizc
$82/E02D 3A          DEC A                   A:001F X:03C1 Y:0387 P:envmxdizc
$82/E02E 85 08       STA $08    [$00:0008]   A:001E X:03C1 Y:0387 P:envmxdizc
$82/E030 85 0C       STA $0C    [$00:000C]   A:001E X:03C1 Y:0387 P:envmxdizc
$82/E032 A9 01 00    LDA #$0001              A:001E X:03C1 Y:0387 P:envmxdizc
$82/E035 85 0A       STA $0A    [$00:000A]   A:0001 X:03C1 Y:0387 P:envmxdizc
$82/E037 A5 0A       LDA $0A    [$00:000A]   A:0001 X:03C1 Y:0387 P:envmxdizc
$82/E039 EB          XBA                     A:0001 X:03C1 Y:0387 P:envmxdizc
$82/E03A 4A          LSR A                   A:0100 X:03C1 Y:0387 P:envmxdiZc
$82/E03B 4A          LSR A                   A:0080 X:03C1 Y:0387 P:envmxdizc
$82/E03C 4A          LSR A                   A:0040 X:03C1 Y:0387 P:envmxdizc
$82/E03D 05 08       ORA $08    [$00:0008]   A:0020 X:03C1 Y:0387 P:envmxdizc
$82/E03F AA          TAX                     A:003E X:03C1 Y:0387 P:envmxdizc
$82/E040 7B          TDC                     A:003E X:003E Y:0387 P:envmxdizc
$82/E041 E2 20       SEP #$20                A:0000 X:003E Y:0387 P:envmxdiZc
$82/E043 BF 00 C8 7F LDA $7FC800,x[$7F:C83E] A:0000 X:003E Y:0387 P:envMxdiZc
$82/E047 C2 20       REP #$20                A:001E X:003E Y:0387 P:envMxdizc
$82/E049 C9 00 00    CMP #$0000              A:001E X:003E Y:0387 P:envmxdizc
$82/E04C F0 05       BEQ $05    [$E053]      A:001E X:003E Y:0387 P:envmxdizC
$82/E04E C9 FF 00    CMP #$00FF              A:001E X:003E Y:0387 P:envmxdizC
$82/E051 D0 21       BNE $21    [$E074]      A:001E X:003E Y:0387 P:eNvmxdizc
$82/E074 A5 00       LDA $00    [$00:0000]   A:001E X:003E Y:0387 P:eNvmxdizc
$82/E076 8D CE 16    STA $16CE  [$82:16CE]   A:FFA0 X:003E Y:0387 P:eNvmxdizc
$82/E079 A5 02       LDA $02    [$00:0002]   A:FFA0 X:003E Y:0387 P:eNvmxdizc
$82/E07B 8D D0 16    STA $16D0  [$82:16D0]   A:0340 X:003E Y:0387 P:envmxdizc
$82/E07E A5 04       LDA $04    [$00:0004]   A:0340 X:003E Y:0387 P:envmxdizc
$82/E080 8D D2 16    STA $16D2  [$82:16D2]   A:FFA8 X:003E Y:0387 P:eNvmxdizc
$82/E083 A5 06       LDA $06    [$00:0006]   A:FFA8 X:003E Y:0387 P:eNvmxdizc
$82/E085 8D D4 16    STA $16D4  [$82:16D4]   A:0268 X:003E Y:0387 P:envmxdizc
$82/E088 E2 20       SEP #$20                A:0268 X:003E Y:0387 P:envmxdizc
$82/E08A 20 EA FC    JSR $FCEA  [$82:FCEA]   A:0268 X:003E Y:0387 P:envMxdizc
$82/E08D 22 3D 85 86 JSL $86853D[$86:853D]   A:001F X:03DF Y:0387 P:envMxdiZC
$82/E091 AB          PLB                     A:0000 X:1F1F Y:0387 P:eNvMxdizC
$82/E092 6B          RTL                     A:0000 X:1F1F Y:0387 P:eNvMxdizC

$82/F810 ?

From the Game Intro - "Quest presents" stuff

$82/F810 29 FF 00    AND #$00FF              A:041C X:0400 Y:0B44 P:envmxdizc
$82/F813 F0 45       BEQ $45    [$F85A]      A:001C X:0400 Y:0B44 P:envmxdizc
$82/F815 0A          ASL A                   A:001C X:0400 Y:0B44 P:envmxdizc
$82/F816 85 0C       STA $0C    [$00:000C]   A:0038 X:0400 Y:0B44 P:envmxdizc
$82/F818 18          CLC                     A:0038 X:0400 Y:0B44 P:envmxdizc
$82/F819 6D C5 0E    ADC $0EC5  [$82:0EC5]   A:0038 X:0400 Y:0B44 P:envmxdizc
$82/F81C AA          TAX                     A:0038 X:0400 Y:0B44 P:envmxdizc
$82/F81D E2 20       SEP #$20                A:0038 X:0038 Y:0B44 P:envmxdizc
$82/F81F AD C7 0E    LDA $0EC7  [$82:0EC7]   A:0038 X:0038 Y:0B44 P:envMxdizc
$82/F822 1A          INC A                   A:0000 X:0038 Y:0B44 P:envMxdiZc
$82/F823 22 CB AD 80 JSL $80ADCB   ; Calculate Offset: A * #$40 + X
$82/F827 E0 00 12    CPX #$1200    ; ??? Maybe check if the result is too big?
$82/F82A 90 0C       BCC $0C       ; [$F838] ??? Taken if smaller

Code is missing here

$82/F838 C2 21       REP #$21      ; 16-bit A + Clear Carry
$82/F83A A5 0A       LDA $0A       ; ???
$82/F83C 69 00 78    ADC #$7800    ; ???
$82/F83F A8          TAY           ; VRAM Destination Address
$82/F840 AD D8 16    LDA $16D8     ; ???
$82/F843 18          CLC           ; ???
$82/F844 69 00 EC    ADC #$EC00    ; ???
$82/F847 AA          TAX           ; DMA Source Address
$82/F848 E2 20       SEP #$20
$82/F84A A9 7F       LDA #$7F      ; VRAM DMA Source Bank
$82/F84C 22 24 9F 80 JSL $809F24   ; VRAM DMA Setup Execution
$82/F850 C2 21       REP #$21                A:1801 X:0038 Y:7EC4 P:eNvMxdizc
$82/F852 A5 0C       LDA $0C    [$00:000C]   A:1801 X:0038 Y:7EC4 P:eNvmxdizc
$82/F854 6D D8 16    ADC $16D8  [$82:16D8]   A:0038 X:0038 Y:7EC4 P:envmxdizc
$82/F857 8D D8 16    STA $16D8  [$82:16D8]   A:0038 X:0038 Y:7EC4 P:envmxdizc
$82/F85A 60          RTS                     A:0038 X:0038 Y:7EC4 P:envmxdizc

$82/FAAC ?

The second part of this subroutine transfers the data from $164B onwards into the CGRAM buffer and builds actual palettes from it - the data at $164B only contains fourteen colors per planned palette.

The palettes are built the following way:

($FAD2 to $FAD9) The first color is $0000
($FADA to $FAE9) The next #$0D (thirteen) colors are copied from [$20] = $00/164B + x
($FAEA to $FAEB) The fourteenth color gets left out
($FAEC to $FAF7) The fifteenth and last color gets copied from [$20] = $00/164B + x
$82/FAAC 8B          PHB           ; Preserve Data Bank
$82/FAAD 4B          PHK           ; Change Data Bank to this
$82/FAAE AB          PLB
$82/FAAF A2 4B 16    LDX #$164B    ; Setup 24-bit Address in $20-22 to $00/164B (=$7E/164B)
$82/FAB2 86 20       STX $20
$82/FAB4 A9 00       LDA #$00
$82/FAB6 85 22       STA $22
$82/FAB8 22 0F FB 82 JSL $82FB0F   ; ???
$82/FABC D4 00       PEI ($00)     ; Preserve $00-3 on Stack
$82/FABE D4 02       PEI ($02)
$82/FAC0 C2 20       REP #$20
$82/FAC2 A2 80 00    LDX #$0080    ; Store Index - where to begin to store in $124B and $144B
$82/FAC5 A0 00 00    LDY #$0000    ; Load Index
$82/FAC8 A9 04 00    LDA #$0004    ; Setup Palette Counter - how many palettes to do
$82/FACB 85 00       STA $00
$82/FACD A9 0D 00    LDA #$000D    ; Setup Color counter - counter for the thirteen colors
$82/FAD0 85 02       STA $02    
$82/FAD2 9E 4B 12    STZ $124B,x   ; Clear the first two bytes in the palette (making it pitch-black)
$82/FAD5 9E 4B 14    STZ $144B,x   ; Do the same in the second CGRAM buffer
$82/FAD8 E8          INX           ; Increment Store Index so it points to the next color
$82/FAD9 E8          INX
$82/FADA B7 20       LDA [$20],y   ; Load color from around $164B
$82/FADC 9D 4B 12    STA $124B,x   ; Store it in CGRAM buffer
$82/FADF 9D 4B 14    STA $144B,x   ; Do the same in the second CGRAM buffer
$82/FAE2 C8          INY           ; Increment Load Index so it points to the next color
$82/FAE3 C8          INY
$82/FAE4 E8          INX           ; Increment Store Index so it points to the next color
$82/FAE5 E8          INX
$82/FAE6 C6 02       DEC $02       ; Decrement color counter
$82/FAE8 D0 F0       BNE $F0       ; [$FADA] Loop until all thirteen colors are done
$82/FAEA E8          INX           ; Increment X twice - leave the fourteenth color out
$82/FAEB E8          INX
$82/FAEC B7 20       LDA [$20],y   ; Load color from around $164B
$82/FAEE 9D 4B 12    STA $124B,x   ; Store it in CGRAM buffer
$82/FAF1 9D 4B 14    STA $144B,x   ; Do the same in the second CGRAM buffer
$82/FAF4 C8          INY           ; Increment Load Index so it points to the next color
$82/FAF5 C8          INY
$82/FAF6 E8          INX           ; Increment Store Index so it points to the next color
$82/FAF7 E8          INX
$82/FAF8 C6 00       DEC $00       ; Decrement Palette Counter
$82/FAFA D0 D1       BNE $D1       ; [$FACD] Loop until all four palettes are done
$82/FAFC E2 20       SEP #$20
$82/FAFE A9 40       LDA #$40      ; CGRAM Destination
$82/FB00 A0 80 00    LDY #$0080    ; Number of Bytes
$82/FB03 22 B5 9E 80 JSL $809EB5   ; Transfer these four palettes from CGRAM buffer to CGRAM
$82/FB07 7A          PLY           ; Restore $00-$03 and exit
$82/FB08 84 02       STY $02
$82/FB0A 7A          PLY
$82/FB0B 84 00       STY $00
$82/FB0D AB          PLB
$82/FB0E 6B          RTL

Bank $83

$83/A990 ?

This is about some color calculation. $20-22 and $23-25 both contain 24-addresses to colors.

$83/A990 7B          TDC           ; Clear 16-bit A
$83/A991 AD A6 17    LDA $17A6  [$83:17A6]   A:0000 X:DCD4 Y:9E53 P:envMxdiZC
$83/A994 AA          TAX                     A:0010 X:DCD4 Y:9E53 P:envMxdizC
$83/A995 86 06       STX $06    [$00:0006]   A:0010 X:0010 Y:9E53 P:envMxdizC
$83/A997 AD A7 17    LDA $17A7  [$83:17A7]   A:0010 X:0010 Y:9E53 P:envMxdizC
$83/A99A C2 20       REP #$20                A:0000 X:0010 Y:9E53 P:envMxdiZC
$83/A99C 0A          ASL A                   A:0000 X:0010 Y:9E53 P:envmxdiZC
$83/A99D A8          TAY                     A:0000 X:0010 Y:9E53 P:envmxdiZc
$83/A99E A2 00 00    LDX #$0000              A:0000 X:0010 Y:0000 P:envmxdiZc
$83/A9A1 C2 20       REP #$20                A:0000 X:0000 Y:0000 P:envmxdiZc
$83/A9A3 B7 23       LDA [$23],y[$9C:DCD4]   A:0000 X:0000 Y:0000 P:envmxdiZc
$83/A9A5 85 02       STA $02    [$00:0002]   A:0042 X:0000 Y:0000 P:envmxdizc
$83/A9A7 B7 20       LDA [$20],y[$00:124B]   A:0042 X:0000 Y:0000 P:envmxdizc
$83/A9A9 85 00       STA $00    [$00:0000]   A:0000 X:0000 Y:0000 P:envmxdiZc

buffer color

$83/A9AB E2 20       SEP #$20                A:0000 X:0000 Y:0000 P:envmxdiZc
$83/A9AD 29 1F       AND #$1F                A:0000 X:0000 Y:0000 P:envMxdiZc
$83/A9AF 85 04       STA $04    [$00:0004]   A:0000 X:0000 Y:0000 P:envMxdiZc

exempt color

$83/A9B1 0A          ASL A                   A:0000 X:0000 Y:0000 P:envMxdiZc
$83/A9B2 0A          ASL A                   A:0000 X:0000 Y:0000 P:envMxdiZc
$83/A9B3 0A          ASL A                   A:0000 X:0000 Y:0000 P:envMxdiZc
$83/A9B4 9F 41 B1 7E STA $7EB141,x[$7E:B141] A:0000 X:0000 Y:0000 P:envMxdiZc
$83/A9B8 A5 02       LDA $02    [$00:0002]   A:0000 X:0000 Y:0000 P:envMxdiZc
$83/A9BA 29 1F       AND #$1F                A:0042 X:0000 Y:0000 P:envMxdizc
$83/A9BC 38          SEC                     A:0002 X:0000 Y:0000 P:envMxdizc
$83/A9BD E5 04       SBC $04    [$00:0004]   A:0002 X:0000 Y:0000 P:envMxdizC
$83/A9BF 9F 40 B1 7E STA $7EB140,x[$7E:B140] A:0002 X:0000 Y:0000 P:envMxdizC
$83/A9C3 C2 20       REP #$20                A:0002 X:0000 Y:0000 P:envMxdizC
$83/A9C5 A5 00       LDA $00    [$00:0000]   A:0002 X:0000 Y:0000 P:envmxdizC
$83/A9C7 29 E0 03    AND #$03E0              A:0000 X:0000 Y:0000 P:envmxdiZC
$83/A9CA 85 04       STA $04    [$00:0004]   A:0000 X:0000 Y:0000 P:envmxdiZC
$83/A9CC 4A          LSR A                   A:0000 X:0000 Y:0000 P:envmxdiZC
$83/A9CD 4A          LSR A                   A:0000 X:0000 Y:0000 P:envmxdiZc
$83/A9CE E2 20       SEP #$20                A:0000 X:0000 Y:0000 P:envmxdiZc
$83/A9D0 9F 81 B1 7E STA $7EB181,x[$7E:B181] A:0000 X:0000 Y:0000 P:envMxdiZc
$83/A9D4 C2 20       REP #$20                A:0000 X:0000 Y:0000 P:envMxdiZc
$83/A9D6 A5 02       LDA $02    [$00:0002]   A:0000 X:0000 Y:0000 P:envmxdiZc
$83/A9D8 29 E0 03    AND #$03E0              A:0042 X:0000 Y:0000 P:envmxdizc
$83/A9DB 38          SEC                     A:0040 X:0000 Y:0000 P:envmxdizc
$83/A9DC E5 04       SBC $04    [$00:0004]   A:0040 X:0000 Y:0000 P:envmxdizC
$83/A9DE 4A          LSR A                   A:0040 X:0000 Y:0000 P:envmxdizC
$83/A9DF 4A          LSR A                   A:0020 X:0000 Y:0000 P:envmxdizc
$83/A9E0 4A          LSR A                   A:0010 X:0000 Y:0000 P:envmxdizc
$83/A9E1 4A          LSR A                   A:0008 X:0000 Y:0000 P:envmxdizc
$83/A9E2 4A          LSR A                   A:0004 X:0000 Y:0000 P:envmxdizc
$83/A9E3 E2 20       SEP #$20                A:0002 X:0000 Y:0000 P:envmxdizc
$83/A9E5 9F 80 B1 7E STA $7EB180,x[$7E:B180] A:0002 X:0000 Y:0000 P:envMxdizc
$83/A9E9 A5 01       LDA $01    [$00:0001]   A:0002 X:0000 Y:0000 P:envMxdizc
$83/A9EB 29 7C       AND #$7C                A:0000 X:0000 Y:0000 P:envMxdiZc
$83/A9ED 85 04       STA $04    [$00:0004]   A:0000 X:0000 Y:0000 P:envMxdiZc
$83/A9EF 0A          ASL A                   A:0000 X:0000 Y:0000 P:envMxdiZc
$83/A9F0 9F 61 B1 7E STA $7EB161,x[$7E:B161] A:0000 X:0000 Y:0000 P:envMxdiZc
$83/A9F4 A5 03       LDA $03    [$00:0003]   A:0000 X:0000 Y:0000 P:envMxdiZc
$83/A9F6 29 7C       AND #$7C                A:0000 X:0000 Y:0000 P:envMxdiZc
$83/A9F8 38          SEC                     A:0000 X:0000 Y:0000 P:envMxdiZc
$83/A9F9 E5 04       SBC $04    [$00:0004]   A:0000 X:0000 Y:0000 P:envMxdiZC
$83/A9FB 10 06       BPL $06    [$AA03]      A:0000 X:0000 Y:0000 P:envMxdiZC
$83/AA03 4A          LSR A                   A:0000 X:0000 Y:0000 P:envMxdiZC
$83/AA04 4A          LSR A                   A:0000 X:0000 Y:0000 P:envMxdiZc
$83/AA05 9F 60 B1 7E STA $7EB160,x[$7E:B160] A:0000 X:0000 Y:0000 P:envMxdiZc
$83/AA09 C8          INY                     A:0000 X:0000 Y:0000 P:envMxdiZc
$83/AA0A C8          INY                     A:0000 X:0000 Y:0001 P:envMxdizc
$83/AA0B E8          INX                     A:0000 X:0000 Y:0002 P:envMxdizc
$83/AA0C E8          INX                     A:0000 X:0001 Y:0002 P:envMxdizc
$83/AA0D A5 00       LDA $00    [$00:0000]   A:0000 X:0002 Y:0002 P:envMxdizc
$83/AA0F C6 06       DEC $06    [$00:0006]   A:0000 X:0002 Y:0002 P:envMxdiZc
$83/AA11 D0 8E       BNE $8E    [$A9A1]      A:0000 X:0002 Y:0002 P:envMxdizc
$83/AA13 60          RTS                     A:0000 X:0020 Y:0020 P:envMxdiZc

Bank $84

$84/805F ?

$84/805F 8B          PHB           ; Preserve Data Bank on Stack
$84/8060 4B          PHK           ; Change Data Bank to $84
$84/8061 AB          PLB
$84/8062 AD C9 11    LDA $11C9  [$84:11C9]   A:0000 X:0040 Y:0000 P:eNvMxdizC
$84/8065 CD CA 11    CMP $11CA  [$84:11CA]   A:0000 X:0040 Y:0000 P:envMxdiZC
$84/8068 F0 03       BEQ $03    [$806D]      A:0000 X:0040 Y:0000 P:envMxdiZC

Code is missing here

$84/806D D4 39       PEI ($39)     ; Push $39-$3C on Stack
$84/806F D4 3B       PEI ($3B)
$84/8071 7B          TDC                     A:0000 X:0040 Y:0000 P:envMxdiZC
$84/8072 AD F4 05    LDA $05F4  [$84:05F4]   A:0000 X:0040 Y:0000 P:envMxdiZC
$84/8075 0A          ASL A                   A:0000 X:0040 Y:0000 P:envMxdiZC
$84/8076 0A          ASL A                   A:0000 X:0040 Y:0000 P:envMxdiZc
$84/8077 A8          TAY                     A:0000 X:0040 Y:0000 P:envMxdiZc
$84/8078 7B          TDC                     A:0000 X:0040 Y:0000 P:envMxdiZc
$84/8079 B9 7A 83    LDA $837A,y[$84:837A]   A:0000 X:0040 Y:0000 P:envMxdiZc
$84/807C 10 09       BPL $09    [$8087]      A:0080 X:0040 Y:0000 P:eNvMxdizc
$84/807E C9 FF       CMP #$FF                A:0080 X:0040 Y:0000 P:eNvMxdizc
$84/8080 F0 39       BEQ $39    [$80BB]      A:0080 X:0040 Y:0000 P:eNvMxdizc
$84/8082 20 2E E7    JSR $E72E  [$84:E72E]   A:0080 X:0040 Y:0000 P:eNvMxdizc
$84/8085 80 34       BRA $34    [$80BB]      A:0040 X:EE21 Y:12C0 P:envMxdizc
$84/8087 5A          PHY                     A:0000 X:0026 Y:0008 P:envMxdiZc
$84/8088 A8          TAY                     A:0000 X:0026 Y:0008 P:envMxdiZc
$84/8089 B9 AE 17    LDA $17AE,y[$84:17AE]   A:0000 X:0026 Y:0000 P:envMxdiZc
$84/808C F0 26       BEQ $26    [$80B4]      A:0001 X:0026 Y:0000 P:envMxdizc
$84/808E C9 F0       CMP #$F0                A:0001 X:0026 Y:0000 P:envMxdizc
$84/8090 B0 04       BCS $04    [$8096]      A:0001 X:0026 Y:0000 P:envMxdizc
$84/8092 C9 DC       CMP #$DC                A:0001 X:0026 Y:0000 P:envMxdizc
$84/8094 B0 1E       BCS $1E    [$80B4]      A:0001 X:0026 Y:0000 P:envMxdizc
$84/8096 BE 3E 1E    LDX $1E3E,y[$84:1E3E]   A:0001 X:0026 Y:0000 P:envMxdizc
$84/8099 BD 03 06    LDA $0603,x[$84:0603]   A:0001 X:0000 Y:0000 P:envMxdiZc
$84/809C F0 16       BEQ $16    [$80B4]      A:0001 X:0000 Y:0000 P:envMxdizc
$84/809E B9 DF 19    LDA $19DF,y[$84:19DF]   A:0001 X:0000 Y:0000 P:envMxdizc
$84/80A1 89 40       BIT #$40                A:0000 X:0000 Y:0000 P:envMxdiZc
$84/80A3 D0 0F       BNE $0F    [$80B4]      A:0000 X:0000 Y:0000 P:envMxdiZc
$84/80A5 B9 DE 19    LDA $19DE,y[$84:19DE]   A:0000 X:0000 Y:0000 P:envMxdiZc
$84/80A8 89 02       BIT #$02                A:0000 X:0000 Y:0000 P:envMxdiZc
$84/80AA D0 08       BNE $08    [$80B4]      A:0000 X:0000 Y:0000 P:envMxdiZc
$84/80AC BD C3 06    LDA $06C3,x[$84:06C3]   A:0000 X:0000 Y:0000 P:envMxdiZc
$84/80AF F0 03       BEQ $03    [$80B4]      A:0008 X:0000 Y:0000 P:envMxdizc
$84/80B1 20 CC 80    JSR $80CC  [$84:80CC]   A:0008 X:0000 Y:0000 P:envMxdizc
$84/80B4 7A          PLY                     A:00FF X:0040 Y:89D3 P:envMxdiZC
$84/80B5 C8          INY                     A:00FF X:0040 Y:0008 P:envMxdizC
$84/80B6 98          TYA                     A:00FF X:0040 Y:0009 P:envMxdizC
$84/80B7 89 03       BIT #$03                A:0009 X:0040 Y:0009 P:envMxdizC
$84/80B9 D0 BD       BNE $BD    [$8078]      A:0009 X:0040 Y:0009 P:envMxdizC
$84/80BB AD F4 05    LDA $05F4  [$84:05F4]   A:0040 X:EE21 Y:12C0 P:envMxdizc
$84/80BE 1A          INC A                   A:0000 X:EE21 Y:12C0 P:envMxdiZc
$84/80BF 29 07       AND #$07                A:0001 X:EE21 Y:12C0 P:envMxdizc
$84/80C1 8D F4 05    STA $05F4  [$84:05F4]   A:0001 X:EE21 Y:12C0 P:envMxdizc
$84/80C4 FA          PLX           ; Restore $39-$3B from Stack
$84/80C5 86 3B       STX $3B
$84/80C7 FA          PLX
$84/80C8 86 39       STX $39
$84/80CA AB          PLB           ; Restore Data Bank
$84/80CB 6B          RTL

$84/821A Use Jump Table

$84/821A 0A          ASL A                   A:0081 X:0000 Y:89C4 P:eNvMxdizc
$84/821B AA          TAX                     A:0002 X:0000 Y:89C4 P:envMxdizC
$84/821C 7C 1F 82    JMP ($821F,x)[$84:8254] A:0002 X:0002 Y:89C4 P:envMxdizC

$84/821F Jump Table for $84/821A

2F 82 - $822F - Entry #$00
54 82 - $8254 - Entry #$01
3E 82 - $823E - Entry #$02
54 82 - $8254 - Entry #$03
A4 82 - $82A4 - Entry #$04
E4 82 - $82E4 - Entry #$05
CD 82 - $82CD - Entry #$06
4D 83 - $834D - Entry #$07

$84/82A4 ?

$84/82A4 7B          TDC                     A:0008 X:0008 Y:8C90 P:envMxdizC
$84/82A5 B9 01 00    LDA $0001,y[$84:8C91]   A:0000 X:0008 Y:8C90 P:envMxdiZC
$84/82A8 C2 20       REP #$20                A:0002 X:0008 Y:8C90 P:envMxdizC
$84/82AA EB          XBA                     A:0002 X:0008 Y:8C90 P:envmxdizC
$84/82AB 4A          LSR A                   A:0200 X:0008 Y:8C90 P:envmxdiZC
$84/82AC 4A          LSR A                   A:0100 X:0008 Y:8C90 P:envmxdizc
$84/82AD 4A          LSR A                   A:0080 X:0008 Y:8C90 P:envmxdizc
$84/82AE 85 0C       STA $0C    [$00:000C]   A:0040 X:0008 Y:8C90 P:envmxdizc
$84/82B0 E2 20       SEP #$20                A:0040 X:0008 Y:8C90 P:envmxdizc
$84/82B2 C8          INY                     A:0040 X:0008 Y:8C90 P:envMxdizc
$84/82B3 C8          INY                     A:0040 X:0008 Y:8C91 P:eNvMxdizc
$84/82B4 5A          PHY                     A:0040 X:0008 Y:8C92 P:eNvMxdizc
$84/82B5 A4 04       LDY $04    [$00:0004]   A:0040 X:0008 Y:8C92 P:eNvMxdizc
$84/82B7 A2 15 B8    LDX #$B815              A:0040 X:0008 Y:4740 P:envMxdizc
$84/82BA A9 84       LDA #$84                A:0040 X:B815 Y:4740 P:eNvMxdizc
$84/82BC 22 B7 9F 80 JSL $809FB7[$80:9FB7]   A:0084 X:B815 Y:4740 P:eNvMxdizc
$84/82C0 7A          PLY                     A:1800 X:0040 Y:4740 P:eNvMxdizc
$84/82C1 C2 20       REP #$20                A:1800 X:0040 Y:8C92 P:eNvMxdizc
$84/82C3 A5 0C       LDA $0C    [$00:000C]   A:1800 X:0040 Y:8C92 P:eNvmxdizc
$84/82C5 4A          LSR A                   A:0040 X:0040 Y:8C92 P:envmxdizc
$84/82C6 65 04       ADC $04    [$00:0004]   A:0020 X:0040 Y:8C92 P:envmxdizc
$84/82C8 85 04       STA $04    [$00:0004]   A:4760 X:0040 Y:8C92 P:envmxdizc
$84/82CA E2 20       SEP #$20                A:4760 X:0040 Y:8C92 P:envmxdizc
$84/82CC 60          RTS                     A:4760 X:0040 Y:8C92 P:envMxdizc

$84/B98A Battle figure moving animation?

This is executed in the title screen demo, when the soldier jumps over the gap and beats the archeress(?)

This executes an VRAM DMA - I can imagine this is the graphics update for a marching game figure animation.

There are some values to this subroutine carried in before it is called:

A contains some Index for a table at $84/BA03 ($0002:3A03)

Y contains the VRAM destination address

$20 to $22 contains an offset for the DMA Source Address

$84/B98A 8B          PHB           ; Preserve Data Bank on Stack
$84/B98B 4B          PHK           ; Change Data Bank to $84
$84/B98C AB          PLB
$84/B98D D4 00       PEI ($00)     ; Push current content of $00 on stack
$84/B98F D4 02       PEI ($02)     ; Push current content of $02 on stack
$84/B991 D4 0C       PEI ($0C)     ; Push current content of $0C on stack
$84/B993 D4 0E       PEI ($0E)     ; Push current content of $0E on stack
$84/B995 09 00       ORA #$00      ; Set the "focus" of the flag register back on the Accumulator???
$84/B997 10 0A       BPL $0A       ; [$B9A3] Branch if A value is between #$00 and #$7F
$84/B999 29 7F       AND #$7F      ; If not, remove the MSB anyways
$84/B99B 85 00       STA $00       ; Store Original A minus MSB in $00
$84/B99D A9 02       LDA #$02      ; Set up a counter for left/right side of the  graphic
$84/B99F 85 01       STA $01       ; Yeah, I wouldn't understand that comment, too
$84/B9A1 80 04       BRA $04       ; [$B9A7]

Code is missing here

$84/B9A7 84 02       STY $02       ; Buffer VRAM destination in $02
$84/B9A9 A2 40 00    LDX #$0040    ; Number of Bytes to transfer
$84/B9AC 86 0C       STX $0C
$84/B9AE A9 80       LDA #$80      ; VRAM settings for the DMA (for $2115)
$84/B9B0 85 0E       STA $0E
$84/B9B2 7B          TDC           ; Clear 16-bit A
$84/B9B3 A5 00       LDA $00       ; Load Original A value
$84/B9B5 0A          ASL A         ; Multiply by 4 (4 byte sized table entries?)
$84/B9B6 0A          ASL A
$84/B9B7 A8          TAY           ; Transfer in Y
$84/B9B8 7B          TDC           ; Clear 16-bit A
$84/B9B9 B9 03 BA    LDA $BA03,y   ; Load Table entry
$84/B9BC C9 FF       CMP #$FF      ; ???
$84/B9BE F0 0F       BEQ $0F       ; [$B9CF] ???
$84/B9C0 C2 20       REP #$20      ; Multiply loaded byte by #$20 (thirty-two)
$84/B9C2 EB          XBA
$84/B9C3 4A          LSR A
$84/B9C4 4A          LSR A
$84/B9C5 4A          LSR A
$84/B9C6 65 20       ADC $20       ; Add some DMA Source Address Offset that was set up before this subroutine
$84/B9C8 AA          TAX           ; Transfer in X as DMA Source Address
$84/B9C9 E2 20       SEP #$20
$84/B9CB A5 22       LDA $22       ; Load $22 in A as DMA SOurce Bank
$84/B9CD 80 05       BRA $05       ; [$B9D4] Branch

Code is missing here

$84/B9D4 5A          PHY           ; Push Y on stack - it's the Load Index for the table at $BA03
$84/B9D5 A4 02       LDY $02       ; Load VRAM destination address in Y
$84/B9D7 22 24 9F 80 JSL $809F24   ; VRAM DMA
$84/B9DB 7A          PLY           ; Restore the Load Index for the table at $BA03
$84/B9DC C8          INY           ; Increment it
$84/B9DD 98          TYA           ; Copy it to A
$84/B9DE 29 03       AND #$03      ; Look if it has done 4 graphics; 4 sprite graphics per Unit
$84/B9E0 F0 13       BEQ $13       ; [$B9F5] If so, exit
$84/B9E2 7B          TDC           ; Clear 16-bit A
$84/B9E3 A9 20       LDA #$20      ; ??? This has something to do with the positioning of sprites in VRAM
$84/B9E5 C6 01       DEC $01       ; ??? The right sprite is $20 away from the left, the one below $100 ($20+$E0)
$84/B9E7 D0 02       BNE $02       ; [$B9EB] ??? $01 is a counter for this, whether it should add...
$84/B9E9 A9 E0       LDA #$E0      ; ??? $20 or $E0 to get to the VRAM address to reach the next graphic
$84/B9EB C2 21       REP #$21      ; Add this $20 or $E0 to the VRAM address, store it in it's buffer...
$84/B9ED 65 02       ADC $02
$84/B9EF 85 02       STA $02
$84/B9F1 E2 20       SEP #$20
$84/B9F3 80 C3       BRA $C3       ; [$B9B8] ... and loop
$84/B9F5 FA          PLX           ; Restore the old values of $0E, $0C, $02 and $00
$84/B9F6 86 0E       STX $0E
$84/B9F8 FA          PLX
$84/B9F9 86 0C       STX $0C
$84/B9FB FA          PLX
$84/B9FC 86 02       STX $02
$84/B9FE FA          PLX
$84/B9FF 86 00       STX $00
$84/BA01 AB          PLB           ; Restore old bank
$84/BA02 6B          RTL

Bank $86

$86/8019 ?

This is executed in the title screen demo, when the soldier jumps over the gap and beats the archeress(?)

$86/8019 8B          PHB           ; Preserve Bank on Stack
$86/801A 4B          PHK           ; Change Bank
$86/801B AB          PLB
$86/801C A2 20 05    LDX #$0520    ; [assumed] start of the OAM high table buffer
$86/801F A0 20 03    LDY #$0320    ; [assumed] start of the OAM low table buffer
$86/8022 CC 45 05    CPY $0545     ; Is this actually the position?
$86/8025 D0 06       BNE $06       ; [$802D] If it isn't, skip this next part
$86/8027 A2 00 03    LDX #$0300    ; ??? Change position of OAM high table buffer?
$86/802A A0 00 01    LDY #$0100    ; ??? Change position of OAM high table buffer?
$86/802D 86 26       STX $26       ; Store in Temp Register
$86/802F 84 29       STY $29       ; Store in Temp Register
$86/8031 C2 20       REP #$20
$86/8033 AD 43 05    LDA $0543     ; ??? Load number currently used sprites?
$86/8036 0A          ASL A
$86/8037 0A          ASL A         ; Multiply by 4 (each sprite needs 4 bytes in Low Table)
$86/8038 65 29       ADC $29       ; Add Low Table Offset
$86/803A 85 29       STA $29       ; Store in $29 the address of the first unused Low Table entry
$86/803C AD 43 05    LDA $0543     ; ??? Load number currently used sprites?
$86/803F 4A          LSR A
$86/8040 4A          LSR A         ; Divide by 4 (each sprite needs 2 bits in High Table)
$86/8041 65 26       ADC $26       ; Add High Table Offset
$86/8043 85 26       STA $26       ; Store in $26 the address of the first unused High Table entry
$86/8045 E2 20       SEP #$20
$86/8047 A9 80       LDA #$80      ; Max. number of sprites
$86/8049 38          SEC
$86/804A ED 43 05    SBC $0543     ; Subtract number of used sprites(?)
$86/804D 85 2B       STA $2B       ; Store in $2B (Number of free sprites)
$86/804F A9 80       LDA #$80      ; ???
$86/8051 85 28       STA $28       ; ???
$86/8053 A0 00 00    LDY #$0000    ; ???
$86/8056 BE 83 0E    LDX $0E83,y   ; ???
$86/8059 30 4A       BMI $4A       ; [$80A5]
$86/805B 5A          PHY           ; ???
$86/805C 7B          TDC           ; ???
$86/805D BD C3 09    LDA $09C3,x   ; ???
$86/8060 10 05       BPL $05       ; [$8067]
$86/8062 20 81 81    JSR $8181     ; ???
$86/8065 80 37       BRA $37       ; [$809E]

Code is missing here

$86/809E 7A          PLY           ; ???
$86/809F C8          INY           ; ???
$86/80A0 C8          INY           ; ???
$86/80A1 A5 2B       LDA $2B       ; ???
$86/80A3 D0 B1       BNE $B1       ; [$8056]
$86/80A5 20 96 84    JSR $8496     ; Check if more Sprites are needed and clear OAM entries for it
$86/80A8 A0 20 03    LDY #$0320    ; Change OAM Buffer address from $100 to $320 or vice versa
$86/80AB CC 45 05    CPY $0545
$86/80AE D0 03       BNE $03       ; [$80B3] Take branch if it isn't $320
$86/80B0 A0 00 01    LDY #$0100
$86/80B3 8C 45 05    STY $0545
$86/80B6 A9 01       LDA #$01      ; Set OAM Update flag
$86/80B8 8D 40 05    STA $0540
$86/80BB AB          PLB           ; Restore Program Bank
$86/80BC 6B          RTL

$86/8181 ?

$86/8181 BD 03 06    LDA $0603,x[$86:0603]   A:00FF X:0000 Y:0000 P:eNVMxdizC
$86/8184 F0 0B       BEQ $0B    [$8191]      A:0001 X:0000 Y:0000 P:enVMxdizC
$86/8186 BD 04 06    LDA $0604,x[$86:0604]   A:0001 X:0000 Y:0000 P:enVMxdizC
$86/8189 F0 06       BEQ $06    [$8191]      A:0001 X:0000 Y:0000 P:enVMxdizC
$86/818B BD 04 07    LDA $0704,x[$86:0704]   A:0001 X:0000 Y:0000 P:enVMxdizC
$86/818E 4A          LSR A                   A:0000 X:0000 Y:0000 P:enVMxdiZC
$86/818F 90 03       BCC $03    [$8194]      A:0000 X:0000 Y:0000 P:enVMxdiZc

Code is missing here

$86/8194 A9 8B       LDA #$8B                A:0000 X:0000 Y:0000 P:enVMxdiZc
$86/8196 48          PHA                     A:008B X:0000 Y:0000 P:eNVMxdizc
$86/8197 AB          PLB                     A:008B X:0000 Y:0000 P:eNVMxdizc
$86/8198 86 3B       STX $3B    [$00:003B]   A:008B X:0000 Y:0000 P:eNVMxdizc
$86/819A BD 03 07    LDA $0703,x[$8B:0703]   A:008B X:0000 Y:0000 P:eNVMxdizc
$86/819D 85 06       STA $06    [$00:0006]   A:0006 X:0000 Y:0000 P:enVMxdizc
$86/819F BD 43 08    LDA $0843,x[$8B:0843]   A:0006 X:0000 Y:0000 P:enVMxdizc
$86/81A2 85 05       STA $05    [$00:0005]   A:0001 X:0000 Y:0000 P:enVMxdizc
$86/81A4 7B          TDC                     A:0001 X:0000 Y:0000 P:enVMxdizc
$86/81A5 BD 03 06    LDA $0603,x[$8B:0603]   A:0000 X:0000 Y:0000 P:enVMxdiZc
$86/81A8 C2 20       REP #$20                A:0001 X:0000 Y:0000 P:enVMxdizc
$86/81AA 3A          DEC A                   A:0001 X:0000 Y:0000 P:enVmxdizc
$86/81AB 0A          ASL A                   A:0000 X:0000 Y:0000 P:enVmxdiZc
$86/81AC 69 2F A6    ADC #$A62F              A:0000 X:0000 Y:0000 P:enVmxdiZc
$86/81AF A8          TAY                     A:A62F X:0000 Y:0000 P:eNvmxdizc
$86/81B0 BD 04 06    LDA $0604,x[$8B:0604]   A:A62F X:0000 Y:A62F P:eNvmxdizc
$86/81B3 3A          DEC A                   A:0001 X:0000 Y:A62F P:envmxdizc
$86/81B4 29 FF 00    AND #$00FF              A:0000 X:0000 Y:A62F P:envmxdiZc
$86/81B7 0A          ASL A                   A:0000 X:0000 Y:A62F P:envmxdiZc
$86/81B8 79 00 00    ADC $0000,y[$8B:A62F]   A:0000 X:0000 Y:A62F P:envmxdiZc
$86/81BB A8          TAY                     A:A7E9 X:0000 Y:A62F P:eNvmxdizc
$86/81BC B9 00 00    LDA $0000,y[$8B:A7E9]   A:A7E9 X:0000 Y:A7E9 P:eNvmxdizc
$86/81BF 85 23       STA $23    [$00:0023]   A:B5DF X:0000 Y:A7E9 P:eNvmxdizc
$86/81C1 BD 83 09    LDA $0983,x[$8B:0983]   A:B5DF X:0000 Y:A7E9 P:eNvmxdizc
$86/81C4 85 00       STA $00    [$00:0000]   A:0000 X:0000 Y:A7E9 P:envmxdiZc
$86/81C6 A5 29       LDA $29    [$00:0029]   A:0000 X:0000 Y:A7E9 P:envmxdiZc
$86/81C8 9D 83 09    STA $0983,x[$8B:0983]   A:03A0 X:0000 Y:A7E9 P:envmxdizc
$86/81CB E2 20       SEP #$20                A:03A0 X:0000 Y:A7E9 P:envmxdizc
$86/81CD B2 23       LDA ($23)  [$8B:B5DF]   A:03A0 X:0000 Y:A7E9 P:envMxdizc
$86/81CF D0 03       BNE $03    [$81D4]      A:0391 X:0000 Y:A7E9 P:eNvMxdizc
$86/81D4 7B          TDC                     A:0391 X:0000 Y:A7E9 P:eNvMxdizc
$86/81D5 18          CLC                     A:0000 X:0000 Y:A7E9 P:envMxdiZc
$86/81D6 BD C3 06    LDA $06C3,x[$8B:06C3]   A:0000 X:0000 Y:A7E9 P:envMxdiZc
$86/81D9 29 3C       AND #$3C                A:0008 X:0000 Y:A7E9 P:envMxdizc
$86/81DB 7D C3 06    ADC $06C3,x[$8B:06C3]   A:0008 X:0000 Y:A7E9 P:envMxdizc
$86/81DE C2 20       REP #$20                A:0010 X:0000 Y:A7E9 P:envMxdizc
$86/81E0 0A          ASL A                   A:0010 X:0000 Y:A7E9 P:envmxdizc
$86/81E1 0A          ASL A                   A:0020 X:0000 Y:A7E9 P:envmxdizc
$86/81E2 85 08       STA $08    [$00:0008]   A:0040 X:0000 Y:A7E9 P:envmxdizc
$86/81E4 E2 20       SEP #$20                A:0040 X:0000 Y:A7E9 P:envmxdizc
$86/81E6 A6 29       LDX $29    [$00:0029]   A:0040 X:0000 Y:A7E9 P:envMxdizc
$86/81E8 DA          PHX                     A:0040 X:03A0 Y:A7E9 P:envMxdizc
$86/81E9 A6 3B       LDX $3B    [$00:003B]   A:0040 X:03A0 Y:A7E9 P:envMxdizc
$86/81EB A0 10 00    LDY #$0010              A:0040 X:0000 Y:A7E9 P:envMxdiZc
$86/81EE B2 23       LDA ($23)  [$8B:B5DF]   A:0040 X:0000 Y:0010 P:envMxdizc
$86/81F0 30 03       BMI $03    [$81F5]      A:0091 X:0000 Y:0010 P:eNvMxdizc

Code is missing here

$86/81F5 84 0E       STY $0E    [$00:000E]   A:0091 X:0000 Y:0010 P:eNvMxdizc
$86/81F7 4A          LSR A                   A:0091 X:0000 Y:0010 P:eNvMxdizc
$86/81F8 4A          LSR A                   A:0048 X:0000 Y:0010 P:envMxdizC
$86/81F9 4A          LSR A                   A:0024 X:0000 Y:0010 P:envMxdizc
$86/81FA 29 07       AND #$07                A:0012 X:0000 Y:0010 P:envMxdizc
$86/81FC 85 02       STA $02    [$00:0002]   A:0002 X:0000 Y:0010 P:envMxdizc
$86/81FE B2 23       LDA ($23)  [$8B:B5DF]   A:0002 X:0000 Y:0010 P:envMxdizc
$86/8200 29 07       AND #$07                A:0091 X:0000 Y:0010 P:eNvMxdizc
$86/8202 85 03       STA $03    [$00:0003]   A:0001 X:0000 Y:0010 P:envMxdizc
$86/8204 A0 01 00    LDY #$0001              A:0001 X:0000 Y:0010 P:envMxdizc
$86/8207 A5 06       LDA $06    [$00:0006]   A:0001 X:0000 Y:0001 P:envMxdizc
$86/8209 0A          ASL A                   A:0006 X:0000 Y:0001 P:envMxdizc
$86/820A 0A          ASL A                   A:000C X:0000 Y:0001 P:envMxdizc
$86/820B 7B          TDC                     A:0018 X:0000 Y:0001 P:envMxdizc
$86/820C B1 23       LDA ($23),y[$8B:B5E0]   A:0000 X:0000 Y:0001 P:envMxdiZc
$86/820E 90 06       BCC $06    [$8216]      A:00F8 X:0000 Y:0001 P:eNvMxdizc

Code is missing here

$86/8216 C2 20       REP #$20                A:00F8 X:0000 Y:0001 P:eNvMxdizc
$86/8218 C9 80 00    CMP #$0080              A:00F8 X:0000 Y:0001 P:eNvmxdizc
$86/821B 90 03       BCC $03    [$8220]      A:00F8 X:0000 Y:0001 P:envmxdizC
$86/821D E9 00 01    SBC #$0100              A:00F8 X:0000 Y:0001 P:envmxdizC
$86/8220 18          CLC                     A:FFF8 X:0000 Y:0001 P:eNvmxdizc
$86/8221 7D 43 07    ADC $0743,x[$8B:0743]   A:FFF8 X:0000 Y:0001 P:eNvmxdizc
$86/8224 85 0A       STA $0A    [$00:000A]   A:0088 X:0000 Y:0001 P:envmxdizC
$86/8226 E2 20       SEP #$20                A:0088 X:0000 Y:0001 P:envmxdizC
$86/8228 C8          INY                     A:0088 X:0000 Y:0001 P:envMxdizC
$86/8229 A5 06       LDA $06    [$00:0006]   A:0088 X:0000 Y:0002 P:envMxdizC
$86/822B 0A          ASL A                   A:0006 X:0000 Y:0002 P:envMxdizC
$86/822C 7B          TDC                     A:000C X:0000 Y:0002 P:envMxdizc
$86/822D B1 23       LDA ($23),y[$8B:B5E1]   A:0000 X:0000 Y:0002 P:envMxdiZc
$86/822F 90 06       BCC $06    [$8237]      A:00F6 X:0000 Y:0002 P:eNvMxdizc

Code is missing here

$86/8237 C2 20       REP #$20                A:00F6 X:0000 Y:0002 P:eNvMxdizc
$86/8239 C9 80 00    CMP #$0080              A:00F6 X:0000 Y:0002 P:eNvmxdizc
$86/823C 90 03       BCC $03    [$8241]      A:00F6 X:0000 Y:0002 P:envmxdizC
$86/823E E9 00 01    SBC #$0100              A:00F6 X:0000 Y:0002 P:envmxdizC
$86/8241 18          CLC                     A:FFF6 X:0000 Y:0002 P:eNvmxdizc
$86/8242 7D 83 07    ADC $0783,x[$8B:0783]   A:FFF6 X:0000 Y:0002 P:eNvmxdizc
$86/8245 3A          DEC A                   A:003D X:0000 Y:0002 P:envmxdizC
$86/8246 85 20       STA $20    [$00:0020]   A:003C X:0000 Y:0002 P:envmxdizC
$86/8248 E2 20       SEP #$20                A:003C X:0000 Y:0002 P:envmxdizC
$86/824A C8          INY                     A:003C X:0000 Y:0002 P:envMxdizC
$86/824B FA          PLX                     A:003C X:0000 Y:0003 P:envMxdizC
$86/824C A5 02       LDA $02    [$00:0002]   A:003C X:03A0 Y:0003 P:envMxdizC
$86/824E 85 04       STA $04    [$00:0004]   A:0002 X:03A0 Y:0003 P:envMxdizC
$86/8250 C2 20       REP #$20                A:0002 X:03A0 Y:0003 P:envMxdizC
$86/8252 A5 20       LDA $20    [$00:0020]   A:0002 X:03A0 Y:0003 P:envmxdizC
$86/8254 85 0C       STA $0C    [$00:000C]   A:003C X:03A0 Y:0003 P:envmxdizC
$86/8256 B1 23       LDA ($23),y[$8B:B5E2]   A:003C X:03A0 Y:0003 P:envmxdizC
$86/8258 C9 FF FF    CMP #$FFFF              A:0000 X:03A0 Y:0003 P:envmxdiZC
$86/825B D0 07       BNE $07    [$8264]      A:0000 X:03A0 Y:0003 P:envmxdizc

Code is missing here

$86/8264 A5 0C       LDA $0C    [$00:000C]   A:0000 X:03A0 Y:0003 P:envmxdizc
$86/8266 38          SEC                     A:003C X:03A0 Y:0003 P:envmxdizc
$86/8267 ED 97 05    SBC $0597  [$8B:0597]   A:003C X:03A0 Y:0003 P:envmxdizC
$86/826A C9 E0 00    CMP #$00E0              A:0064 X:03A0 Y:0003 P:envmxdizc
$86/826D 90 05       BCC $05    [$8274]      A:0064 X:03A0 Y:0003 P:eNvmxdizc

Code is missing here

$86/8274 E2 20       SEP #$20                A:0064 X:03A0 Y:0003 P:eNvmxdizc
$86/8276 95 01       STA $01,x  [$00:03A1]   A:0064 X:03A0 Y:0003 P:eNvMxdizc
$86/8278 C2 20       REP #$20                A:0064 X:03A0 Y:0003 P:eNvMxdizc
$86/827A A5 0A       LDA $0A    [$00:000A]   A:0064 X:03A0 Y:0003 P:eNvmxdizc
$86/827C 38          SEC                     A:0088 X:03A0 Y:0003 P:envmxdizc
$86/827D ED 95 05    SBC $0595  [$8B:0595]   A:0088 X:03A0 Y:0003 P:envmxdizC
$86/8280 C9 00 01    CMP #$0100              A:0078 X:03A0 Y:0003 P:envmxdizC
$86/8283 90 05       BCC $05    [$828A]      A:0078 X:03A0 Y:0003 P:eNvmxdizc

Code is missing here

$86/828A E2 20       SEP #$20                A:0078 X:03A0 Y:0003 P:eNvmxdizc
$86/828C 95 00       STA $00,x  [$00:03A0]   A:0078 X:03A0 Y:0003 P:eNvMxdizc
$86/828E EB          XBA                     A:0078 X:03A0 Y:0003 P:eNvMxdizc
$86/828F 4A          LSR A                   A:7800 X:03A0 Y:0003 P:envMxdiZc
$86/8290 66 28       ROR $28    [$00:0028]   A:7800 X:03A0 Y:0003 P:envMxdiZc
$86/8292 80 09       BRA $09    [$829D]      A:7800 X:03A0 Y:0003 P:envMxdizc

Code is missing here

$86/829D A5 05       LDA $05    [$00:0005]   A:7800 X:03A0 Y:0003 P:envMxdizc
$86/829F D0 16       BNE $16    [$82B7]      A:7801 X:03A0 Y:0003 P:envMxdizc

Code is missing here

$86/82B7 B1 23       LDA ($23),y[$8B:B5E2]   A:7801 X:03A0 Y:0003 P:envMxdizc
$86/82B9 18          CLC                     A:7800 X:03A0 Y:0003 P:envMxdiZc
$86/82BA 65 08       ADC $08    [$00:0008]   A:7800 X:03A0 Y:0003 P:envMxdiZc
$86/82BC 95 02       STA $02,x  [$00:03A2]   A:7840 X:03A0 Y:0003 P:envMxdizc
$86/82BE 08          PHP                     A:7840 X:03A0 Y:0003 P:envMxdizc
$86/82BF 51 23       EOR ($23),y[$8B:B5E2]   A:7840 X:03A0 Y:0003 P:envMxdizc
$86/82C1 29 10       AND #$10                A:7840 X:03A0 Y:0003 P:envMxdizc
$86/82C3 18          CLC                     A:7800 X:03A0 Y:0003 P:envMxdiZc
$86/82C4 75 02       ADC $02,x  [$00:03A2]   A:7800 X:03A0 Y:0003 P:envMxdiZc
$86/82C6 95 02       STA $02,x  [$00:03A2]   A:7840 X:03A0 Y:0003 P:envMxdizc
$86/82C8 C8          INY                     A:7840 X:03A0 Y:0003 P:envMxdizc
$86/82C9 B1 23       LDA ($23),y[$8B:B5E3]   A:7840 X:03A0 Y:0004 P:envMxdizc
$86/82CB C8          INY                     A:7800 X:03A0 Y:0004 P:envMxdiZc
$86/82CC 85 25       STA $25    [$00:0025]   A:7800 X:03A0 Y:0005 P:envMxdizc
$86/82CE A5 06       LDA $06    [$00:0006]   A:7800 X:03A0 Y:0005 P:envMxdizc
$86/82D0 29 0E       AND #$0E                A:7806 X:03A0 Y:0005 P:envMxdizc
$86/82D2 F0 08       BEQ $08    [$82DC]      A:7806 X:03A0 Y:0005 P:envMxdizc
$86/82D4 EB          XBA                     A:7806 X:03A0 Y:0005 P:envMxdizc
$86/82D5 A9 0E       LDA #$0E                A:0678 X:03A0 Y:0005 P:envMxdizc
$86/82D7 14 25       TRB $25    [$00:0025]   A:060E X:03A0 Y:0005 P:envMxdizc
$86/82D9 EB          XBA                     A:060E X:03A0 Y:0005 P:envMxdiZc
$86/82DA 04 25       TSB $25    [$00:0025]   A:0E06 X:03A0 Y:0005 P:envMxdizc
$86/82DC A5 06       LDA $06    [$00:0006]   A:0E06 X:03A0 Y:0005 P:envMxdiZc
$86/82DE 29 C0       AND #$C0                A:0E06 X:03A0 Y:0005 P:envMxdizc
$86/82E0 45 25       EOR $25    [$00:0025]   A:0E00 X:03A0 Y:0005 P:envMxdiZc
$86/82E2 28          PLP                     A:0E06 X:03A0 Y:0005 P:envMxdizc
$86/82E3 65 09       ADC $09    [$00:0009]   A:0E06 X:03A0 Y:0005 P:envMxdizc
$86/82E5 85 25       STA $25    [$00:0025]   A:0E06 X:03A0 Y:0005 P:envMxdizc
$86/82E7 A5 06       LDA $06    [$00:0006]   A:0E06 X:03A0 Y:0005 P:envMxdizc
$86/82E9 29 30       AND #$30                A:0E06 X:03A0 Y:0005 P:envMxdizc
$86/82EB D0 03       BNE $03    [$82F0]      A:0E00 X:03A0 Y:0005 P:envMxdiZc
$86/82ED 20 61 83    JSR $8361  [$86:8361]   A:0E00 X:03A0 Y:0005 P:envMxdiZc

$86/8496 Check if more Sprites are needed and clear OAM entries for it

This seems to check if the program needs more, less or the same number of sprites in the next frame as it does in the current one.

$86/8496 A2 42 05    LDX #$0542    ; Load Number of free Sprites in OAM at $7E0100
$86/8499 A0 20 03    LDY #$0320    ; Test if OAM buffer at $320 is active or not
$86/849C CC 45 05    CPY $0545
$86/849F D0 03       BNE $03       ; [$84A4] If $100 is active, keep X = #$0542, else...
$86/84A1 A2 41 05    LDX #$0541    ; replace it with #$0541
$86/84A4 86 02       STX $02       ; Temp store it
$86/84A6 7B          TDC           ; Clear 16-bit A
$86/84A7 A5 2B       LDA $2B       ; Load number of free sprites
$86/84A9 F0 28       BEQ $28       ; [$84D3] Exit if none is free
$86/84AB 38          SEC
$86/84AC F2 02       SBC ($02)     ; Subtract the old value (in $0541 or $0542)
$86/84AE 90 17       BCC $17       ; [$84C7] Branch if the number of needed sprites has decreased
$86/84B0 F0 15       BEQ $15       ; [$84C7] Branch if the number of needed sprites is the same as before

If more sprites are needed

$86/84B2 A8          TAY           ; Y contains the additional amount of sprites needed in this frame
$86/84B3 A6 29       LDX $29       ; Load start point of OAM low table
$86/84B5 C2 20       REP #$20
$86/84B7 A9 00 E8    LDA #$E800    ; Clear the additionally needed OAM Low Table entries
$86/84BA 95 00       STA $00,x     ; Sprite position: 0 to the left, appear at scanline 232 (outside the visible area)
$86/84BC 74 02       STZ $02,x     ; H/V flip, priority 2, palette 4
$86/84BE E8          INX           ; Increment write index to point to the next entry's start
$86/84BF E8          INX
$86/84C0 E8          INX
$86/84C1 E8          INX
$86/84C2 88          DEY           ; Decrement number of additionally needed sprite entries
$86/84C3 D0 F5       BNE $F5       ; [$84BA] Loop until all of them are done
$86/84C5 E2 20       SEP #$20

If less or the same number of sprites are needed

$86/84C7 A5 28       LDA $28       ; ??? Probably the number of used OAM entries (= sprites)?
$86/84C9 C9 80       CMP #$80      ; ??? Are all sprites used(?)
$86/84CB F0 06       BEQ $06       ; [$84D3] ??? Exit if equal
$86/84CD 4A          LSR A         ; ???
$86/84CE 4A          LSR A         ; ???
$86/84CF 90 FC       BCC $FC       ; [$84CD] ???
$86/84D1 92 26       STA ($26)     ; ???
$86/84D3 A5 2B       LDA $2B       ; Store number of free Sprites in $0541/$0542
$86/84D5 92 02       STA ($02)
$86/84D7 60          RTS

$88/84D8 ?

$86/84D8 8B          PHB           ; Buffer Data Bank on Stack
$86/84D9 A9 7E       LDA #$7E      ; Set Data Bank to $7E
$86/84DB 48          PHA
$86/84DC AB          PLB
$86/84DD A0 C4 BD    LDY #$BDC4    ; Write "$0000" for #$80 bytes at $7E/BDC4
$86/84E0 A2 80 00    LDX #$0080
$86/84E3 7B          TDC
$86/84E4 C2 20       REP #$20
$86/84E6 22 C8 9D 80 JSL $809DC8   ; Long Jump to Write Empty Tilemap in WRAM
$86/84EA E2 20       SEP #$20                A:0000 X:AD38 Y:BE44 P:eNvmxdIzc
$86/84EC A0 03 00    LDY #$0003              A:0000 X:AD38 Y:BE44 P:eNvMxdIzc
$86/84EF A2 79 00    LDX #$0079              A:0000 X:AD38 Y:0003 P:envMxdIzc
$86/84F2 22 B6 A6 9B JSL $9BA6B6[$9B:A6B6]   A:0000 X:0079 Y:0003 P:envMxdIzc
$86/84F6 E8          INX                     A:0000 X:0079 Y:0003 P:envMxdIzc
$86/84F7 88          DEY                     A:0000 X:007A Y:0003 P:envMxdIzc
$86/84F8 D0 F8       BNE $F8    [$84F2]      A:0000 X:007A Y:0002 P:envMxdIzc
$86/84FA AB          PLB           ; Restore Data Bank on Stack
$86/84FB 6B          RTL

Bank $88

$88/8000 ?

$88/8000 AE 47 05    LDX $0547     ; ??? ("Has-Joypad-inputs"-register?)
$88/8003 F0 4F       BEQ $4F       ; [$8054]
$88/8005 A5 A1       LDA $A1    [$00:00A1]   A:0000 X:0101 Y:0004 P:enVMxdIzC
$88/8007 89 81       BIT #$81                A:0000 X:0101 Y:0004 P:enVMxdIZC
$88/8009 D0 00       BNE $00       ; [$800B] this line could be removed(?)
$88/800B A2 00 00    LDX #$0000              A:0000 X:0101 Y:0004 P:enVMxdIZC
$88/800E 7B          TDC                     A:0000 X:0000 Y:0004 P:enVMxdIZC
$88/800F AD 5B 05    LDA $055B  [$80:055B]   A:0000 X:0000 Y:0004 P:enVMxdIZC
$88/8012 29 7F       AND #$7F                A:0000 X:0000 Y:0004 P:enVMxdIZC
$88/8014 F0 21       BEQ $21    [$8037]      A:0000 X:0000 Y:0004 P:enVMxdIZC

Code is missing here

$88/8037 BD 47 05    LDA $0547,x[$80:0547]   A:0000 X:0000 Y:0004 P:enVMxdIZC
$88/803A F0 18       BEQ $18    [$8054]      A:0001 X:0000 Y:0004 P:enVMxdIzC
$88/803C 7B          TDC                     A:0001 X:0000 Y:0004 P:enVMxdIzC
$88/803D 8A          TXA                     A:0000 X:0000 Y:0004 P:enVMxdIZC
$88/803E 0A          ASL A                   A:0000 X:0000 Y:0004 P:enVMxdIZC
$88/803F AA          TAX                     A:0000 X:0000 Y:0004 P:enVMxdIZc
$88/8040 BC 49 05    LDY $0549,x   ; Joypad x Inputs
$88/8043 8C 61 05    STY $0561
$88/8046 BC 51 05    LDY $0551,x   ; Last frame's Joypad x Inputs
$88/8049 8C 63 05    STY $0563
$88/804C BC 4D 05    LDY $054D,x   ; Joypad x held buttons
$88/804F 8C 65 05    STY $0565
$88/8052 80 0C       BRA $0C       ; [$8060] Exit

Code is missing here

$88/8060 6B          RTL

$88/9E40 ?

$88/9E40 8B          PHB           ; Preserve Program Bank
$88/9E41 4B          PHK
$88/9E42 AB          PLB
$88/9E43 A0 00 A8    LDY #$A800    ; Setup write address for the Tilemap Rectangle Builder
$88/9E46 84 20       STY $20       ; This time, it's the BG3 Buffer for the Battle Stats Menu
$88/9E48 A9 7E       LDA #$7E
$88/9E4A 85 22       STA $22
$88/9E4C A9 08       LDA #$08      ; Tilemap Rectangle Builder: Number of Columns
$88/9E4E 85 00       STA $00
$88/9E50 A9 04       LDA #$04      ; Tilemap Rectangle Builder: Number of Rows
$88/9E52 85 02       STA $02
$88/9E54 A0 42 00    LDY #$0042    ; Where to write index: $42 Bytes after the buffer begin
$88/9E57 A5 04       LDA $04    [$00:0004]   A:2004 X:0000 Y:0042 P:envMxdizc
$88/9E59 05 05       ORA $05    [$00:0005]   A:2008 X:0000 Y:0042 P:envMxdizc
$88/9E5B D0 09       BNE $09    [$9E66]      A:2008 X:0000 Y:0042 P:envMxdizc

Code is missing here

$88/9E66 A2 9F 9E    LDX #$9E9F              A:2008 X:0000 Y:0042 P:envMxdizc
$88/9E69 22 05 A4 80 JSL $80A405[$80:A405]   A:2008 X:9E9F Y:0042 P:eNvMxdizc
$88/9E6D A9 06       LDA #$06      ; Tilemap Rectangle Builder: Number of Columns
$88/9E6F 85 00       STA $00
$88/9E71 A9 02       LDA #$02      ; Tilemap Rectangle Builder: Number of Rows
$88/9E73 85 02       STA $02
$88/9E75 A0 B2 00    LDY #$00B2              A:0102 X:9EDF Y:0142 P:envMxdizc
$88/9E78 A5 06       LDA $06    [$00:0006]   A:0102 X:9EDF Y:00B2 P:envMxdizc
$88/9E7A D0 09       BNE $09    [$9E85]      A:0103 X:9EDF Y:00B2 P:envMxdizc

Code is missing here

$88/9E85 A2 DF 9E    LDX #$9EDF              A:0103 X:9EDF Y:00B2 P:envMxdizc
$88/9E88 22 05 A4 80 JSL $80A405[$80:A405]   A:0103 X:9EDF Y:00B2 P:eNvMxdizc
$88/9E8C 22 EB 9E 80 JSL $809EEB   ; VRAM DMA of the following data:
$88/9E90 40 A8 7E    Address:      $7E/A840
$88/9E93 20 3C       VRAM Address:    $3C20 (Battle Stat Menu BG3 Tilemap + $20, skips the menu border tile line)
$88/9E95 D2 00       Transfer         $00D2 Bytes
$88/9E97 22 D9 BA 82 JSL $82BAD9[$82:BAD9]   A:A880 X:0200 Y:3C20 P:eNvMxdizc
$88/9E9B AB          PLB           ; Restore Program Bank
$88/9E9C 6B          RTL

Bank $89

$89/B62A ?

During the new game creation process, this is executed when one of these artworks gets loaded

$89/B62A 22 EB 9E 80 JSL $809EEB   ; VRAM DMA of the following data:
$89/B62E 80 F1 7F    Address:      $7F/F180
$89/B631 C0 7E       VRAM Address:    $7EC0
$89/B633 00 01       Transfer         $0100 Bytes
$89/B635 60          RTS

$89/BE00 ?

During the new game creation process, this is executed when one of these artworks gets loaded

This sets the BG2 tilemap (which is the artwork of the figure)

$89/BE00 A2 80 ED    LDX #$ED80    ; Set up data transfer to $7FED80
$89/BE03 86 20       STX $20
$89/BE05 A9 7F       LDA #$7F
$89/BE07 85 22       STA $22
$89/BE09 A6 DF       LDX $DF    [$00:00DF]   A:FF7F X:ED80 Y:61D7 P:envMxdizC
$89/BE0B 7B          TDC                     A:FF7F X:2000 Y:61D7 P:envMxdizC
$89/BE0C BD 27 00    LDA $0027,x[$7E:2027]   A:0000 X:2000 Y:61D7 P:envMxdiZC
$89/BE0F EB          XBA                     A:0002 X:2000 Y:61D7 P:envMxdizC
$89/BE10 C2 20       REP #$20                A:0200 X:2000 Y:61D7 P:envMxdiZC
$89/BE12 0A          ASL A                   A:0200 X:2000 Y:61D7 P:envmxdiZC
$89/BE13 0A          ASL A                   A:0400 X:2000 Y:61D7 P:envmxdizc
$89/BE14 65 5C       ADC $5C    [$00:005C]   A:0800 X:2000 Y:61D7 P:envmxdizc
$89/BE16 AA          TAX                     A:59D7 X:2000 Y:61D7 P:envmxdizc
$89/BE17 E2 20       SEP #$20                A:59D7 X:59D7 Y:61D7 P:envmxdizc
$89/BE19 A9 7E       LDA #$7E
$89/BE1B A0 00 04    LDY #$0400    ; Transfer $0400 Byte
$89/BE1E 22 33 8D 9A JSL $9A8D33   ; Transfer Data from $7E/59D7 to $7F/ED80
$89/BE22 A9 80       LDA #$80      ; VRAM transfer settings ($2115)
$89/BE24 85 0E       STA $0E
$89/BE26 A2 00 04    LDX #$0400    ; Number of Bytes to transfer: #$400
$89/BE29 86 0C       STX $0C
$89/BE2B A0 C0 7C    LDY #$7CC0    ; VRAM Destination $7CC0
$89/BE2E A2 80 ED    LDX #$ED80    ; Source Address: $7F/ED80
$89/BE31 A9 7F       LDA #$7F
$89/BE33 22 24 9F 80 JSL $809F24   ; VRAM DMA
$89/BE37 60          RTS

Bank $8F

$8F/83DB Sound-related stuff

$8F/83DB C5 FA       CMP $FA       ; ???
$8F/83DD D0 2B       BNE $2B    [$840A]
$8F/83DF A5 F5       LDA $F5
$8F/83E1 05 F6       ORA $F6
$8F/83E3 05 F7       ORA $F7
$8F/83E5 F0 21       BEQ $21       ; If $F5/$F6/$F7 are empty, exit
$8F/83E7 A5 F5       LDA $F5       ; Transfer buffer to $2140
$8F/83E9 8D 40 21    STA $2140
$8F/83EC A5 F6       LDA $F6       ; Transfer buffer to $2141
$8F/83EE 8D 41 21    STA $2141
$8F/83F1 A5 F7       LDA $F7       ; Transfer buffer to $2142
$8F/83F3 8D 42 21    STA $2142
$8F/83F6 64 F5       STZ $F5       ; Clear buffers $F5, $F6 and $F7
$8F/83F8 64 F6       STZ $F6
$8F/83FA 64 F7       STZ $F7
$8F/83FC A5 FA       LDA $FA       ; Transfer buffer to $2143
$8F/83FE 8D 43 21    STA $2143
$8F/8401 1A          INC A         ; Increment $FA value
$8F/8402 29 7F       AND #$7F      ; If it turned #$80 ==> #$00
$8F/8404 F0 FB       BEQ $FB       ; If #$00 ==> Increment again
$8F/8406 85 FA       STA $FA       ; Store back in $FA
$8F/8408 18          CLC           ; ???
$8F/8409 6B          RTL

Bank $99

$99/8A23 ?

$99/8A23 E2 20       SEP #$20                A:937E X:932C Y:0100 P:envMxdizC
$99/8A25 A6 E1       LDX $E1    [$00:00E1]   A:937E X:932C Y:0100 P:envMxdizC
$99/8A27 BC 06 00    LDY $0006,x[$7E:3306]   A:937E X:3300 Y:0100 P:envMxdizC
$99/8A2A 84 E3       STY $E3    [$00:00E3]   A:937E X:3300 Y:375A P:envMxdizC
$99/8A2C BD 08 00    LDA $0008,x[$7E:3308]   A:937E X:3300 Y:375A P:envMxdizC
$99/8A2F 85 E5       STA $E5    [$00:00E5]   A:937E X:3300 Y:375A P:envMxdizC
$99/8A31 E2 20       SEP #$20                A:937E X:3300 Y:375A P:envMxdizC
$99/8A33 A6 E1       LDX $E1    [$00:00E1]   A:937E X:3300 Y:375A P:envMxdizC
$99/8A35 7B          TDC                     A:937E X:3300 Y:375A P:envMxdizC
$99/8A36 BD 0B 00    LDA $000B,x[$7E:330B]   A:0000 X:3300 Y:375A P:envMxdiZC
$99/8A39 F0 0A       BEQ $0A    [$8A45]      A:0000 X:3300 Y:375A P:envMxdiZC
$99/8A45 7B          TDC                     A:0000 X:3300 Y:375A P:envMxdiZC
$99/8A46 A7 E3       LDA [$E3]  [$7E:375A]   A:0000 X:3300 Y:375A P:envMxdiZC
$99/8A48 C9 FF       CMP #$FF                A:0065 X:3300 Y:375A P:envMxdizC
$99/8A4A D0 08       BNE $08    [$8A54]      A:0065 X:3300 Y:375A P:envMxdizc
$99/8A54 C2 20       REP #$20                A:0065 X:3300 Y:375A P:envMxdizc
$99/8A56 0A          ASL A                   A:0065 X:3300 Y:375A P:envmxdizc
$99/8A57 AA          TAX                     A:00CA X:3300 Y:375A P:envmxdizc
$99/8A58 E6 E3       INC $E3    [$00:00E3]   A:00CA X:00CA Y:375A P:envmxdizc
$99/8A5A 7C 77 8A    JMP ($8A77,x)[$99:901B] A:00CA X:00CA Y:375A P:envmxdizc

$99/8A77 Table for $99/8A23

01 92   Entry #$00
0B 92   Entry #$01
15 92   Entry #$02
26 92   Entry #$03
37 92   Entry #$04
4F 92   Entry #$05
60 92   Entry #$06
71 92   Entry #$07
81 92   Entry #$08
8E 92   Entry #$09
9B 92   Entry #$0A
A8 92   Entry #$0B
B5 92   Entry #$0C
BF 92   Entry #$0D
71 8C   Entry #$0E
31 8A   Entry #$0F - Direct Return to the Main Subroutine
F0 92   Entry #$10
20 93   Entry #$11
71 8C   Entry #$12
50 93   Entry #$13
E7 93   Entry #$14
71 8C   Entry #$15
BB 9B   Entry #$16
DC 9B   Entry #$17
0D 9C   Entry #$18
18 9C   Entry #$19
4A 9C   Entry #$1A
91 9C   Entry #$1B
D0 9C   Entry #$1C
DA 9C   Entry #$1D
DA 9C   Entry #$1E
71 8C   Entry #$1F
73 8C   Entry #$20
79 98   Entry #$21
9D 99   Entry #$22
92 8C   Entry #$23
0B 99   Entry #$24
2F 9A   Entry #$25
03 99   Entry #$26
27 9A   Entry #$27
ED 94   Entry #$28
F1 96   Entry #$29
76 97   Entry #$2A
F8 97   Entry #$2B
E5 94   Entry #$2C
E9 96   Entry #$2D
7F 98   Entry #$2E
A3 99   Entry #$2F
6A 9F   Entry #$30
96 9F   Entry #$31
2E BD   Entry #$32
DA C2   Entry #$33
00 C5   Entry #$34
12 C5   Entry #$35
CE C0   Entry #$36
28 C7   Entry #$37
28 C8   Entry #$38
43 C8   Entry #$39
AB BE   Entry #$3A
EA 9C   Entry #$3B
F3 9C   Entry #$3C
F7 C5   Entry #$3D
5E B2   Entry #$3E
56 B2   Entry #$3F
D0 B2   Entry #$40
C4 B2   Entry #$41
DA 9C   Entry #$42
DA 9C   Entry #$43
EE BC   Entry #$44
DE 9C   Entry #$45
DE 9C   Entry #$46
E6 9F   Entry #$47
DE 9C   Entry #$48
DE 9C   Entry #$49
EF B5   Entry #$4A
EF B5   Entry #$4B
B8 9A   Entry #$4C
65 9E   Entry #$4D
DE 9E   Entry #$4E
E9 9E   Entry #$4F
BA B1   Entry #$50
38 9F   Entry #$51
AB C7   Entry #$52
EF C7   Entry #$53
25 C5   Entry #$54
3A C4   Entry #$55
75 C4   Entry #$56
5E C8   Entry #$57
BD 9F   Entry #$58
FD 9F   Entry #$59
27 A0   Entry #$5A
C0 BE   Entry #$5B
73 C0   Entry #$5C
ED C0   Entry #$5D
2B C0   Entry #$5E
FA C3   Entry #$5F
FD 9B   Entry #$60
05 BC   Entry #$61
E4 BC   Entry #$62
DA C2   Entry #$63
49 A0   Entry #$64
1B 90   Entry #$65 - Load Music(?)

$99/901B ?

$99/901B E2 20       SEP #$20                A:00CA X:00CA Y:375A P:envmxdizc
$99/901D AD AC 17    LDA $17AC  [$7E:17AC]   A:00CA X:00CA Y:375A P:envMxdizc
$99/9020 48          PHA                     A:0000 X:00CA Y:375A P:envMxdiZc
$99/9021 9C AC 17    STZ $17AC  [$7E:17AC]   A:0000 X:00CA Y:375A P:envMxdiZc
$99/9024 7B          TDC                     A:0000 X:00CA Y:375A P:envMxdiZc
$99/9025 A7 E3       LDA [$E3]  [$7E:375B]   A:0000 X:00CA Y:375A P:envMxdiZc
$99/9027 C9 4D       CMP #$4D                A:000D X:00CA Y:375A P:envMxdizc
$99/9029 B0 14       BCS $14    [$903F]      A:000D X:00CA Y:375A P:eNvMxdizc
$99/902B A8          TAY                     A:000D X:00CA Y:375A P:eNvMxdizc
$99/902C A2 5E 90    LDX #$905E              A:000D X:00CA Y:000D P:envMxdizc
$99/902F A9 99       LDA #$99                A:000D X:905E Y:000D P:eNvMxdizc
$99/9031 22 8F EF 81 JSL $81EF8F[$81:EF8F]   A:0099 X:905E Y:000D P:eNvMxdizc
$99/9035 B0 08       BCS $08    [$903F]      A:0020 X:905F Y:000D P:envMxdizc
$99/9037 A7 E3       LDA [$E3]  [$7E:375B]   A:0020 X:905F Y:000D P:envMxdizc
$99/9039 22 F2 AE 80 JSL $80AEF2   ; Load Music
$99/903D 80 14       BRA $14    [$9053]      A:0000 X:33CC Y:D686 P:envMxdizc
$99/9053 68          PLA                     A:0000 X:33CC Y:D686 P:envMxdizc
$99/9054 8D AC 17    STA $17AC  [$7E:17AC]   A:0000 X:33CC Y:D686 P:envMxdiZc
$99/9057 C2 20       REP #$20                A:0000 X:33CC Y:D686 P:envMxdiZc
$99/9059 E6 E3       INC $E3    [$00:00E3]   A:0000 X:33CC Y:D686 P:envmxdiZc
$99/905B 4C 31 8A    JMP $8A31  [$99:8A31]   A:0000 X:33CC Y:D686 P:envmxdizc

$99/D056 ?

$99/D056 C2 21       REP #$21                A:0B00 X:3300 Y:0014 P:envMxdiZC
$99/D058 A6 E1       LDX $E1    [$00:00E1]   A:0B00 X:3300 Y:0014 P:envmxdiZc
$99/D05A AD 91 05    LDA $0591  [$7E:0591]   A:0B00 X:3300 Y:0014 P:envmxdizc
$99/D05D 69 00 10    ADC #$1000              A:00E6 X:3300 Y:0014 P:envmxdizc
$99/D060 85 0A       STA $0A    [$00:000A]   A:10E6 X:3300 Y:0014 P:envmxdizc
$99/D062 BD 12 00    LDA $0012,x[$7E:3312]   A:10E6 X:3300 Y:0014 P:envmxdizc
$99/D065 18          CLC                     A:00B0 X:3300 Y:0014 P:envmxdizc
$99/D066 69 00 10    ADC #$1000              A:00B0 X:3300 Y:0014 P:envmxdizc
$99/D069 85 0C       STA $0C    [$00:000C]   A:10B0 X:3300 Y:0014 P:envmxdizc
$99/D06B BD 16 00    LDA $0016,x[$7E:3316]   A:10B0 X:3300 Y:0014 P:envmxdizc
$99/D06E 85 08       STA $08    [$00:0008]   A:006D X:3300 Y:0014 P:envmxdizc
$99/D070 A5 0A       LDA $0A    [$00:000A]   A:006D X:3300 Y:0014 P:envmxdizc
$99/D072 38          SEC                     A:10E6 X:3300 Y:0014 P:envmxdizc
$99/D073 E5 0C       SBC $0C    [$00:000C]   A:10E6 X:3300 Y:0014 P:envmxdizC
$99/D075 10 04       BPL $04    [$D07B]      A:0036 X:3300 Y:0014 P:envmxdizC
Code is missing here
$99/D07B 64 02       STZ $02    [$00:0002]   A:0036 X:3300 Y:0014 P:envmxdizC
$99/D07D 64 00       STZ $00    [$00:0000]   A:0036 X:3300 Y:0014 P:envmxdizC
$99/D07F 85 01       STA $01    [$00:0001]   A:0036 X:3300 Y:0014 P:envmxdizC
$99/D081 22 06 A6 80 JSL $80A606[$80:A606]   A:0036 X:3300 Y:0014 P:envmxdizC
$99/D085 A5 0A       LDA $0A    [$00:000A]   A:005A X:3300 Y:0014 P:envmxdizC
$99/D087 C5 0C       CMP $0C    [$00:000C]   A:10E6 X:3300 Y:0014 P:envmxdizC
$99/D089 90 1C       BCC $1C    [$D0A7]      A:10E6 X:3300 Y:0014 P:envmxdizC
$99/D08B E2 21       SEP #$21                A:10E6 X:3300 Y:0014 P:envmxdizC
$99/D08D BD 18 00    LDA $0018,x[$7E:3318]   A:10E6 X:3300 Y:0014 P:envMxdizC
$99/D090 E5 04       SBC $04    [$00:0004]   A:10CE X:3300 Y:0014 P:eNvMxdizC
$99/D092 9D 18 00    STA $0018,x[$7E:3318]   A:1050 X:3300 Y:0014 P:enVMxdizC
$99/D095 AD 91 05    LDA $0591  [$7E:0591]   A:1050 X:3300 Y:0014 P:enVMxdizC
$99/D098 E5 05       SBC $05    [$00:0005]   A:10E6 X:3300 Y:0014 P:eNVMxdizC
$99/D09A 8D 91 05    STA $0591  [$7E:0591]   A:10E6 X:3300 Y:0014 P:eNvMxdizC
$99/D09D AD 92 05    LDA $0592  [$7E:0592]   A:10E6 X:3300 Y:0014 P:eNvMxdizC
$99/D0A0 E9 00       SBC #$00                A:1000 X:3300 Y:0014 P:envMxdiZC
$99/D0A2 8D 92 05    STA $0592  [$7E:0592]   A:1000 X:3300 Y:0014 P:envMxdiZC
$99/D0A5 80 1A       BRA $1A    [$D0C1]      A:1000 X:3300 Y:0014 P:envMxdiZC
Code is missing here
$99/D0C1 C2 21       REP #$21                A:1000 X:3300 Y:0014 P:envMxdiZC
$99/D0C3 A6 E1       LDX $E1    [$00:00E1]   A:1000 X:3300 Y:0014 P:envmxdiZc
$99/D0C5 AD 93 05    LDA $0593  [$7E:0593]   A:1000 X:3300 Y:0014 P:envmxdizc
$99/D0C8 69 00 10    ADC #$1000              A:0060 X:3300 Y:0014 P:envmxdizc
$99/D0CB 85 0A       STA $0A    [$00:000A]   A:1060 X:3300 Y:0014 P:envmxdizc
$99/D0CD BD 14 00    LDA $0014,x[$7E:3314]   A:1060 X:3300 Y:0014 P:envmxdizc
$99/D0D0 18          CLC                     A:0060 X:3300 Y:0014 P:envmxdizc
$99/D0D1 69 00 10    ADC #$1000              A:0060 X:3300 Y:0014 P:envmxdizc
$99/D0D4 85 0C       STA $0C    [$00:000C]   A:1060 X:3300 Y:0014 P:envmxdizc
$99/D0D6 BD 16 00    LDA $0016,x[$7E:3316]   A:1060 X:3300 Y:0014 P:envmxdizc
$99/D0D9 85 08       STA $08    [$00:0008]   A:006D X:3300 Y:0014 P:envmxdizc
$99/D0DB A5 0A       LDA $0A    [$00:000A]   A:006D X:3300 Y:0014 P:envmxdizc
$99/D0DD 38          SEC                     A:1060 X:3300 Y:0014 P:envmxdizc
$99/D0DE E5 0C       SBC $0C    [$00:000C]   A:1060 X:3300 Y:0014 P:envmxdizC
$99/D0E0 10 04       BPL $04    [$D0E6]      A:0000 X:3300 Y:0014 P:envmxdiZC
Code is missing here
$99/D0E6 64 02       STZ $02    [$00:0002]   A:0000 X:3300 Y:0014 P:envmxdiZC
$99/D0E8 64 00       STZ $00    [$00:0000]   A:0000 X:3300 Y:0014 P:envmxdiZC
$99/D0EA 85 01       STA $01    [$00:0001]   A:0000 X:3300 Y:0014 P:envmxdiZC
$99/D0EC 22 06 A6 80 JSL $80A606[$80:A606]   A:0000 X:3300 Y:0014 P:envmxdiZC
$99/D0F0 A5 0A       LDA $0A    [$00:000A]   A:0000 X:3300 Y:0014 P:envmxdizC
$99/D0F2 C5 0C       CMP $0C    [$00:000C]   A:1060 X:3300 Y:0014 P:envmxdizC
$99/D0F4 90 1C       BCC $1C    [$D112]      A:1060 X:3300 Y:0014 P:envmxdiZC
$99/D0F6 E2 21       SEP #$21                A:1060 X:3300 Y:0014 P:envmxdiZC
$99/D0F8 BD 19 00    LDA $0019,x[$7E:3319]   A:1060 X:3300 Y:0014 P:envMxdiZC
$99/D0FB E5 04       SBC $04    [$00:0004]   A:1024 X:3300 Y:0014 P:envMxdizC
$99/D0FD 9D 19 00    STA $0019,x[$7E:3319]   A:1024 X:3300 Y:0014 P:envMxdizC
$99/D100 AD 93 05    LDA $0593  [$7E:0593]   A:1024 X:3300 Y:0014 P:envMxdizC
$99/D103 E5 05       SBC $05    [$00:0005]   A:1060 X:3300 Y:0014 P:envMxdizC
$99/D105 8D 93 05    STA $0593  [$7E:0593]   A:1060 X:3300 Y:0014 P:envMxdizC
$99/D108 AD 94 05    LDA $0594  [$7E:0594]   A:1060 X:3300 Y:0014 P:envMxdizC
$99/D10B E9 00       SBC #$00      ; Subtract the Carry (if it was set by the low byte subtraction)
$99/D10D 8D 94 05    STA $0594  [$7E:0594]   A:1000 X:3300 Y:0014 P:envMxdiZC
$99/D110 80 1A       BRA $1A    [$D12C]      A:1000 X:3300 Y:0014 P:envMxdiZC
Code is missing here
$99/D12C C2 20       REP #$20                A:1000 X:3300 Y:0014 P:envMxdiZC
$99/D12E DE 16 00    DEC $0016,x[$7E:3316]   A:1000 X:3300 Y:0014 P:envmxdiZC
$99/D131 D0 11       BNE $11    [$D144]      A:1000 X:3300 Y:0014 P:envmxdizC
$99/D133 BD 12 00    LDA $0012,x[$7E:3312]   A:1000 X:3300 Y:0010 P:envmxdiZC
$99/D136 8D 91 05    STA $0591  [$7E:0591]   A:00B0 X:3300 Y:0010 P:envmxdizC
$99/D139 BD 14 00    LDA $0014,x[$7E:3314]   A:00B0 X:3300 Y:0010 P:envmxdizC
$99/D13C 8D 93 05    STA $0593  [$7E:0593]   A:0060 X:3300 Y:0010 P:envmxdizC
$99/D13F E2 20       SEP #$20                A:0060 X:3300 Y:0010 P:envmxdizC
$99/D141 9E 11 00    STZ $0011,x[$7E:3311]   A:0060 X:3300 Y:0010 P:envMxdizC
$99/D144 E2 20       SEP #$20
$99/D146 60          RTS
$99/D147 A6 E1       LDX $E1    [$00:00E1]   A:FF01 X:1744 Y:000A P:envMxdizC
$99/D149 BD 11 00    LDA $0011,x[$7E:3311]   A:FF01 X:3300 Y:000A P:envMxdizC
$99/D14C C9 02       CMP #$02                A:FF04 X:3300 Y:000A P:envMxdizC
$99/D14E F0 15       BEQ $15    [$D165]      A:FF04 X:3300 Y:000A P:envMxdizC
$99/D150 C9 04       CMP #$04                A:FF04 X:3300 Y:000A P:envMxdizC
$99/D152 F0 11       BEQ $11    [$D165]      A:FF04 X:3300 Y:000A P:envMxdiZC
$99/D154 C9 05       CMP #$05                A:FF00 X:3300 Y:000A P:eNvMxdizc
$99/D156 F0 0D       BEQ $0D    [$D165]      A:FF00 X:3300 Y:000A P:eNvMxdizc
$99/D158 22 AA 89 80 JSL $8089AA   ; Long Jump to Check if the Cursor is in Screen Center
$99/D15C C9 00       CMP #$00      ; Is the Cursor in Center?
$99/D15E D0 05       BNE $05       ; [$D165] Exit if not
Code is missing here
$99/D165 60          RTS                     A:FF04 X:3300 Y:000A P:envMxdiZC
$99/D166 A6 E1       LDX $E1    [$00:00E1]   A:0002 X:3300 Y:FFFE P:envMxdizC
$99/D168 BD 1D 00    LDA $001D,x[$7E:331D]   A:0002 X:3300 Y:FFFE P:envMxdizC
$99/D16B F0 5C       BEQ $5C    [$D1C9]      A:0000 X:3300 Y:FFFE P:envMxdiZC
$99/D1C9 60          RTS                     A:0000 X:3300 Y:FFFE P:envMxdiZC

Bank $9A

$9A/8D33 Transfer Data Loop

This is used at least during the new game creation process, this is executed when one of these artworks gets loaded

This subroutine moves data from one position to another via loop. As it is via loop, it makes more sense to use this method for smaller amounts of data. Should be noted that the transfer works with an 8-bit Accumulator, so it can transfer an odd number of bytes, too.

These registers have to contain the settings for this transfer:

A has to contain the bank where the data is (like, $7E or $7F)

X contains the address on that bank where the data is

Y contains the number of bytes to transfer

$20-$22 contains the 24-bit address where to store

$9A/8D33 8B          PHB           ; Preserve current Program Bank
$9A/8D34 48          PHA           ; Set the value in A as new Bank
$9A/8D35 AB          PLB
$9A/8D36 5A          PHY           ; Put Y (number of Bytes to transfer) on stack
$9A/8D37 A0 00 00    LDY #$0000    ; Set up write index
$9A/8D3A BD 00 00    LDA $0000,x   ; Load Byte
$9A/8D3D 97 20       STA [$20],y   ; Store Byte
$9A/8D3F E8          INX           ; Increment Read and Write Index
$9A/8D40 C8          INY
$9A/8D41 C2 20       REP #$20      ; This loads the number of bytes from stack, decrements it and stores it back
$9A/8D43 A3 01       LDA $01,s
$9A/8D45 3A          DEC A
$9A/8D46 83 01       STA $01,s
$9A/8D48 E2 20       SEP #$20
$9A/8D4A D0 EE       BNE $EE       ; [$8D3A] Loop until all bytes are done
$9A/8D4C 7A          PLY
$9A/8D4D AB          PLB           ; Restore Program Bank
$9A/8D4E 6B          RTL

Bank $9B

$9B/80DE ?

This subroutines main part is about copying three palettes; I *think* this is for the small figure you can see in the Battle Stats menu; that figure is on a BG plain, while the very same graphic you see above is a sprite. So, I think this is for this.

$9B/80DE 8B          PHB           ; Buffer Program Bank on Stack
$9B/80DF 4B          PHK
$9B/80E0 AB          PLB           ; Change Program Bank
$9B/80E1 DA          PHX           ; Buffer X and Y
$9B/80E2 5A          PHY
$9B/80E3 D4 00       PEI ($00)     ; Buffer registers $00 to $0F and $20 to $2B
$9B/80E5 D4 02       PEI ($02)
$9B/80E7 D4 04       PEI ($04)
$9B/80E9 D4 06       PEI ($06)
$9B/80EB D4 08       PEI ($08)
$9B/80ED D4 0A       PEI ($0A)
$9B/80EF D4 0C       PEI ($0C)
$9B/80F1 D4 0E       PEI ($0E)
$9B/80F3 D4 20       PEI ($20)
$9B/80F5 D4 22       PEI ($22)
$9B/80F7 D4 24       PEI ($24)
$9B/80F9 D4 26       PEI ($26)
$9B/80FB D4 28       PEI ($28)
$9B/80FD D4 2A       PEI ($2A)
$9B/80FF A2 00 00    LDX #$0000    ; Set up counter
$9B/8102 BD AE 17    LDA $17AE,x   ; Load each figure's graphic number (i. e. "this figure is Denam, it has Denam graphics")
$9B/8105 F0 3B       BEQ $3B       ; [$8142] Go to next figure if this is empty
$9B/8107 BC 3E 1E    LDY $1E3E,x   ; ???
$9B/810A C9 F0       CMP #$F0      ; ??? (Note to self: It's CMP, not CPY!)
$9B/810C F0 16       BEQ $16       ; [$8124] ???
$9B/810E BD DE 19    LDA $19DE,x   ; ??? (Status effects?)
$9B/8111 89 10       BIT #$10      ; ???
$9B/8113 F0 0F       BEQ $0F       ; [$8124] ???
$9B/8124 B9 03 07    LDA $0703,y   ; ???
$9B/8127 89 06       BIT #$06      ; ???
$9B/8129 F0 17       BEQ $17       ; [$8142] ???
$9B/812B 89 08       BIT #$08      ; ???
$9B/812D F0 13       BEQ $13       ; [$8142] ???

Code is missing here

$9B/8142 E8          INX           ; Increment Loop counter
$9B/8143 E8          INX
$9B/8144 E0 28 00    CPX #$0028    ; Loop until every figure is done
$9B/8147 90 B9       BCC $B9       ; [$8102]
$9B/8149 AD B9 05    LDA $05B9     ; ???
$9B/814C 29 18       AND #$18      ; ???
$9B/814E D0 1D       BNE $1D       ; [$816D] ???

Code is missing here

$9B/816D C2 20       REP #$20      ; This sets up and executes a loop that copies three palettes
$9B/816F A2 20 01    LDX #$0120
$9B/8172 A0 30 00    LDY #$0030
$9B/8175 BD 4B 12    LDA $124B,x
$9B/8178 9D CB 12    STA $12CB,x
$9B/817B E8          INX
$9B/817C E8          INX
$9B/817D 88          DEY
$9B/817E D0 F5       BNE $F5       ; [$8175]
$9B/8180 E2 20       SEP #$20
$9B/8182 A9 01       LDA #$01      ; Set flag for CGRAM update
$9B/8184 8D 49 12    STA $1249
$9B/8187 7A          PLY           ; Restore all the buffered registers
$9B/8188 84 2A       STY $2A
$9B/818A 7A          PLY
$9B/818B 84 28       STY $28
$9B/818D 7A          PLY
$9B/818E 84 26       STY $26
$9B/8190 7A          PLY
$9B/8191 84 24       STY $24
$9B/8193 7A          PLY
$9B/8194 84 22       STY $22
$9B/8196 7A          PLY
$9B/8197 84 20       STY $20
$9B/8199 7A          PLY
$9B/819A 84 0E       STY $0E
$9B/819C 7A          PLY
$9B/819D 84 0C       STY $0C
$9B/819F 7A          PLY
$9B/81A0 84 0A       STY $0A
$9B/81A2 7A          PLY
$9B/81A3 84 08       STY $08
$9B/81A5 7A          PLY
$9B/81A6 84 06       STY $06
$9B/81A8 7A          PLY
$9B/81A9 84 04       STY $04
$9B/81AB 7A          PLY
$9B/81AC 84 02       STY $02
$9B/81AE 7A          PLY
$9B/81AF 84 00       STY $00
$9B/81B1 7A          PLY          ; Restore Y, X, Program Bank
$9B/81B2 FA          PLX
$9B/81B3 AB          PLB
$9B/81B4 6B          RTL

$9B/9BA5 (Decompress and) Transfer graphic data sets to VRAM

At $9B/9C17 ($000D:9C17) is an address table. When this subroutine gets called, A contains an entry number for this address table. The corresponding address is loaded. The data there is a chain of different "graphic sets" that are transfered here. The data's first value (16 bit) can be negative or positive:

If negative, this is a standard VRAM DMA.

The first two byte are the VRAM destination (MSB gets removed)
the next three bytes are the 24 bit address of the graphic data in the ROM
the last two byte are the 16 bit value of how many bytes are to be transfered

If the first value is positive, the data has to be decompressed before it gets transfered to VRAM by DMA.

(as before) The first two byte are the VRAM destination
(as before) the next three bytes are the 24 bit address of the COMPRESSED graphic data in the ROM
the last three bytes are the 24-bit-address where to temp store the decompressed data

If positive, it is not necessary to add the size of the data, because that is already part of the compressed data

This stuff gets executed when you start a new game, screwing this up removes the script from the text boxes, so I can imagine this is for the whole Kanji sets / Hiragana / Katakana.

$9B/9BA5 8B          PHB           ; Preserve Program Bank on stack
$9B/9BA6 4B          PHK           ; Change Program Bank
$9B/9BA7 AB          PLB
$9B/9BA8 C2 20       REP #$20
$9B/9BAA 29 FF 00    AND #$00FF    ; The value that was in A at the start is an index for a Table
$9B/9BAD 0A          ASL A         ; It gets multiplied by 2 and transfered in Y...
$9B/9BAE A8          TAY
$9B/9BAF B9 17 9C    LDA $9C17,y   ; ... and the table value gets loaded
$9B/9BB2 A8          TAY           ; The value itself is an address...
$9B/9BB3 B9 00 00    LDA $0000,y   ; ... from which we load data
$9B/9BB6 30 33       BMI $33       ; [$9BEB] Branch if the loaded data is between #$8000-#$FFFF
$9B/9BB8 5A          PHY           ; IF POSITIVE: Push the address that was loaded at the very beginning on stack
$9B/9BB9 48          PHA           ; Put the secondly loaded value on stack, too
$9B/9BBA E2 20       SEP #$20
$9B/9BBC BE 05 00    LDX $0005,y   ; Set up the temp store address of the decompressed data in $20-$22
$9B/9BBF B9 07 00    LDA $0007,y
$9B/9BC2 86 20       STX $20
$9B/9BC4 85 22       STA $22
$9B/9BC6 C9 7E       CMP #$7E      ; Branch if the Temp Address isn't $7E/2000
$9B/9BC8 D0 0E       BNE $0E       ; [$9BD8] 
$9B/9BCA E0 00 20    CPX #$2000
$9B/9BCD D0 09       BNE $09       ; [$9BD8]
$9B/9BCF AD 6A 05    LDA $056A     ; $2100 Buffer (FBLANK / Screen Brightness)
$9B/9BD2 30 04       BMI $04       ; [$9BD8] Branch if FBLANK is active

Code is missing here

$9B/9BD8 BE 02 00    LDX $0002,y   ; Load the Address of the Compressed Data
$9B/9BDB B9 04 00    LDA $0004,y   ; Load the Bank of the Compressed Data
$9B/9BDE 7A          PLY           ; Restore VRAM Address
$9B/9BDF 22 7B 9E 80 JSL $809E7B   ; Decompress Data and transfer it to VRAM
$9B/9BE3 C2 21       REP #$21      ; A = 16 bit, clear carry
$9B/9BE5 68          PLA           ; Load the address from the address table
$9B/9BE6 69 08 00    ADC #$0008    ; Add 8 (next entry)
$9B/9BE9 80 C7       BRA $C7       ; [$9BB2] Loop, do the next entry in this list
$9B/9BEB C9 FF FF    CMP #$FFFF    ; Is the loaded data #$FFFF?
$9B/9BEE F0 23       BEQ $23       ; [$9C13] Exit if it is
$9B/9BF0 5A          PHY           ; Push the address that was loaded at the very beginning on stack
$9B/9BF1 29 FF 7F    AND #$7FFF    ; Remove the MSB from the secondly loaded data
$9B/9BF4 48          PHA           ; And throw it on stack
$9B/9BF5 E2 20       SEP #$20      ; Now, a VRAM DMA is built
$9B/9BF7 A9 80       LDA #$80      ; These are VRAM transfer settings (for $2115)
$9B/9BF9 85 0E       STA $0E
$9B/9BFB BE 05 00    LDX $0005,y   ; Loaded Data Address + 5 contains the number of bytes to be transfered (16 bit value)
$9B/9BFE 86 0C       STX $0C
$9B/9C00 BE 02 00    LDX $0002,y   ; Loaded Data Address + 2 contains the DMA Source Address (16 bit, of course)
$9B/9C03 B9 04 00    LDA $0004,y   ; Loaded Data Address + 4 contains the DMA Source Bank (8 bit)
$9B/9C06 7A          PLY           ; The modified loaded data value is the VRAM destination address
$9B/9C07 22 24 9F 80 JSL $809F24   ; VRAM DMA
$9B/9C0B C2 21       REP #$21      ; A = 16 bit, clear carry
$9B/9C0D 68          PLA           ; Load the address from the address table
$9B/9C0E 69 07 00    ADC #$0007    ; Add 7 (next entry)
$9B/9C11 80 9F       BRA $9F       ; [$9BB2] Loop, do the next entry in this list
$9B/9C13 E2 20       SEP #$20      ; Restore everything and exit
$9B/9C15 AB          PLB
$9B/9C16 6B          RTL

$9B/9C17 Address Table for $9B/9BA5

$9B/9C17 31 9C       Entry $00: $9C31
$9B/9C19 58 9C       Entry $01: $9C58
$9B/9C1B 62 9C       Entry $02: $9C62
$9B/9C1D 6B 9C       Entry $03: $9C6B
$9B/9C1F 31 9C       Entry $04-$0C: The same as Entry $00
$9B/9C21 31 9C 
$9B/9C23 31 9C 
$9B/9C25 31 9C 
$9B/9C27 31 9C 
$9B/9C29 31 9C 
$9B/9C2B 31 9C 
$9B/9C2D 31 9C 
$9B/9C2F 31 9C

$9B/9C31 Graphic Set $00 for $9B/9BA5

$9B/9C31 00 C0 00 80 B7 00 04      ; B78000 These are Debug(???) Numbers and Symbols that are never seen(?)
$9B/9C38 00 28 00 80 BF 00 20 7E
$9B/9C40 00 2A DB 80 DA 00 20 7E
$9B/9C48 00 30 D0 81 DA 00 20 7E

After this, the stuff for the next Graphic Set gets executed, too. Graphic Set 1 is a part of Graphic Set 0

$9B/9C50 Graphic Set $01 for $9B/9BA5

$9B/9C50 00 65 65 88 DA 00 20 7E
$9B/9C58 00 61 58 97 DA 00 20 7E
$9B/9C60 FF FF

$9B/9C62 Graphic Set $01 for $9B/9BA5

$9B/9C62 00 C0 00 80 B7 00 04
$9B/9C69 FF FF

$9B/9C6B Graphic Set $03 for $9B/9BA5

$9B/9C6B 00 65 65 88 DA 00 20 7E
$9B/9C73 00 61 58 97 DA 00 20 7E
$9B/9C7B 00 10 D0 81 DA 00 20 7E
$9B/9C83 00 78 41 BE DB 00 20 7E
$9B/9C8B 00 00 AB CA DB 00 20 7E
$9B/9C93 00 50 9E F1 DB 00 20 7E
$9B/9C9B C0 8F 74 EA 9B 80 00
$9B/9CA2 FF FF

Bank $9C

$9C/8B49 Jump Table for $05C0

$9C/8B49 AD C0 05    LDA $05C0     ; Load Jump Table Index
$9C/8B4C EB          XBA           ; Fill the other byte of A with #$00
$9C/8B4D A9 00       LDA #$00
$9C/8B4F EB          XBA           ; Switch it back and multiply by 2
$9C/8B50 0A          ASL A
$9C/8B51 AA          TAX           ; Transfer in X
$9C/8B52 7C 55 8B    JMP ($8B55,x) ; Table is at $9C/8B55, jump to the entry

$9C/8B55 Table for $9C/8B49

A7 8B   $8BA7 - Entry #$00
49 8E   $8E49 - Entry #$01
6A 8E   $8E6A - Entry #$02
D2 8E   $8ED2 - Entry #$03
7F 8F   $8F7F - Entry #$04
70 90   $9070 - Entry #$05
E5 90   $90E5 - Entry #$06
F0 95   $95F0 - Entry #$07
30 97   $9730 - Entry #$08
97 98   $9897 - Entry #$09
A1 98   $98A1 - Entry #$0A
59 95   $9559 - Entry #$0B
75 99   $9975 - Entry #$0C
59 91   $9159 - Entry #$0D
8C 93   $938C - Entry #$0E

$9C/8BA7 Quest Logo?

A lot of loading, some Mode 7 stuff

This is a program part that $9C/8B49 jumps to.

$9C/8BA7 22 70 A1 80 JSL $80A170   ; Long Jump to Disable IRQ
$9C/8BAB 22 4A A1 80 JSL $80A14A   ; Long Jump to Deactivate NMI, Auto Joypad, HDMAs
$9C/8BAF 22 B6 A1 80 JSL $80A1B6   ; Write Executable Code in WRAM
$9C/8BB3 A9 30       LDA #$30      ; Write HBLANK/VBLANK IRQ activation bits in $4200 Buffer
$9C/8BB5 1C AF 05    TRB $05AF
$9C/8BB8 A9 FF       LDA #$FF      ; ??? (Sound related?)
$9C/8BBA 85 F5       STA $F5
$9C/8BBC 20 DE 9C    JSR $9CDE     ; Wait to the end of HBLANK, then FBLANK
$9C/8BBF 20 E7 BD    JSR $BDE7  [$9C:BDE7]   A:A180 X:05ED Y:0000 P:eNVMxdizc
$9C/8BC2 AD 9D 17    LDA $179D  [$9C:179D]   A:0000 X:0000 Y:0000 P:envMxdiZC
$9C/8BC5 D0 03       BNE $03    [$8BCA]      A:0000 X:0000 Y:0000 P:envMxdiZC
$9C/8BC7 20 91 C5    JSR $C591  [$9C:C591]   A:0000 X:0000 Y:0000 P:envMxdiZC
$9C/8BCA 64 36       STZ $36    [$00:0036]   A:0000 X:0000 Y:0000 P:envMxdiZC
$9C/8BCC 9C C7 0E    STZ $0EC7  [$9C:0EC7]   A:0000 X:0000 Y:0000 P:envMxdiZC
$9C/8BCF 9C C9 11    STZ $11C9  [$9C:11C9]   A:0000 X:0000 Y:0000 P:envMxdiZC
$9C/8BD2 9C CA 11    STZ $11CA  [$9C:11CA]   A:0000 X:0000 Y:0000 P:envMxdiZC
$9C/8BD5 22 98 C5 9C JSL $9CC598   ; Test SRAM
$9C/8BD9 64 C1       STZ $C1    [$00:00C1]   A:0020 X:0004 Y:0000 P:envMxdiZC
$9C/8BDB A2 00 20    LDX #$2000              A:0020 X:0004 Y:0000 P:envMxdiZC
$9C/8BDE 86 5A       STX $5A    [$00:005A]   A:0020 X:2000 Y:0000 P:envMxdizC
$9C/8BE0 86 5C       STX $5C    [$00:005C]   A:0020 X:2000 Y:0000 P:envMxdizC
$9C/8BE2 A2 00 A8    LDX #$A800              A:0020 X:2000 Y:0000 P:envMxdizC
$9C/8BE5 86 5E       STX $5E    [$00:005E]   A:0020 X:A800 Y:0000 P:eNvMxdizC
$9C/8BE7 C2 20       REP #$20                A:0020 X:A800 Y:0000 P:eNvMxdizC
$9C/8BE9 A9 00 00    LDA #$0000    ; Setup the whole VRAM Clear - DMA Data Size: Clear WHOLE VRAM
$9C/8BEC 8F 05 43 00 STA $004305
$9C/8BF0 E2 20       SEP #$20
$9C/8BF2 A9 9C       LDA #$9C      ; Position of the Clear Byte: $9C/9258
$9C/8BF4 A2 58 92    LDX #$9258
$9C/8BF7 A0 00 00    LDY #$0000    ; VRAM Start Position: $0000
$9C/8BFA 22 81 9D 80 JSL $809D81   ; Long Jump to VRAM Clear
$9C/8BFE 22 D2 9C 9C JSL $9C9CD2[$9C:9CD2]   A:0001 X:9258 Y:0000 P:eNvMxdizC
$9C/8C02 D0 01       BNE $01    [$8C05]      A:0000 X:9258 Y:0000 P:envMxdiZC
$9C/8C04 1A          INC A                   A:0000 X:9258 Y:0000 P:envMxdiZC
$9C/8C05 8F 02 42 00 STA $004202[$00:4202]   A:0001 X:9258 Y:0000 P:envMxdizC
$9C/8C09 A9 22       LDA #$22                A:0001 X:9258 Y:0000 P:envMxdizC
$9C/8C0B 22 4F FD 85 JSL $85FD4F[$85:FD4F]   A:0022 X:9258 Y:0000 P:envMxdizC
$9C/8C0F 8F 03 42 00 STA $004203[$00:4203]   A:00A0 X:9258 Y:0000 P:eNvMxdizc
$9C/8C13 A0 57 9B    LDY #$9B57    ; Decompress all the Tiles and Tilemaps for the Title Intro
$9C/8C16 20 15 9B    JSR $9B15     ; Decompress Data and transfer it to VRAM in a Row
$9C/8C19 20 7B 9C    JSR $9C7B  [$9C:9C7B]   A:FF80 X:FFFF Y:9BAF P:envMxdiZC
$9C/8C1C A9 80       LDA #$80      ; VRAM settings ($2115)
$9C/8C1E 85 0E       STA $0E
$9C/8C20 A0 00 00    LDY #$0000    ; VRAM Destination
$9C/8C23 A2 00 14    LDX #$1400    ; Number of Bytes to transfer
$9C/8C26 86 0C       STX $0C
$9C/8C28 A2 00 20    LDX #$2000    ; VRAM DMA Source Address: $7E/2000
$9C/8C2B A9 7E       LDA #$7E
$9C/8C2D 22 24 9F 80 JSL $809F24   ; Long Jump to VRAM: $7E/2000 to $0000 VRAM
$9C/8C31 C2 20       REP #$20
$9C/8C33 7B          TDC           ; Clear 16-bit A
$9C/8C34 AA          TAX           ; Clear X
$9C/8C35 A0 A0 00    LDY #$00A0
$9C/8C38 BF 47 A0 CB LDA $CBA047,x ; Transfer the palettes for the whole manufacturer's logo intro...
$9C/8C3C 9D 4B 12    STA $124B,x   ; ... to the CGRAM buffer
$9C/8C3F 9D 4B 14    STA $144B,x   ; ... and a second CGRAM buffer?
$9C/8C42 E8          INX
$9C/8C43 E8          INX
$9C/8C44 88          DEY
$9C/8C45 D0 F1       BNE $F1       ; [$8C38]
$9C/8C47 E2 20       SEP #$20
$9C/8C49 A9 09       LDA #$09      ; BG Mode 1
$9C/8C4B 8D 05 21    STA $2105
$9C/8C4E 8D 89 05    STA $0589     ; Update Buffer register, too
$9C/8C51 A9 1C       LDA #$1C      ; BG Tilemap 1 is at $1C00 in VRAM
$9C/8C53 8D 07 21    STA $2107
$9C/8C56 8D 8B 05    STA $058B     ; Update Buffer register, too
$9C/8C59 A9 14       LDA #$14      ; BG Tilemap 2 is at $1400 in VRAM
$9C/8C5B 8D 08 21    STA $2108
$9C/8C5E 8D 8C 05    STA $058C     ; Update Buffer register, too
$9C/8C61 A9 1C       LDA #$1C      ; BG Tilemap 3 is at $1C00 in VRAM
$9C/8C63 8D 09 21    STA $2109
$9C/8C66 8D 8D 05    STA $058D     ; Update Buffer register, too
$9C/8C69 A9 02       LDA #$02      ; Sprite size 8x8 and 64x64
$9C/8C6B 8D 88 05    STA $0588     ; Store only buffer
$9C/8C6E A9 35       LDA #$35      ; BG1 Tiles at $3000, BG2 Tiles at $5000
$9C/8C70 8D 0B 21    STA $210B
$9C/8C73 8D 8F 05    STA $058F     ; Update Buffer register, too
$9C/8C76 9C 0C 21    STZ $210C     ; BG3/4 Tiles at $0000
$9C/8C79 9C 90 05    STZ $0590     ; Update Buffer register, too
$9C/8C7C A9 02       LDA #$02      ; Only BG2 on Main Screen
$9C/8C7E 8D 2C 21    STA $212C
$9C/8C81 8D A6 05    STA $05A6     ; Update Buffer register, too
$9C/8C84 9C 2D 21    STZ $212D     ; Nothing on Subscreen
$9C/8C87 9C A7 05    STZ $05A7     ; Update Buffer register, too
$9C/8C8A A9 05       LDA #$05      ; BG3 Window Mask Designation on Main Screen
$9C/8C8C 8D A8 05    STA $05A8     ; Update Buffer register, too
$9C/8C8F 8D 2E 21    STA $212E
$9C/8C92 9C A9 05    STZ $05A9     ; Update Buffer register, too
$9C/8C95 9C 2F 21    STZ $212F     ; No Window Mask Designation on Subscreen
$9C/8C98 A9 02       LDA #$02      ; Add Subscreen - $2130
$9C/8C9A 8D AA 05    STA $05AA
$9C/8C9D A9 E0       LDA #$E0
$9C/8C9F 8D AC 05    STA $05AC     ; $2132 Buffer - Deactivate
$9C/8CA2 8D AD 05    STA $05AD     ; $2132 Buffer - Deactivate
$9C/8CA5 8D AE 05    STA $05AE     ; $2132 Buffer - Deactivate
$9C/8CA8 9C 8A 05    STZ $058A     ; $212E buffer. Window Mask Designation for Main Screen
$9C/8CAB A2 68 97    LDX #$9768    ; Window 1 Left/Right Position
$9C/8CAE 8E 26 21    STX $2126
$9C/8CB1 A2 03 03    LDX #$0303    ; Enable Window 1 and Window 1 Inversion for BG1/3
$9C/8CB4 8E 23 21    STX $2123
$9C/8CB7 A9 30       LDA #$30      ; Enable Window 1 and Window 1 Inversion for Color
$9C/8CB9 8D 25 21    STA $2125
$9C/8CBC A9 26       LDA #$26      ; ???
$9C/8CBE 8D AB 05    STA $05AB
$9C/8CC1 A9 01       LDA #$01      ; Set the Flag for CGRAM Update
$9C/8CC3 8D 49 12    STA $1249
$9C/8CC6 7B          TDC           ; Clear 16-bit A
$9C/8CC7 AA          TAX           ; Clear X
$9C/8CC8 8E 91 05    STX $0591     ; (Mode 7) BG1 H Scroll = 0
$9C/8CCB 8E 93 05    STX $0593     ; (Mode 7) BG1 V Scroll = 0
$9C/8CCE 8E 97 05    STX $0597     ; BG2 V Scroll = 0
$9C/8CD1 CA          DEX           ; X = #$FFFF
$9C/8CD2 8E 9B 05    STX $059B     ; BG3 V Scroll = #$FFFF
$9C/8CD5 A2 04 00    LDX #$0004
$9C/8CD8 8E 95 05    STX $0595     ; BG2 H Scroll = 4
$9C/8CDB 9C B0 05    STZ $05B0     ; HDMA Activation Flag Buffer
$9C/8CDE A9 42       LDA #$42      ; HDMA Addressing Mode, 1 register write twice
$9C/8CE0 8D 10 43    STA $4310
$9C/8CE3 8D 20 43    STA $4320
$9C/8CE6 A9 1B       LDA #$1B      ; First HDMA Destination: $211B (Mode 7 Matrix A)
$9C/8CE8 8D 11 43    STA $4311
$9C/8CEB A9 1E       LDA #$1E      ; First HDMA Destination: $211E (Mode 7 Matrix D)
$9C/8CED 8D 21 43    STA $4321
$9C/8CF0 A2 11 9B    LDX #$9B11    ; HDMA Source address for both: $9C/9B11 -(000E:1B11)
$9C/8CF3 8E 12 43    STX $4312
$9C/8CF6 8E 22 43    STX $4322
$9C/8CF9 A9 9C       LDA #$9C
$9C/8CFB 8D 14 43    STA $4314
$9C/8CFE 8D 24 43    STA $4324
$9C/8D01 A9 00       LDA #$00      ; Both HDMA Indirect addresses are on Bank $00
$9C/8D03 8D 17 43    STA $4317
$9C/8D06 8D 27 43    STA $4327
$9C/8D09 A9 00       LDA #$00      ; Mode 7 Settings
$9C/8D0B 8D 1A 21    STA $211A
$9C/8D0E 9C 1B 21    STZ $211B     ; Mode 7 Matrix A
$9C/8D11 A9 01       LDA #$01
$9C/8D13 8D 1B 21    STA $211B
$9C/8D16 9C 1C 21    STZ $211C     ; Mode 7 Matrix B
$9C/8D19 9C 1C 21    STZ $211C
$9C/8D1C 9C 1D 21    STZ $211D     ; Mode 7 Matrix C
$9C/8D1F 9C 1D 21    STZ $211D
$9C/8D22 A9 01       LDA #$01
$9C/8D24 9C 1E 21    STZ $211E     ; Mode 7 Matrix D
$9C/8D27 8D 1E 21    STA $211E
$9C/8D2A A9 80       LDA #$80
$9C/8D2C 8D 1F 21    STA $211F     ; Mode 7 Center X
$9C/8D2F 9C 1F 21    STZ $211F
$9C/8D32 A9 58       LDA #$58
$9C/8D34 8D 20 21    STA $2120     ; Mode 7 Center X
$9C/8D37 9C 20 21    STZ $2120
$9C/8D3A C2 20       REP #$20
$9C/8D3C A2 00 02    LDX #$0200    ; Write "$E000" at $7E/0100 for $200 byte - this clears OAM Buffer 1's Low Table
$9C/8D3F A0 00 01    LDY #$0100
$9C/8D42 A9 00 E0    LDA #$E000
$9C/8D45 22 C8 9D 80 JSL $809DC8
$9C/8D49 A2 00 02    LDX #$0200    ; Write "$E000" at $7E/0320 for $200 byte - this clears OAM Buffer 2's Low Table
$9C/8D4C A0 20 03    LDY #$0320
$9C/8D4F A9 00 E0    LDA #$E000
$9C/8D52 22 C8 9D 80 JSL $809DC8
$9C/8D56 A2 20 00    LDX #$0020    ; Write "$0000" at $7E/0300 for $20 byte - this clears OAM Buffer 1's High Table
$9C/8D59 A0 00 03    LDY #$0300
$9C/8D5C A9 00 00    LDA #$0000
$9C/8D5F 22 C8 9D 80 JSL $809DC8
$9C/8D63 A2 20 00    LDX #$0020    ; Write "$0000" at $7E/0520 for $20 byte - this clears OAM Buffer 2's High Table
$9C/8D66 A0 20 05    LDY #$0520
$9C/8D69 A9 00 00    LDA #$0000
$9C/8D6C 22 C8 9D 80 JSL $809DC8
$9C/8D70 7B          TDC           ; Clear 16-bit A
$9C/8D71 AA          TAX           ; Clear X
$9C/8D72 BF 9A DD 9C LDA $9CDD9A,x ; Transfer Data from ROM to WRAM
$9C/8D76 9D 00 01    STA $0100,x   ; This is for a OAM Low Table
$9C/8D79 E8          INX
$9C/8D7A E8          INX
$9C/8D7B E0 08 01    CPX #$0108
$9C/8D7E D0 F2       BNE $F2       ; [$8D72]
$9C/8D80 E2 20       SEP #$20
$9C/8D82 7B          TDC           ; Clear 16-bit A
$9C/8D83 AA          TAX           ; Clear X
$9C/8D84 BF 74 DD 9C LDA $9CDD74,x ; Transfer Data from ROM to WRAM
$9C/8D88 9D 00 03    STA $0300,x   ; This is for a OAM Hi Table
$9C/8D8B E8          INX
$9C/8D8C E0 11 00    CPX #$0011
$9C/8D8F D0 F3       BNE $F3       ; [$8D84]
$9C/8D91 A2 00 01    LDX #$0100    ; OAM Buffer is at $0100
$9C/8D94 8E 45 05    STX $0545
$9C/8D97 A9 01       LDA #$01      ; Update OAM
$9C/8D99 8D 40 05    STA $0540
$9C/8D9C A9 7F       LDA #$7F      ; Data Bank = $7F
$9C/8D9E 48          PHA
$9C/8D9F AB          PLB
$9C/8DA0 C2 20       REP #$20
$9C/8DA2 A2 00 80    LDX #$8000    ; Write "$001F" at $7F/0000 to $7F/7FFF
$9C/8DA5 A0 00 00    LDY #$0000
$9C/8DA8 A9 1F 00    LDA #$001F
$9C/8DAB 22 C8 9D 80 JSL $809DC8
$9C/8DAF E2 20       SEP #$20      ; This line could be removed? (If nothing ever jumps to $9C/8DB3)
$9C/8DB1 4B          PHK           ; This line could be removed?
$9C/8DB2 AB          PLB           ; This line could be removed?
$9C/8DB3 A9 7F       LDA #$7F      ; This line could be removed?
$9C/8DB5 48          PHA           ; This line could be removed?
$9C/8DB6 AB          PLB           ; This line could be removed?
$9C/8DB7 C2 20       REP #$20      ; This line could be removed?
$9C/8DB9 A2 00 60    LDX #$6000    ; Write "$0000" at $7F/A000 to $7F/FFFF
$9C/8DBC A0 00 A0    LDY #$A000
$9C/8DBF A9 00 00    LDA #$0000
$9C/8DC2 22 C8 9D 80 JSL $809DC8
$9C/8DC6 E2 20       SEP #$20
$9C/8DC8 4B          PHK           ; Set Data Bank to $9C
$9C/8DC9 AB          PLB
$9C/8DCA A9 85       LDA #$85      ; Data Address of colors for several palettes $85/B170
$9C/8DCC 85 22       STA $22
$9C/8DCE A2 70 B1    LDX #$B170
$9C/8DD1 86 20       STX $20
$9C/8DD3 20 AB 9C    JSR $9CAB     ; Replace three colors in several palettes
$9C/8DD6 A9 CA       LDA #$CA      ; Set up address for transfer loop: $CA/BD25
$9C/8DD8 85 22       STA $22
$9C/8DDA A2 25 BD    LDX #$BD25
$9C/8DDD 86 20       STX $20
$9C/8DDF 7B          TDC           ; Clear 16-bit A
$9C/8DE0 AA          TAX           ; Clear X
$9C/8DE1 A8          TAY           ; Clear Y
$9C/8DE2 A9 20       LDA #$20      ; Set up transfer loop counter
$9C/8DE4 85 00       STA $00
$9C/8DE6 B7 20       LDA [$20],y   ; ???
$9C/8DE8 9F 00 00 7F STA $7F0000,x ; ???
$9C/8DEC C8          INY
$9C/8DED C6 00       DEC $00
$9C/8DEF D0 0E       BNE $0E       ; [$8DFF]
$9C/8DFF E8          INX
$9C/8E00 E8          INX
$9C/8E01 C0 A0 01    CPY #$01A0
$9C/8E04 D0 E0       BNE $E0       ; [$8DE6]
$9C/8DF1 C2 20       REP #$20
$9C/8DF3 8A          TXA           ; ???
$9C/8DF4 18          CLC           ; ???
$9C/8DF5 69 C0 00    ADC #$00C0    ; ???
$9C/8DF8 AA          TAX           ; ???
$9C/8DF9 E2 20       SEP #$20
$9C/8DFB A9 20       LDA #$20      ; ???
$9C/8DFD 85 00       STA $00       ; ???
$9C/8E06 A9 00       LDA #$00      ; ???
$9C/8E08 22 03 80 8F JSL $8F8003   ; ???
$9C/8E0C A9 20       LDA #$20      ; ???
$9C/8E0E 22 03 80 8F JSL $8F8003   ; ???
$9C/8E12 64 E7       STZ $E7       ; ???
$9C/8E14 9C 9C 17    STZ $179C     ; ???
$9C/8E17 9C E6 1E    STZ $1EE6     ; ???
$9C/8E1A 7B          TDC           ; ???
$9C/8E1B AA          TAX           ; ???
$9C/8E1C 8E 61 00    STX $0061     ; ???
$9C/8E1F 8E 63 00    STX $0063     ; ???
$9C/8E22 8E 65 00    STX $0065     ; ???
$9C/8E25 8F 28 B2 7E STA $7EB228   ; ???
$9C/8E29 8F 29 B2 7E STA $7EB229   ; ???
$9C/8E2D 8F A9 B2 7E STA $7EB2A9   ; ???
$9C/8E31 EE C0 05    INC $05C0     ; ???
$9C/8E34 A9 00       LDA #$00      ; Deactivate FBLANK, Screen Brightness = 0%
$9C/8E36 8D 00 21    STA $2100
$9C/8E39 8D 87 05    STA $0587     ; Update Buffer register, too
$9C/8E3C 8D 6A 05    STA $056A     ; Update (second?) Buffer register, too
$9C/8E3F 22 27 A1 80 JSL $80A127   ; ???
$9C/8E43 A9 81       LDA #$81      ; Activate NMI and Auto-Joypad Read
$9C/8E45 0C AF 05    TSB $05AF     ; Store in Buffer
$9C/8E48 60          RTS

$9C/8E49 ?

$9C/8E49 EE 9C 17    INC $179C  [$9C:179C]   A:0002 X:0002 Y:9E53 P:envMxdizc
$9C/8E4C AD 9C 17    LDA $179C  [$9C:179C]   A:0002 X:0002 Y:9E53 P:envMxdizc
$9C/8E4F C9 9E       CMP #$9E                A:0001 X:0002 Y:9E53 P:envMxdizc
$9C/8E51 B0 03       BCS $03    [$8E56]      A:0001 X:0002 Y:9E53 P:envMxdizc
$9C/8E53 4C 64 9C    JMP $9C64     ; ??? Screen fade in?
$9C/8E56 4A          LSR A                   A:009E X:0002 Y:9E53 P:envMxdiZC
$9C/8E57 90 10       BCC $10       ; [$8E69] ??? Exit
$9C/8E59 CE 87 05    DEC $0587     ; Decrement Screen Brightness (Buffer value)
$9C/8E5C D0 0B       BNE $0B       ; [$8E69] Exit if Brightness hasn't reached zero
$9C/8E5E A9 0C       LDA #$0C                A:005D X:0002 Y:9E53 P:envMxdiZC
$9C/8E60 8D 8C 05    STA $058C  [$9C:058C]   A:000C X:0002 Y:9E53 P:envMxdizC
$9C/8E63 9C 9C 17    STZ $179C  [$9C:179C]   A:000C X:0002 Y:9E53 P:envMxdizC
$9C/8E66 EE C0 05    INC $05C0  [$9C:05C0]   A:000C X:0002 Y:9E53 P:envMxdizC
$9C/8E69 60          RTS

$9C/8E6A ?

$9C/8E6A EE 9C 17    INC $179C  [$9C:179C]   A:0004 X:0004 Y:9E53 P:envMxdizc
$9C/8E6D AD 9C 17    LDA $179C  [$9C:179C]   A:0004 X:0004 Y:9E53 P:envMxdizc
$9C/8E70 C9 96       CMP #$96                A:0001 X:0004 Y:9E53 P:envMxdizc
$9C/8E72 D0 06       BNE $06    [$8E7A]      A:0001 X:0004 Y:9E53 P:envMxdizc
$9C/8E74 48          PHA                     A:0096 X:0004 Y:9E53 P:envMxdiZC
$9C/8E75 A9 01       LDA #$01                A:0096 X:0004 Y:9E53 P:envMxdiZC
$9C/8E77 85 F5       STA $F5    [$00:00F5]   A:0001 X:0004 Y:9E53 P:envMxdizC
$9C/8E79 68          PLA                     A:0001 X:0004 Y:9E53 P:envMxdizC
$9C/8E7A C9 9E       CMP #$9E                A:0001 X:0004 Y:9E53 P:envMxdizc
$9C/8E7C B0 03       BCS $03    [$8E81]      A:0001 X:0004 Y:9E53 P:envMxdizc
$9C/8E7E 4C 64 9C    JMP $9C64     ; ??? Screen fade in?
$9C/8E81 4A          LSR A                   A:009E X:0004 Y:9E53 P:envMxdiZC
$9C/8E82 90 4D       BCC $4D       ; [$8ED1] ??? Exit
$9C/8E84 CE 87 05    DEC $0587  [$9C:0587]   A:004F X:0004 Y:9E53 P:envMxdizC
$9C/8E87 D0 48       BNE $48       ; [$8ED1] ??? Exit
$9C/8E89 A9 10       LDA #$10                A:005D X:0004 Y:9E53 P:envMxdiZC
$9C/8E8B 8D A6 17    STA $17A6  [$9C:17A6]   A:0010 X:0004 Y:9E53 P:envMxdizC
$9C/8E8E 9C A7 17    STZ $17A7  [$9C:17A7]   A:0010 X:0004 Y:9E53 P:envMxdizC
$9C/8E91 A9 00       LDA #$00                A:0010 X:0004 Y:9E53 P:envMxdizC
$9C/8E93 85 22       STA $22    [$00:0022]   A:0000 X:0004 Y:9E53 P:envMxdiZC
$9C/8E95 A2 4B 12    LDX #$124B              A:0000 X:0004 Y:9E53 P:envMxdiZC
$9C/8E98 86 20       STX $20    [$00:0020]   A:0000 X:124B Y:9E53 P:envMxdizC
$9C/8E9A A9 9C       LDA #$9C                A:0000 X:124B Y:9E53 P:envMxdizC
$9C/8E9C 85 25       STA $25    [$00:0025]   A:009C X:124B Y:9E53 P:eNvMxdizC
$9C/8E9E A2 D4 DC    LDX #$DCD4              A:009C X:124B Y:9E53 P:eNvMxdizC
$9C/8EA1 86 23       STX $23    [$00:0023]   A:009C X:DCD4 Y:9E53 P:eNvMxdizC
$9C/8EA3 22 14 AA 83 JSL $83AA14[$83:AA14]   A:009C X:DCD4 Y:9E53 P:eNvMxdizC
$9C/8EA7 9C 87 05    STZ $0587     ; $2100 Buffer - Turn Screen off
$9C/8EAA A9 02       LDA #$02      ; $212C Buffer - Put BG2 on Main Screen
$9C/8EAC 8D A6 05    STA $05A6
$9C/8EAF A9 01       LDA #$01      ; $212D Buffer - Put BG1 on Subscreen
$9C/8EB1 8D A7 05    STA $05A7
$9C/8EB4 A9 18       LDA #$18      ; BG1 Tilemap Address: $1800
$9C/8EB6 8D 8B 05    STA $058B
$9C/8EB9 A9 10       LDA #$10      ; BG2 Tilemap Address: $1000
$9C/8EBB 8D 8C 05    STA $058C
$9C/8EBE A9 53       LDA #$53      ; BG2 Tileset Address: $5000, BG1 Tileset Address: $3000
$9C/8EC0 8D 8F 05    STA $058F
$9C/8EC3 7B          TDC           ; Clear 16-bit A
$9C/8EC4 AA          TAX           ; Clear X
$9C/8EC5 8E 9C 17    STX $179C  [$9C:179C]   A:0000 X:0000 Y:0020 P:envMxdiZc
$9C/8EC8 8E 9E 17    STX $179E  [$9C:179E]   A:0000 X:0000 Y:0020 P:envMxdiZc
$9C/8ECB 8E 95 05    STX $0595     ; BG2 Horizontal Scroll Register
$9C/8ECE EE C0 05    INC $05C0     ; ??? Increment Jump Table Index
$9C/8ED1 60          RTS

$9C/8ED2 ?

$9C/8ED2 AE 9C 17    LDX $179C  [$9C:179C]   A:0006 X:0006 Y:0020 P:envMxdizc
$9C/8ED5 E8          INX                     A:0006 X:0000 Y:0020 P:envMxdiZc
$9C/8ED6 8E 9C 17    STX $179C  [$9C:179C]   A:0006 X:0001 Y:0020 P:envMxdizc
$9C/8ED9 E0 AE 01    CPX #$01AE              A:0006 X:0001 Y:0020 P:envMxdizc
$9C/8EDC D0 44       BNE $44    [$8F22]      A:0006 X:0001 Y:0020 P:eNvMxdizc

Code is missing here

$9C/8F22 E0 24 01    CPX #$0124              A:0006 X:0001 Y:0020 P:eNvMxdizc
$9C/8F25 90 54       BCC $54    [$8F7B]      A:0006 X:0001 Y:0020 P:eNvMxdizc
$9C/8F7B 20 64 9C    JSR $9C64  [$9C:9C64]   A:0006 X:0001 Y:0020 P:eNvMxdizc
$9C/8F7E 60          RTS                     A:0080 X:0001 Y:0020 P:eNvMxdizc

$9C/9053 Transfer colors to CGRAM buffer

This transfers colors to the CGRAM buffer and sets the flag that CGRAM gets updated the next time

A contains the number of Colors (number of 16-bit-values!) to transfer

X contains the Index where to store in the CGRAM buffer

$20-$22 contain the Load Address.

$9C/9053 85 00       STA $00       ; Carried in A value is the counter value for the transfer
$9C/9055 64 01       STZ $01       ; Clear upper Byte of the counter
$9C/9057 7B          TDC           ; Clear 16 bit A
$9C/9058 A8          TAY           ; Clear Y
$9C/9059 C2 20       REP #$20
$9C/905B B7 20       LDA [$20],y   ; Transfer data from address
$9C/905D 9D 4B 12    STA $124B,x   ; Store CGRAM buffer
$9C/9060 C8          INY           ; Increment Load index
$9C/9061 C8          INY
$9C/9062 E8          INX           ; Increment Store index
$9C/9063 E8          INX
$9C/9064 C6 00       DEC $00       ; Decrement Loop counter
$9C/9066 D0 F3       BNE $F3       ; [$905B]
$9C/9068 E2 20       SEP #$20
$9C/906A A9 01       LDA #$01      ; Set Flag for CGRAM Update
$9C/906C 8D 49 12    STA $1249
$9C/906F 60          RTS

$9C/9234 ?

I don't know if this subroutine starts here, just for a quick note

$9C/9234 A9 21       LDA #$21                A:00FF X:001A Y:01A1 P:envMxdiZC
$9C/9236 22 03 80 8F JSL $8F8003[$8F:8003]   A:0021 X:001A Y:01A1 P:envMxdizC

The "$21" is the sound that gets played when the soldier hits the archeress in the intro demo

$9C/9258 Clear Byte for $9C/8BE9

$9C/9258 00 00

$9C/98A1 Title Screen BG1 Tilemap builder

This builds the BG1 tilemap for the TO start screen in WRAM at $7F:E000

$9C/98A1 A9 7F       LDA #$7F      ; Setup 24-bit Address in $20: $7F:E000
$9C/98A3 85 22       STA $22
$9C/98A5 A2 00 E0    LDX #$E000
$9C/98A8 86 20       STX $20
$9C/98AA 7B          TDC           ; Clear 16-bit A
$9C/98AB AA          TAX           ; Clear X
$9C/98AC A8          TAY           ; Clear Y
$9C/98AD BF 25 BD CA LDA $CABD25,x ; This loads the Low byte of the Tilemap from the ROM
$9C/98B1 EB          XBA
$9C/98B2 A9 32       LDA #$32      ; This adds the Tilemap high byte of #$32
$9C/98B4 EB          XBA
$9C/98B5 C2 20       REP #$20      ; A = 16 bit
$9C/98B7 97 20       STA [$20],y   ; This now stores both bytes in WRAM
$9C/98B9 E2 20       SEP #$20      ; A = 8 bit
$9C/98BB C8          INY           ; Increment the index registers
$9C/98BC C8          INY
$9C/98BD E8          INX
$9C/98BE E0 A0 01    CPX #$01A0
$9C/98C1 D0 EA       BNE $EA       ; [$98AD]

THis transers some palettes to the CGRAM buffer. These are the palettes that are used in the intro sequence where the text appears on the cloudy sky.

$9C/98C3 A9 CB       LDA #$CB      ; Data Address of a palette: $CB/A047 (= $0025:A047)
$9C/98C5 85 22       STA $22
$9C/98C7 A2 47 A0    LDX #$A047
$9C/98CA 86 20       STX $20
$9C/98CC A9 10       LDA #$10      ; Transfer #$10 Colors
$9C/98CE A2 80 00    LDX #$0080    ; Transfer it as the palette no. 0 for sprites
$9C/98D1 20 53 90    JSR $9053     ; Transfer Data into the CGRAM Buffer
$9C/98D4 A9 20       LDA #$20      ; Transfer the #$20 Colors after that
$9C/98D6 A2 00 00    LDX #$0000    ; And set them as BG palettes
$9C/98D9 20 53 90    JSR $9053     ; Transfer Data into the CGRAM Buffer
$9C/98DC A9 08       LDA #$08      ; Transfer half an palette
$9C/98DE A2 A0 00    LDX #$00A0    ; Somethere in the sprite palette department
$9C/98E1 20 53 90    JSR $9053     ; Transfer Data into the CGRAM Buffer
$9C/98E4 A9 CB       LDA #$CB      ; Reset the address to $CB/A047 as before
$9C/98E6 85 22       STA $22
$9C/98E8 A2 47 A0    LDX #$A047
$9C/98EB 86 20       STX $20
$9C/98ED A9 10       LDA #$10      ; Transfer #$10 Colors (which should be an all-pitchblack palette)
$9C/98EF A2 20 00    LDX #$0020    ; Set it as third BG palette
$9C/98F2 20 53 90    JSR $9053     ; Transfer Data into the CGRAM Buffer
$9C/98F5 A2 FE 01    LDX #$01FE    ; ???
$9C/98F8 8E 91 05    STX $0591     ; ???
$9C/98FB A2 FF 01    LDX #$01FF    ; ???
$9C/98FE 8E 93 05    STX $0593     ; ???
$9C/9901 A9 03       LDA #$03      ; BG1 Tiles are at $3000 in VRAM (BG2 Tiles at $0000)
$9C/9903 8D 8F 05    STA $058F     ; Store in Buffer register
$9C/9906 A9 11       LDA #$11      ; BG3/4 Tiles are at $1000 in VRAM
$9C/9908 8D 90 05    STA $0590     ; Store in Buffer register
$9C/990B A9 70       LDA #$70      ; BG1 Tilemap at $7000 in VRAM
$9C/990D 8D 8B 05    STA $058B     ; Store in Buffer register
$9C/9910 A9 01       LDA #$01      ; Show BG1 on Main Screen
$9C/9912 8D A6 05    STA $05A6     ; Store in Buffer register
$9C/9915 A9 29       LDA #$29      ; Mode 1 + BG3 priority, BG2 with big Tiles
$9C/9917 8D 89 05    STA $0589     ; Store in Buffer register
$9C/991A A9 80       LDA #$80      ; Settings for $2115 for the upcoming VRAM DMA
$9C/991C 85 0E       STA $0E
$9C/991E A0 00 70    LDY #$7000    ; VRAM destination: $7000 (BG1 Tilemap)
$9C/9921 A2 40 03    LDX #$0340    ; Transfer $0340 Bytes
$9C/9924 86 0C       STX $0C
$9C/9926 A2 00 E0    LDX #$E000    ; Source Address: $7F/E000
$9C/9929 A9 7F       LDA #$7F
$9C/992B 22 24 9F 80 JSL $809F24   ; Sets up and executes a DMA from $7F/E000 to VRAM $7000
$9C/992F 7B          TDC           ; Clear 16-bit A
$9C/9930 AA          TAX           ; Clear X
$9C/9931 8E 99 05    STX $0599     ; ???
$9C/9934 A9 78       LDA #$78      ; BG2 Tilemap at $7800
$9C/9936 8D 8C 05    STA $058C     ; Store in Buffer register
$9C/9939 A9 74       LDA #$74      ; BG3 Tilemap at $7400
$9C/993B 8D 8D 05    STA $058D     ; Store in Buffer register
$9C/993E A9 15       LDA #$15      ; Show BG1-3 + Sprites on Main Screen
$9C/9940 8D A6 05    STA $05A6     ; Store in Buffer register
$9C/9943 A9 02       LDA #$02      ; Show BG2 on Subscreen
$9C/9945 8D A7 05    STA $05A7     ; Store in Buffer register
$9C/9948 A9 04       LDA #$04      ; ???
$9C/994A 8D AB 05    STA $05AB     ; ???
$9C/994D A9 10       LDA #$10      ; ???
$9C/994F 8D A6 17    STA $17A6     ; ???
$9C/9952 9C A7 17    STZ $17A7     ; ???
$9C/9955 A9 CB       LDA #$CB      ; Reset the address to $CB/A047 as before
$9C/9957 85 22       STA $22
$9C/9959 A2 47 A0    LDX #$A047
$9C/995C 86 20       STX $20
$9C/995E A9 9C       LDA #$9C      ; Setup 24-bit addresss in $23: $9C/DEA2
$9C/9960 85 25       STA $25
$9C/9962 A2 A2 DE    LDX #$DEA2
$9C/9965 86 23       STX $23
$9C/9967 22 14 AA 83 JSL $83AA14   ; ???
$9C/996B 9C 9C 17    STZ $179C     ; ???
$9C/996E 9C 9D 17    STZ $179D     ; ???
$9C/9971 EE C0 05    INC $05C0     ; ???
$9C/9974 60          RTS

$9C/9B15 Decompress Data and transfer it to VRAM in a Row

This subroutine decompresses and transfers data to VRAM and can do this in a row.

It has to receive the address of a list of data to do, this list has to be structured this way:

3 bytes - 24-bit address for the temp store of the decompressed data
3 bytes - 24-bit address of the compressed data
2 bytes - VRAM destination / VRAM DMA transfer leave-out flag

If as VRAM destination you have $8000, the VRAM DMA gets left out. If after any of these 8 byte entries there is a $FFFF, this subroutine gets exited.

When this subroutine is called, Y contains the address of the data list - the Data Bank has to be set to the list's bank.

$9C/9B15 B9 02 00    LDA $0002,y   ; Load the 1st 3 bytes and set them as store address of the decomp subroutine
$9C/9B18 85 22       STA $22
$9C/9B1A BE 00 00    LDX $0000,y
$9C/9B1D 86 20       STX $20
$9C/9B1F C8          INY           ; Increment the Load Index thrice
$9C/9B20 C8          INY
$9C/9B21 C8          INY
$9C/9B22 B9 02 00    LDA $0002,y   ; Load next three bytes - the address of the compressed data
$9C/9B25 BE 00 00    LDX $0000,y
$9C/9B28 C8          INY           ; Increment the Load Index thrice
$9C/9B29 C8          INY
$9C/9B2A C8          INY
$9C/9B2B 5A          PHY           ; Buffer Load Index on Stack
$9C/9B2C 22 E5 F9 81 JSL $81F9E5   ; Decompress data
$9C/9B30 7A          PLY           ; Restore Load Index
$9C/9B31 A6 0E       LDX $0E       ; Load size of decompressed data...
$9C/9B33 86 0C       STX $0C       ; ... set it as bytes to transfer
$9C/9B35 A9 80       LDA #$80      ; VRAM settings ($2115)
$9C/9B37 85 0E       STA $0E
$9C/9B39 BE 00 00    LDX $0000,y   ; Load next two bytes (VRAM destination)
$9C/9B3C C8          INY           ; Increment the Load Index twice
$9C/9B3D C8          INY
$9C/9B3E 5A          PHY           ; Buffer Load Index on Stack
$9C/9B3F 9B          TXY           ; Transfer VRAM destination to Y (for the upcoming VRAM DMA subroutine)
$9C/9B40 C0 00 80    CPY #$8000    ; If "VRAM Destination" is $8000, leave out the VRAM DMA
$9C/9B43 F0 08       BEQ $08       ; [$9B4D]
$9C/9B45 A6 20       LDX $20       ; Pick up the decrompession address as source address for the VRAM DMA
$9C/9B47 A5 22       LDA $22
$9C/9B49 22 24 9F 80 JSL $809F24   ; Long Jump to VRAM DMA
$9C/9B4D 7A          PLY           ; Restore Load Index
$9C/9B4E BE 00 00    LDX $0000,y   ; Load next double byte
$9C/9B51 E0 FF FF    CPX #$FFFF    ; Look if there is the End-signal
$9C/9B54 D0 BF       BNE $BF       ; [$9B15] Loop if not
$9C/9B56 60          RTS

$9C/9B57 Data List for $9C/9B15

This is a list of compressed data for the subroutine at $9C/9B15 to decompress and transfer to VRAM.

00 20 7E BB BF DF 00 10 ; Sky Tilemap
00 20 7E 53 BC DF 00 1C ; Intro Japanese text Tilemap
00 20 7E 63 B2 DF 00 70 ; Part of the Sky Tileset
00 20 7E 80 9F DF 00 60 ; Part of the Sky Tileset
00 20 7E EB 8B DF 00 50 ; Part of the Sky Tileset
00 20 7E 45 C5 DF 00 14 ; Quest Logo Tilemap
00 20 7E DC C5 DF 00 18 ; "Quest Presents" Tilemap
00 20 7E 6E C6 DF 00 0C ; Hermit Logo Tilemap
00 20 7E 07 E9 DE 00 30 ; Part of Intro Japanese text Tileset
00 40 7E 3B FD DE 00 40 ; Part of Intro Japanese text Tileset/Quest/Hermet/"Quest Presents" Tileset
00 94 7F 20 CD DF 00 80 ; ??? (Don't transfer to VRAM)
FF FF

$9C/9C64 Screen fade in?

$9C/9C64 AD 87 05    LDA $0587     ; Check if Screen Brightness is on maximum or FBLANK is active
$9C/9C67 C9 0F       CMP #$0F
$9C/9C69 90 01       BCC $01       ; [$9C6C] Exit if it is
$9C/9C6B 60          RTS
$9C/9C6C A9 01       LDA #$01      ; Set Screen Fade In Flag
$9C/9C6E 8D C2 05    STA $05C2
$9C/9C71 22 6A 8D 80 JSL $808D6A   ; Turn Brightness higher if not maximum
$9C/9C75 22 8A A1 80 JSL $80A18A   ; ??? Wait for NMI
$9C/9C79 18          CLC
$9C/9C7A 60          RTS

$9C/9C7B ?

This subroutine merges data in WRAM. This builds a tilemap, IIRC.

$9C/9C7B C2 20       REP #$20       ; 16 Bit A
$9C/9C7D 7B          TDC            ; Clear A, X, Y
$9C/9C7E AA          TAX
$9C/9C7F A8          TAY
$9C/9C80 F4 00 7E    PEA $7E00      ; Set Data Bank to $7E
$9C/9C83 AB          PLB
$9C/9C84 AB          PLB
$9C/9C85 A9 08 00    LDA #$0008              A:0000 X:0000 Y:0000 P:envmxdizC
$9C/9C88 85 00       STA $00    [$00:0000]   A:0008 X:0000 Y:0000 P:envmxdizC
$9C/9C8A BD 00 20    LDA $2000,x[$7E:2000]   A:0008 X:0000 Y:0000 P:envmxdizC
$9C/9C8D 1D 10 20    ORA $2010,x[$7E:2010]   A:0000 X:0000 Y:0000 P:envmxdiZC
$9C/9C90 99 00 20    STA $2000,y[$7E:2000]   A:0000 X:0000 Y:0000 P:envmxdiZC
$9C/9C93 E8          INX                     A:0000 X:0000 Y:0000 P:envmxdiZC
$9C/9C94 E8          INX                     A:0000 X:0001 Y:0000 P:envmxdizC
$9C/9C95 C8          INY                     A:0000 X:0002 Y:0000 P:envmxdizC
$9C/9C96 C8          INY                     A:0000 X:0002 Y:0001 P:envmxdizC
$9C/9C97 C6 00       DEC $00    [$00:0000]   A:0000 X:0002 Y:0002 P:envmxdizC
$9C/9C99 D0 EF       BNE $EF    [$9C8A]      A:0000 X:0002 Y:0002 P:envmxdizC
$9C/9C9B 8A          TXA                     A:0000 X:0010 Y:0010 P:envmxdiZC
$9C/9C9C 18          CLC                     A:0010 X:0010 Y:0010 P:envmxdizC
$9C/9C9D 69 10 00    ADC #$0010              A:0010 X:0010 Y:0010 P:envmxdizc
$9C/9CA0 AA          TAX                     A:0020 X:0010 Y:0010 P:envmxdizc
$9C/9CA1 C0 00 14    CPY #$1400              A:0020 X:0020 Y:0010 P:envmxdizc
$9C/9CA4 D0 DF       BNE $DF    [$9C85]      A:0020 X:0020 Y:0010 P:eNvmxdizc
$9C/9CA6 4B          PHK           ; Set Data Bank to $9C
$9C/9CA7 AB          PLB
$9C/9CA8 E2 20       SEP #$20      ; 8 Bit A
$9C/9CAA 60          RTS

$9C/9CAB Replace three colors in several palettes

This subroutine replaces three colors in several palettes

$9C/9CAB A0 06 00    LDY #$0006    ; Set up the Loop Counter
$9C/9CAE A2 42 01    LDX #$0142    ; Where to store in CGRAM buffer (sprite palettes)
$9C/9CB1 A9 03       LDA #$03      ; Number of colors
$9C/9CB3 5A          PHY           ; Push Y on the counter, because Y needs to be used in the upcoming Subroutine
$9C/9CB4 DA          PHX           ; Buffer the start point where to store
$9C/9CB5 20 53 90    JSR $9053     ; Transfer Data into the CGRAM Buffer
$9C/9CB8 FA          PLX           ; Restore the start point where to store
$9C/9CB9 7A          PLY           ; Restore loop counter
$9C/9CBA 88          DEY           ; Decrement counter
$9C/9CBB F0 14       BEQ $14       ; [$9CD1] Exit if counter reached zero
$9C/9CBD C2 20       REP #$20
$9C/9CBF A5 20       LDA $20       ; Load Data Source Address
$9C/9CC1 18          CLC           ; Increase the Address (6 bytes were transfered, so increase by 6)
$9C/9CC2 69 06 00    ADC #$0006
$9C/9CC5 85 20       STA $20       ; Store back
$9C/9CC7 8A          TXA           ; Add #$20 to the start point where to store - point at the next palette
$9C/9CC8 18          CLC
$9C/9CC9 69 20 00    ADC #$0020
$9C/9CCC AA          TAX           ; Transfer back to X
$9C/9CCD E2 20       SEP #$20
$9C/9CCF 80 E0       BRA $E0       ; [$9CB1]
$9C/9CD1 60          RTS

$9C/9CDE Wait to the end of HBLANK, then FBLANK

$9C/9CDE A9 80       LDA #$80
$9C/9CE0 2C 12 42    BIT $4212
$9C/9CE3 70 FB       BVS $FB       ; [$9CE0] Wait for a HBLANK to start
$9C/9CE5 2C 12 42    BIT $4212
$9C/9CE8 50 FB       BVC $FB       ; [$9CE5] Wait for a HBLANK to end
$9C/9CEA 8D 00 21    STA $2100     ; FBLANK
$9C/9CED 8D 87 05    STA $0587     ; Update $2100 Buffer 1
$9C/9CF0 8D 6A 05    STA $056A     ; Update $2100 Buffer 2
$9C/9CF3 9C 2C 21    STZ $212C     ; Remove all Main Screen Designations
$9C/9CF6 9C 2D 21    STZ $212D     ; Remove all Subscreen Designations
$9C/9CF9 60          RTS

$9C/C598 Test SRAM and store in it

$9C/C598 7B          TDC           ; Clear 16-bit A
$9C/C599 AA          TAX           ; Clear X
$9C/C59A BF CA C5 9C LDA $9CC5CA,x ; Transfer the ASCII-Code "#T-O" in SRAM
$9C/C59E 9F 00 00 70 STA $700000,x
$9C/C5A2 E8          INX
$9C/C5A3 E0 04 00    CPX #$0004
$9C/C5A6 D0 F2       BNE $F2       ; [$C59A]
$9C/C5A8 BF CA C5 9C LDA $9CC5CA,x ; Test if the ASCII-Code is in SRAM
$9C/C5AC DF 00 00 70 CMP $700000,x
$9C/C5B0 D0 07       BNE $07    [$C5B9]      A:0043 X:0004 Y:0000 P:eNvMxdizc

$9C/C5B2 E8          INX           ; MANUALLY DISASSEMBLED LINE
$9C/C5B3 E0 08 00    CPX #$0008    ; MANUALLY DISASSEMBLED LINE
$9C/C5B6 D0 F0       BNE $F0       ; [$C5A8] MANUALLY DISASSEMBLED LINE
$9C/C5B8 6B          RTL           ; MANUALLY DISASSEMBLED LINE

$9C/C5B9 7B          TDC                     A:0043 X:0004 Y:0000 P:eNvMxdizc
$9C/C5BA AA          TAX                     A:0000 X:0004 Y:0000 P:envMxdiZc
$9C/C5BB BF D2 C5 9C LDA $9CC5D2,x[$9C:C5D2] A:0000 X:0000 Y:0000 P:envMxdiZc
$9C/C5BF 9F 04 00 70 STA $700004,x[$70:0004] A:0047 X:0000 Y:0000 P:envMxdizc
$9C/C5C3 E8          INX                     A:0047 X:0000 Y:0000 P:envMxdizc
$9C/C5C4 E0 04 00    CPX #$0004              A:0047 X:0001 Y:0000 P:envMxdizc
$9C/C5C7 D0 F2       BNE $F2    [$C5BB]      A:0047 X:0001 Y:0000 P:eNvMxdizc
$9C/C5C9 6B          RTL                     A:0020 X:0004 Y:0000 P:envMxdiZC

$9C/C5CA 23 54 2D 4F ASCII-Code for "#T-O"
$9C/C5CE 43 4F 4D 50 ASCII-Code for "COMP"
$9C/C5D2 47 52 45 20 ASCII-Code for "GRE "

$9C/C7D3 Stuff with the NES-Style Controller Registers

$9C/C7D3 08          PHP           ; Push Flag Register
$9C/C7D4 E2 20       SEP #$20
$9C/C7D6 A9 00       LDA #$00      ; Deactivate NMI and Auto-Joypad Read
$9C/C7D8 8F 00 42 00 STA $004200
$9C/C7DC A9 01       LDA #$01      ; The NES-style Joypad Access... Doin' some latchin'
$9C/C7DE 8F 16 40 00 STA $004016
$9C/C7E2 A9 00       LDA #$00
$9C/C7E4 8F 16 40 00 STA $004016
$9C/C7E8 85 00       STA $00       ; ???
$9C/C7EA 85 01       STA $01       ; ???
$9C/C7EC 85 02       STA $02       ; ???
$9C/C7EE 85 03       STA $03       ; ???
$9C/C7F0 A2 08 00    LDX #$0008    ; ???
$9C/C7F3 AF 17 40 00 LDA $004017   ; ???
$9C/C7F7 4A          LSR A         ; ???
$9C/C7F8 26 01       ROL $01       ; ???
$9C/C7FA CA          DEX           ; ???
$9C/C7FB D0 F6       BNE $F6       ; ???
$9C/C7FD A2 08 00    LDX #$0008    ; ???
$9C/C800 AF 17 40 00 LDA $004017   ; ???
$9C/C804 4A          LSR A         ; ???
$9C/C805 26 00       ROL $00       ; ???
$9C/C807 CA          DEX           ; ???
$9C/C808 D0 F6       BNE $F6       ; ???
$9C/C80A A2 08 00    LDX #$0008    ; ???
$9C/C80D AF 17 40 00 LDA $004017   ; ???
$9C/C811 4A          LSR A         ; ???
$9C/C812 26 02       ROL $02       ; ???
$9C/C814 CA          DEX           ; ???
$9C/C815 D0 F6       BNE $F6       ; ???
$9C/C817 A9 81       LDA #$81      ; Reactivate NMI and Auto Joypad Read
$9C/C819 8F 00 42 00 STA $004200
$9C/C81D 28          PLP           ; Restore Flag Register
$9C/C81E 60          RTS

Bank $9D

$9D/9FE4 Clear BG3 Tilemap Buffer

This subroutine writes an empty tilemap for BG3 in WRAM. It writes at 7E/A800 "$03EE" for $800 bytes and transfers this to VRAM at $3C00, where the BG3 Tilemap in many/most of the cases is located. "$03EE" is of course an empty tile - "$0000" is used by some sprite tiles.

This is about the same as the subroutine at $82/B1DA, but the other one transfers this to VRAM in the same move, but this one only does the preparation for this in WRAM.

$9D/9FE4 8B          PHB           ; Buffer Data Bank Register on Stack
$9D/9FE5 A9 7E       LDA #$7E      ; Set Data Bank to $7E
$9D/9FE7 48          PHA
$9D/9FE8 AB          PLB
$9D/9FE9 C2 20       REP #$20
$9D/9FEB A2 00 08    LDX #$0800    ; Write "$03EE" at $7E/A800 and onwards for #$0800 times
$9D/9FEE A0 00 A8    LDY #$A800
$9D/9FF1 A9 EE 03    LDA #$03EE
$9D/9FF4 22 C8 9D 80 JSL $809DC8
$9D/9FF8 E2 20       SEP #$20                A:03EE X:0000 Y:B000 P:envmxdiZc
$9D/9FFA AB          PLB           ; Restore Data Bank
$9D/9FFB 6B          RTL

$9D/A998 ?

$9D/A998 8B          PHB           ; Buffer Data Bank Register on Stack
$9D/A999 4B          PHK           ; Set Data Bank to $9D
$9D/A99A AB          PLB
$9D/A99B 22 C4 F3 81 JSL $81F3C4   ; Fade Screen out
$9D/A99F 22 4A A1 80 JSL $80A14A   ; Deactivate NMI, Auto-Joypad and HDMAs
$9D/A9A3 9C 36 00    STZ $0036     ; ???
$9D/A9A6 22 6B B6 80 JSL $80B66B   ; Clear Registers, clear WRAM Bank $7F
$9D/A9AA 22 45 B5 80 JSL $80B545   ; Clear Graphic Setup Registers
$9D/A9AE 22 C5 B5 80 JSL $80B5C5   ; ??? Clears some values
$9D/A9B2 22 B6 A1 80 JSL $80A1B6   ; Write Executable Code in WRAM
$9D/A9B6 A9 01       LDA #$01      ; DEACTIVATE MASK WINDOWS
$9D/A9B8 8F 26 21 00 STA $002126   ; Set Windows Left Positions to 1
$9D/A9BC 8F 28 21 00 STA $002128
$9D/A9C0 7B          TDC           ; Set Windows Right Positions to 0
$9D/A9C1 8F 27 21 00 STA $002127
$9D/A9C5 8F 29 21 00 STA $002129
$9D/A9C9 A9 00       LDA #$00                A:0000 X:05ED Y:0000 P:envMxdiZC
$9D/A9CB 22 A5 9B 9B JSL $9B9BA5   ; (Decompress and) Transfer graphic data sets to VRAM
$9D/A9CF A9 01       LDA #$01                A:FFFF X:0500 Y:9C60 P:eNvMxdizC
$9D/A9D1 22 A5 9B 9B JSL $9B9BA5   ; (Decompress and) Transfer graphic data sets to VRAM
$9D/A9D5 A9 03       LDA #$03                A:FFFF X:0500 Y:9C60 P:eNvMxdizC
$9D/A9D7 85 A4       STA $A4    [$00:00A4]   A:FF03 X:0500 Y:9C60 P:envMxdizC
$9D/A9D9 A9 00       LDA #$00                A:FF03 X:0500 Y:9C60 P:envMxdizC
$9D/A9DB 85 A5       STA $A5    [$00:00A5]   A:FF00 X:0500 Y:9C60 P:envMxdiZC
$9D/A9DD A9 00       LDA #$00                A:FF00 X:0500 Y:9C60 P:envMxdiZC
$9D/A9DF 22 A4 9C 9B JSL $9B9CA4[$9B:9CA4]   A:FF00 X:0500 Y:9C60 P:envMxdiZC
$9D/A9E3 A2 00 00    LDX #$0000              A:1200 X:124B Y:0200 P:eNvMxdizc
$9D/A9E6 8E 91 05    STX $0591  [$9D:0591]   A:1200 X:0000 Y:0200 P:envMxdiZc
$9D/A9E9 8E 93 05    STX $0593  [$9D:0593]   A:1200 X:0000 Y:0200 P:envMxdiZc
$9D/A9EC 8E 95 05    STX $0595  [$9D:0595]   A:1200 X:0000 Y:0200 P:envMxdiZc
$9D/A9EF 8E 97 05    STX $0597  [$9D:0597]   A:1200 X:0000 Y:0200 P:envMxdiZc
$9D/A9F2 8E 99 05    STX $0599  [$9D:0599]   A:1200 X:0000 Y:0200 P:envMxdiZc
$9D/A9F5 8E 9B 05    STX $059B  [$9D:059B]   A:1200 X:0000 Y:0200 P:envMxdiZc
$9D/A9F8 9C 0C 42    STZ $420C     ; Disable all HDMAs...
$9D/A9FB 9C B0 05    STZ $05B0     ; ... and clear $420C buffer
$9D/A9FE 22 00 80 86 JSL $868000[$86:8000]   A:1200 X:0000 Y:0200 P:envMxdiZc
$9D/AA02 A2 FF FF    LDX #$FFFF              A:FFFF X:FFFE Y:0200 P:eNvMxdizc
$9D/AA05 8E 3D 00    STX $003D  [$9D:003D]   A:FFFF X:FFFF Y:0200 P:eNvMxdizc
$9D/AA08 22 01 BE 9E JSL $9EBE01   ; Clear OAM Buffers
$9D/AA0C 22 E4 9F 9D JSL $9D9FE4[$9D:9FE4]   A:FF00 X:0100 Y:0020 P:envMxdizC
$9D/AA10 22 36 E8 81 JSL $81E836[$81:E836]   A:03EE X:0000 Y:B000 P:eNvMxdizc
$9D/AA14 22 49 E8 81 JSL $81E849[$81:E849]   A:03EE X:FFFF Y:B000 P:eNvMxdizc
$9D/AA18 22 27 A1 80 JSL $80A127   ; Activate NMI and Auto-Joypad Read
$9D/AA1C 22 62 A1 80 JSL $80A162   ; Enable VBLANK IRQ
$9D/AA20 AB          PLB           ; Restore Bank
$9D/AA21 6B          RTL

$9D/AE67 Deactivate Mask Windows

This sets the left position of the Mask Windows to 1 and the right positions to 0, which deactivates the windows.

$9D/AE67 A9 01       LDA #$01      ; Set Windows Left Positions to 1
$9D/AE69 8F 26 21 00 STA $002126
$9D/AE6D 8F 28 21 00 STA $002128
$9D/AE71 7B          TDC           ; Set Windows Right Positions to 0
$9D/AE72 8F 27 21 00 STA $002127
$9D/AE76 8F 29 21 00 STA $002129
$9D/AE7A 6B          RTL

Bank $9E

$9E/BE01 Long Jump to Clear OAM Buffers

$9E/BE01 20 05 BE    JSR $BE05     ; Clear OAM Buffers
$9E/BE04 6B          RTL

$9E/BE05 Clear OAM Buffers

$9E/BE05 A0 00 00    LDY #$0000    ; Clear Low Tables
$9E/BE08 A9 E8       LDA #$E8      ; This is the value that puts the sprites so low they're invisible
$9E/BE0A 99 01 01    STA $0101,y
$9E/BE0D 99 21 03    STA $0321,y
$9E/BE10 C8          INY
$9E/BE11 C8          INY
$9E/BE12 C8          INY
$9E/BE13 C8          INY
$9E/BE14 C0 00 02    CPY #$0200
$9E/BE17 90 F1       BCC $F1       ; [$BE0A]

$9E/BE19 A0 00 00    LDY #$0000    ; Clear High Tables
$9E/BE1C A9 00       LDA #$00
$9E/BE1E 99 00 03    STA $0300,y
$9E/BE21 99 20 05    STA $0520,y
$9E/BE24 C8          INY
$9E/BE25 C0 20 00    CPY #$0020
$9E/BE28 90 F4       BCC $F4       ; [$BE1E]

$9E/BE2A A2 00 01    LDX #$0100    ; Set OAM Buffer address to $100
$9E/BE2D 8E 45 05    STX $0545
$9E/BE30 EE 40 05    INC $0540     ; Set Flag for OAM Buffers
$9E/BE33 60          RTS

Bank $CB

$CB/A047 Palettes

$CB/A047-$CB/A066 - Empty Palette
$CB/A067-$CB/A086 - Palette used in the intro for the manufacturer's logos and the intro
$CB/A087-$CB/A0A6 - Palette used in the intro for the manufacturer's logos and the intro