Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; table: #'s of bits to copy from values in stage_table
- CODE_108B05: db $05, $04, $05, $05
- CODE_108B09: db $06, $06, $06, $07
- CODE_108B0D: db $04, $05, $06, $05
- CODE_108B11: db $05, $04, $02, $00
- ; the stage tables in the address table at $17/F7C3
- ; contain information about each area in the game
- ; in a packed format, rather than 8- or 16-bit pieces
- ; it is variable-bit pieces of data packed tightly.
- ; the table above at $10/8B05 contains the # of bits
- ; of each piece of data. it totals 75 so the tables
- ; are each 75 bits long, which occupies 10 bytes.
- ; this routine copies each level header piece
- ; into separate addresses in RAM starting at $0134
- ; the table in ROM's pattern goes as follows:
- ; BBBBB = Background Color
- ; TTTT = Tileset
- ; PPPPP = Layer 1 Object Palette
- ; IIIII = Layer 2 Image
- ; LLLLLL = Layer 2 Object Palette
- ; AAAAAA = Layer 3 Image
- ; OOOOOO = Layer 3 Object Palette
- ; SSSSSSS = Sprite Set
- ; RRRR = Sprite Palette
- ; YYYYY = Layer/Ordering Property
- ; EEEEEE = Special effects
- ; XXXXX = Unknown
- ; NNNNN = Initial Layer 2/3 Position
- ; CCCC = Music
- ; ZZ = Unknown 2/Midring
- ; |byte 1| |byte 2| |byte 3| |byte 4| |byte 5| |byte 6| |byte 7| |byte 8| |byte 9| |byte 10|
- ; BBBBBTTT TPPPPPII IIILLLLL LAAAAAAO OOOOOSSS SSSSRRRR YYYYYEEE EEEXXXXX NNNNNCCC CZZ-----
- $10/8B15 8B PHB ;
- $10/8B16 4B PHK ;
- $10/8B17 AB PLB ;
- $10/8B18 C2 10 REP #$10 ;
- $10/8B1A A0 00 00 LDY #$0000 ;
- $10/8B1D A2 00 00 LDX #$0000 ;
- $10/8B20 86 99 STX $99 [$00:0099] ;
- $10/8B22 64 02 STZ $02 [$00:0002] ;
- $10/8B24 BD 05 8B LDA $8B05,x[$10:8B05] ;
- $10/8B27 85 04 STA $04 [$00:0004] ; \ begin data unpack/copy
- $10/8B29 A9 00 LDA #$00 ; |
- $10/8B2B C6 02 DEC $02 [$00:0002] ; \ begin inner loop (copy one bit)
- $10/8B2D 10 11 BPL $11 [$8B40] ; |
- $10/8B2F 48 PHA ; |
- $10/8B30 A9 07 LDA #$07 ; |
- $10/8B32 85 02 STA $02 [$00:0002] ; |
- $10/8B34 5A PHY ; |
- $10/8B35 A4 99 LDY $99 [$00:0099] ; | load in next byte to continue copying chunks
- $10/8B37 B7 32 LDA [$32],y[$00:0000] ; | at stage_table[y]
- $10/8B39 85 06 STA $06 [$00:0006] ; |
- $10/8B3B C8 INY ; | increment stage_table index
- $10/8B3C 84 99 STY $99 [$00:0099] ; |
- $10/8B3E 7A PLY ; |
- $10/8B3F 68 PLA ; |
- $10/8B40 06 06 ASL $06 [$00:0006] ; | take next bit from stage_table
- $10/8B42 2A ROL A ; |
- $10/8B43 CE 04 00 DEC $0004 [$10:0004] ; |
- $10/8B46 D0 E3 BNE $E3 [$8B2B] ; /
- $10/8B48 99 34 01 STA $0134,y[$10:0134] ; | store variable-sized piece at current spot in RAM table
- $10/8B4B C8 INY ; |
- $10/8B4C C8 INY ; | go to next entry in $0134
- $10/8B4D E8 INX ; | as well as next in size table
- $10/8B4E BD 05 8B LDA $8B05,x[$10:8B05] ; | load next # of bits to copy
- $10/8B51 D0 D4 BNE $D4 [$8B27] ; / ($00 ends the loop)
- $10/8B53 AD 50 01 LDA $0150 [$10:0150] ;
- $10/8B56 8D BE 03 STA $03BE [$10:03BE] ;
- $10/8B59 E2 10 SEP #$10 ;
- $10/8B5B AB PLB ;
- $10/8B5C 6B RTL ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement