BS-X BIOS:ROM map

From Data Crystal
Revision as of 08:50, 20 February 2017 by Lytron (talk | contribs) (Created page with "{{rommap|game=BS-X BIOS}} == Bank $80 == === $80/8200 Update Graphics Registers === Transfers values from their $01xx-buffers to their registers $80/8200 08 PHP...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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/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 are missing here

$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


Internal Data for BS-X BIOS

ROM MapRAM MapText TableNotesTutorials