BS-X BIOS:ROM map

From Data Crystal
Revision as of 08:15, 21 February 2017 by Lytron (talk | contribs)
Jump to: navigation, search

Bank $10

There is a Jump Table on the Satellaview that is used at the Start Up. I guess its implemented to serve as a verification that the Satellaview is there and working correctly, because the BIOS jumps to this jump table just to be redirected to subroutines in itself again.

$10/5974 6B          RTL                     A:0 X:FFFE Y:E280 P:envmxdIzc
$10/598C 5C AD C2 80 JMP $80C2AD    ; Check if Satellaview Stream Number Registers work

$10/59A4 5C 6D C3 80 JMP $80C36D[$80:C36D]   A:0 X:FFFE Y:E280 P:envMxdIZC

$10/59B0 5C D6 C3 80 JMP $80C3D6[$80:C3D6]   A:0008 X:FFFE Y:E280 P:envMxdIzC

$10/5A6C 5C 84 BB 80 JMP $80BB84    ; MCC Memory Controller Settings: Enable Flash R/W
$10/5A70 5C B1 BB 80 JMP $80BBB1    ; MCC Memory Controller Settings: Disable Flash R/W

$10/5B0C 5C 77 C1 80 JMP $80C177[$80:C177]   A:0080 X:0007 Y:0 P:eNvMxdIzC

$10/5B58 5C F2 F2 80 JMP $80F2F2[$80:F2F2]   A:0 X:FFFE Y:E280 P:envMxdIZC

Bank $80

$80/8200 Update Graphics Registers

Transfers values from their $01xx-buffers to their registers

$80/8200 08          PHP            ; Buffer Flag Register value on stack
$80/8201 E2 20       SEP #$20       ; A = 8-bit
$80/8203 AD 00 01    LDA $0100      ; Update Display Control 1 (FBLANK / Brightness) and it's buffer
$80/8206 8D 00 21    STA $2100
$80/8209 8D 1B 02    STA $021B
$80/820C AD 01 01    LDA $0101      ; Update Object Size and Object Base
$80/820F 8D 01 21    STA $2101
$80/8212 AD 04 01    LDA $0104      ; Update BG Mode
$80/8215 8D 05 21    STA $2105
$80/8218 AD 05 01    LDA $0105      ; Update Mosaic
$80/821B 8D 06 21    STA $2106
$80/821E AD 06 01    LDA $0106      ; Update BG1 Tilemap Address and Mirroring
$80/8221 8D 07 21    STA $2107
$80/8224 AD 07 01    LDA $0107      ; Update BG2 Tilemap Address and Mirroring
$80/8227 8D 08 21    STA $2108
$80/822A AD 08 01    LDA $0108      ; Update BG3 Tilemap Address and Mirroring
$80/822D 8D 09 21    STA $2109
$80/8230 AD 09 01    LDA $0109      ; Update BG4 Tilemap Address and Mirroring
$80/8233 8D 0A 21    STA $210A
$80/8236 AD 0A 01    LDA $010A      ; Update BG1/2 Tileset Address
$80/8239 8D 0B 21    STA $210B
$80/823C AD 0B 01    LDA $010B      ; Update BG3/4 Tileset Address
$80/823F 8D 0C 21    STA $210C
$80/8242 AD 0C 01    LDA $010C      ; Update Mode 7 Rotation/Scaling Mode Settings
$80/8245 8D 1A 21    STA $211A
$80/8248 AD 0D 01    LDA $010D      ; Update Window BG1/BG2 Mask Settings
$80/824B 8D 23 21    STA $2123
$80/824E AD 0E 01    LDA $010E      ; Update Window BG3/BG4 Mask Settings
$80/8251 8D 24 21    STA $2124
$80/8254 AD 1F 01    LDA $011F      ; Update Window OBJ/MATH Mask Settings
$80/8257 8D 25 21    STA $2125
$80/825A AD 20 01    LDA $0120      ; Update Window 1 Left Position (X1)
$80/825D 8D 26 21    STA $2126
$80/8260 AD 21 01    LDA $0121      ; Update Window 1 Right Position (X2)
$80/8263 8D 27 21    STA $2127
$80/8266 AD 22 01    LDA $0122      ; Update Window 2 Left Position (X1)
$80/8269 8D 28 21    STA $2128
$80/826C AD 23 01    LDA $0123      ; Update Window 2 Right Position (X2)
$80/826F 8D 29 21    STA $2129
$80/8272 AD 24 01    LDA $0124      ; Update Window 1/2 Mask Logic (BG1-BG4)
$80/8275 8D 2A 21    STA $212A
$80/8278 AD 25 01    LDA $0125      ; Update Window 1/2 Mask Logic (OBJ/MATH)
$80/827B 8D 2B 21    STA $212B
$80/827E AD 26 01    LDA $0126      ; Update Main Screen Designation
$80/8281 8D 2C 21    STA $212C
$80/8284 AD 28 01    LDA $0128      ; Update Window Area Main Screen Disable
$80/8287 8D 2E 21    STA $212E
$80/828A AD 27 01    LDA $0127      ; Update Sub Screen Designation
$80/828D 8D 2D 21    STA $212D
$80/8290 AD 29 01    LDA $0129      ; Update Window Area Sub Screen Disable
$80/8293 8D 2F 21    STA $212F
$80/8296 AD 2A 01    LDA $012A      ; Update 
$80/8299 8D 30 21    STA $2130
$80/829C AD 2B 01    LDA $012B      ; Update 
$80/829F 8D 31 21    STA $2131
$80/82A2 AD 2D 01    LDA $012D      ; Update Color Math Sub Screen Backdrop Color - RED
$80/82A5 09 20       ORA #$20
$80/82A7 8D 32 21    STA $2132
$80/82AA AD 2E 01    LDA $012E      ; Update Color Math Sub Screen Backdrop Color - GREEN
$80/82AD 09 40       ORA #$40
$80/82AF 8D 32 21    STA $2132
$80/82B2 AD 2F 01    LDA $012F      ; Update Color Math Sub Screen Backdrop Color - BLUE
$80/82B5 09 80       ORA #$80
$80/82B7 8D 32 21    STA $2132
$80/82BA AD 30 01    LDA $0130      ; Update Display Control 2
$80/82BD 8D 33 21    STA $2133
$80/82C0 AD 0F 01    LDA $010F      ; Update Scroll Registers for BG1 to BG4
$80/82C3 8D 0D 21    STA $210D
$80/82C6 AD 10 01    LDA $0110
$80/82C9 8D 0D 21    STA $210D
$80/82CC AD 11 01    LDA $0111
$80/82CF 8D 0E 21    STA $210E
$80/82D2 AD 12 01    LDA $0112
$80/82D5 8D 0E 21    STA $210E
$80/82D8 AD 13 01    LDA $0113
$80/82DB 8D 0F 21    STA $210F
$80/82DE AD 14 01    LDA $0114
$80/82E1 8D 0F 21    STA $210F
$80/82E4 AD 15 01    LDA $0115
$80/82E7 8D 10 21    STA $2110
$80/82EA AD 16 01    LDA $0116
$80/82ED 8D 10 21    STA $2110
$80/82F0 AD 17 01    LDA $0117
$80/82F3 8D 11 21    STA $2111
$80/82F6 AD 18 01    LDA $0118
$80/82F9 8D 11 21    STA $2111
$80/82FC AD 19 01    LDA $0119
$80/82FF 8D 12 21    STA $2112
$80/8302 AD 1A 01    LDA $011A
$80/8305 8D 12 21    STA $2112
$80/8308 AD 1B 01    LDA $011B
$80/830B 8D 13 21    STA $2113
$80/830E AD 1C 01    LDA $011C
$80/8311 8D 13 21    STA $2113
$80/8314 AD 1D 01    LDA $011D
$80/8317 8D 14 21    STA $2114
$80/831A AD 1E 01    LDA $011E
$80/831D 8D 14 21    STA $2114
$80/8320 AD 3A 01    LDA $013A      ; Set HDMA flags
$80/8323 8D 0C 42    STA $420C
$80/8326 28          PLP            ; Restore Flag Register value
$80/8327 6B          RTL

