NoahJosephHall

s2.notes.txt

Feb 13th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; ---------------------------------------------------------------------------
  2. ; STYLE:
  3. ;
  4. ; Code is indented by one tab stop, which on my editor is 8 spaces. Most labels
  5. ; appear on separate lines, with the exception of nameless temporary labels
  6. ; which always appear next to the relevant instruction. Blank lines are inserted
  7. ; after reverse branches, to help make loops clearer; they may also be inserted
  8. ; before the start of the loop if it is simple enough. If code execution cannot
  9. ; continue linerally because of an unconditional jump, branch, or a return
  10. ; instruction, a series of dashed or double-dashed lines is inserted at the
  11. ; point where PC is altered. (Double dashes indicate possibly more significant
  12. ; boundaries than single dashes, but there is no hard rule behind the choice.)
  13. ; These dashes have been removed when breached by nameless temporary variables.
  14. ;
  15. ; Variables and structures have underscore-seperated names (eg Decomp_Buffer,
  16. ; Camera_X_Pos), while subroutine labels lack underscores for the most part.
  17. ; The exception here is templated names, where each part of the template is
  18. ; separated from the rest of the label by underscores. It's easy to figure
  19. ; out what a templated name refers to, because the template makes it obvious.
  20. ; For example, Obj##_ always refers to code, because the concept of "object" as
  21. ; it applies to Genesis Sonic games only makes sense when applied to executable
  22. ; code.
  23. ; Variables and labels that are relative to the start of z80 RAM begin with
  24. ; a lowercase "z" character. The Z80 sound driver code is in s2.sounddriver.asm.
  25.  
  26. ; I kept as many old and alternate label names around in the comments as I could,
  27. ; for your convenience in case you search for something by those label names.
  28. ; However, I renamed prefixes of address-containing labels as I saw fit,
  29. ; so for example you should search for "EC000:" instead of "loc_EC000:"
  30. ;
  31. ; I removed the colon after certain labels; this is because they ended with
  32. ; the names of other more important labels and would otherwise make searching
  33. ; for those other labels more difficult. In those cases, the colon is replaced
  34. ; with a space, so there is still something to add to your search if you
  35. ; want to find the definition of one of these conflicting less-important labels.
  36. ; This only applies to labels starting with "JmpTo_" or "BranchTo_".
  37. ;
  38. ; As comments on lines that change a subroutine counter, I use "=>" to mean
  39. ; "this changes the state such that this subroutine will get called:"
  40. ; On lines that change a subtype or data loading param, I use "<==" to mean
  41. ; "this changes the state such that this data will get loaded:"
  42. ;
  43. ; In case you want to change the object status table offset values:
  44. ; Many of these aren't completely safe to change because
  45. ; some code implicitly assumes the existing order when setting multiple variables,
  46. ; but swapping x with y, mappings with a position variable,
  47. ; or variables above $19 with each other should be safe, if you know what you're doing.
  48. ;
  49. ; The rest of this document is somewhat out of date.
  50.  
  51. ; ---------------------------------------------------------------------------
  52. ; TEMPLATES:
  53. ;
  54. ; Obj$(NAME_OF_OBJECT)
  55. ;   Start of object code.
  56. ; Obj_$(OBJECT_REF_NUM)_subtbl
  57. ;   Jump table of subroutine pointers. May be appended with '2' if this is a
  58. ;   secondary jump table (i.e. it goes with the secondary routine counter).
  59. ; Obj_$(OBJECT_REF_NUM)_sub_$(SUBROUTINE_VALUE)
  60. ;   Start of an object subroutine.
  61. ; MapUnc_$(OBJECT_REF_NUM)
  62. ;   Sprite table for $(OBJECT_REF_NUM). If an object has more than one, each is
  63. ;   appended by _primary, _scndary, _trnary, etc. If a single table is used
  64. ;   by multiple objects, the reference number of each is listed.
  65.  
  66. ; Blocks marked (!) require further investigation.
  67. ; ---------------------------------------------------------------------------
  68. ; MAIN MEMORY MAP - NORMAL PLAY
  69.  
  70. ; $0000 - $7FFF     Metablock table
  71. ; $8000 - $8FFF     Level layout
  72. ; $9000 - $A9FF     Block table
  73. ; $AA00 - $A?FF     Decompression buffer
  74. ; $AC00 - $AFFF     Intermediate sprite attribute table buffer
  75. ; $B000 - $D5FF     Object attribute table
  76. ; $D600 - $D8FF     Primary collision index
  77. ; $D900 - $DBFF     Secondary collision index
  78. ; $DC00 - $DFFF     Queued VDP command buffer
  79. ; $E000 - $E3FF     H scroll table buffer
  80. ; $E400 - $E4FF     Unknown data
  81. ; $E500 - $E5FF     Unknown data
  82. ; $E600 - $E6FF     Unknown data
  83. ; $E700 - $E7FF     Empty space?
  84. ; $E800 - $EDFF     Ring position table
  85. ; $EE00 - $EFFF     Variables
  86. ; $F000 - $F07F     Unknown palette
  87. ; $F080 - $F0FF     Underwater palette
  88. ; $F100 - $F67F     Variables
  89. ; $F680 - $F6FF     Pattern load queue
  90. ; $F700 - $F7FF     Variables
  91. ; $F800 - $F93F     Sprite attribute table buffer
  92. ; $F940 - $FAFF     Variables
  93. ; $FB00 - $FBF7     Above water palette
  94. ; $FB80 - $FBFF     Unknown palette
  95. ; $FC00 - $FCFF     Object respawn table
  96. ; $FD00 - $FFFF     Variables
  97.  
  98. ; Special stages have a completely different memory layout, but I don't know
  99. ; enough about it to fill out a releaseable map.
  100.  
  101. ; ---------------------------------------------------------------------------
  102. ; VRAM MAP - NORMAL PLAY
  103.  
  104. ; $0000 - $BFFF     Main patterns *
  105. ; $C000 - $CFFF     Plane A pattern name table
  106. ; $D000 - $DFFF     Patterns for text, powerups, and rings
  107. ; $E000 - $E7FF     Plane B pattern name table
  108. ; $F000 - $F7FF     Sonic and Tails (both are always loaded)
  109. ; $F800 - $FA7F     Sprite attribute table
  110. ; $FA80 - $FBFF     Life counter
  111. ; $FC00 - $FFFF     Horizontal scroll table
  112.  
  113. ; Pattern name tables are 64x32 cells; display is 40x28 cells. The extra space
  114. ; is used as a scroll buffer.
  115.  
  116. ; VRAM MAP - SPECIAL STAGE
  117.  
  118. ; $0000 - $7FFF     Main patterns *
  119. ; $8000 - $9FFF     Plane A pattern name table 1
  120. ; $A000 - $BFFF     Plane B pattern name table
  121. ; $C000 - $DFFF     Plane A pattern name table 2
  122. ; $E000 - $F7FF     Background tiles
  123. ; $F800 - $FA7F     Sprite attribute table
  124. ; $FA80 - $FBFF     Life counter (not used in special stage)
  125. ; $FC00 - $FFFF     Horizontal scroll table
  126.  
  127. ; Pattern name tables are 128x32 cells, display is 32x28 cells. This means
  128. ; that fully four display screens can be represented by the pattern name
  129. ; tables. This extra room is probably used for animation.
  130.  
  131. ; Plane W (the window) is disabled.
  132.  
  133. ; * The upper part of this area contains sprite patterns, while the lower part
  134. ;   contains patterns for the scrolling layers (i.e. the fore and background).
  135. ;   Where the division lies seems to depend on the particular Zone. Oil Ocean
  136. ;   Zone, for example, doesn't have a very complex background, and so can free
  137. ;   up some more space for sprites by repeatedly referencing the same blocks
  138. ;   in Scroll B's pattern name table.
Advertisement
Add Comment
Please, Sign In to add comment