Advertisement
Guest User

Untitled

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