$80/8411 Store a chain of values in $01xx (Graphics Register buffer)

When this subroutine is called from a place in code, the next three byte are arguments for this subroutine. The arguments are a 24-bit-address.

The address this points contains a variable number of arguments in the following format:

1st byte: Destination ($0100-$01FE)
2nd byte: Value for that register

When #$FF is the first byte the loop is ended.

$80/8411 08          PHP            ; Buffer Flag Register value on stack
$80/8412 E2 10       SEP #$10       ; X/Y = 8-bit
$80/8414 C2 20       REP #$20       ; A = 16-bit
$80/8416 A3 03       LDA $03,s      ; Copy the original return address (pointing to data for this subroutine)...
$80/8418 8D 21 00    STA $0021      ; ... into $20-$22 as a 24-bit load address
$80/841B A3 02       LDA $02,s
$80/841D 8D 20 00    STA $0020
$80/8420 18          CLC            ; Change return address on stack to leap over the data
$80/8421 69 03 00    ADC #$0003
$80/8424 83 02       STA $02,s
$80/8426 A0 01       LDY #$01       ; Load Data from the original return address
$80/8428 B7 20       LDA [$20],y    ; Set this data up as another 24-bit-address in $23-$25
$80/842A 8D 23 00    STA $0023
$80/842D C8          INY
$80/842E B7 20       LDA [$20],y
$80/8430 8D 24 00    STA $0024
$80/8433 E2 20       SEP #$20       ; A = 8 bit
$80/8435 A0 00       LDY #$00       ; Reset Load Index
$80/8437 B7 23       LDA [$23],y    ; Load byte from the second address
$80/8439 AA          TAX            ; Transfer to X as (potential) Store Index
$80/843A C9 FF       CMP #$FF       ; Exit if that byte was = #$FF
$80/843C F0 09       BEQ $09        ; [$8447]
$80/843E C8          INY
$80/843F B7 23       LDA [$23],y    ; Load next byte and store it in $01xx
$80/8441 9D 00 01    STA $0100,x
$80/8444 C8          INY
$80/8445 80 F0       BRA $F0        ; [$8437] Loop
$80/8447 28          PLP            ; Restore Flag Register value
$80/8448 6B          RTL

$80/8944 Update OAM

This subroutine transfers the whole OAM buffer at $7E/1C00 to the OAM via DMA.

$80/8944 08          PHP            ; Buffer Flag Register value on stack
$80/8945 E2 10       SEP #$10       ; X/Y = 8-bit
$80/8947 C2 20       REP #$20       ; A = 16-bit
$80/8949 A9 00 04    LDA #$0400     ; DMA transfer type: 8-bit, $2104
$80/894C 8D 00 43    STA $4300
$80/894F A9 00 1C    LDA #$1C00     ; Source Address: $00/1C00
$80/8952 8D 02 43    STA $4302
$80/8955 A2 00       LDX #$00
$80/8957 8E 04 43    STX $4304
$80/895A A9 20 02    LDA #$0220     ; Transfer #$220 bytes
$80/895D 8D 05 43    STA $4305
$80/8960 9C 02 21    STZ $2102      ; Start at $0000 in OAM
$80/8963 A2 01       LDX #$01       ; Activate DMA
$80/8965 8E 0B 42    STX $420B
$80/8968 28          PLP            ; Restore Flag Register value
$80/8969 6B          RTL

$80/8F7D PROGRAM START

$00/8F7D 78          SEI            ; Disable Interrupts
$00/8F7E 18          CLC            ; Activate Native Mode
$00/8F7F FB          XCE
$00/8F80 5C 84 8F 80 JMP $808F84    ; Switch to FastROM addressing
$80/8F84 E2 20       SEP #$20       ; A = 8-bit
$80/8F86 C2 10       REP #$10       ; X/Y = 16-bit
$80/8F88 4B          PHK            ; Data Bank = Program Bank
$80/8F89 AB          PLB
$80/8F8A A9 01       LDA #$01
$80/8F8C 8D 00 42    STA $4200      ; Auto-Joypad-Enable, NMI/IRQ Disable
$80/8F8F 8D 0D 42    STA $420D      ; Activate FastROM
$80/8F92 A9 80       LDA #$80       ; FBLANK
$80/8F94 8D 00 21    STA $2100
$80/8F97 C2 30       REP #$30       ; A/X/Y = 16-bit
$80/8F99 A9 00 00    LDA #$0000     ; Direct Page: $0000
$80/8F9C 5B          TCD
$80/8F9D AD 63 06    LDA $0663  [$80:0663]   A:0000 X:0 Y:0 P:envmxdIZC
$80/8FA0 49 FF FF    EOR #$FFFF              A:5555 X:0 Y:0 P:envmxdIzC
$80/8FA3 CD 61 06    CMP $0661  [$80:0661]   A:AAAA X:0 Y:0 P:eNvmxdIzC
$80/8FA6 D0 06       BNE $06    [$8FAE]      A:AAAA X:0 Y:0 P:envmxdIzC

code is missing here

$80/8FAE A9 00 00    LDA #$0000     ; Clear whole WRAM
$80/8FB1 8F 00 00 7E STA $7E0000
$80/8FB5 8F 00 00 7F STA $7F0000
$80/8FB9 A9 FD FF    LDA #$FFFD     ;   (Clear Bank $7E)
$80/8FBC A2 01 00    LDX #$0001
$80/8FBF 9B          TXY
$80/8FC0 C8          INY
$80/8FC1 54 7E 7E    MVN 7E 7E
$80/8FC4 A9 FD FF    LDA #$FFFD     ;   (Clear Bank $7F)
$80/8FC7 A2 01 00    LDX #$0001
$80/8FCA 9B          TXY
$80/8FCB C8          INY
$80/8FCC 54 7F 7F    MVN 7F 7F
$80/8FCF 4B          PHK            ; Data Bank = Program Bank
$80/8FD0 AB          PLB
$80/8FD1 7B          TDC            ; Buffer Direct Page in $0665
$80/8FD2 8D 65 06    STA $0665
$80/8FD5 A9 00 00    LDA #$0000     ; Direct Page: $0000
$80/8FD8 5B          TCD
$80/8FD9 A9 FF 1E    LDA #$1EFF     ; Stack: $1EFF
$80/8FDC 1B          TCS
$80/8FDD 22 11 84 80 JSL $808411    ; Store a chain of values in $01xx
     Arguments:
     $80/8FE1 D7 90 80              ; Data for $01xx registers is at $80/90D7
$80/8FE4 A9 80 00    LDA #$0080
$80/8FE7 8D 00 01    STA $0100      ; #$80 in value to set in $2100 (FBLANK)
$80/8FEA 8D 1B 02    STA $021B      ; #$80 in value currently set in $2100 (FBLANK)
$80/8FED A9 01 00    LDA #$0001              A:0080 X:00FF Y:0062 P:envmxdIzC
$80/8FF0 8D 35 01    STA $0135  [$80:0135]   A:0001 X:00FF Y:0062 P:envmxdIzC
$80/8FF3 22 00 82 80 JSL $808200[$80:8200]   A:0001 X:00FF Y:0062 P:envmxdIzC
$80/8FF7 AF F1 FF 9F LDA $9FFFF1    ; Setup address of the SPC program to transfer in $20-22: $9D/8000
$80/8FFB 85 21       STA $21        ;    (UNNECESSARY LINE - one could save a few bytes if the address...)
$80/8FFD AF F0 FF 9F LDA $9FFFF0    ;    (would be loaded directly here instead of this bank $9F detour)
$80/9001 85 20       STA $20
$80/9003 22 5A 99 80 JSL $80995A    ; Transfer Data to SPC
$80/9007 AD 12 42    LDA $4212      ; Wait until the Auto-Joypad read is done
$80/900A 4A          LSR A
$80/900B 90 FA       BCC $FA        ; [$9007]
$80/900D AD 12 42    LDA $4212
$80/9010 4A          LSR A
$80/9011 B0 FA       BCS $FA        ; [$900D]
$80/9013 AD 1A 42    LDA $421A      ; Load Joypad 2 data
$80/9016 29 F0 FF    AND #$FFF0     ; Check if A/B/X/Y/L/R are pushed all at the same time
$80/9019 C9 F0 C0    CMP #$C0F0
$80/901C D0 0E       BNE $0E        ; [$902C] Branch if not

code is missing here

$80/902C 22 F7 C8 80 JSL $80C8F7    ; Copy data from banks $10-$12 to $13-$15
$80/9030 22 74 59 10 JSL $105974[$10:5974]   A:0 X:FFFE Y:E280 P:envmxdIzc
$80/9034 E2 20       SEP #$20                A:0 X:FFFE Y:E280 P:envmxdIzc
$80/9036 C2 10       REP #$10                A:0 X:FFFE Y:E280 P:envMxdIzc
$80/9038 9C 3F 14    STZ $143F  [$80:143F]   A:0 X:FFFE Y:E280 P:envMxdIzc
$80/903B 22 8C 59 10 JSL $10598C    ; Check if Satellaview Stream Number Registers work
$80/903F F0 03       BEQ $03    [$9044]      A:0 X:FFFE Y:E280 P:envMxdIZC

code is missing here

$80/9044 22 58 5B 10 JSL $105B58[$10:5B58]   A:0 X:FFFE Y:E280 P:envMxdIZC
$80/9048 22 A4 59 10 JSL $1059A4[$10:59A4]   A:0 X:FFFE Y:E280 P:envMxdIZC
$80/904C 22 6C 5A 10 JSL $105A6C    ; MCC Memory Controller Settings: Enable Flash R/W
$80/9050 22 0C 5B 10 JSL $105B0C[$10:5B0C]   A:0080 X:0007 Y:0 P:eNvMxdIzC
$80/9054 22 70 5A 10 JSL $105A70    ; MCC Memory Controller Settings: Disable Flash R/W
$80/9058 C2 30       REP #$30                A:0080 X:0 Y:0 P:eNvMxdIzC
$80/905A 22 0F 8C 80 JSL $808C0F[$80:8C0F]   A:0080 X:0 Y:0 P:eNvmxdIzC
$80/905E 22 09 A7 80 JSL $80A709[$80:A709]   A:0010 X:00FF Y:0 P:eNvmxdIzC
$80/9062 22 58 83 80 JSL $808358[$80:8358]   A:00E0 X:FFFE Y:0 P:eNvmxdIzC
$80/9066 22 40 5B 10 JSL $105B40[$10:5B40]   A:0061 X:FFFE Y:0 P:eNvmxdIzC
$80/906A A9 08 00    LDA #$0008              A:0006 X:FFFF Y:0 P:eNvmxdIzC
$80/906D 8D 4C 01    STA $014C  [$80:014C]   A:0008 X:FFFF Y:0 P:envmxdIzC
$80/9070 A9 04 00    LDA #$0004              A:0008 X:FFFF Y:0 P:envmxdIzC
$80/9073 8D 4E 01    STA $014E  [$80:014E]   A:0004 X:FFFF Y:0 P:envmxdIzC
$80/9076 A9 FF FF    LDA #$FFFF              A:0004 X:FFFF Y:0 P:envmxdIzC
$80/9079 8D 13 0A    STA $0A13  [$80:0A13]   A:FFFF X:FFFF Y:0 P:eNvmxdIzC
$80/907C A9 FF FF    LDA #$FFFF              A:FFFF X:FFFF Y:0 P:eNvmxdIzC
$80/907F 8F 15 87 7E STA $7E8715[$7E:8715]   A:FFFF X:FFFF Y:0 P:eNvmxdIzC
$80/9083 AD 65 06    LDA $0665  [$80:0665]   A:FFFF X:FFFF Y:0 P:eNvmxdIzC
$80/9086 C9 47 53    CMP #$5347              A:0 X:FFFF Y:0 P:envmxdIZC
$80/9089 F0 0E       BEQ $0E    [$9099]      A:0 X:FFFF Y:0 P:eNvmxdIzc
$80/908B A9 00 80    LDA #$8000              A:0 X:FFFF Y:0 P:eNvmxdIzc
$80/908E 8D 37 06    STA $0637  [$80:0637]   A:8000 X:FFFF Y:0 P:eNvmxdIzc
$80/9091 A9 94 00    LDA #$0094              A:8000 X:FFFF Y:0 P:eNvmxdIzc
$80/9094 8D 39 06    STA $0639  [$80:0639]   A:0094 X:FFFF Y:0 P:envmxdIzc
$80/9097 80 18       BRA $18    [$90B1]      A:0094 X:FFFF Y:0 P:envmxdIzc
$80/90B1 9C 65 06    STZ $0665  [$80:0665]   A:0094 X:FFFF Y:0 P:envmxdIzc
$80/90B4 22 25 92 80 JSL $809225[$80:9225]   A:0094 X:FFFF Y:0 P:envmxdIzc
$80/90B8 A9 3A 91    LDA #$913A              A:0 X:0010 Y:0 P:envmxdIzc
$80/90BB 8D 3F 06    STA $063F  [$80:063F]   A:913A X:0010 Y:0 P:eNvmxdIzc
$80/90BE A9 80 00    LDA #$0080              A:913A X:0010 Y:0 P:eNvmxdIzc
$80/90C1 8D 41 06    STA $0641  [$80:0641]   A:0080 X:0010 Y:0 P:envmxdIzc
$80/90C4 22 9D 83 80 JSL $80839D[$80:839D]   A:0080 X:0010 Y:0 P:envmxdIzc
$80/90C8 58          CLI                     A:0081 X:0010 Y:0 P:envmxdIzc
$80/90C9 20 6A 93    JSR $936A  [$80:936A]   A:0081 X:0010 Y:0 P:envmxdizc
$80/90CC 4B          PHK                     A:913A X:0010 Y:0 P:eNvmxdizc
$80/90CD F4 D2 90    PEA $90D2               A:913A X:0010 Y:0 P:eNvmxdizc
$80/90D0 DC 33 06    JML [$0633][$80:913A]   A:913A X:0010 Y:0 P:eNvmxdizc

$80/90D7 Data

This data gets transfered to the $01xx Graphics Register buffer via $80/8411 at $80/8FDD.

This is executed while the start-up, these values serve to clear those Graphics Registers.

$80/90D7 01 00 - Value for $0101 = $2101 - Object Size and Object Base
$80/90D9 02 00 - Value for $0102
$80/90DB 03 00 - Value for $0103
$80/90DD 04 00 - Value for $0104 = $2105 - BG Mode
$80/90DF 05 00 - Value for $0105 = $2106 - Mosaic
$80/90E1 06 00
$80/90E3 07 00
$80/90E5 08 00
$80/90E7 09 00
$80/90E9 0A 00
$80/90EB 0B 00
$80/90ED 0F 00
$80/90EF 10 00
$80/90F1 11 00
$80/90F3 12 00
$80/90F5 13 00
$80/90F7 14 00
$80/90F9 15 00
$80/90FB 16 00
$80/90FD 17 00
$80/90FF 18 00
$80/9101 19 00
$80/9103 1A 00
$80/9105 1B 00
$80/9107 1C 00
$80/9109 1D 00
$80/910B 1E 00
$80/910D 0C 00
$80/910F 0D 00
$80/9111 0E 00
$80/9113 1F 00
$80/9115 20 00
$80/9117 21 00
$80/9119 22 00
$80/911B 23 00
$80/911D 24 00
$80/911F 25 00
$80/9121 26 00
$80/9123 27 00
$80/9125 28 00
$80/9127 2A 30
$80/9129 2B 00
$80/912B 2C E0
$80/912D 30 00
$80/912F 38 00
$80/9131 39 00
$80/9133 36 00
$80/9135 37 00
$80/9137 3A 00
$80/9139 FF

$80/9390 USELESS SUBROUTINE

Life would be so desolate without them.

$80/9390 08          PHP            ; UNNECESSARY LINE
$80/9391 28          PLP            ; UNNECESSARY LINE
$80/9392 6B          RTL            ; UNNECESSARY LINE

$80/995A Transfer Data to SPC

I guess this subroutine is the standard SPC Data Transfer Subroutine by Nintendo. Furthermore, since this ROM is programmed by Nintendo (I guess?), they surely will use this subroutine, too, to transfer song/sfx data. Other developers tended to write their own.

$80/995A 08          PHP            ; Buffer Flag Register value on stack
$80/995B C2 30       REP #$30       ; A/X/Y = 16 bit
$80/995D AC 20 00    LDY $0020  [$80:0020]   A:8000 X:00FF Y:0062 P:eNvmxdIzC
$80/9960 9C 20 00    STZ $0020  [$80:0020]   A:8000 X:00FF Y:8000 P:eNvmxdIzC
$80/9963 A9 AA BB    LDA #$BBAA     ; Is the SPC ready?
$80/9966 CD 40 21    CMP $2140
$80/9969 D0 FB       BNE $FB        ; [$9966]
$80/996B E2 20       SEP #$20       ; Send ready signal back
$80/996D A9 CC       LDA #$CC
$80/996F 80 2B       BRA $2B        ; [$999C]
$80/9971 FA          PLX                     A:51CC X:03FA Y:8004 P:enVMxdIZC
$80/9972 B7 20       LDA [$20],y[$9D:8004]   A:51CC X:00F0 Y:8004 P:enVMxdIzC
$80/9974 20 D5 99    JSR $99D5      ; Inc Y
$80/9977 EB          XBA                     A:5120 X:00F0 Y:8005 P:eNVMxdIzC
$80/9978 A9 00       LDA #$00                A:2051 X:00F0 Y:8005 P:enVMxdIzC
$80/997A 80 0D       BRA $0D    [$9989]      A:2000 X:00F0 Y:8005 P:enVMxdIZC
$80/997C EB          XBA                     A:2000 X:00EF Y:8005 P:enVMxdIzC
$80/997D B7 20       LDA [$20],y[$9D:8005]   A:0020 X:00EF Y:8005 P:enVMxdIzC
$80/997F 20 D5 99    JSR $99D5  [$80:99D5]   A:0054 X:00EF Y:8005 P:enVMxdIzC
$80/9982 EB          XBA                     A:0054 X:00EF Y:8006 P:eNVMxdIzC
$80/9983 CD 40 21    CMP $2140  [$80:2140]   A:5400 X:00EF Y:8006 P:enVMxdIZC
$80/9986 D0 FB       BNE $FB    [$9983]      A:5400 X:00EF Y:8006 P:enVMxdIzc
$80/9988 1A          INC A                   A:5400 X:00EF Y:8006 P:enVMxdIZC
$80/9989 C2 20       REP #$20                A:2000 X:00F0 Y:8005 P:enVMxdIZC
$80/998B 8D 40 21    STA $2140  [$80:2140]   A:2000 X:00F0 Y:8005 P:enVmxdIZC
$80/998E E2 20       SEP #$20                A:2000 X:00F0 Y:8005 P:enVmxdIZC
$80/9990 CA          DEX                     A:2000 X:00F0 Y:8005 P:enVMxdIZC
$80/9991 D0 E9       BNE $E9    [$997C]      A:2000 X:00EF Y:8005 P:enVMxdIzC
$80/9993 CD 40 21    CMP $2140  [$80:2140]   A:E4EF X:0 Y:80F4 P:enVMxdIZC
$80/9996 D0 FB       BNE $FB    [$9993]      A:E4EF X:0 Y:80F4 P:enVMxdIzC
$80/9998 69 03       ADC #$03                A:E4EF X:0 Y:80F4 P:enVMxdIZC
$80/999A F0 FC       BEQ $FC    [$9998]      A:E4F3 X:0 Y:80F4 P:eNvMxdIzc

$80/999C 48          PHA                     A:BBCC X:00FF Y:8000 P:eNvMxdIzC
$80/999D C2 20       REP #$20       ; A = 16-bit
$80/999F B7 20       LDA [$20],y[$9D:8000]   A:BBCC X:00FF Y:8000 P:eNvmxdIzC
$80/99A1 20 D5 99    JSR $99D5      ; Inc Y
$80/99A4 20 D5 99    JSR $99D5      ; Inc Y
$80/99A7 AA          TAX                     A:00F0 X:00FF Y:8002 P:eNvmxdIzC
$80/99A8 B7 20       LDA [$20],y[$9D:8002]   A:00F0 X:00F0 Y:8002 P:envmxdIzC
$80/99AA 20 D5 99    JSR $99D5      ; Inc Y
$80/99AD 20 D5 99    JSR $99D5      ; Inc Y
$80/99B0 8D 42 21    STA $2142  [$80:2142]   A:5100 X:00F0 Y:8004 P:eNvmxdIzC
$80/99B3 E2 20       SEP #$20                A:5100 X:00F0 Y:8004 P:eNvmxdIzC
$80/99B5 E0 01 00    CPX #$0001              A:5100 X:00F0 Y:8004 P:eNvMxdIzC
$80/99B8 A9 00       LDA #$00                A:5100 X:00F0 Y:8004 P:envMxdIzC
$80/99BA 2A          ROL A                   A:5100 X:00F0 Y:8004 P:envMxdIZC
$80/99BB 8D 41 21    STA $2141  [$80:2141]   A:5101 X:00F0 Y:8004 P:envMxdIzc
$80/99BE 69 7F       ADC #$7F                A:5101 X:00F0 Y:8004 P:envMxdIzc
$80/99C0 68          PLA                     A:5180 X:00F0 Y:8004 P:eNVMxdIzc
$80/99C1 8D 40 21    STA $2140  [$80:2140]   A:51CC X:00F0 Y:8004 P:eNVMxdIzc
$80/99C4 DA          PHX                     A:51CC X:00F0 Y:8004 P:eNVMxdIzc
$80/99C5 A2 00 04    LDX #$0400              A:51CC X:00F0 Y:8004 P:eNVMxdIzc
$80/99C8 CA          DEX                     A:51CC X:0400 Y:8004 P:enVMxdIzc
$80/99C9 F0 07       BEQ $07    [$99D2]      A:51CC X:03FF Y:8004 P:enVMxdIzc
$80/99CB CD 40 21    CMP $2140  [$80:2140]   A:51CC X:03FF Y:8004 P:enVMxdIzc
$80/99CE D0 F8       BNE $F8    [$99C8]      A:51CC X:03FF Y:8004 P:enVMxdIzC
$80/99D0 70 9F       BVS $9F    [$9971]      A:51CC X:03FA Y:8004 P:enVMxdIZC
$80/99D2 FA          PLX                     A:0403 X:03F9 Y:E280 P:envMxdIZC
$80/99D3 28          PLP            ; Restore Flag Register value
$80/99D4 6B          RTL

$80/C2AD Check if Satellaview Stream Number Registers work

If something went wrong, A != #$00 at the end. If everything is fine, A = #$00.

$80/C2AD A9 01       LDA #$01       ; Set Power Bit for Satellaview
$80/C2AF 8D 94 21    STA $2194
$80/C2B2 A9 AA       LDA #$AA       ; Check if you can write into $2188 and check if it keeps its value
$80/C2B4 8D 88 21    STA $2188
$80/C2B7 CD 88 21    CMP $2188
$80/C2BA D0 22       BNE $22        ; [$C2DE] Exit if it doesn't work
$80/C2BC A9 55       LDA #$55       ; Check if you can write into $2188 and check if it keeps its value
$80/C2BE 8D 88 21    STA $2188
$80/C2C1 CD 88 21    CMP $2188
$80/C2C4 D0 18       BNE $18        ; [$C2DE] Exit if it doesn't work
$80/C2C6 9C 88 21    STZ $2188      ; Check if you can clear $2189/9/E/F and the values stay cleared
$80/C2C9 9C 89 21    STZ $2189
$80/C2CC 9C 8E 21    STZ $218E
$80/C2CF 9C 8F 21    STZ $218F
$80/C2D2 AD 88 21    LDA $2188
$80/C2D5 0D 89 21    ORA $2189
$80/C2D8 0D 8E 21    ORA $218E
$80/C2DB 0D 8F 21    ORA $218F
$80/C2DE 6B          RTL


$80/C8F7 Satellaview-related

$80/C8F7 08          PHP            ; Buffer Flag Register value on stack
$80/C8F8 C2 30       REP #$30       ; A/X/Y = 16 bit
$80/C8FA 9C 02 00    STZ $0002  [$80:0002]   A:0 X:0 Y:E280 P:envmxdIzc
$80/C8FD AF 00 50 10 LDA $105000    ; Check if a Satellaview is connected
$80/C901 C9 53 47    CMP #$4753     ; If it is, it has #$4753 in $10/5000 (ASCII: "SG")
$80/C904 D0 45       BNE $45        ; [$C94B] Branch if not
$80/C906 AF 04 50 10 LDA $105004    ; Load Checksum
$80/C90A 4F 02 50 10 EOR $105002    ; EOR it with the Checksum Complement
$80/C90E C9 FF FF    CMP #$FFFF     ; Does Checksum fit with its complement?
$80/C911 D0 38       BNE $38        ; [$C94B] Branch if not
$80/C913 64 00       STZ $00    [$00:0000]   A:FFFF X:0 Y:E280 P:envmxdIZC
$80/C915 A2 FF 0F    LDX #$0FFF     ; CALCULATE CHECKSUM
$80/C918 BF 00 50 10 LDA $105000,x  ; The Checksum is every byte between $5000-$5FFF (from banks $10-$12) added together
$80/C91C 29 FF 00    AND #$00FF
$80/C91F 18          CLC
$80/C920 65 00       ADC $00
$80/C922 85 00       STA $00
$80/C924 BF 00 50 11 LDA $115000,x
$80/C928 29 FF 00    AND #$00FF
$80/C92B 18          CLC
$80/C92C 65 00       ADC $00
$80/C92E 85 00       STA $00
$80/C930 BF 00 50 12 LDA $125000,x
$80/C934 29 FF 00    AND #$00FF
$80/C937 18          CLC
$80/C938 65 00       ADC $00
$80/C93A 85 00       STA $00
$80/C93C CA          DEX
$80/C93D 10 D9       BPL $D9        ; [$C918] Loop
$80/C93F CF 04 50 10 CMP $105004    ; Is the calculated Checksum the same as the one in $10/5004?
$80/C943 D0 06       BNE $06        ; [$C94B] Branch if not
$80/C945 22 1B CA 80 JSL $80CA1B[$80:CA1B]   A:8BD3 X:FFFF Y:E280 P:envmxdIZC
$80/C949 80 42       BRA $42        ; [$C98D] Exit

code is missing here (executed when Satellaview does not respond correctly)

$80/C98D 28          PLP            ; Restore Flag Register value
$80/C98E 6B          RTL

$80/CA1B Satellaview-related: Copy data from banks $10-$12 to $13-$15

This subroutine copies the data from $5000-$5FFF from the banks $10-12 to $13-15.

$80/CA1B 08          PHP            ; Buffer Flag Register value on stack
$80/CA1C C2 30       REP #$30       ; A/X/Y = 16 bit
$80/CA1E A2 FE 0F    LDX #$0FFE     ; Setup Load/Store Index/Loop Counter
$80/CA21 BF 00 50 10 LDA $105000,x  ; Transfer from bank $10 to $13
$80/CA25 9F 00 50 13 STA $135000,x
$80/CA29 BF 00 50 11 LDA $115000,x  ; Transfer from bank $11 to $14
$80/CA2D 9F 00 50 14 STA $145000,x
$80/CA31 BF 00 50 12 LDA $125000,x  ; Transfer from bank $12 to $15
$80/CA35 9F 00 50 15 STA $155000,x
$80/CA39 CA          DEX            ; Decrement Load/Store Index twice
$80/CA3A CA          DEX
$80/CA3B 10 E4       BPL $E4        ; [$CA21] Loop until everything is done
$80/CA3D 28          PLP            ; Restore Flag Register value
$80/CA3E 6B          RTL

$80/99D5 Increment Load Index Y

This subroutine increments Y. If it turned from #$FFFF to #$0000, its value gets set to #$8000 and the bank of the 24-bit-address in $20-$22 gets incremented.

Side Note: One could save one byte of code if the branch command is a BNE that points to an RTS, but maybe they built it this way to save cycles?

$80/99D5 C8          INY            ; Increment Load index
$80/99D6 F0 01       BEQ $01        ; [$99D9] Branch if it turned from #$FFFF to #$0000
$80/99D8 60          RTS
$80/99D9 E6 22       INC $22        ; Increment bank
$80/99DB A0 00 80    LDY #$8000     ; Reset to #$8000 (first byte of the new LoROM bank)
$80/99DE 60          RTS

$80/BB84 MCC Memory Controller Settings: Enable Flash R/W

$80/BB84 08          PHP            ; Buffer Flag Register value on stack
$80/BB85 E2 20       SEP #$20       ; A = 8-bit
$80/BB87 A9 00       LDA #$00
$80/BB89 8F 00 50 05 STA $055000    ; Bank $40-$4F: PSRAM
$80/BB8D 8F 00 50 06 STA $065000    ; Bank $50-$5F: PSRAM
$80/BB91 8F 00 50 04 STA $045000    ; LoROM Mapping
$80/BB95 8F 00 50 01 STA $015000    ; Bank $00-$3F: Flash
$80/BB99 A9 80       LDA #$80
$80/BB9B 8F 00 50 02 STA $025000    ; Flash: HiROM
$80/BB9F 8F 00 50 03 STA $035000    ; Bank $60-$6F: Flash
$80/BBA3 8F 00 50 0C STA $0C5000    ; Enable Bank $C0-$FF Flash Reads
$80/BBA7 8F 00 50 0D STA $0D5000    ; Enable Bank $C0-$FF Flash Writes
$80/BBAB 8F 00 50 0E STA $0E5000    ; Apply Changes to Other MCC Registers
$80/BBAF 28          PLP            ; Restore Flag Register value
$80/BBB0 6B          RTL

$80/BBB1 MCC Memory Controller Settings: Disable Flash R/W

$80/BBB1 08          PHP            ; Buffer Flag Register value on stack
$80/BBB2 E2 20       SEP #$20       ; A = 8-bit
$80/BBB4 A9 00       LDA #$00
$80/BBB6 8F 00 50 05 STA $055000    ; Bank $40-$4F: PSRAM
$80/BBBA 8F 00 50 06 STA $065000    ; Bank $50-$5F: PSRAM
$80/BBBE 8F 00 50 04 STA $045000    ; LoROM Mapping
$80/BBC2 8F 00 50 01 STA $015000    ; Bank $00-$3F: Flash
$80/BBC6 8F 00 50 0C STA $0C5000    ; Disable Bank $C0-$FF Flash Reads
$80/BBCA 8F 00 50 0D STA $0D5000    ; Disable Bank $C0-$FF Flash Writes
$80/BBCE A9 80       LDA #$80
$80/BBD0 8F 00 50 02 STA $025000    ; Flash: HiROM
$80/BBD4 8F 00 50 03 STA $035000    ; Bank $60-$6F: Flash
$80/BBD8 8F 00 50 0E STA $0E5000    ; Apply Changes to Other MCC Registers
$80/BBDC 28          PLP            ; Restore Flag Register value
$80/BBDD 6B          RTL

$80/F2F2 Deactivate Satellaview Power Down Mode

From FullSNES:

  2197h Control (only bit7 is modified) (R/W)
  
  0-6  Unknown/unused (should be left unchanged)
  7    Power Down Mode? (0=Power Down, 1=Operate/Normal) (Soundlink enable?)
  
  Bit7 is set by various BIOS functions, and, notably: When [7FD9h/FFD9h].Bit4 (in Satellaview FLASH File Header) is set. Also notably: Bit7 is set/cleared depending on Town Status Entry[07h].Bit6-7.
$80/F2F2 08          PHP            ; Buffer Flag Register value and A on stack
$80/F2F3 E2 20       SEP #$20
$80/F2F5 48          PHA
$80/F2F6 AF 97 21 00 LDA $002197    ; Load $2197 value, set MSB, store back
$80/F2FA 09 80       ORA #$80
$80/F2FC 8F 97 21 00 STA $002197
$80/F300 68          PLA            ; Restore Flag Register value and A
$80/F301 28          PLP
$80/F302 6B          RTL

Bank $9F

$9F/FFF0 Address of the SPC program

This gets used at $80/8FF7. This is an UNNECESSARY LINE: It makes no sense why this address isn't directly loaded there. This must be a remnant of the development that was left the few bytes it saves would make no difference.

$9F/FFF0 00 80 9D                   ; SPC program is at $9D/8000


Internal Data for BS-X BIOS

ROM MapRAM MapText TableNotesTutorials