Difference between revisions of "Sonic the Hedgehog (8-bit)"
From Sonic Retro
(→Level Headers: Added description for Under Water level header byte) |
m (Text replacement - " Mappings==" to " mappings==") |
||
(88 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{back}} The Guide is based on work by [[User:Magus|David Declerck]][http://sonicology.fateback.com/hacks/s1smsrom.htm][http://sonicology.fateback.com/hacks/s1ggrom.htm], [[User:Kroc|Kroc Camen]] and Penta Penguin. The Music Hacking Guide is based on notes by [[User:ValleyBell|ValleyBell]]. | |
− | ===ROM | + | ==Community Help== |
+ | A great deal is not yet understood about the ROM. In order to help with the building of tools (such as level / sprite editors), here is a list of some of the things that need investigating: | ||
− | ====Master System | + | * '''Sprite Mappings:''' How sprites are mapped from their [[#Object_Layout|object values]] to the actual sprite art tile indices is not known. Whilst we can load sprite art, we do not know how to read from the ROM where the enemy sprite is in the sprite art, how it is constructed and how the [[#Object_Layout|Object Layout]] relates to that. ''This knowledge is needed to create a level editor that allows changing of sprite sets for existing levels'' |
− | {|class="prettytable" | + | |
+ | * '''Solidity Data:''' The [[#Level_Headers|Level Headers]] contain a "Solidity Pointer" -- an index to somewhere in the ROM where data defines which tiles are solid / passable. This data is most likely 256 bytes long (one byte for each tile) and will need to define various states such as sloped tiles, water tiles (with current) and possibly much more. It is not known where the solidity data is stored, nor what format it is in. ''This knowledge is needed to modify [[#Level_Art|Level Art]].'' | ||
+ | |||
+ | * '''Level Headers:''' Various portions of the [[#Level_Headers|Level Headers]] are undocumented. Experiments are needed to work out the effects of the undocumented header bytes and to better understand existing ones. A full chart of the level header values is [[#Level_Headers|here]]. ''This knowledge is needed to create a level editor with the ability to work from a blank canvas'' | ||
+ | |||
+ | * '''Disassembly:''' The ROM has not been fully disassembled. For a total understanding of the game to allow complete control over every facet, a full disassembly is recommended. Moderate Z80 skills are required for this. There are many reasons why a disassembly would be beneficial: | ||
+ | ** Fix bugs / slowdown | ||
+ | ** Add new features such as a spin dash | ||
+ | ** Move the ROM to 512K so that content can have room to grow | ||
+ | ** Add new badnicks, traps bosses and more | ||
+ | |||
+ | If you have anything to contribute regarding these unknowns: | ||
+ | * Update this page, add to the discussion page or post on the forums if you have an account | ||
+ | * Contact Kroc Camen [[User:Kroc|here]] | ||
+ | |||
+ | ==ROM map== | ||
+ | |||
+ | ===Master System=== | ||
+ | {| class="prettytable" style="width:auto;" | ||
! Offset ||style="text-align:left;"| Description | ! Offset ||style="text-align:left;"| Description | ||
|- | |- | ||
− | + | |<tt>$00000</tt> – ? | |
|Main Game Code | |Main Game Code | ||
+ | |- | ||
+ | |<tt>$0024B</tt> – <tt>$0026A</tt> | ||
+ | |Labyrinth Act 1-2 Underwater [[#Palettes|Palette]] | ||
+ | |- | ||
+ | |<tt>$0026B</tt> – <tt>$0028A</tt> | ||
+ | |Labyrinth Act 3 Underwater [[#Palettes|Palette]] | ||
+ | |- | ||
+ | |<tt>$00F0E</tt> – <tt>$00F2D</tt> | ||
+ | |Map Screen 1 [[#Palettes|Palette]] | ||
+ | |- | ||
+ | |<tt>$00F2E</tt> – <tt>$00F4D</tt> | ||
+ | |Map Screen 2 [[#Palettes|Palette]] | ||
+ | |- | ||
+ | |nowrap style="vertical-align:top;"|<tt>$01209</tt> – <tt>$0122C</tt> | ||
+ | |Zone Title Pointers: | ||
+ | {| class="prettytable" style="width:auto;" | ||
+ | ! Offset ||style="text-align:left;"| Description | ||
+ | |- | ||
+ | |<tt>$01209</tt>–<tt>0A</tt> || Green Hill Act 1 (=<tt>$122D</tt>) | ||
+ | |- | ||
+ | |<tt>$0120B</tt>–<tt>0C</tt> || Green Hill Act 2 (=<tt>$122D</tt>) | ||
+ | |- | ||
+ | |<tt>$0120D</tt>–<tt>0E</tt> || Green Hill Act 3 (=<tt>$122D</tt>) | ||
+ | |- | ||
+ | |<tt>$0120F</tt>–<tt>10</tt> || Bridge Act 1 (=<tt>$123C</tt>) | ||
+ | |- | ||
+ | |<tt>$01211</tt>–<tt>12</tt> || Bridge Act 2 (=<tt>$123C</tt>) | ||
+ | |- | ||
+ | |<tt>$01213</tt>–<tt>14</tt> || Bridge Act 3 (=<tt>$123C</tt>) | ||
+ | |- | ||
+ | |<tt>$01215</tt>–<tt>16</tt> || Jungle Act 1 (=<tt>$124B</tt>) | ||
+ | |- | ||
+ | |<tt>$01217</tt>–<tt>18</tt> || Jungle Act 2 (=<tt>$124B</tt>) | ||
+ | |- | ||
+ | |<tt>$01219</tt>–<tt>1A</tt> || Jungle Act 3 (=<tt>$124B</tt>) | ||
+ | |- | ||
+ | |<tt>$0121B</tt>–<tt>1C</tt> || Labyrinth Act 1 (=<tt>$125A</tt>) | ||
+ | |- | ||
+ | |<tt>$0121D</tt>–<tt>1E</tt> || Labyrinth Act 2 (=<tt>$125A</tt>) | ||
+ | |- | ||
+ | |<tt>$0121F</tt>–<tt>20</tt> || Labyrinth Act 3 (=<tt>$125A</tt>) | ||
+ | |- | ||
+ | |<tt>$01221</tt>–<tt>22</tt> || Scrap Brain Act 1 (=<tt>$1269</tt>) | ||
+ | |- | ||
+ | |<tt>$01223</tt>–<tt>24</tt> || Scrap Brain Act 2 (=<tt>$1269</tt>) | ||
+ | |- | ||
+ | |<tt>$01225</tt>–<tt>26</tt> || Scrap Brain Act 3 (=<tt>$1269</tt>) | ||
+ | |- | ||
+ | |<tt>$01227</tt>–<tt>28</tt> || Sky Base Act 1 (=<tt>$1278</tt>) | ||
+ | |- | ||
+ | |<tt>$01229</tt>–<tt>2A</tt> || Sky Base Act 2 (=<tt>$1278</tt>) | ||
+ | |- | ||
+ | |<tt>$0122B</tt>–<tt>2C</tt> || Sky Base Act 3 (=<tt>$1278</tt>) | ||
+ | |} | ||
+ | |- | ||
+ | |nowrap style="vertical-align:top;"|<tt>$0122D</tt> – <tt>$01286</tt> | ||
+ | |[[#Zone_Titles|Zone Titles:]] ([[#Game_Text|Text Format]]) | ||
+ | {| class="prettytable" style="width:auto;" | ||
+ | ! Offset ||style="text-align:left;"| Description | ||
+ | |- | ||
+ | |<tt>$0122D</tt>–<tt>3B</tt> || "GREEN HILL" | ||
+ | |- | ||
+ | |<tt>$0123C</tt>–<tt>4A</tt> || "BRIDGE" | ||
+ | |- | ||
+ | |<tt>$0124B</tt>–<tt>59</tt> || "JUNGLE" | ||
+ | |- | ||
+ | |<tt>$0125A</tt>–<tt>68</tt> || "LABYRINTH" | ||
+ | |- | ||
+ | |<tt>$01269</tt>–<tt>77</tt> ||"SCRAP BRAIN" | ||
+ | |- | ||
+ | |<tt>$01278</tt>–<tt>86</tt> ||"SKY BASE" | ||
+ | |} | ||
+ | |- | ||
+ | |<tt>$013E1</tt> – <tt>$01400</tt> | ||
+ | |Title Screen [[#Palettes|Palette]] | ||
+ | |- | ||
+ | |style="vertical-align:top;"|<tt>$0197E</tt> – <tt>$019AD</tt> | ||
+ | |[[#Final_Score_Titles|Final Score Titles]]: ([[#Game_Text|Text Format]])<br />The text used for the score bonuses given on the completion of the game | ||
+ | {| class="prettytable" style="width:auto;" | ||
+ | ! Offset ||style="text-align:left;"| Description | ||
+ | |- | ||
+ | |<tt>$0197E</tt>–<tt>8D</tt> || "CHAOS EMERALD" | ||
+ | |- | ||
+ | |<tt>$0198E</tt>–<tt>9D</tt> || "SONIC LEFT" | ||
+ | |- | ||
+ | |<tt>$0199E</tt>–<tt>AD</tt> || "SPECIAL BONUS" | ||
+ | |} | ||
+ | |- | ||
+ | |<tt>$01F9D</tt> – <tt>$01FA8</tt> | ||
+ | |[[#Sky_Base_Act_1_Lightning_Palettes|Lightning Palette Control]] | ||
+ | |- | ||
+ | |<tt>$01B8D</tt> – <tt>$01BAC</tt> | ||
+ | |"Sonic Has Passed" Screen [[#Palettes|Palette]] | ||
+ | |- | ||
+ | |<tt>$02905</tt> – <tt>$02AD5</tt> | ||
+ | |[[#Credits_Text|Credits Text]] ([[#Game_Text|Text Format]]) | ||
+ | |- | ||
+ | |<tt>$02AD6</tt> – <tt>$02AF5</tt> | ||
+ | |Credits Screen [[#Palettes|Palette]] | ||
+ | |- | ||
+ | |<tt>$0626C</tt> – <tt>$0627B</tt> | ||
+ | |End Sign Sprite [[#Palettes|Palette]] | ||
|- | |- | ||
|style="vertical-align:top;"|<tt>$0627C</tt> – <tt>$0628B</tt> | |style="vertical-align:top;"|<tt>$0627C</tt> – <tt>$0628B</tt> | ||
− | |Palette Pointers: | + | |[[#Level_Palettes|Palette Pointers]]: |
− | {|class="prettytable" | + | {| class="prettytable" style="width:auto;" |
! Offset ||style="text-align:left;"| Description | ! Offset ||style="text-align:left;"| Description | ||
|- | |- | ||
− | |<tt>$0627C</tt>–<tt>D</tt> | + | |<tt>$0627C</tt>–<tt>D</tt> || 0: Green Hill (=<tt>$629E</tt>) |
− | |0: Green Hill | ||
|- | |- | ||
− | |<tt>$0627E</tt>–<tt>F</tt> | + | |<tt>$0627E</tt>–<tt>F</tt> || 1: Bridge (=<tt>$62EE</tt>) |
− | |1: Bridge | ||
|- | |- | ||
− | |<tt>$06280</tt>–<tt>1</tt> | + | |<tt>$06280</tt>–<tt>1</tt> || 2: Jungle (=<tt>$633E</tt>) |
− | |2: Jungle | ||
|- | |- | ||
− | |<tt>$06282</tt>–<tt>3</tt> | + | |<tt>$06282</tt>–<tt>3</tt> || 3: Labyrinth (=<tt>$638E</tt>) |
− | |3: Labyrinth | ||
|- | |- | ||
− | |<tt>$06284</tt>–<tt>5</tt> | + | |<tt>$06284</tt>–<tt>5</tt> || 4: Scrap Brain (=<tt>$63DE</tt>) |
− | |4: Scrap Brain | ||
|- | |- | ||
− | |<tt>$06286</tt>–<tt>7</tt> | + | |<tt>$06286</tt>–<tt>7</tt> || 5: Sky Base 1/2A (=<tt>$643E</tt>) |
− | |5: Sky Base 1/2A | ||
|- | |- | ||
− | |<tt>$06288</tt>–<tt>9</tt> | + | |<tt>$06288</tt>–<tt>9</tt> || 6: Sky Base 2B/3 (=<tt>$658E</tt>) |
− | |6: Sky Base 2B/3 | ||
|- | |- | ||
− | |<tt>$0628A</tt>–<tt>B</tt> | + | |<tt>$0628A</tt>–<tt>B</tt> || 7: Special Stage (=<tt>$655E</tt>) |
− | |7: Special Stage | ||
|} | |} | ||
|- | |- | ||
− | |style="vertical-align:top;"|<tt>$0628C</tt> – <tt>$ | + | |style="vertical-align:top;"|<tt>$0628C</tt> – <tt>$0629D</tt> |
− | |Palette Cycle Pointers: | + | |[[#Level_Cycle_Palettes|Palette Cycle Pointers]]: |
− | {|class="prettytable" | + | {| class="prettytable" style="width:auto;" |
! Offset ||style="text-align:left;"| Description | ! Offset ||style="text-align:left;"| Description | ||
|- | |- | ||
− | |<tt>$0628C</tt>–<tt>D</tt> | + | |<tt>$0628C</tt>–<tt>D</tt> || 0: Green Hill (=<tt>$62BE</tt>) |
− | |0: Green Hill | ||
|- | |- | ||
− | |<tt>$0628E</tt>–<tt>F</tt> | + | |<tt>$0628E</tt>–<tt>F</tt> || 1: Bridge (=<tt>$630E</tt>) |
− | |1: Bridge | ||
|- | |- | ||
− | |<tt>$06290</tt>–<tt>1</tt> | + | |<tt>$06290</tt>–<tt>1</tt> || 2: Jungle (=<tt>$635E</tt>) |
− | |2: Jungle | ||
|- | |- | ||
− | |<tt>$06292</tt>–<tt>3</tt> | + | |<tt>$06292</tt>–<tt>3</tt> || 3: Labyrinth (=<tt>$63AE</tt>) |
− | |3: Labyrinth | ||
|- | |- | ||
− | |<tt>$06294</tt>–<tt>5</tt> | + | |<tt>$06294</tt>–<tt>5</tt> || 4: Scrap Brain (=<tt>$63FE</tt>) |
− | |4: Scrap Brain | ||
|- | |- | ||
− | |<tt>$06296</tt>–<tt>7</tt> | + | |<tt>$06296</tt>–<tt>7</tt> || 5: Sky Base 1 (=<tt>$645E</tt>) |
− | |5: Sky Base 1 | ||
|- | |- | ||
− | |<tt>$06298</tt>–<tt>9</tt> | + | |<tt>$06298</tt>–<tt>9</tt> || 6: Sky Base 2-Interior / 3 (=<tt>$65AE</tt>) |
− | |6: Sky Base 2-Interior / 3 | ||
|- | |- | ||
− | |<tt>$0629A</tt>–<tt>B</tt> | + | |<tt>$0629A</tt>–<tt>B</tt> || 7: Special Stage (=<tt>$657E</tt>) |
− | |7: Special Stage | ||
|- | |- | ||
− | |<tt>$0629C</tt>–<tt>D</tt> | + | |<tt>$0629C</tt>–<tt>D</tt> || 8: Sky Base 2 (=<tt>$651E</tt>) |
− | |8: Sky Base 2 | ||
|} | |} | ||
|- | |- | ||
− | |<tt>$0629E</tt> – <tt>$ | + | |style="vertical-align:top;"|<tt>$0629E</tt> – <tt>$065ED</tt> |
− | |Palettes | + | |[[#Palettes|Palettes]]: |
+ | {| class="prettytable" style="width:auto;" | ||
+ | ! Offset ||style="text-align:left;"| Description | ||
+ | |- | ||
+ | |<tt>$0629E</tt>–<tt>2BD</tt> || Green Hill Palette | ||
+ | |- | ||
+ | |<tt>$062BE</tt>–<tt>2ED</tt> || Green Hill Cycle Palettes ×3 | ||
|- | |- | ||
− | |<tt>$0C7F0</tt> – <tt>$ | + | |<tt>$062EE</tt>–<tt>30D</tt> || Bridge Palette |
+ | |- | ||
+ | |<tt>$0630E</tt>–<tt>33D</tt> || Bridge Cycle Palettes ×3 | ||
+ | |- | ||
+ | |<tt>$0633E</tt>–<tt>35D</tt> || Jungle Palette | ||
+ | |- | ||
+ | |<tt>$0635E</tt>–<tt>38D</tt> || Jungle Cycle Palettes ×3 | ||
+ | |- | ||
+ | |<tt>$0638E</tt>–<tt>3AD</tt> || Labyrinth Palette | ||
+ | |- | ||
+ | |<tt>$063AE</tt>–<tt>3DD</tt> || Labyrinth Cycle Palettes ×3 | ||
+ | |- | ||
+ | |<tt>$063DE</tt>–<tt>3FD</tt> || Scrap Brain Palette | ||
+ | |- | ||
+ | |<tt>$063FE</tt>–<tt>43D</tt> || Scrap Brain Cycle Palettes ×4 | ||
+ | |- | ||
+ | |<tt>$0643E</tt>–<tt>45D</tt> || Sky Base 1/2A Palette | ||
+ | |- | ||
+ | |<tt>$0645E</tt>–<tt>49D</tt> || Sky Base 1 Cycle Palettes ×4 | ||
+ | |- | ||
+ | |<tt>$0649E</tt>–<tt>4DD</tt> || Sky Base 1 Lightning Cycle Palettes Part-1 ×4 | ||
+ | |- | ||
+ | |<tt>$064DE</tt>–<tt>51D</tt> || Sky Base 1 Lightning Cycle Palettes Part-2 ×4 | ||
+ | |- | ||
+ | |<tt>$0651E</tt>–<tt>55D</tt> || Sky Base 2 Cycle Palettes ×4 | ||
+ | |- | ||
+ | |<tt>$0655E</tt>–<tt>57D</tt> || Special Stage Palette | ||
+ | |- | ||
+ | |<tt>$0657E</tt>–<tt>58D</tt> || Special Stage Cycle Palettes ×1 | ||
+ | |- | ||
+ | |<tt>$0658E</tt>–<tt>5AD</tt> || Sky Base 2B/3 Palette | ||
+ | |- | ||
+ | |<tt>$065AE</tt>–<tt>5ED</tt> || Sky Base 2A/3 Cycle Palettes ×4 | ||
+ | |} | ||
+ | |- | ||
+ | |<tt>$0731C</tt> – <tt>$0732B</tt> | ||
+ | |Boss Sprite [[#Palettes|Palette]] (including end [[capsule]]) | ||
+ | |- | ||
+ | |<tt>$0C7F0</tt> – <tt>$0FFB0</tt> | ||
|Music, sounds, and other stuff | |Music, sounds, and other stuff | ||
|- | |- | ||
− | |style="vertical-align:top;"|<tt>$10000</tt> – <tt>$ | + | |<tt>$0FFB1</tt> – <tt>$0FFFF</tt> |
− | | | + | |''EMPTY SPACE'' |
− | {|class="prettytable" | + | |- |
+ | |style="vertical-align:top;"|<tt>$10000</tt> – <tt>$14C9F</tt> | ||
+ | |[[#Block_Mappings|Block Mappings]]: | ||
+ | {| class="prettytable" style="width:auto;" | ||
! Offset ||style="text-align:left;"| Description | ! Offset ||style="text-align:left;"| Description | ||
|- | |- | ||
− | |<tt>$10000</tt> – <tt>$10B7F</tt> | + | |<tt>$10000</tt> – <tt>$10B7F</tt> || Green Hill (184 blocks) |
− | |Green Hill (184 | ||
|- | |- | ||
− | |<tt>$10B80</tt> – <tt>$1147F</tt> | + | |<tt>$10B80</tt> – <tt>$1147F</tt> || Bridge (144 blocks) |
− | |Bridge (144 | ||
|- | |- | ||
− | |<tt>$11480</tt> – <tt>$11E7F</tt> | + | |<tt>$11480</tt> – <tt>$11E7F</tt> || Jungle (160 blocks) |
− | |Jungle (160 | ||
|- | |- | ||
− | |<tt>$11E80</tt> – <tt>$1297F</tt> | + | |<tt>$11E80</tt> – <tt>$1297F</tt> || Labyrinth (176 blocks) |
− | |Labyrinth (176 | ||
|- | |- | ||
− | |<tt>$12980</tt> – <tt>$1357F</tt> | + | |<tt>$12980</tt> – <tt>$1357F</tt> || Scrap Brain (192 blocks) |
− | |Scrap Brain (192 | ||
|- | |- | ||
− | |<tt>$13580</tt> – <tt>$142FF</tt> | + | |<tt>$13580</tt> – <tt>$142FF</tt> || Sky Base 1-2 (216 blocks) |
− | |Sky Base 1-2 (216 | ||
|- | |- | ||
− | |<tt>$14300</tt> – <tt>$1497F</tt> | + | |<tt>$14300</tt> – <tt>$1497F</tt> || Sky Base 3 (104 blocks) |
− | |Sky Base 3 (104 | ||
|- | |- | ||
− | |<tt>$14980</tt> – | + | |<tt>$14980</tt> – <tt>$1517F</tt> || Bonus Stage (128 blocks) |
− | |Bonus Stage ( | ||
|} | |} | ||
|- | |- | ||
− | |<tt>$ | + | |<tt>$15180</tt> – <tt>$1557F</tt> |
− | |'' | + | |[[#Blinking_Items_Art|Blinking Items Art]] (Box, etc...) |
+ | |- | ||
+ | |style="vertical-align:top;"|<tt>$15580</tt> – <tt>$155C9</tt> | ||
+ | |[[#Level_Headers_Pointers|Level Header Pointers]]: | ||
+ | {| class="prettytable" style="width:auto;" | ||
+ | ! Offset ||style="text-align:left;"| Description | ||
+ | |- | ||
+ | |<tt>$15580</tt>–<tt>81</tt> || 0: Green Hill Act 1 | ||
+ | |- | ||
+ | |<tt>$15582</tt>–<tt>83</tt> || 1: Green Hill Act 2 | ||
+ | |- | ||
+ | |<tt>$15584</tt>–<tt>85</tt> || 2: Green Hill Act 3 | ||
+ | |- | ||
+ | |<tt>$15586</tt>–<tt>87</tt> || 3: Bridge Act 1 | ||
+ | |- | ||
+ | |<tt>$15588</tt>–<tt>89</tt> || 4: Bridge Act 2 | ||
+ | |- | ||
+ | |<tt>$1558A</tt>–<tt>8B</tt> || 5: Bridge Act 3 | ||
+ | |- | ||
+ | |<tt>$1558C</tt>–<tt>8D</tt> || 6: Jungle Act 1 | ||
+ | |- | ||
+ | |<tt>$1558E</tt>–<tt>8F</tt> || 7: Jungle Act 2 | ||
+ | |- | ||
+ | |<tt>$15590</tt>–<tt>91</tt> || 8: Jungle Act 3 | ||
+ | |- | ||
+ | |<tt>$15592</tt>–<tt>93</tt> || 9: Labyrinth Act 1 | ||
+ | |- | ||
+ | |<tt>$15594</tt>–<tt>95</tt> || 10: Labyrinth Act 2 | ||
+ | |- | ||
+ | |<tt>$15596</tt>–<tt>97</tt> || 11: Labyrinth Act 3 | ||
+ | |- | ||
+ | |<tt>$15598</tt>–<tt>99</tt> || 12: Scrap Brain Act 1 | ||
+ | |- | ||
+ | |<tt>$1559A</tt>–<tt>9B</tt> || 13: Scrap Brain Act 2 | ||
+ | |- | ||
+ | |<tt>$1559C</tt>–<tt>9D</tt> || 14: Scrap Brain Act 3 | ||
+ | |- | ||
+ | |<tt>$1559E</tt>–<tt>9F</tt> || 15: Sky Base Act 1 | ||
+ | |- | ||
+ | |<tt>$155A0</tt>–<tt>A1</tt> || 16: Sky Base Act 2 | ||
+ | |- | ||
+ | |<tt>$155A2</tt>–<tt>A3</tt> || 17: Sky Base Act 3 | ||
+ | |- | ||
+ | |<tt>$155A4</tt>–<tt>A5</tt> || 18: End Sequence | ||
+ | |- | ||
+ | |<tt>$155A6</tt>–<tt>A7</tt> || 19: ''UNUSED (invalid data)'' | ||
+ | |- | ||
+ | |<tt>$155A8</tt>–<tt>A9</tt> || 20: Scrap Brain Act 2 (Emerald Maze), from corridor | ||
+ | |- | ||
+ | |<tt>$155AA</tt>–<tt>AB</tt> || 21: Scrap Brain Act 2 (Ballhog Area) | ||
+ | |- | ||
+ | |<tt>$155AC</tt>–<tt>AD</tt> || 22: Scrap Brain Act 2, from transporter | ||
+ | |- | ||
+ | |<tt>$155AE</tt>–<tt>AF</tt> || 23: Scrap Brain Act 2 (Emerald Maze), from transporter | ||
+ | |- | ||
+ | |<tt>$155B0</tt>–<tt>B1</tt> || 24: Scrap Brain Act 2, from Emerald Maze | ||
+ | |- | ||
+ | |<tt>$155B2</tt>–<tt>B3</tt> || 25: Scrap Brain Act 2, from Ballhog Area | ||
+ | |- | ||
+ | |<tt>$155B4</tt>–<tt>B5</tt> || 26: Sky Base Act 2 (Interior) | ||
+ | |- | ||
+ | |<tt>$155B6</tt>–<tt>B7</tt> || 27: Sky Base Act 2 (Interior), this one is identical | ||
+ | |- | ||
+ | |<tt>$155B8</tt>–<tt>B9</tt> || 28: Special Stage 1 | ||
+ | |- | ||
+ | |<tt>$155BA</tt>–<tt>BB</tt> || 29: Special Stage 2 | ||
+ | |- | ||
+ | |<tt>$155BC</tt>–<tt>BD</tt> || 30: Special Stage 3 | ||
+ | |- | ||
+ | |<tt>$155BE</tt>–<tt>BF</tt> || 31: Special Stage 4 | ||
+ | |- | ||
+ | |<tt>$155C0</tt>–<tt>C1</tt> || 32: Special Stage 5 | ||
+ | |- | ||
+ | |<tt>$155C2</tt>–<tt>C3</tt> || 33: Special Stage 6 | ||
+ | |- | ||
+ | |<tt>$155C4</tt>–<tt>C5</tt> || 34: Special Stage 7 | ||
|- | |- | ||
− | |<tt>$ | + | |<tt>$155C6</tt>–<tt>C7</tt> || 35: Special Stage 8 |
− | | | ||
|- | |- | ||
− | |<tt>$ | + | |<tt>$155C8</tt>–<tt>C9</tt> || 36: ''UNUSED (invalid data)'' |
− | | | + | |} |
|- | |- | ||
|style="vertical-align:top;"|<tt>$155CA</tt> – <tt>$15AB3</tt> | |style="vertical-align:top;"|<tt>$155CA</tt> – <tt>$15AB3</tt> | ||
− | ||Level Headers: | + | |[[#Level_Headers|Level Headers]]: |
− | {|class="prettytable" | + | {| class="prettytable" style="width:auto;" |
! Offset ||style="text-align:left;"| Description | ! Offset ||style="text-align:left;"| Description | ||
|- | |- | ||
− | |<tt>$155CA</tt> – <tt>$155EE</tt> | + | |<tt>$155CA</tt> – <tt>$155EE</tt> || Green Hill Act 1 |
− | |Green Hill Act 1 | ||
|- | |- | ||
− | |<tt>$155EF</tt> – <tt>$15613</tt> | + | |<tt>$155EF</tt> – <tt>$15613</tt> || Green Hill Act 2 |
− | |Green Hill Act 2 | ||
|- | |- | ||
− | |<tt>$15614</tt> – <tt>$15638</tt> | + | |<tt>$15614</tt> – <tt>$15638</tt> || Green Hill Act 3 |
− | |Green Hill Act 3 | ||
|- | |- | ||
− | |<tt>$15639</tt> – <tt>$1565D</tt> | + | |<tt>$15639</tt> – <tt>$1565D</tt> || End Sequence |
− | |End Sequence | ||
|- | |- | ||
− | |<tt>$1565E</tt> – <tt>$15682</tt> | + | |<tt>$1565E</tt> – <tt>$15682</tt> || Bridge Act 1 |
− | |Bridge Act 1 | ||
|- | |- | ||
− | |<tt>$15683</tt> – <tt>$156A7</tt> | + | |<tt>$15683</tt> – <tt>$156A7</tt> || Bridge Act 2 |
− | |Bridge Act 2 | ||
|- | |- | ||
− | |<tt>$156A8</tt> – <tt>$156CC</tt> | + | |<tt>$156A8</tt> – <tt>$156CC</tt> || Bridge Act 3 |
− | |Bridge Act 3 | ||
|- | |- | ||
− | |<tt>$156CD</tt> – <tt>$156F1</tt> | + | |<tt>$156CD</tt> – <tt>$156F1</tt> || Jungle Act 1 |
− | |Jungle Act 1 | ||
|- | |- | ||
− | |<tt>$156F2</tt> – <tt>$15716</tt> | + | |<tt>$156F2</tt> – <tt>$15716</tt> || Jungle Act 2 |
− | |Jungle Act 2 | ||
|- | |- | ||
− | |<tt>$15717</tt> – <tt>$1573B</tt> | + | |<tt>$15717</tt> – <tt>$1573B</tt> || Jungle Act 3 |
− | |Jungle Act 3 | ||
|- | |- | ||
− | |<tt>$1573C</tt> – <tt>$15760</tt> | + | |<tt>$1573C</tt> – <tt>$15760</tt> || Labyrinth Act 1 |
− | |Labyrinth Act 1 | ||
|- | |- | ||
− | |<tt>$15761</tt> – <tt>$15785</tt> | + | |<tt>$15761</tt> – <tt>$15785</tt> || Labyrinth Act 2 |
− | |Labyrinth Act 2 | ||
|- | |- | ||
− | |<tt>$15786</tt> – <tt>$157AA</tt> | + | |<tt>$15786</tt> – <tt>$157AA</tt> || Labyrinth Act 3 |
− | |Labyrinth Act 3 | ||
|- | |- | ||
− | |<tt>$157AB</tt> – <tt>$157CF</tt> | + | |<tt>$157AB</tt> – <tt>$157CF</tt> || Scrap Brain Act 1 |
− | |Scrap Brain Act 1 | ||
|- | |- | ||
− | |<tt>$157D0</tt> – <tt>$157F4</tt> | + | |<tt>$157D0</tt> – <tt>$157F4</tt> || Scrap Brain Act 2 |
− | |Scrap Brain Act 2 | ||
|- | |- | ||
− | |<tt>$157F5</tt> – <tt>$15819</tt> | + | |<tt>$157F5</tt> – <tt>$15819</tt> || Scrap Brain Act 2 (Emerald Maze), From Corridor |
− | |Scrap Brain Act 2 (Emerald Maze), From Corridor | ||
|- | |- | ||
− | |<tt>$1581A</tt> – <tt>$1583E</tt> | + | |<tt>$1581A</tt> – <tt>$1583E</tt> || Scrap Brain Act 2 (Ballhog Area) |
− | |Scrap Brain Act 2 (Ballhog Area) | ||
|- | |- | ||
− | |<tt>$1583F</tt> – <tt>$15863</tt> | + | |<tt>$1583F</tt> – <tt>$15863</tt> || Scrap Brain Act 3 |
− | |Scrap Brain Act 3 | ||
|- | |- | ||
− | |<tt>$15864</tt> – <tt>$15888</tt> | + | |<tt>$15864</tt> – <tt>$15888</tt> || Scrap Brain Act 2, From Emerald Maze |
− | |Scrap Brain Act 2, From Emerald Maze | ||
|- | |- | ||
− | |<tt>$15889</tt> – <tt>$158AD</tt> | + | |<tt>$15889</tt> – <tt>$158AD</tt> || Scrap Brain Act 2, From Ballhog Area |
− | |Scrap Brain Act 2, From Ballhog Area | ||
|- | |- | ||
− | |<tt>$158AE</tt> – <tt>$158D2</tt> | + | |<tt>$158AE</tt> – <tt>$158D2</tt> || Scrap Brain Act 2, From Transporter |
− | |Scrap Brain Act 2, From Transporter | ||
|- | |- | ||
− | |<tt>$158D3</tt> – <tt>$158F7</tt> | + | |<tt>$158D3</tt> – <tt>$158F7</tt> || Scrap Brain Act 2 (Emerald Maze), From Transporter |
− | |Scrap Brain Act 2 (Emerald Maze), From Transporter | ||
|- | |- | ||
− | |<tt>$158F8</tt> – <tt>$1591C</tt> | + | |<tt>$158F8</tt> – <tt>$1591C</tt> || Sky Base Act 1 |
− | |Sky Base Act 1 | ||
|- | |- | ||
− | |<tt>$1591D</tt> – <tt>$15941</tt> | + | |<tt>$1591D</tt> – <tt>$15941</tt> || Sky Base Act 2 |
− | |Sky Base Act 2 | ||
|- | |- | ||
− | |<tt>$15942</tt> – <tt>$15966</tt> | + | |<tt>$15942</tt> – <tt>$15966</tt> || Sky Base Act 3 |
− | |Sky Base Act 3 | ||
|- | |- | ||
− | |<tt>$15967</tt> – <tt>$1598B</tt> | + | |<tt>$15967</tt> – <tt>$1598B</tt> || Sky Base Act 2 (Interior) |
− | |Sky Base Act 2 (Interior) | ||
|- | |- | ||
− | |<tt>$1598C</tt> – <tt>$159B0</tt> | + | |<tt>$1598C</tt> – <tt>$159B0</tt> || Special Stage 1 |
− | |Special Stage 1 | ||
|- | |- | ||
− | |<tt>$159B1</tt> – <tt>$159D5</tt> | + | |<tt>$159B1</tt> – <tt>$159D5</tt> || Special Stage 2 |
− | |Special Stage 2 | ||
|- | |- | ||
− | |<tt>$159D6</tt> – <tt>$159FA</tt> | + | |<tt>$159D6</tt> – <tt>$159FA</tt> || Special Stage 3 |
− | |Special Stage 3 | ||
|- | |- | ||
− | |<tt>$159FB</tt> – <tt>$15A1F</tt> | + | |<tt>$159FB</tt> – <tt>$15A1F</tt> || Special Stage 4 |
− | |Special Stage 4 | ||
|- | |- | ||
− | |<tt>$15A20</tt> – <tt>$15A44</tt> | + | |<tt>$15A20</tt> – <tt>$15A44</tt> || Special Stage 5 |
− | |Special Stage 5 | ||
|- | |- | ||
− | |<tt>$15A45</tt> – <tt>$15A69</tt> | + | |<tt>$15A45</tt> – <tt>$15A69</tt> || Special Stage 6 |
− | |Special Stage 6 | ||
|- | |- | ||
− | |<tt>$15A6A</tt> – <tt>$15A8E</tt> | + | |<tt>$15A6A</tt> – <tt>$15A8E</tt> || Special Stage 7 |
− | |Special Stage 7 | ||
|- | |- | ||
− | |<tt>$15A8F</tt> – <tt>$15AB3</tt> | + | |<tt>$15A8F</tt> – <tt>$15AB3</tt> || Special Stage 8 |
− | |Special Stage 8 | ||
|} | |} | ||
|- | |- | ||
− | |<tt>$15AB4</tt> – <tt>$15FFF</tt> | + | |style="vertical-align:top;"|<tt>$15AB4</tt> – <tt>$15FFF</tt> |
− | | | + | |[[#Object_Layout|Object Layout]]: |
+ | {| class="prettytable" style="width:auto;" | ||
+ | ! Offset ||style="text-align:left;"| Description | ||
+ | |- | ||
+ | |<tt>$15AB4</tt> – <tt>$15AFF</tt> || Green Hill Act 1 (26 Objects) | ||
+ | |- | ||
+ | |<tt>$15B00</tt> – <tt>$15B42</tt> || Green Hill Act 2 (23 Objects) | ||
+ | |- | ||
+ | |<tt>$15B43</tt> – <tt>$15B55</tt> || Green Hill Act 3 (7 Objects) | ||
+ | |- | ||
+ | |<tt>$15B56</tt> – <tt>$15B9B</tt> || Bridge Act 1 (24 Objects) | ||
+ | |- | ||
+ | |<tt>$15B9C</tt> – <tt>$15BD5</tt> || Bridge Act 2 (20 Objects) | ||
+ | |- | ||
+ | |<tt>$15BD6</tt> – <tt>$15BEB</tt> || Bridge Act 3 (8 Objects) | ||
+ | |- | ||
+ | |<tt>$15BEC</tt> – <tt>$15C43</tt> || Jungle Act 1 (30 Objects) | ||
+ | |- | ||
+ | |<tt>$15C44</tt> – <tt>$15C8C</tt> || Jungle Act 2 (25 Objects) | ||
+ | |- | ||
+ | |<tt>$15C8D</tt> – <tt>$15CA2</tt> || Jungle Act 3 (8 Objects) | ||
+ | |- | ||
+ | |<tt>$15CA3</tt> – <tt>$15CF1</tt> || Labyrinth Act 1 (27 Objects) | ||
+ | |- | ||
+ | |<tt>$15CF2</tt> – <tt>$15D49</tt> || Labyrinth Act 2 (30 Objects) | ||
+ | |- | ||
+ | |<tt>$15D4A</tt> – <tt>$14D68</tt> || Labyrinth Act 3 (11 Objects) | ||
+ | |- | ||
+ | |<tt>$15D69</tt> – <tt>$15DAB</tt> || Scrap Brain Act 1 (23 Objects) | ||
+ | |- | ||
+ | |<tt>$15DAC</tt> – <tt>$15DE8</tt> || Scrap Brain Act 2 (21 Objects) | ||
+ | |- | ||
+ | |<tt>$15DE9</tt> – <tt>$15E34</tt> || Scrap Brain Act 2, Emerald Maze (26 Objects) | ||
+ | |- | ||
+ | |<tt>$15E35</tt> – <tt>$15E4D</tt> || Scrap Brain Act 2, Ballhog Area (9 Objects) | ||
+ | |- | ||
+ | |<tt>$15E4E</tt> – <tt>$15E99</tt> || Scrap Brain Act 3 (26 Objects) | ||
+ | |- | ||
+ | |<tt>$15E9A</tt> – <tt>$15ED3</tt> || Sky Base Act 1 (20 Objects) | ||
+ | |- | ||
+ | |<tt>$15ED4</tt> – <tt>$15F20</tt> || Sky Base Act 2 (23 Objects) | ||
+ | |- | ||
+ | |<tt>$15F21</tt> – <tt>$15F16</tt> || Sky Base Act 2, Interior (2 Objects) | ||
+ | |- | ||
+ | |<tt>$15F17</tt> – <tt>$15F25</tt> || Sky Base Act 3 (4 Objects) | ||
+ | |- | ||
+ | |<tt>$15F26</tt> – <tt>$15F2B</tt> || Special Stage 1 (3 Objects) | ||
+ | |- | ||
+ | |<tt>$15F2C</tt> – <tt>$15F35</tt> || Special Stage 2 (4 Objects) | ||
+ | |- | ||
+ | |<tt>$15F36</tt> – <tt>$15F3F</tt> || Special Stage 3 (4 Objects) | ||
+ | |- | ||
+ | |<tt>$15F40</tt> – <tt>$15F52</tt> || Special Stage 4 (7 Objects) | ||
+ | |- | ||
+ | |<tt>$15F53</tt> – <tt>$15F65</tt> || Special Stage 5 (7 Objects) | ||
+ | |- | ||
+ | |<tt>$15F66</tt> – <tt>$15F7E</tt> || Special Stage 6 (9 Objects) | ||
+ | |- | ||
+ | |<tt>$15F7F</tt> – <tt>$15F94</tt> || Special Stage 7 (8 Objects) | ||
+ | |- | ||
+ | |<tt>$15F95</tt> – <tt>$15FB9</tt> || Special Stage 8 (13 Objects) | ||
+ | |- | ||
+ | |<tt>$15FBA</tt> – <tt>$15FC3</tt> || End Sequence, Green Hill (4 Objects) | ||
+ | |- | ||
+ | |<tt>$15FC4</tt> – <tt>$15FFF</tt> || ''EMPTY SPACE'' | ||
+ | |} | ||
|- | |- | ||
|style="vertical-align:top;"|<tt>$16000</tt> – <tt>$16DE9</tt> | |style="vertical-align:top;"|<tt>$16000</tt> – <tt>$16DE9</tt> | ||
− | |Misc Mappings: | + | |[[#Misc_Mappings|Misc Mappings]]: ([[#RLE_Compression|RLE Compressed]]) |
− | {|class="prettytable" | + | {| class="prettytable" style="width:auto;" |
! Offset ||style="text-align:left;"| Description | ! Offset ||style="text-align:left;"| Description | ||
|- | |- | ||
− | |<tt>$16000</tt> – <tt>$1612E</tt>? | + | |<tt>$16000</tt> – <tt>$1612E</tt>? || Title Screen |
− | |Title Screen | ||
|- | |- | ||
− | |<tt>$1627E</tt> – <tt>$163F5</tt> | + | |<tt>$1627E</tt> – <tt>$163F5</tt> || Map 1 Background |
− | |Map 1 Background | ||
|- | |- | ||
− | |<tt>$163F6</tt> – <tt>$1653A</tt> | + | |<tt>$163F6</tt> – <tt>$1653A</tt> || Map 1 Foreground |
− | |Map 1 Foreground | ||
|- | |- | ||
− | |<tt>$1653B</tt> – <tt>$166AA</tt> | + | |<tt>$1653B</tt> – <tt>$166AA</tt> || Map 2 Background (zoom on Robotnik's 'fortress') |
− | |Map 2 Background (zoom on Robotnik's 'fortress') | ||
|- | |- | ||
− | |<tt>$166AB</tt> – <tt>$167FE</tt>? | + | |<tt>$166AB</tt> – <tt>$167FE</tt>? || Map 2 Foreground (zoom on Robotnik's 'fortress') |
− | |Map 2 Foreground (zoom on Robotnik's 'fortress') | ||
|- | |- | ||
− | |<tt>$16830</tt> – <tt>$169A9</tt>? | + | |<tt>$16830</tt> – <tt>$169A9</tt>? || Map 3 (when the game is finished) |
− | |Map 3 (when the game is finished) | ||
|- | |- | ||
− | |<tt>$16C61</tt> – <tt>$16DE9</tt> | + | |<tt>$16C61</tt> – <tt>$16DE9</tt> || Credits Screen |
− | |Credits Screen | ||
|} | |} | ||
|- | |- | ||
|style="vertical-align:top;"|<tt>$16DEA</tt> – <tt>$1FFFF</tt> | |style="vertical-align:top;"|<tt>$16DEA</tt> – <tt>$1FFFF</tt> | ||
− | |Level Layout: | + | |[[#Floor_Layout|Level Layout]]: ([[#RLE_Compression|RLE Compressed]]) |
− | {|class="prettytable" | + | {| class="prettytable" style="width:auto;" |
! Offset ||style="text-align:left;"| Description | ! Offset ||style="text-align:left;"| Description | ||
|- | |- | ||
Line 274: | Line 515: | ||
|- | |- | ||
|style="vertical-align:top"|<tt>$18A62</tt> – <tt>$1933C</tt> | |style="vertical-align:top"|<tt>$18A62</tt> – <tt>$1933C</tt> | ||
− | |Jungle Act 2 / Special Stage 4 / 8<br />(The tall special stage is packed | + | |Jungle Act 2 / Special Stage 4 / 8<br />(The tall special stage is packed on top of the Jungle waterfall level! The level headers specify a different starting position, tileset, music &c.) |
|- | |- | ||
|<tt>$1933D</tt> – <tt>$199D6</tt> | |<tt>$1933D</tt> – <tt>$199D6</tt> | ||
Line 328: | Line 569: | ||
|} | |} | ||
|- | |- | ||
− | |<tt>$20000</tt> – <tt>$ | + | |<tt>$20000</tt> – <tt>$25FFF</tt> |
− | | | + | |''UNKNOWN'' |
+ | |- | ||
+ | |style="vertical-align:top;"|<tt>$26000</tt> – <tt>$32FE5</tt> | ||
+ | |Tile and Sprite Sets: ([[#Art_Compression|Compressed Art]]) | ||
+ | {| class="prettytable" style="width:auto;" | ||
+ | ! Offset ||style="text-align:left;"| Description | ||
+ | |- | ||
+ | | <tt>$26000</tt> – <tt>$2751E</tt> || Title Screen Tile Set (256 Tiles) | ||
+ | |- | ||
+ | | <tt>$2751F</tt> – <tt>$28293</tt> || "Sonic Has Passed" Screen Tile Set (256 Tiles) | ||
+ | |- | ||
+ | | <tt>$28294</tt> – <tt>$28B09</tt> || End Sign Sprite Set (128 Tiles) | ||
+ | |- | ||
+ | | <tt>$28B0A</tt> – <tt>$2926A</tt> || Title Screen Animated Finger Sprite Set (128 Tiles) | ||
+ | |- | ||
+ | | <tt>$2926B</tt> – <tt>$29941</tt> || Map Screen 1 Sprite Set (128 Tiles) | ||
+ | |- | ||
+ | | <tt>$29942</tt> – <tt>$2A129</tt> || Map Screen 2 Sprite Set (128 Tiles) | ||
+ | |- | ||
+ | | <tt>$2A12A</tt> – <tt>$2AC3C</tt> || Green Hill Sprites (128 tiles) | ||
+ | |- | ||
+ | | <tt>$2AC3D</tt> – <tt>$2B7CC</tt> || Bridge Sprites (128 tiles) | ||
+ | |- | ||
+ | | <tt>$2B7CD</tt> – <tt>$2C3B5</tt> || Jungle Sprites (128 tiles) | ||
+ | |- | ||
+ | | <tt>$2C3B6</tt> – <tt>$2CF74</tt> || Labyrinth Sprites (128 tiles) | ||
+ | |- | ||
+ | | <tt>$2CF75</tt> – <tt>$2D9DF</tt> || Scrap Brain Sprites (128 tiles) | ||
+ | |- | ||
+ | | <tt>$2D9E0</tt> – <tt>$2E510</tt> || Sky Base Sprites (128 tiles) | ||
+ | |- | ||
+ | | <tt>$2E511</tt> – <tt>$2EEB0</tt> || Special Stage Sprites (128 tiles) | ||
+ | |- | ||
+ | | <tt>$2EEB1</tt> – <tt>$2F92D</tt> || Boss Sprites (128 tiles) | ||
+ | |- | ||
+ | | <tt>$2F92E</tt> – <tt>$2FD6F</tt> || HUD Sprite Set (128 Tiles) | ||
+ | |- | ||
+ | | <tt>$2FD70</tt> – <tt>$2FFEF</tt> || Ring Animation (20 Tiles), ''UNCOMPRESSED'' | ||
+ | |- | ||
+ | | <tt>$2FFF0</tt> – <tt>$2FFFF</tt> || ''EMPTY SPACE'' | ||
+ | |- | ||
+ | | <tt>$30000</tt> – <tt>$31800</tt> || Map Screen 1 Tile Set (256 Tiles) | ||
+ | |- | ||
+ | | <tt>$31801</tt> – <tt>$32FE5</tt> || Map Screen 2 / Credits Screen Tile Set (256 Tiles) | ||
+ | |} | ||
+ | |- | ||
+ | |style="vertical-align:top;"|<tt>$32FE6</tt> – <tt>$3DA27</tt> | ||
+ | |[[#Level_Art|Level Art]]: ([[#Art_Compression|Compressed Art]]) | ||
+ | {| class="prettytable" style="width:auto;" | ||
+ | ! Offset ||style="text-align:left;"| Description | ||
+ | |- | ||
+ | |<tt>$32FE6</tt> – <tt>$32FED</tt> | ||
+ | |Header For Green Hill Art | ||
+ | |- | ||
+ | |<tt>$32FEE</tt> – <tt>$330ED</tt> | ||
+ | |Unique Rows List For Green Hill | ||
+ | |- | ||
+ | |<tt>$330EE</tt> – <tt>$337A7</tt> | ||
+ | |Duplicate Rows List For Green Hill | ||
+ | |- | ||
+ | |<tt>$337A8</tt> – <tt>$34576</tt> | ||
+ | |Art Data For Green Hill | ||
+ | |- | ||
+ | | | ||
+ | |- | ||
+ | |<tt>$34578</tt> – <tt>$3457F</tt> | ||
+ | |Header For Bridge Art | ||
+ | |- | ||
+ | |<tt>$34580</tt> – <tt>$3467F</tt> | ||
+ | |Unique Rows List For Bridge | ||
+ | |- | ||
+ | |<tt>$34680</tt> – <tt>$34C7F</tt> | ||
+ | |Duplicate Rows List For Bridge | ||
+ | |- | ||
+ | |<tt>$34C80</tt> – <tt>$35AFF</tt> | ||
+ | |Art Data For Bridge | ||
+ | |- | ||
+ | | | ||
+ | |- | ||
+ | |<tt>$35B00</tt> – <tt>$35B07</tt> | ||
+ | |Header For Jungle Art | ||
+ | |- | ||
+ | |<tt>$35B08</tt> – <tt>$35C07</tt> | ||
+ | |Unique Rows List For Jungle | ||
+ | |- | ||
+ | |<tt>$35C08</tt> – <tt>$36176</tt> | ||
+ | |Duplicate Rows List For Jungle | ||
+ | |- | ||
+ | |<tt>$36177</tt> – <tt>$371BE</tt> | ||
+ | |Art Data For Jungle | ||
+ | |- | ||
+ | | | ||
+ | |- | ||
+ | |<tt>$371BF</tt> – <tt>$371C6</tt> | ||
+ | |Header For Labyrinth Art | ||
+ | |- | ||
+ | |<tt>$371C7</tt> – <tt>$372C6</tt> | ||
+ | |Unique Rows List For Labyrinth | ||
+ | |- | ||
+ | |<tt>$372C7</tt> – <tt>$37866</tt> | ||
+ | |Duplicate Rows List For Labyrinth | ||
+ | |- | ||
+ | |<tt>$37867</tt> – <tt>$3884A</tt> | ||
+ | |Art Data For Labyrinth | ||
+ | |- | ||
+ | | | ||
+ | |- | ||
+ | |<tt>$3884B</tt> – <tt>$38852</tt> | ||
+ | |Header For Scrap Brain Art | ||
+ | |- | ||
+ | |<tt>$38853</tt> – <tt>$38952</tt> | ||
+ | |Unique Rows List For Scrap Brain | ||
+ | |- | ||
+ | |<tt>$38953</tt> – <tt>$38FF1</tt> | ||
+ | |Duplicate Rows List For Scrap Brain | ||
+ | |- | ||
+ | |<tt>$38FF2</tt> – <tt>$39CED</tt> | ||
+ | |Art Data For Scrap Brain | ||
+ | |- | ||
+ | | | ||
+ | |- | ||
+ | |<tt>$39CEE</tt> – <tt>$39CF5</tt> | ||
+ | |Header For Sky Base 1 / 2 Art | ||
+ | |- | ||
+ | |<tt>$39CF6</tt> – <tt>$39DF5</tt> | ||
+ | |Unique Rows List For Sky Base 1 / 2 | ||
+ | |- | ||
+ | |<tt>$39DF6</tt> – <tt>$3A3C8</tt> | ||
+ | |Duplicate Rows List For Sky Base 1 / 2 | ||
+ | |- | ||
+ | |<tt>$3A3C9</tt> – <tt>$3B3B4</tt> | ||
+ | |Art Data For Sky Base 1 / 2 | ||
+ | |- | ||
+ | | | ||
+ | |- | ||
+ | |<tt>$3B3B5</tt> – <tt>$3B3BC</tt> | ||
+ | |Header For Sky Base 3 Art | ||
+ | |- | ||
+ | |<tt>$3B3BD</tt> – <tt>$3B4BC</tt> | ||
+ | |Unique Rows List For Sky Base 3 | ||
+ | |- | ||
+ | |<tt>$3B4BD</tt> – <tt>$3BBB5</tt> | ||
+ | |Duplicate Rows List For Sky Base 3 | ||
+ | |- | ||
+ | |<tt>$3BBB6</tt> – <tt>$3C7FD</tt> | ||
+ | |Art Data For Sky Base 3 | ||
+ | |- | ||
+ | | | ||
+ | |- | ||
+ | |<tt>$3C7FE</tt> – <tt>$3C805</tt> | ||
+ | |Header For Special Stages Art | ||
+ | |- | ||
+ | |<tt>$3C806</tt> – <tt>$3C905</tt> | ||
+ | |Unique Rows List For Special Stages | ||
|- | |- | ||
− | |<tt>$ | + | |<tt>$3C906</tt> – <tt>$3CF53</tt> |
− | | | + | |Duplicate Rows List For Special Stages |
|- | |- | ||
− | |<tt>$3DA28</tt> – <tt>$ | + | |<tt>$3CF54</tt> – <tt>$3DA27</tt> |
+ | |Art Data For Special Stages | ||
+ | |} | ||
+ | |- | ||
+ | |<tt>$3DA28</tt> – <tt>$3FF20</tt> | ||
|Contains sprite art and/or sprite mappings | |Contains sprite art and/or sprite mappings | ||
+ | |- | ||
+ | |<tt>$3FF21</tt> – <tt>$40000</tt> | ||
+ | |''EMPTY SPACE'' | ||
|} | |} | ||
− | + | ===Game Gear=== | |
− | {|class="prettytable" | + | {| class="prettytable" style="width:auto;" |
! Offset !! Description | ! Offset !! Description | ||
|- | |- | ||
− | |$00000 | + | |<tt>$00000</tt> – <tt>$10000</tt> |
|Main Game Code, musics, sounds... | |Main Game Code, musics, sounds... | ||
|- | |- | ||
− | |$10000 | + | |<tt>$10000</tt> – <tt>$14D00</tt> |
− | | | + | |[[#Block_Mappings|Block Mappings]] |
|- | |- | ||
− | |$14D00 | + | |<tt>$14D00</tt> – <tt>$15200</tt> |
|Unknown | |Unknown | ||
|- | |- | ||
− | |$15200 | + | |<tt>$15200</tt> – <tt>$15600</tt> |
− | |Blinking Items Art (Box, etc...) | + | |[[#Blinking_Items_Art|Blinking Items Art]] (Box, etc...) |
|- | |- | ||
− | |$15600 | + | |<tt>$15600</tt> – <tt>$1564A</tt> |
− | |Level Headers Pointers | + | |[[#Level_Headers_Pointers|Level Headers Pointers]] |
|- | |- | ||
− | |$1564A | + | |<tt>$1564A</tt> – <tt>$15B34</tt> |
− | |Level Headers | + | |[[#Level_Headers|Level Headers]] |
|- | |- | ||
− | |$15B34 | + | |style="vertical-align:top;"|<tt>$15B34</tt> – <tt>$16200</tt> |
− | | | + | |[[#Object_Layout|Object Layout]]: |
+ | {| class="prettytable" style="width:auto;" | ||
+ | ! Offset ||style="text-align:left;"| Description | ||
|- | |- | ||
− | |$16200 | + | |<tt>$15B34</tt> – <tt>$15B7F</tt> || Green Hill Act 1 (26 Objects) |
− | | | + | |- |
+ | |<tt>$15B80</tt> – <tt>$15BC2</tt> || Green Hill Act 2 (23 Objects) | ||
+ | |- | ||
+ | |<tt>$15BC3</tt> – <tt>$15BD5</tt> || Green Hill Act 3 (7 Objects) | ||
+ | |- | ||
+ | |<tt>$15BD6</tt> – <tt>$15C1B</tt> || Bridge Act 1 (24 Objects) | ||
+ | |- | ||
+ | |<tt>$15C1C</tt> – <tt>$15C4F</tt> || Bridge Act 2 (20 Objects) | ||
+ | |- | ||
+ | |<tt>$15C50</tt> – <tt>$15C65</tt> || Bridge Act 3 (8 Objects) | ||
+ | |- | ||
+ | |<tt>$15C66</tt> – <tt>$15CC0</tt> || Jungle Act 1 (30 Objects) | ||
+ | |- | ||
+ | |<tt>$15CC1</tt> – <tt>$15D03</tt> || Jungle Act 2 (25 Objects) | ||
+ | |- | ||
+ | |<tt>$15D04</tt> – <tt>$15D19</tt> || Jungle Act 3 (8 Objects) | ||
+ | |- | ||
+ | |<tt>$15D1A</tt> – <tt>$15D59</tt> || Labyrinth Act 1 (27 Objects) | ||
+ | |- | ||
+ | |<tt>$15D5A</tt> – <tt>$15DB1</tt> || Labyrinth Act 2 (30 Objects) | ||
+ | |- | ||
+ | |<tt>$15DB2</tt> – <tt>$14DD0</tt> || Labyrinth Act 3 (11 Objects) | ||
+ | |- | ||
+ | |<tt>$15DD1</tt> – <tt>$15E9F</tt> || Scrap Brain Act 1 (23 Objects) | ||
+ | |- | ||
+ | |<tt>$15E20</tt> – <tt>$15E5F</tt> || Scrap Brain Act 2 (21 Objects) | ||
+ | |- | ||
+ | |<tt>$15E60</tt> – <tt>$15EAB</tt> || Scrap Brain Act 2, Emerald Maze (26 Objects) | ||
+ | |- | ||
+ | |<tt>$15EAC</tt> – <tt>$15ECD</tt> || Scrap Brain Act 2, Ballhog Area (9 Objects) | ||
+ | |- | ||
+ | |<tt>$15ECE</tt> – <tt>$15F19</tt> || Scrap Brain Act 3 (26 Objects) | ||
+ | |- | ||
+ | |<tt>$15F1A</tt> – <tt>$15F53</tt> || Sky Base Act 1 (20 Objects) | ||
+ | |- | ||
+ | |<tt>$15F54</tt> – <tt>$15FAC</tt> || Sky Base Act 2 (23 Objects) | ||
+ | |- | ||
+ | |<tt>$15FAD</tt> – <tt>$15FA2</tt> || Sky Base Act 2, Interior (2 Objects) | ||
+ | |- | ||
+ | |<tt>$15FA3</tt> – <tt>$15FB0</tt> || Sky Base Act 3 (4 Objects) | ||
+ | |- | ||
+ | |<tt>$15FB1</tt> – <tt>$15FC0</tt> || Special Stage 1 (3 Objects) | ||
+ | |- | ||
+ | |<tt>$15FC1</tt> – <tt>$15FCA</tt> || Special Stage 2 (4 Objects) | ||
+ | |- | ||
+ | |<tt>$15FCB</tt> – <tt>$15FD1</tt> || Special Stage 3 (4 Objects) | ||
+ | |- | ||
+ | |<tt>$15FD2</tt> – <tt>$15FE4</tt> || Special Stage 4 (7 Objects) | ||
+ | |- | ||
+ | |<tt>$15FE5</tt> – <tt>$15FFD</tt> || Special Stage 5 (7 Objects) | ||
+ | |- | ||
+ | |<tt>$15FFE</tt> – <tt>$16013</tt> || Special Stage 6 (9 Objects) | ||
+ | |- | ||
+ | |<tt>$16014</tt> – <tt>$16029</tt> || Special Stage 7 (8 Objects) | ||
+ | |- | ||
+ | |<tt>$1602A</tt> – <tt>$16045</tt> || Special Stage 8 (13 Objects) | ||
+ | |- | ||
+ | |<tt>$16046</tt> – <tt>$16052</tt> || End Sequence, Green Hill (4 Objects) | ||
+ | |- | ||
+ | |<tt>$16053</tt> – <tt>$161FF</tt> || ''EMPTY SPACE''? | ||
+ | |} | ||
+ | |- | ||
+ | |<tt>$16200</tt> – <tt>$16738</tt> | ||
+ | |''UNKNOWN'' | ||
|- | |- | ||
− | |$16738 | + | |<tt>$16738</tt> – <tt>$17430</tt> |
− | |Misc Mappings | + | |[[#Misc_Mappings|Misc Mappings]] |
|- | |- | ||
− | |$17430 | + | |<tt>$17430</tt> – <tt>$1F600</tt> |
− | |Level Layout | + | |[[#Floor_Layout|Level Layout]] |
|- | |- | ||
− | |$1F600 | + | |<tt>$1F600</tt> – <tt>$20000</tt> |
|Sega Screen Art / Mappings | |Sega Screen Art / Mappings | ||
|- | |- | ||
− | |$20000 | + | |<tt>$20000</tt> – <tt>$23440</tt> |
|Sonic Art / Mappings | |Sonic Art / Mappings | ||
|- | |- | ||
− | |$23400 | + | |style="vertical-align:top;"|<tt>$23400</tt> – <tt>$23450</tt> |
− | | | + | |[[#Level_Cycle_Palettes|Palette Cycle Pointers]]: |
+ | {| class="prettytable" style="width:auto;" | ||
+ | ! Offset || Description | ||
+ | |- | ||
+ | |<tt>$23400</tt> | ||
+ | |Green Hill | ||
+ | |- | ||
+ | |<tt>$23402</tt> | ||
+ | |Bridge | ||
+ | |- | ||
+ | |<tt>$23404</tt> | ||
+ | |Jungle | ||
|- | |- | ||
− | |$ | + | |<tt>$23406</tt> |
− | | | + | |Labyrinth |
|- | |- | ||
− | |$ | + | |<tt>$23408</tt> |
− | | | + | |Scrap Brain |
|- | |- | ||
− | |$ | + | |<tt>$2340A</tt> |
− | | | + | |Sky Base 1/2A |
|- | |- | ||
− | |$ | + | |<tt>$2340C</tt> |
− | | | + | |Sky Base 2B/3 |
|- | |- | ||
− | |$ | + | |<tt>$2340E</tt> |
− | | | + | |Special Stage |
|} | |} | ||
− | + | [[#Level_Palettes|Palette Pointers]]: | |
− | + | {| class="prettytable" style="width:auto;" | |
− | + | ! Offset ||style="text-align:left;"| Description | |
− | |||
− | |||
− | |||
− | |||
− | [[ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | {|class="prettytable" | ||
− | ! Offset | ||
|- | |- | ||
− | |$ | + | |<tt>$23440</tt> |
− | |Green Hill | + | |Green Hill |
|- | |- | ||
− | |$ | + | |<tt>$23442</tt> |
− | |Bridge | + | |Bridge |
|- | |- | ||
− | |$ | + | |<tt>$23444</tt> |
− | |Jungle | + | |Jungle |
|- | |- | ||
− | |$ | + | |<tt>$23446</tt> |
− | |Labyrinth | + | |Labyrinth |
|- | |- | ||
− | |$ | + | |<tt>$23448</tt> |
− | |Scrap Brain | + | |Scrap Brain |
|- | |- | ||
− | |$ | + | |<tt>$2344A</tt> |
− | |Sky Base 1 | + | |Sky Base 1/2A |
|- | |- | ||
− | |$ | + | |<tt>$2344C</tt> |
− | |Sky Base 3 | + | |Sky Base 2B/3 |
|- | |- | ||
− | |$ | + | |<tt>$2344E</tt> |
− | | | + | |Special Stage |
|} | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | |$ | + | |<tt>$23450</tt> – <tt>$23C00</tt> |
− | | | + | |[[#Palettes|Palettes]] |
|- | |- | ||
− | |$ | + | |<tt>$23C00</tt> – <tt>$25500</tt> |
− | | | + | |'Sega' sound |
|- | |- | ||
− | |$ | + | |<tt>$25500</tt> – <tt>$30000</tt> |
− | | | + | |Art : Title Screen / Map / Levels / Stats / Sprites |
|- | |- | ||
− | |$ | + | |<tt>$30000</tt> – <tt>$40000</tt> |
− | | | + | |Art : Sega Screen / Map / Levels |
|- | |- | ||
− | |$ | + | |<tt>$3DA28</tt> – <tt>$40000</tt> |
− | | | + | |Contains sprite art and/or sprite mappings |
+ | |} | ||
+ | |||
+ | ==Compressed data== | ||
+ | |||
+ | ===RLE compression=== | ||
+ | Some data ([[#Floor_Layout|level layouts]], [[#Misc_Mappings|misc. mappings]]) in the ROM is compressed using a form of Run-Length-Encoding, where bytes that repeat themselves many times in a row are reduced by specifying the number of times to repeat a byte. | ||
+ | |||
+ | In practice, the ROM stores this data normally byte-for-byte but indicates a value to repeat by a duplicate byte followed by another byte that specifies the number of successive bytes to repeat. | ||
+ | |||
+ | A bug / oversight made by the developers means that the byte that specifies the number of times to repeat is off-by-one (causing an overflow (255 → 0). This means that a repeating-value of <tt>01</tt> means ''zero'' repeats (therefore wasting space!), <tt>02</tt> means 1 repeat, <tt>FF</tt> means 255 repeats, but <tt>00</tt> actually means 256 repeats! Be keenly aware of this when de/compressing! | ||
+ | |||
+ | Example: | ||
+ | :<tt>06 7C 32 <u>2E 2E 01</u> D1</tt> → <tt>06 7C 32 <u>2E 2E</u> D1</tt> | ||
+ | :<tt>6B <u>3F 3F 02</u> 51 2D C0</tt> → <tt>6B <u>3F 3F 3F</u> 51 2D C0</tt> | ||
+ | :<tt>05 07 <u>5A 5A 03</u> 08 B2</tt> → <tt>05 07 <u>5A 5A 5A 5A</u> 08 B2</tt> | ||
+ | :<tt>05 07 <u>5A 5A 03</u> 08 B2</tt> → <tt>05 07 <u>5A 5A 5A 5A</u> 08 B2</tt> | ||
+ | :<tt>29 EF <u>00 00 00</u> BB D2</tt> → <tt>29 EF <u>00 00 […00x256…]</u> BB D2</tt> | ||
+ | |||
+ | As you can see, this format wastes one byte of space if a byte is only repeated twice. If a byte is repeated three times, there is no size difference. Only when a byte is repeated four or more times is there a savings in space usage. | ||
+ | |||
+ | ===Art compression=== | ||
+ | '''WARNING:''' Here comes the science bit! If you want to understand how this works then read ''very'' carefully. First, some background info: The Master System uses character-based graphics, that is, 8×8 pixel tiles arranged into a 32×24 grid. The screen is not drawn to directly, instead up to 448 tiles can be defined and images are crafted by arranging different tiles on the grid. | ||
+ | |||
+ | The graphics for a level consist of 256 tiles and sprite sets are 128 tiles. Each tile consists of 8 rows (of 8 pixels), each row is 4 bytes (more on that later). The graphic art is compressed in a very complex, but effective, manner. The rows of all the tiles are divided into unique rows and duplicate rows. The data is stored like this: | ||
+ | |||
+ | * [[#Header|Header]] (8-bytes) | ||
+ | * [[#Unique_Rows_list|List of unique rows]] | ||
+ | * [[#Duplicate_Rows_list|List of duplicate rows]] | ||
+ | * [[#Art_Data|Art Data]] (the actual graphics) | ||
+ | |||
+ | ====Header==== | ||
+ | The 8-byte header is in the format of: | ||
+ | |||
+ | :<tt>48 59 DR DR AD AD RC RC</tt> | ||
+ | |||
+ | (Note that dual-byte values "DR", "AD" and "RC" are Little-Endian, the lowest byte first. e.g. "<tt>08 01</tt>" = "<tt>0108</tt>") | ||
+ | |||
+ | *<tt>DR</tt>: "Duplicate Rows". An offset from the start of the level art header, to the where the duplicate rows list begins. For tile sets this value is always "<tt>0108</tt>" (256 + 8 in hexadecimal). For sprite sets it's "<tt>0088</tt>" (128 + 8 in hexadecimal) | ||
+ | *<tt>AD</tt>: "Art Data". An offset, from the beginning of the level art header (e.g. {{SMS}} <tt>$32FE6</tt>), to the start of the [[#Art_Data|Art Data]] section. This is critically important because the length of the [[#Duplicate_Rows_List|duplicate rows list]] can vary | ||
+ | *<tt>RC</tt>: "Row Count". The number of rows in the tileset; <tt>0800</tt> (2048, 256×8) for [[#Level_Art|tile sets]], <tt>0400</tt> (1024, 128×8) for sprite sets. | ||
+ | |||
+ | ====Unique Rows list==== | ||
+ | The list of unique rows is one byte for each tile we are defining (256 for [[#Level_Art|tile sets]], 128 for sprite sets). To process this data begin with the first byte of the unique rows list. Each bit in this byte refers to a row in the first tile of the tile set that we are decompressing. | ||
+ | |||
+ | Note that bits in a byte are ordered right to left, as such: | ||
+ | |||
+ | {| class="prettytable" style="width:auto;" | ||
+ | ! Bit# !! 8 !! 7 !! 6 !! 5 !! 4 !! 3 !! 2 !! 1 | ||
|- | |- | ||
− | | | + | ! Value: |
− | | | + | | 1 || 1 || 0 || 1 || 0 || 0 || 1 || 1 |
− | | | ||
− | | | ||
− | | | ||
− | | | ||
− | | | ||
− | | | ||
|} | |} | ||
− | ===Level Headers / Level Headers | + | Therefore bit #1 (on the right), refers to the first row of the current tile we are decoding and bit #8 (on the left) refers to the 8<sup>th</sup> row of the tile. |
+ | |||
+ | When a bit value is 0, it means that the tile row it corresponds to is a unique row. Read in 4 bytes from the [[#Art_Data|Art Data]] section and decode into the 8 pixels for that row (see the [[#Art_Data|Art Data]] heading below). In the example above, rows 3, 4 & 6 and of the tile are unique, and 4 bytes would be read from the [[#Art_Data|Art Data]] for each. | ||
+ | |||
+ | Walk through the whole unique rows list decoding in this way and you should have a partial tile set with all the unique rows filled in. | ||
+ | |||
+ | ====Duplicate Rows list==== | ||
+ | The list of duplicate rows "fills in the blanks" in the rows missed by the [[#Unique_Rows_List|unique list]]. For each row in the tile set that was missed by the unique rows list the duplicate rows list will contain an index value to where in the [[#Art_Data|Art Data]] the row is. | ||
+ | |||
+ | Begin by walking the [[#Unique_Rows_List|unique rows list]] again in the same order as before, but this time when a bit value is 1 it means that row is a duplicate: read a byte from the duplicate rows list. This value is an index to where in the [[#Art_Data|art data]] the row is located, i.e. a value of <tt>80</tt> (hex) means: | ||
+ | |||
+ | $30000 Base address (Master System) | ||
+ | + 2FE6 "Level Art" pointer in the level header, Green Hill for example | ||
+ | + 7C2 Art Data pointer in the level art header, again Green Hill | ||
+ | + 80*4 Skip to the 128th, decimal, row in the art data | ||
+ | |||
+ | For values <tt>00</tt> to <tt>EF</tt> (0 to 239), there is only one byte, indicating the row index in the [[#Art_Data|Art Data]]. However, for values after <tt>EF</tt>, there are two bytes. The first one starts with an <tt>F</tt>, so the actual line number is the two bytes number minus <tt>F0 00</tt>. E.g.: <tt>F3 A2</tt> is for art data row number <tt>3A2</tt>. Note that you can also write line numbers <tt>00</tt> to <tt>EF</tt> using two bytes numbers, but this is a waste of space (that's why they are stored with one byte!). | ||
+ | |||
+ | Once you've walked the [[#Unique_Rows_List|unique rows list]] a second time, reading the duplicate row list for each bit-value of 1 you see, all the blank rows in the title set should be filled in and you should have a complete tile set — if you've understood everything correctly! | ||
+ | |||
+ | ====Art data==== | ||
+ | The SMS uses a [[#Palettes|palette]] of 16 colours for tiles, therefore the data that defines the tile graphics do not specify the actual R/G/B values, but just an index (0-15) to the [[#Palettes|palette]] colour to use. Therefore an 8-pixel row is stored as 4 bytes, where 4 bits (values 0-15) are assigned to each pixel. | ||
+ | |||
+ | However, instead of being stored as nybbles (4-bits in a row), the data is stored across 4 bit-planes. To understand what bit-planes are, imagine 4 bytes stacked on top of each other like layers in a cake. A bit plane would be a slice of the cake — 1 bit from each of the 4 bytes. | ||
+ | |||
+ | To decode the 4 bytes into 8 colour pixels, slice the bit-planes to get the index values (0-15) for each pixel and then look up the final colour from the [[#Palettes|palette]]. | ||
+ | |||
+ | In pseudo code, something like this: | ||
+ | |||
+ | <pre>input byte1, byte2, byte3, byte4 | ||
+ | pixel = array (0 to 7) | ||
+ | |||
+ | for bit = 0 to 7 | ||
+ | if byte1 AND 2 ^ (7-bit) then pixel[bit] = pixel[bit] OR 1 | ||
+ | if byte2 AND 2 ^ (7-bit) then pixel[bit] = pixel[bit] OR 2 | ||
+ | if byte3 AND 2 ^ (7-bit) then pixel[bit] = pixel[bit] OR 4 | ||
+ | if byte4 AND 2 ^ (7-bit) then pixel[bit] = pixel[bit] OR 8 | ||
+ | |||
+ | pixel[bit] = palette-color-from-index: pixel[bit] | ||
+ | next bit</pre> | ||
+ | |||
+ | ==Level Headers / Level Headers pointers== | ||
Each level has a header. This header contains several pieces of data, such as starting position, music location, etc. Each level header is 37 bytes long and is referenced by a pointer. | Each level has a header. This header contains several pieces of data, such as starting position, music location, etc. Each level header is 37 bytes long and is referenced by a pointer. | ||
− | + | ===Level Headers pointers=== | |
+ | A level header pointer is comprised of two bytes. The data for the pointer is stored in little endian format. The value stored by this pointer specifies the number of bytes away a level header is from {{SMS}} <tt>$15580</tt> {{GG}} <tt>$15600</tt>. | ||
− | + | There are 37 Level Headers in total. Some levels have more than one pointer because they can be accessed from different locations, and Sonic's starting position differs at level start. Also two invalid level pointers exist that act as dividers between the main sequence of levels and the out-of-sequence levels (Scrap Brain's sub-maps and the Special Stages). See the [[#ROM_Map|ROM map]] for the full list of level pointers. | |
− | + | ''Example:'' | |
+ | The two first bytes are <tt>4A 00</tt>. So, at {{SMS}} <tt>$15580</tt> + <tt>$004A</tt>, we will find the level header for the first level (Green Hill 1). | ||
− | + | ===Level Headers=== | |
+ | The level headers are located at {{SMS}} <tt>$155CA</tt> – <tt>$15AB3</tt> {{GG}} <tt>$1564A</tt> – <tt>$15B34</tt>. | ||
− | + | Each level header use 37 bytes. Here is the format (partial): | |
− | The | + | |
+ | :<tt>SP FW FW FH FH LX LX ?? LW LY LY XH LH</tt> | ||
+ | :<tt>SX SY FL FL FS FS BM BM LA LA 09 SA SA</tt> | ||
+ | :<tt>IP CS CC CP OL OL SR UW TL 00 MU</tt> | ||
+ | |||
+ | <dl> | ||
+ | |||
+ | <dt>'''SP:''' ''Solidity Pointer'' | ||
+ | <dd>Indicates what solidity data to use. The location of this data and its format is undocumented | ||
+ | |||
+ | <dt>'''FW, FH:''' ''Floor Width / Height (Little-Endian)'' | ||
+ | <dd>Number of blocks wide / high the [[#Floor_Layout|Floor Layout]] is. Levels can share the same Floor Layout (such as the special stages), and the specific level can occupy a subset of the Floor Layout. The <tt>LX</tt> / <tt>LY</tt> / <tt>LW</tt> / <tt>LH</tt> values specify the offset and size of the level within the Floor Layout | ||
+ | |||
+ | <dt>'''LX:''' ''Level X Offset'' | ||
+ | <dd>Left-hand offset position of the level in the Floor Layout (see "<tt>FW</tt>" above), in pixels, i.e. where, horizontally, the left hand side of the level is. There is always effectively 8 added to this value due to the hidden scrolling zone on the left side of the screen | ||
+ | |||
+ | <dt>'''??:''' ''Unknown Byte'' | ||
+ | <dd>The 8th byte in the header appears to be some kind of flag-bits. Only Green Hill Act 1 & 2 use it, and changing the value appears to make no discernible difference to the level | ||
+ | |||
+ | <dt>'''LW:''' ''Level Width'' | ||
+ | <dd>Although named "Level Width", it is actually a little more complicated than that. This value sets the right hand limit of the level, and everything thereafter is cropped out. The value is multiplied by 8 and 14 is added on top (the minimum width of a Floor Layout is apparently 14 blocks) to determine the right-most limit (in blocks) | ||
+ | |||
+ | <dt>'''LY:''' ''Level Y Offset'' | ||
+ | <dd>Top offset position of the level in the Floor Layout (see "<tt>FH</tt>" above), in pixels, i.e. where, vertically, the top of the level is | ||
+ | |||
+ | <dt>'''XH:''' ''Extend Height'' | ||
+ | <dd>Due to the nature of the bottom of the level being at "''6+(LH×8)''" blocks this may not align desirably. This is notable in Green Hill Act 1 in which the level height is 2 blocks short of the Floor Layout and causes Sonic to die when hitting the jump ramp as it is now touching the bottom of the level. The Extend Height value adds a number of pixels to the height of the level to compensate, ideally this should be in multiples of <tt>20</tt> (hex), 32 (decimal) | ||
+ | |||
+ | <dt>'''LH:''' ''Level Height'' | ||
+ | <dd>This value sets the bottom-most limit of the level, and everything thereafter is cropped out. The value is multiplied by 8 and 6 is added on top (the minimum height of a Floor Layout is apparently 6 blocks — one screen height) to determine the bottom-most limit (in blocks) | ||
+ | |||
+ | <dt>'''SX, SY:''' ''Sonic starting position X/Y'' | ||
+ | <dd>Position, in blocks, where the player starts | ||
+ | |||
+ | <dt>'''FL:''' ''Floor Layout (Little Endian)'' | ||
+ | <dd>How many bytes away from {{SMS}} <tt>$14000</tt> the [[#Floor_Layout|Floor Layout]] is located | ||
+ | |||
+ | <dt>'''FS:''' ''Floor Data Size (Little Endian)'' | ||
+ | <dd>Length, in bytes, of the [[#RLE_Compression|compressed]] Floor Layout data | ||
+ | |||
+ | <dt>'''BM:''' ''Block Mapping (Little Endian)'' | ||
+ | <dd>How many bytes away from {{SMS}}{{GG}} <tt>$10000</tt> the [[#Block_Mappings|mappings]] for this level are located | ||
+ | |||
+ | <dt>'''LA:''' ''Level Art (Little Endian)'' | ||
+ | <dd>How many bytes away from {{SMS}} <tt>$30000</tt> the [[#Level_Art|level art]] is located | ||
+ | |||
+ | <dt>'''SA:''' ''Sprite Art (Little Endian)'' | ||
+ | <dd>How many bytes away from {{SMS}} <tt>$24000</tt> is the sprite art located | ||
+ | |||
+ | <dt>'''09:''' ''Unknown Byte'' | ||
+ | <dd>The 24th byte in the header always has a value of <tt>9</tt>, it's purpose is unknown | ||
+ | |||
+ | <dt>'''IP:''' ''Initial Palette'' | ||
+ | <dd>Indicates the number of the initial [[#Level_Palettes|palette pointer]] to use, in the pointer order of appearance | ||
+ | |||
+ | <dt>'''CS:''' ''Cycle Speed'' | ||
+ | <dd>Determines the speed of the palette cycle. <tt>0</tt> = no cycle, <tt>1</tt> = change every frame, <tt>2</tt> = change every second frame, and so on | ||
+ | |||
+ | <dt>'''CC:''' ''Color Cycles'' | ||
+ | <dd>Indicates the number of color cycles for the level palette | ||
+ | |||
+ | <dt>'''CP:''' ''Cycle Palette'' | ||
+ | <dd>Indicates the number of the [[#Level_Cycle_Palettes|cyclic palette]] pointer to use, in the pointer order of appearance | ||
+ | |||
+ | <dt>'''OL:''' ''Object Layout (Little Endian)'' | ||
+ | <dd>How many bytes away from {{SMS}} <tt>$15580</tt> {{GG}} <tt>$15600</tt> the [[#Object_Layout|Object layout]] is located | ||
+ | |||
+ | <dt>'''SR''' ''Scrolling / Ring HUD Flags'' | ||
+ | <dd> | ||
+ | Bit flags that control how the level scrolls and the presence of the ring count in the HUD.<br /> | ||
+ | Combine any of the hex values below: | ||
+ | * <tt>01</tt> Sonic immediately dies, the game hangs and doesn't reload the level; purpose unknown | ||
+ | * <tt>02</tt> The demo play data controls Sonic | ||
+ | * <tt>04</tt> Shows ring count in HUD and rings are displayed. When this value is not included no rings are visible, even though the sparkle effect occurs when you collect them | ||
+ | * <tt>08</tt> The level automatically scrolls to the right (ala Bridge Act 2) | ||
+ | * <tt>10</tt> After a pause, the level automatically scrolls upwards! If you get caught at the bottom of the screen, you die | ||
+ | * <tt>20</tt> The screen scrolls smoothly, allowing you to get ahead of it | ||
+ | * <tt>40</tt> Slow up and down wave effect (ala Sky Base Act 2) | ||
+ | * <tt>80</tt> Screen does not scroll down (ala Jungle Act 2). If you get caught at the bottom of the screen, you die | ||
− | + | <dt>'''UW:''' ''Under Water Flag'' | |
+ | <dd>Controls the under-water effect (slow movement / water colour / drowning) in Labyrinth (<tt>80</tt> is on, <tt>00</tt> is off). The presence of Object <tt>$40</tt> in the [[#Object_Layout|Object Layout]] sets the water height at its Y-level | ||
− | + | <dt>'''TL:''' ''Time HUD / Lightning effect flags'' | |
+ | <dd> | ||
+ | Bit flags that control the presence of the time counter in the HUD, and the use of the [[#Sky_Base_Act_1_Lightning_Palettes|lightning effect]]<br /> | ||
+ | Combine any of the hex values below: | ||
+ | * <tt>01</tt> Centers the time display when on a special stage. Outside of the special stage causes the game to switch to the special stage | ||
+ | * <tt>02</tt> Uses the [[#Sky_Base_Act_1_Lightning_Palettes|lightning effect]]. This overrides the level's own palette | ||
+ | * <tt>04</tt> / <tt>08</tt> No effect? | ||
+ | * <tt>10</tt> Use the [[#Labyrinth.27s_Under_Water_Palettes|boss underwater palette]] (ala Labyrinth Act 3) | ||
+ | * <tt>20</tt> Displays the time | ||
+ | * <tt>40</tt> Locks the screen, no scrolling occurs | ||
+ | * <tt>80</tt> No effect? | ||
− | + | <dt>'''00:''' ''Unknown Byte'' | |
− | + | <dd>The 36th byte in the header always has a value of <tt>0</tt>, it's purpose is unknown | |
− | |||
− | + | <dt>'''MU:''' ''Music'' | |
− | * | + | <dd> |
− | + | *<tt>00</tt>–<tt>05</tt>: Level Music | |
− | + | *<tt>06</tt>: Title Music | |
− | * | + | *<tt>08</tt>: Invincibility |
− | + | *<tt>09</tt>: Level Complete | |
− | * | + | *<tt>0A</tt>: Dead |
− | * | + | *<tt>0B</tt>/<tt>0C</tt>/<tt>0D</tt>: Boss |
− | + | *<tt>0E</tt>: Credits | |
− | + | *<tt>10</tt>: Bonus Stage | |
− | |||
− | * | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | * | ||
− | * | ||
− | + | </dl> | |
− | |||
This is a table of the complete level headers for the Master System version: (all values are hexadecimal) | This is a table of the complete level headers for the Master System version: (all values are hexadecimal) | ||
− | {|class="prettytable" | + | {| class="prettytable" style="width:auto;" |
− | ! Name !! <abbr title="Solidity Pointer">SP</abbr> !! <abbr title=" | + | ! Name !! <abbr title="Solidity Pointer">SP</abbr> !! <abbr title="Floor Width">FW</abbr> !! <abbr title="Floor Height">FH</abbr> !! <abbr title="Level X Offset">LX</abbr> !! ?? !! <abbr title="Level Width">LW</abbr> !! <abbr title="Level Y Offset">LY</abbr> !! <abbr title="Extend Height">XH</abbr> !! <abbr title="Level Height">LH</abbr> !! <abbr title="Start X">SX</abbr> !! <abbr title="Start Y">SY</abbr> !! <abbr title="Floor Layout">FL</abbr> !! <abbr title="Floor Size">FS</abbr> !! <abbr title="Block Mapping">BM</abbr> !! <abbr title="Level Art">LA</abbr> !! <tt>09</tt> !! <abbr title="Sprite Art">SA</abbr> !! <abbr title="Initial Palette">IP</abbr> !! <abbr title="Cycle Speed">CS</abbr> !! <abbr title="Color Cycles">CC</abbr> !! <abbr title="Cycle Palette">CP</abbr> !! <abbr title="Object Layout">OL</abbr> !! <abbr title="Scroll / Ring HUD flags">SR</abbr> !! <abbr title="Under Water Flag">UW</abbr> !! <abbr title="Time HUD and Lightning flags">TL</abbr> !! <tt>00</tt> !! <abbr title="Music">MU</abbr> |
|- | |- | ||
|Green Hill Act 1 | |Green Hill Act 1 | ||
− | |rowspan="3"|<tt>0</tt> || <tt>0100</tt> || <tt>0010</tt> || <tt> | + | |rowspan="3"|<tt>0</tt> || <tt>0100</tt> || <tt>0010</tt> || <tt>0040</tt> || <tt>C0</tt> || <tt>18</tt> || <tt>0020</tt> || <tt>40</tt> || <tt>01</tt> || <tt>08</tt> || <tt>0B</tt> || <tt>2DEA</tt> || <tt>083E</tt> ||rowspan="3"| <tt>0000</tt> ||rowspan="3"| <tt>2FE6</tt> ||rowspan="3"| <tt>9</tt> ||rowspan="3"| <tt>612A</tt> ||rowspan="3"| <tt>0</tt> ||rowspan="3"| <tt>A</tt> ||rowspan="3"| <tt>3</tt> ||rowspan="3"| <tt>0</tt> || <tt>0534</tt> || <tt>04</tt> ||rowspan="3"| <tt>0</tt> || <tt>20</tt> ||rowspan="3"| <tt>0</tt> ||rowspan="3"| <tt>0</tt> |
|- | |- | ||
− | |Green Hill Act 2 || <tt>0080</tt> || <tt>0020</tt> || <tt> | + | |Green Hill Act 2 || <tt>0080</tt> || <tt>0020</tt> || <tt>0001</tt> || <tt>A0</tt> || <tt>0C</tt> || <tt>0001</tt> || <tt>40</tt> || <tt>03</tt> || <tt>02</tt> || <tt>03</tt> || <tt>3628</tt> || <tt>0661</tt> || <tt>0580</tt> || <tt>04</tt> || <tt>20</tt> |
|- | |- | ||
− | |Green Hill Act 3 || <tt>0080</tt> || <tt>0020</tt> || <tt> | + | |Green Hill Act 3 || <tt>0080</tt> || <tt>0020</tt> || <tt>0001</tt> || <tt>00</tt> || <tt>0A</tt> || <tt>00E8</tt> || <tt>40</tt> || <tt>03</tt> || <tt>07</tt> || <tt>16</tt> || <tt>3C89</tt> || <tt>032D</tt> || <tt>05C3</tt> || <tt>00</tt> || <tt>00</tt> |
|- | |- | ||
− | |colspan=" | + | |colspan="35"| |
|- | |- | ||
|Bridge Act 1 | |Bridge Act 1 | ||
− | |rowspan="3"|<tt>1</tt> || <tt>0100</tt> || <tt>0010</tt> ||rowspan="3"| <tt> | + | |rowspan="3"|<tt>1</tt> || <tt>0100</tt> || <tt>0010</tt> ||rowspan="3"| <tt>0001</tt> ||rowspan="3"| <tt>00</tt> || <tt>1F</tt> || <tt>0001</tt> || <tt>40</tt> || <tt>01</tt> || <tt>03</tt> || <tt>0C</tt> || <tt>7ED1</tt> || <tt>0694</tt> ||rowspan="3"| <tt>0B80</tt> ||rowspan="3"| <tt>4578</tt> ||rowspan="3"| <tt>9</tt> ||rowspan="3"| <tt>6C3D</tt> ||rowspan="3"| <tt>1</tt> ||rowspan="3"| <tt>8</tt> ||rowspan="3"| <tt>3</tt> ||rowspan="3"| <tt>1</tt> || <tt>05D6</tt> || <tt>04</tt> ||rowspan="3"| <tt>0</tt> || <tt>20</tt> ||rowspan="3"| <tt>0</tt> ||rowspan="3"| <tt>1</tt> |
|- | |- | ||
− | |Bridge 2 || <tt>0080</tt> || <tt>0020</tt> || <tt>0F</tt> || <tt> | + | |Bridge Act 2 || <tt>0080</tt> || <tt>0020</tt> || <tt>0F</tt> || <tt>0001</tt> || <tt>40</tt> || <tt>03</tt> || <tt>02</tt> || <tt>1C</tt> || <tt>A2A8</tt> || <tt>0499</tt> || <tt>061C</tt> || <tt>0C</tt> || <tt>20</tt> |
|- | |- | ||
− | |Bridge 3 || <tt>0080</tt> || <tt>0020</tt> || <tt>0F</tt> || <tt> | + | |Bridge Act 3 || <tt>0080</tt> || <tt>0020</tt> || <tt>0F</tt> || <tt>0300</tt> || <tt>40</tt> || <tt>03</tt> || <tt>06</tt> || <tt>1B</tt> || <tt>B301</tt> || <tt>0140</tt> || <tt>0656</tt> || <tt>00</tt> || <tt>00</tt> |
|- | |- | ||
− | ! Name !! <abbr title="Solidity Pointer">SP</abbr> !! <abbr title=" | + | ! Name !! <abbr title="Solidity Pointer">SP</abbr> !! <abbr title="Floor Width">FW</abbr> !! <abbr title="Floor Height">FH</abbr> !! <abbr title="Level X Offset">LX</abbr> !! ?? !! <abbr title="Level Width">LW</abbr> !! <abbr title="Level Y Offset">LY</abbr> !! <abbr title="Extend Height">XH</abbr> !! <abbr title="Level Height">LH</abbr> !! <abbr title="Start X">SX</abbr> !! <abbr title="Start Y">SY</abbr> !! <abbr title="Floor Layout">FL</abbr> !! <abbr title="Floor Size">FS</abbr> !! <abbr title="Block Mapping">BM</abbr> !! <abbr title="Level Art">LA</abbr> !! <tt>09</tt> !! <abbr title="Sprite Art">SA</abbr> !! <abbr title="Initial Palette">IP</abbr> !! <abbr title="Cycle Speed">CS</abbr> !! <abbr title="Color Cycles">CC</abbr> !! <abbr title="Cycle Palette">CP</abbr> !! <abbr title="Object Layout">OL</abbr> !! <abbr title="Scroll / Ring HUD flags">SR</abbr> !! <abbr title="Under Water Flag">UW</abbr> !! <abbr title="Time HUD and Lightning flags">TL</abbr> !! <tt>00</tt> !! <abbr title="Music">MU</abbr> |
|- | |- | ||
|Jungle Act 1 | |Jungle Act 1 | ||
− | |rowspan="3"|<tt>2</tt> || <tt>0100</tt> || <tt>0010</tt> ||rowspan="3"| <tt> | + | |rowspan="3"|<tt>2</tt> || <tt>0100</tt> || <tt>0010</tt> ||rowspan="3"| <tt>0001</tt> ||rowspan="3"| <tt>00</tt> || <tt>1F</tt> || <tt>0001</tt> || <tt>20</tt> || <tt>01</tt> || <tt>02</tt> || <tt>0B</tt> || <tt>3FB6</tt> || <tt>0AAC</tt> ||rowspan="3"| <tt>1480</tt> ||rowspan="3"| <tt>5B00</tt> ||rowspan="3"| <tt>9</tt> ||rowspan="3"| <tt>77CD</tt> ||rowspan="3"| <tt>2</tt> ||rowspan="3"| <tt>5</tt> ||rowspan="3"| <tt>3</tt> ||rowspan="3"| <tt>2</tt> || <tt>066C</tt> || <tt>04</tt> ||rowspan="3"| <tt>0</tt> || <tt>20</tt> ||rowspan="3"| <tt>0</tt> ||rowspan="3"| <tt>2</tt> |
|- | |- | ||
− | |Jungle Act 2 || <tt>0010</tt> || <tt>0100</tt> || <tt>01</tt> || <tt> | + | |Jungle Act 2 || <tt>0010</tt> || <tt>0100</tt> || <tt>01</tt> || <tt>0001</tt> || <tt>20</tt> || <tt>1F</tt> || <tt>02</tt> || <tt>FA</tt> || <tt>4A62</tt> || <tt>08DB</tt> || <tt>06C4</tt> || <tt>84</tt> || <tt>20</tt> |
|- | |- | ||
− | |Jungle Act 3 || <tt>0080</tt> || <tt>0020</tt> || <tt>0F</tt> || <tt> | + | |Jungle Act 3 || <tt>0080</tt> || <tt>0020</tt> || <tt>0F</tt> || <tt>0300</tt> || <tt>40</tt> || <tt>03</tt> || <tt>06</tt> || <tt>1B</tt> || <tt>B301</tt> || <tt>0140</tt> || <tt>0656</tt> || <tt>00</tt> || <tt>00</tt> |
|- | |- | ||
− | |colspan=" | + | |colspan="35"| |
|- | |- | ||
|Labyrinth Act 1 | |Labyrinth Act 1 | ||
− | |rowspan="3"|<tt>3</tt> || <tt>0040</tt> || <tt>0040</tt> ||rowspan="3"| <tt> | + | |rowspan="3"|<tt>3</tt> || <tt>0040</tt> || <tt>0040</tt> ||rowspan="3"| <tt>0001</tt> ||rowspan="3"| <tt>00</tt> ||rowspan="3"| <tt>07</tt> ||rowspan="3"| <tt>0001</tt> ||rowspan="3"| <tt>40</tt> ||rowspan="3"| <tt>07</tt> || <tt>02</tt> || <tt>05</tt> || <tt>8565</tt> || <tt>08C2</tt> ||rowspan="3"| <tt>1E80</tt> ||rowspan="3"| <tt>71BF</tt> ||rowspan="3"| <tt>9</tt> ||rowspan="3"| <tt>83B6</tt> ||rowspan="3"| <tt>3</tt> ||rowspan="3"| <tt>5</tt> ||rowspan="3"| <tt>3</tt> ||rowspan="3"| <tt>3</tt> || <tt>0723</tt> || <tt>04</tt> ||rowspan="3"| <tt>80</tt> || <tt>20</tt> ||rowspan="3"| <tt>0</tt> ||rowspan="3"| <tt>3</tt> |
|- | |- | ||
|Labyrinth Act 2 || <tt>0040</tt> || <tt>0040</tt> || <tt>03</tt> || <tt>09</tt> || <tt>8E27</tt> || <tt>0D13</tt> || <tt>0772</tt> || <tt>04</tt> || <tt>20</tt> | |Labyrinth Act 2 || <tt>0040</tt> || <tt>0040</tt> || <tt>03</tt> || <tt>09</tt> || <tt>8E27</tt> || <tt>0D13</tt> || <tt>0772</tt> || <tt>04</tt> || <tt>20</tt> | ||
Line 558: | Line 1,177: | ||
|Labyrinth Act 3 || <tt>0040</tt> || <tt>0040</tt> || <tt>03</tt> || <tt>25</tt> || <tt>AFF6</tt> || <tt>030B</tt> || <tt>07CA</tt> || <tt>00</tt> || <tt>10</tt> | |Labyrinth Act 3 || <tt>0040</tt> || <tt>0040</tt> || <tt>03</tt> || <tt>25</tt> || <tt>AFF6</tt> || <tt>030B</tt> || <tt>07CA</tt> || <tt>00</tt> || <tt>10</tt> | ||
|- | |- | ||
− | ! Name !! <abbr title="Solidity Pointer">SP</abbr> !! <abbr title=" | + | ! Name !! <abbr title="Solidity Pointer">SP</abbr> !! <abbr title="Floor Width">FW</abbr> !! <abbr title="Floor Height">FH</abbr> !! <abbr title="Level X Offset">LX</abbr> !! ?? !! <abbr title="Level Width">LW</abbr> !! <abbr title="Level Y Offset">LY</abbr> !! <abbr title="Extend Height">XH</abbr> !! <abbr title="Level Height">LH</abbr> !! <abbr title="Start X">SX</abbr> !! <abbr title="Start Y">SY</abbr> !! <abbr title="Floor Layout">FL</abbr> !! <abbr title="Floor Size">FS</abbr> !! <abbr title="Block Mapping">BM</abbr> !! <abbr title="Level Art">LA</abbr> !! <tt>09</tt> !! <abbr title="Sprite Art">SA</abbr> !! <abbr title="Initial Palette">IP</abbr> !! <abbr title="Cycle Speed">CS</abbr> !! <abbr title="Color Cycles">CC</abbr> !! <abbr title="Cycle Palette">CP</abbr> !! <abbr title="Object Layout">OL</abbr> !! <abbr title="Scroll / Ring HUD flags">SR</abbr> !! <abbr title="Under Water Flag">UW</abbr> !! <abbr title="Time HUD and Lightning flags">TL</abbr> !! <tt>00</tt> !! <abbr title="Music">MU</abbr> |
|- | |- | ||
|Scrap Brain Act 1 | |Scrap Brain Act 1 | ||
− | |rowspan="3"|<tt>4</tt> || <tt>0100</tt> || <tt>0010</tt> ||rowspan="3"| <tt> | + | |rowspan="3"|<tt>4</tt> || <tt>0100</tt> || <tt>0010</tt> ||rowspan="3"| <tt>0001</tt> ||rowspan="3"| <tt>00</tt> || <tt>1E</tt> || <tt>0001</tt> || <tt>20</tt> || <tt>01</tt> || <tt>03</tt> || <tt>0B</tt> || <tt>533D</tt> || <tt>069A</tt> ||rowspan="3"| <tt>2980</tt> ||rowspan="3"| <tt>884B</tt> ||rowspan="3"| <tt>9</tt> ||rowspan="3"| <tt>8F75</tt> ||rowspan="3"| <tt>4</tt> ||rowspan="3"| <tt>6</tt> ||rowspan="3"| <tt>4</tt> ||rowspan="3"| <tt>4</tt> || <tt>07E9</tt> ||rowspan="3"| <tt>04</tt> ||rowspan="3"| <tt>0</tt> || <tt>20</tt> ||rowspan="3"| <tt>0</tt> ||rowspan="3"| <tt>4</tt> |
|- | |- | ||
− | |Scrap Brain Act 2 || <tt>0080</tt> || <tt>0020</tt> || <tt>0F</tt> || <tt> | + | |Scrap Brain Act 2 || <tt>0080</tt> || <tt>0020</tt> || <tt>0F</tt> || <tt>0001</tt> || <tt>40</tt> || <tt>03</tt> || <tt>04</tt> || <tt>16</tt> || <tt>59D7</tt> || <tt>0904</tt> || <tt>082C</tt> || <tt>20</tt> |
|- | |- | ||
− | |Scrap Brain Act 3 || <tt>0040</tt> || <tt>0040</tt> || <tt>07</tt> || <tt> | + | |Scrap Brain Act 3 || <tt>0040</tt> || <tt>0040</tt> || <tt>07</tt> || <tt>0220</tt> || <tt>40</tt> || <tt>07</tt> || <tt>03</tt> || <tt>36</tt> || <tt>7282</tt> || <tt>08B2</tt> || <tt>08CE</tt> || <tt>00</tt> |
|- | |- | ||
− | |colspan=" | + | |colspan="35"| |
|- | |- | ||
|Sky Base Act 1 | |Sky Base Act 1 | ||
− | |<tt>5</tt> || <tt>0080</tt> || <tt>0020</tt> ||rowspan="3"| <tt> | + | |<tt>5</tt> || <tt>0080</tt> || <tt>0020</tt> ||rowspan="3"| <tt>0001</tt> ||rowspan="3"| <tt>00</tt> || <tt>0F</tt> ||rowspan="3"| <tt>0001</tt> || <tt>40</tt> || <tt>03</tt> || <tt>02</tt> || <tt>1D</tt> || <tt>9B3A</tt> || <tt>076E</tt> || <tt>3580</tt> || <tt>9CEE</tt> ||rowspan="3"| <tt>9</tt> ||rowspan="3"| <tt>99E0</tt> || <tt>5</tt> || <tt>6</tt> ||rowspan="3"| <tt>4</tt> || <tt>5</tt> || <tt>091A</tt> || <tt>04</tt> ||rowspan="3"| <tt>0</tt> || <tt>22</tt> ||rowspan="3"| <tt>0</tt> || <tt>4</tt> |
|- | |- | ||
|Sky Base Act 2 | |Sky Base Act 2 | ||
Line 578: | Line 1,197: | ||
|<tt>7</tt> || <tt>0040</tt> || <tt>0040</tt> || <tt>07</tt> || <tt>20</tt> || <tt>01</tt> || <tt>02</tt> || <tt>01</tt> || <tt>A741</tt> || <tt>04C0</tt> || <tt>4300</tt> || <tt>B3B5</tt> || <tt>6</tt> || <tt>8</tt> || <tt>6</tt> || <tt>0997</tt> || <tt>00</tt> || <tt>00</tt> || <tt>4</tt> | |<tt>7</tt> || <tt>0040</tt> || <tt>0040</tt> || <tt>07</tt> || <tt>20</tt> || <tt>01</tt> || <tt>02</tt> || <tt>01</tt> || <tt>A741</tt> || <tt>04C0</tt> || <tt>4300</tt> || <tt>B3B5</tt> || <tt>6</tt> || <tt>8</tt> || <tt>6</tt> || <tt>0997</tt> || <tt>00</tt> || <tt>00</tt> || <tt>4</tt> | ||
|- | |- | ||
− | |colspan=" | + | |colspan="35"| |
|- | |- | ||
|End Sequence | |End Sequence | ||
− | |<tt>0</tt> || <tt>0100</tt> || <tt>0010</tt> || <tt> | + | |<tt>0</tt> || <tt>0100</tt> || <tt>0010</tt> || <tt>1A40</tt> || <tt>00</tt> || <tt>1D</tt> || <tt>00E0</tt> || <tt>E8</tt> || <tt>00</tt> || <tt>D9</tt> || <tt>0A</tt> || <tt>2DEA</tt> || <tt>083E</tt> || <tt>0000</tt> || <tt>2FE6</tt> || <tt>9</tt> || <tt>AEB1</tt> || <tt>0</tt> || <tt>A</tt> || <tt>3</tt> || <tt>0</tt> || <tt>0A3A</tt> || <tt>00</tt> || <tt>0</tt> || <tt>00</tt> || <tt>0</tt> || <tt>FF</tt> |
|- | |- | ||
− | ! Name !! <abbr title="Solidity Pointer">SP</abbr> !! <abbr title=" | + | ! Name !! <abbr title="Solidity Pointer">SP</abbr> !! <abbr title="Floor Width">FW</abbr> !! <abbr title="Floor Height">FH</abbr> !! <abbr title="Level X Offset">LX</abbr> !! ?? !! <abbr title="Level Width">LW</abbr> !! <abbr title="Level Y Offset">LY</abbr> !! <abbr title="Extend Height">XH</abbr> !! <abbr title="Level Height">LH</abbr> !! <abbr title="Start X">SX</abbr> !! <abbr title="Start Y">SY</abbr> !! <abbr title="Floor Layout">FL</abbr> !! <abbr title="Floor Size">FS</abbr> !! <abbr title="Block Mapping">BM</abbr> !! <abbr title="Level Art">LA</abbr> !! <tt>09</tt> !! <abbr title="Sprite Art">SA</abbr> !! <abbr title="Initial Palette">IP</abbr> !! <abbr title="Cycle Speed">CS</abbr> !! <abbr title="Color Cycles">CC</abbr> !! <abbr title="Cycle Palette">CP</abbr> !! <abbr title="Object Layout">OL</abbr> !! <abbr title="Scroll / Ring HUD flags">SR</abbr> !! <abbr title="Under Water Flag">UW</abbr> !! <abbr title="Time HUD and Lightning flags">TL</abbr> !! <tt>00</tt> !! <abbr title="Music">MU</abbr> |
|- | |- | ||
|Scrap Brain Act 2<br />(Emerald Maze), From Corridor | |Scrap Brain Act 2<br />(Emerald Maze), From Corridor | ||
− | |rowspan="6"| <tt>4</tt> || <tt>0040</tt> || <tt>0040</tt> ||rowspan="6"| <tt> | + | |rowspan="6"| <tt>4</tt> || <tt>0040</tt> || <tt>0040</tt> ||rowspan="6"| <tt>0001</tt> ||rowspan="6"| <tt>00</tt> || <tt>07</tt> ||rowspan="6"| <tt>0001</tt> || <tt>40</tt> || <tt>07</tt> || <tt>03</tt> || <tt>3D</tt> || <tt>62DB</tt> || <tt>08F8</tt> ||rowspan="6"| <tt>2980</tt> ||rowspan="6"| <tt>884B</tt> ||rowspan="6"| <tt>9</tt> ||rowspan="6"| <tt>8F75</tt> ||rowspan="6"| <tt>4</tt> ||rowspan="6"| <tt>6</tt> ||rowspan="6"| <tt>4</tt> ||rowspan="6"| <tt>4</tt> || <tt>0869</tt> ||rowspan="6"| <tt>04</tt> ||rowspan="6"| <tt>0</tt> ||rowspan="6"| <tt>20</tt> ||rowspan="6"| <tt>0</tt> ||rowspan="6"| <tt>4</tt> |
|- | |- | ||
|Scrap Brain Act 2<br />(Ballhog Area) | |Scrap Brain Act 2<br />(Ballhog Area) | ||
Line 603: | Line 1,222: | ||
| <tt>0080</tt> || <tt>0020</tt> || <tt>0F</tt> || <tt>40</tt> || <tt>03</tt> || <tt>7B</tt> || <tt>1B</tt> || <tt>59D7</tt> || <tt>0904</tt> || <tt>082C</tt> | | <tt>0080</tt> || <tt>0020</tt> || <tt>0F</tt> || <tt>40</tt> || <tt>03</tt> || <tt>7B</tt> || <tt>1B</tt> || <tt>59D7</tt> || <tt>0904</tt> || <tt>082C</tt> | ||
|- | |- | ||
− | |colspan=" | + | |colspan="35"| |
|- | |- | ||
|Sky Base Act 2 (Interior) | |Sky Base Act 2 (Interior) | ||
− | |<tt>7</tt> || <tt>0040</tt> || <tt>0040</tt> || <tt> | + | |<tt>7</tt> || <tt>0040</tt> || <tt>0040</tt> || <tt>0001</tt> || <tt>00</tt> || <tt>07</tt> || <tt>0001</tt> || <tt>40</tt> || <tt>07</tt> || <tt>03</tt> || <tt>3B</tt> || <tt>A741</tt> || <tt>04C0</tt> || <tt>4300</tt> || <tt>B3B5</tt> || <tt>9</tt> || <tt>99E0</tt> || <tt>6</tt> || <tt>8</tt> || <tt>4</tt> || <tt>6</tt> || <tt>09A1</tt> || <tt>00</tt> || <tt>0</tt> || <tt>00</tt> || <tt>0</tt> || <tt>4</tt> |
|- | |- | ||
− | ! Name !! <abbr title="Solidity Pointer">SP</abbr> !! <abbr title=" | + | ! Name !! <abbr title="Solidity Pointer">SP</abbr> !! <abbr title="Floor Width">FW</abbr> !! <abbr title="Floor Height">FH</abbr> !! <abbr title="Level X Offset">LX</abbr> !! ?? !! <abbr title="Level Width">LW</abbr> !! <abbr title="Level Y Offset">LY</abbr> !! <abbr title="Extend Height">XH</abbr> !! <abbr title="Level Height">LH</abbr> !! <abbr title="Start X">SX</abbr> !! <abbr title="Start Y">SY</abbr> !! <abbr title="Floor Layout">FL</abbr> !! <abbr title="Floor Size">FS</abbr> !! <abbr title="Block Mapping">BM</abbr> !! <abbr title="Level Art">LA</abbr> !! <tt>09</tt> !! <abbr title="Sprite Art">SA</abbr> !! <abbr title="Initial Palette">IP</abbr> !! <abbr title="Cycle Speed">CS</abbr> !! <abbr title="Color Cycles">CC</abbr> !! <abbr title="Cycle Palette">CP</abbr> !! <abbr title="Object Layout">OL</abbr> !! <abbr title="Scroll / Ring HUD flags">SR</abbr> !! <abbr title="Under Water Flag">UW</abbr> !! <abbr title="Time HUD and Lightning flags">TL</abbr> !! <tt>00</tt> !! <abbr title="Music">MU</abbr> |
|- | |- | ||
|Special Stage 1 | |Special Stage 1 | ||
− | |rowspan="8"| <tt>6</tt> || <tt>0040</tt> || <tt>0040</tt> ||rowspan="8"| <tt> | + | |rowspan="8"| <tt>6</tt> || <tt>0040</tt> || <tt>0040</tt> ||rowspan="8"| <tt>0001</tt> ||rowspan="8"| <tt>00</tt> || <tt>07</tt> || <tt>0001</tt> || <tt>40</tt> || <tt>02</tt> || <tt>02</tt> || <tt>06</tt> || <tt>B441</tt> || <tt>0760</tt> ||rowspan="8"| <tt>4890</tt> ||rowspan="8"| <tt>C7FE</tt> ||rowspan="8"| <tt>9</tt> ||rowspan="8"| <tt>A511</tt> ||rowspan="8"| <tt>7</tt> ||rowspan="8"| <tt>1</tt> ||rowspan="8"| <tt>1</tt> ||rowspan="8"| <tt>7</tt> || <tt>09A5</tt> ||rowspan="8"| <tt>4</tt> ||rowspan="8"| <tt>0</tt> ||rowspan="8"| <tt>21</tt> ||rowspan="8"| <tt>0</tt> ||rowspan="8"| <tt>10</tt> |
|- | |- | ||
|Special Stage 2 | |Special Stage 2 | ||
− | | <tt>0040</tt> || <tt>0040</tt> || <tt>07</tt> || <tt> | + | | <tt>0040</tt> || <tt>0040</tt> || <tt>07</tt> || <tt>0320</tt> || <tt>C0</tt> || <tt>05</tt> || <tt>02</tt> || <tt>1E</tt> || <tt>B441</tt> || <tt>0760</tt> || <tt>09AC</tt> |
|- | |- | ||
|Special Stage 3 | |Special Stage 3 | ||
− | | <tt>0040</tt> || <tt>0040</tt> || <tt>07</tt> || <tt> | + | | <tt>0040</tt> || <tt>0040</tt> || <tt>07</tt> || <tt>0680</tt> || <tt>40</tt> || <tt>07</tt> || <tt>03</tt> || <tt>3B</tt> || <tt>B441</tt> || <tt>0760</tt> || <tt>09B6</tt> |
|- | |- | ||
|Special Stage 4 | |Special Stage 4 | ||
− | | <tt>0010</tt> || <tt>0100</tt> || <tt>01</tt> || <tt> | + | | <tt>0010</tt> || <tt>0100</tt> || <tt>01</tt> || <tt>0001</tt> || <tt>20</tt> || <tt>1F</tt> || <tt>06</tt> || <tt>40</tt> || <tt>4A62</tt> || <tt>08DB</tt> || <tt>09C0</tt> |
|- | |- | ||
|Special Stage 5 | |Special Stage 5 | ||
− | | <tt>0040</tt> || <tt>0040</tt> || <tt>07</tt> || <tt> | + | | <tt>0040</tt> || <tt>0040</tt> || <tt>07</tt> || <tt>0001</tt> || <tt>40</tt> || <tt>02</tt> || <tt>02</tt> || <tt>06</tt> || <tt>B441</tt> || <tt>0760</tt> || <tt>09D3</tt> |
|- | |- | ||
|Special Stage 6 | |Special Stage 6 | ||
− | | <tt>0040</tt> || <tt>0040</tt> || <tt>07</tt> || <tt> | + | | <tt>0040</tt> || <tt>0040</tt> || <tt>07</tt> || <tt>0320</tt> || <tt>C0</tt> || <tt>05</tt> || <tt>02</tt> || <tt>1E</tt> || <tt>B441</tt> || <tt>0760</tt> || <tt>09E6</tt> |
|- | |- | ||
|Special Stage 7 | |Special Stage 7 | ||
− | | <tt>0040</tt> || <tt>0040</tt> || <tt>07</tt> || <tt> | + | | <tt>0040</tt> || <tt>0040</tt> || <tt>07</tt> || <tt>0680</tt> || <tt>40</tt> || <tt>07</tt> || <tt>03</tt> || <tt>3B</tt> || <tt>B441</tt> || <tt>0760</tt> || <tt>09FF</tt> |
|- | |- | ||
|Special Stage 8 | |Special Stage 8 | ||
− | | <tt>0010</tt> || <tt>0100</tt> || <tt>01</tt> || <tt> | + | | <tt>0010</tt> || <tt>0100</tt> || <tt>01</tt> || <tt>0001</tt> || <tt>20</tt> || <tt>1F</tt> || <tt>06</tt> || <tt>04</tt> || <tt>4A62</tt> || <tt>08DB</tt> || <tt>0A15</tt> |
|} | |} | ||
− | ====Level | + | ==Palettes== |
+ | |||
+ | A palette of 32 colors is used, the first 16 reserved for the level and the second 16 for the sprites. | ||
+ | |||
+ | The Master System uses 6-bit colors, each colour in a palette is one byte (32 bytes for a full palette, 16 bytes for a half-palette). 2 bits are assigned to each color (R:0–2, G:0–2, B:0–2), for a total of 64 possible colors. The extra two bits in the byte are unused, therefore the format of the byte is: <tt>00BBGGRR</tt>. The corresponding 24-bit color byte value for the 2-bit numbers are: 0 = 0, 1 = 80, 2 = 175, 3 = 255. | ||
+ | |||
+ | The Game Gear uses 9-bit colors, so each color use two bytes (the first nybble of the second byte is 0, and values for the color nybble are in steps of 2). This color can be defined like that : R(0–7), G(0–7), B(0–7). So, there are only 8 possible values for each primary color. Here are the RGB correspondence : <tt>0/1 = 0</tt>, <tt>2/3 = 36</tt>, <tt>4/5 = 72</tt>, <tt>6/7 = 109</tt>, <tt>8/9 = 145</tt>, <tt>A/B = 182</tt>, <tt>C/D = 218</tt>, <tt>E/F = 255</tt>. So, you can have a maximum of 512 colors. The format for the two bytes is : <tt>GGGGRRRR 0000BBBB</tt> | ||
+ | |||
+ | ===Level palettes=== | ||
+ | A table of Level Palette Pointers are located at: {{SMS}} <tt>$0627C</tt> – <tt>$0628B</tt> {{GG}} <tt>$23440</tt> – <tt>$23450</tt>. Each pointer (2 bytes, little-endian) in the table points to the beginning of a palette in the ROM. On the Master System, these pointers are absolute (give the actual ROM address), but on the Game Gear, are relative, specifying how many bytes from {{GG}} <tt>$23400</tt> the palette can be found. Each level palette is a full-palette (Tiles and Sprites) of 32-colours. | ||
+ | |||
+ | The level palettes are located at: {{SMS}} <tt>$0629E</tt> – <tt>$065ED</tt> {{GG}} <tt>$23450</tt> – <tt>$23C00</tt>. See the [[#ROM_Map|ROM map]] for a more detailed listing. | ||
+ | |||
+ | The Initial Palette ("<tt>IP</tt>") value of a [[#Level_Headers|Level Header]] is an index to the level palette pointers, i.e. 0–7, specifying which palette to load. | ||
+ | |||
+ | ===Level Cycle palettes=== | ||
+ | To create a simple animation effect, such as flowing water, the palettes are "cycled" through a list of other palettes allowing the colours to rapidly change without having to change actual pixel data. | ||
+ | |||
+ | A table of cycle palette pointers exists at {{SMS}} <tt>$0628C</tt> – <tt>$0629D</tt> {{GG}} <tt>$23400</tt> – <tt>$23450</tt>. Each pointer (2 bytes, little-endian) in the table points to the beginning of a cycle palette. Each cycle palette is a half-palette of 16 colours and the number of cycle palettes in a cycle is determined in the [[#Level_Headers|Level Header]] by the Cycle Count ("<tt>CC</tt>") value. The Cycle Palette ("<tt>CP</tt>") value in the [[#Level_Headers|Level Header]] is an index to the Cycle Palette Pointers table, determining which palette cycle to use. | ||
+ | |||
+ | Note that the Level Palettes and Cycle Palettes are intermixed, which is why the pointer tables are necessary. See the [[#ROM_Map|ROM Map]] for a detailed listing of the palette locations. | ||
+ | |||
+ | ===Labyrinth's Under Water palettes=== | ||
+ | Labyrinth uses an under water effect created by a raster line trick, that is, the palette is changed as the TV's electron beam is half-way down the screen. Since a level can only specify one palette, the "under water" palette is stored elsewhere in the ROM. | ||
+ | |||
+ | For Labyrinth Acts 1 & 2 a full 32 color palette is located at {{SMS}} <tt>$0024B</tt>. Labyrinth Act 3 is unusual in that the entire level is underwater but Sonic doesn't drown. Even though the [[#Level_Headers|Level Header]] specifies the normal Labyrinth palette, this is overridden by the palette stored at {{SMS}} <tt>$0026B</tt>, which is necessary to include the under water coloured Boss sprite palette that is normally loaded in [[#On-Demand_Sprite_Palettes|on-demand]]. | ||
− | + | ===Sky Base Act 1 Lightning palettes=== | |
+ | Sky Base 1 has a unique feature in that, as well as the regular palette, a "lightning" flashing effect occurs every few seconds. This is managed entirely separately from the regular palette cycle (i.e. the lightning is not a very long [[#Level_Cycle_Palettes|palette cycle]] list). | ||
− | {|class="prettytable" | + | Locations {{SMS}} <tt>$01F9D</tt> – <tt>$01FA8</tt> control the different palettes used for the lightning effect and looks like this: |
− | ! | + | |
+ | :<tt>02 04 5E 64 02 04 9E 64 02 04 DE 64</tt> | ||
+ | |||
+ | This can be broken down into three stages: | ||
+ | |||
+ | * <tt>02 04 5E 64</tt> (normal palette) | ||
+ | * <tt>02 04 9E 64</tt> (pre-lightning flash) | ||
+ | * <tt>02 04 DE 64</tt> (lightning flashing) | ||
+ | |||
+ | "<tt>02</tt>" controls the frequency of the palette swaps (flashing). Increasing this number will slow the flashing down. | ||
+ | |||
+ | "<tt>04</tt>" specifies the number of cycle palettes in the palette to be swapped. The next two bytes are a little-endian address to the palette to use. {{SMS}} <tt>$645E</tt> is the default Sky Base 1 palette, {{SMS}} <tt>$649E</tt> is the pre-lightning flash where the electricity beams appear and {{SMS}} <tt>$64DE</tt> is the lightning flash. | ||
+ | |||
+ | ===On-Demand Sprite palettes=== | ||
+ | The end sign and boss objects have their own palettes separate from the sprite palette used on a level. When these objects are near their palettes are automatically loaded into the level's sprite palette (the last 16 colors in the 32-color system palette). | ||
+ | |||
+ | The end sign palette is located at {{SMS}} <tt>$0626C</tt> – <tt>$0627B</tt>. | ||
+ | |||
+ | The Boss palette, which also includes the [[Capsule]], is located at {{SMS}} <tt>$0731C</tt> – <tt>$0732B</tt> | ||
+ | |||
+ | ==Block mappings== | ||
+ | |||
+ | The floor layout for each level is comprised of "blocks": prearranged 4×4 tile (32×32 px) patterns. This reduces the amount of memory required for storing levels ("Floor Layouts") as levels are constructed out of these larger blocks rather than storing every tile seen. | ||
+ | |||
+ | Each block is composed of 16 smaller 8×8 px tiles. The block is 16 bytes, each byte is an index to which tile to display in the Level Art. The bytes are arranged on screen in this order: | ||
+ | |||
+ | [[Image:32x32.png]] | ||
+ | |||
+ | And the corresponding data is: | ||
+ | :<tt>00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F</tt> | ||
+ | |||
+ | Block Mappings are stored uncompressed in the ROM. The number of blocks in each mapping is apparently not stored in the ROM, so to determine the number of blocks in each mapping you need to compare the distance between "Mapping Location" [[#Level_Headers|Level Headers]]. For your convenience the size of the mappings are charted below. | ||
+ | |||
+ | {| class="prettytable" style="width:auto;" | ||
+ | ! {{SMS}} Offset !! {{SMS}} Description !! !! {{GG}} Offset !! {{GG}} Description | ||
|- | |- | ||
− | | | + | |<tt>$10000</tt> – <tt>$10B80</tt> |
− | |Green Hill | + | |Green Hill (184 blocks) |
+ | | | ||
+ | |<tt>$10000</tt> – <tt>$10BB0</tt> | ||
+ | |Green Hill (187 blocks) | ||
|- | |- | ||
− | | | + | |<tt>$10B80</tt> – <tt>$11480</tt> |
− | | | + | |Bridge (144 blocks) |
+ | | | ||
+ | |<tt>$10BB0</tt> – <tt>$11510</tt> | ||
+ | |Bridge (150 blocks) | ||
|- | |- | ||
− | | | + | |<tt>$11480</tt> – <tt>$11E80</tt> |
− | | | + | |Jungle (160 blocks) |
+ | | | ||
+ | |<tt>$11510</tt> – <tt>$11FE0</tt> | ||
+ | |Jungle (128 blocks) | ||
|- | |- | ||
− | | | + | |<tt>$11E80</tt> – <tt>$12980</tt> |
− | | | + | |Labyrinth (176 blocks) |
+ | | | ||
+ | |<tt>$11FE0</tt> – <tt>$12A10</tt> | ||
+ | |Labyrinth (208 blocks) | ||
|- | |- | ||
− | | | + | |<tt>$12980</tt> – <tt>$13580</tt> |
− | | | + | |Scrap Brain (192 blocks) |
+ | | | ||
+ | |<tt>$12A10</tt> – <tt>$135B0</tt> | ||
+ | |Scrap Brain (186 blocks) | ||
|- | |- | ||
− | | | + | |<tt>$13580</tt> – <tt>$14300</tt> |
− | | | + | |Sky Base 1-2 (216 blocks) |
+ | | | ||
+ | |<tt>$135B0</tt> – <tt>$14330</tt> | ||
+ | |Sky Base 1-2 (216 blocks) | ||
|- | |- | ||
− | | | + | |<tt>$14300</tt> – <tt>$14980</tt> |
− | | | + | |Sky Base 3 (104 blocks) |
+ | | | ||
+ | |<tt>$14330</tt> – <tt>$149B0</tt> | ||
+ | |Sky Base 3 (104 blocks) | ||
|- | |- | ||
− | | | + | |<tt>$14980</tt> – <tt>$1517F</tt> |
− | | | + | |Bonus Stage (128 blocks) |
− | + | | | |
− | + | |<tt>$149B0</tt> – <tt>$14D00</tt>? | |
− | + | |Bonus Stage (53 blocks?) | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | | | ||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | == | + | ==Floor layout== |
+ | |||
+ | The floor layout is composed of multiple 4×4 tile blocks (See [[#Block_Mappings|Block Mappings]]). Each byte indicates the index of the tile to which to use. However, the data is compressed, so you will have to [[#RLE_Compression|decompress]] it first. | ||
+ | |||
+ | Floor layouts are located at: {{SMS}} <tt>$16DEA</tt> – <tt>$1FFFF</tt> {{GG}} <tt>$17430</tt> – <tt>$1F600</tt>. You'll have to use the pointers ([[#Level_Headers|Level Headers]]), in order to determine their starting address. | ||
− | + | ==Object layout== | |
− | + | Objects are special parts of a level. They can move, attack, give you rings, and do a lot of other things, even if they are not visible. Objects are distinct from "sprites" in that some objects are invisible (have no sprite associated) and have some meta effect (such as setting the water-level in Labyrinth), or load their sprite art [[#On-Demand Sprite Palettes|on-demand]]. | |
− | |||
− | + | Object Layout Data begins with one byte, which is the total number of objects in the zone plus one. | |
+ | Immediately following is the object data itself. Each object uses 3 bytes, in the format: | ||
+ | :<tt>OO XX YY</tt> | ||
− | {|class="prettytable" | + | <tt>XX</tt> and <tt>YY</tt> are the object's coordinates divided by 32. <tt>OO</tt> is one of the objects listed below. (Both the Game Gear and Master System versions share the same Object Layout Data). There are a total of 452 objects throughout the game's levels (though some of these are invalid — <tt>00</tt> / <tt>FF</tt>). |
+ | |||
+ | {| class="prettytable" style="width:auto;" | ||
! ID || Description | ! ID || Description | ||
|- | |- | ||
− | |00 | + | |<tt>00</tt> || ''NONE'' |
− | | | ||
|- | |- | ||
− | |01 | + | |<tt>01</tt> || Super Ring monitor |
− | |Super Ring monitor | ||
|- | |- | ||
− | |02 | + | |<tt>02</tt> || Power Sneakers monitor |
− | |Power Sneakers monitor | ||
|- | |- | ||
− | |03 | + | |<tt>03</tt> || One-Up monitor |
− | |One-Up monitor | ||
|- | |- | ||
− | |04 | + | |<tt>04</tt> || Shield monitor |
− | |Shield monitor | ||
|- | |- | ||
− | |05 | + | |<tt>05</tt> || Invincibility monitor |
− | |Invincibility monitor | ||
|- | |- | ||
− | |06 | + | |<tt>06</tt> || Chaos Emerald |
− | |Chaos Emerald | ||
|- | |- | ||
− | |07 | + | |<tt>07</tt> || End sign |
− | |End sign | ||
|- | |- | ||
− | |08 | + | |<tt>08</tt> || Badnik "Crabmeat" (GH) |
− | |Badnik "Crabmeat" (GH) | ||
|- | |- | ||
− | |09 | + | |<tt>09</tt> || Wooden platform - Swinging (GH) |
− | |Wooden platform - Swinging (GH) | ||
|- | |- | ||
− | | | + | |<tt>0A</tt> || Explosion |
− | | | ||
|- | |- | ||
− | | | + | |<tt>0B</tt> || Wooden platform (GH) |
− | |Wooden platform | ||
|- | |- | ||
− | | | + | |<tt>0C</tt> || Wooden platform - Falls when touched (GH) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>0E</tt> || Badnik "Buzz Bomber" (GH/B) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>0F</tt> || Wooden platform - Sliding left-right (GH) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>10</tt> || Badnik "Moto Bug" (GH) |
− | |Badnik " | ||
|- | |- | ||
− | | | + | |<tt>11</tt> || Badnik "Newtron" (GH) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>12</tt> || Robotnik - Green Hill Boss (GH) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>16</tt> || Flame Thrower (SB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>17</tt> || Door - Opens from left only (SB) |
− | |Door - Opens from | ||
|- | |- | ||
− | | | + | |<tt>18</tt> || Door - Opens from right only (SB) |
− | |Door - | ||
|- | |- | ||
− | | | + | |<tt>19</tt> || Door - Two ways (SB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>1A</tt> || Electric sphere (SB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>1B</tt> || Badnik "Ball Hog" (SB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>1C</tt> || Unknown - Ball from the "Ball Hog" ? |
− | | | ||
|- | |- | ||
− | | | + | |<tt>1D</tt> || Switch (SB, L, others ?) |
− | |Switch | ||
|- | |- | ||
− | | | + | |<tt>1E</tt> || Switch Activated Door (SB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>1F</tt> || Badnik "Caterkiller" (SB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>21</tt> || Bumper - Sliding left-right (Bonus Stage ?) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>22</tt> || Robotnik - Scrap Brain Boss (SB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>23</tt> || Free animal - Rabbit |
− | |Free animal - | ||
|- | |- | ||
− | | | + | |<tt>24</tt> || Free animal - Bird |
− | | | ||
|- | |- | ||
− | | | + | |<tt>25</tt> || Animal Cell |
− | | | ||
|- | |- | ||
− | | | + | |<tt>26</tt> || Badnik "Chopper" (J, B) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>27</tt> || Vertical Step - Falling from a waterfall (J) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>28</tt> || Horizontal Step - Falling from a waterfall (J) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>29</tt> || Floating Step - Sonic can travel with it (J) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>2C</tt> || Robotnik - Jungle Boss (J) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>2D</tt> || Badnik "Yadrin" (B) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>2E</tt> || Falling Bridge (B) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>30</tt> || Passing Clouds (SKYB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>31</tt> || Propeller (SKYB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>32</tt> || Badnik "Bomb" (SKYB) |
− | |Badnik " | ||
|- | |- | ||
− | | | + | |<tt>33</tt> || Large Cannons in Sky Base Act 2 (SKYB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>33</tt> || Cannon Ball (SKYB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>35</tt> || Badnik "Unidus" (SKYB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>37</tt> || Rotating cannon (SKYB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>38</tt> || Flying platform (SKYB) |
− | |Flying platform | ||
|- | |- | ||
− | | | + | |<tt>39</tt> || Spiked wall slowly moving right (SKYB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>3A</tt> || Small cannon in Sky Base Act 1 (SKYB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>3B</tt> || Flying platform moving up-down (SKYB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>3C</tt> || Badnik "Jaws" (L) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>3D</tt> || Rotating spiked ball (L) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>3E</tt> || Spear, shifting up-down (L) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>3F</tt> || Fire ball thrower (L) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>40</tt> || Water Level Object (L) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>41</tt> || Bubble Maker (L) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>44</tt> || Badnik "Burrobot" (L) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>45</tt> || Platform, move up when touched (L) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>46</tt> || Electrical Hazard for the Sky Base Boss (SKYB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>48</tt> || Robotnik - Bridge Boss (SB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>49</tt> || Robotnik - Labyrinth Boss (L) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>4A</tt> || Robotnik - Sky Base Boss (SKYB) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>4B</tt> || Zone that makes you fall (like in GH2) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>4C</tt> || Flipper (Bonus Stage) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>4D</tt> || ''RESET!'' |
− | | | ||
|- | |- | ||
− | | | + | |<tt>4E</tt> || Balance (B) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>4F</tt> || ''RESET!'' |
− | | | ||
|- | |- | ||
− | | | + | |<tt>50</tt> || Flower (GH) |
− | | | ||
|- | |- | ||
− | | | + | |<tt>51</tt> || Box - Starpost |
− | | | ||
|- | |- | ||
− | | | + | |<tt>52</tt> || Box - Continue |
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |- | ||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | |<tt>53</tt> || Final animation in GH, when Sonic falls on Robotnik (then, goes to the next level) |
− | | | ||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | |<tt>54</tt> || Emeralds animation (on the map), when Sonic has them all (and goes to the next level) |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | |<tt>55</tt> || Makes Sonic blink for a short time |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | |<tt>FF</tt> || ''NONE'' |
− | | | ||
− | | | ||
|} | |} | ||
− | == | + | ==Misc mappings== |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | This section contains the mappings for some screens. It looks like the Blocks Mappings, except that the 8×8 tiles are written to the screen, so there is more than 16 tiles. Another thing is that they are compressed (see The compression format). | |
− | |||
− | + | {| class="prettytable" style="width:auto;" | |
− | |||
− | |||
− | |||
− | {|class="prettytable" | ||
! Mappings Offset || Description | ! Mappings Offset || Description | ||
|- | |- | ||
− | |$16738 | + | |<tt>$16738</tt> – <tt>$16865</tt> |
|Title Screen | |Title Screen | ||
|- | |- | ||
− | |$16962 | + | |<tt>$16962</tt> – <tt>$163F6</tt> |
|Map 1 Background | |Map 1 Background | ||
|- | |- | ||
− | |$163F6 | + | |<tt>$163F6</tt> – <tt>$16AFD</tt> |
|Map 1 Foreground | |Map 1 Foreground | ||
|} | |} | ||
− | == | + | ==Blinking Items art== |
− | + | In the game, there are some blinking items. The most common are the box items. You can easily edit them. Each of these items is 16×16, but you must understand that it is composed of four 8×8 tiles. The tiles are displayed from up to down and from left to right. The format is the same as the art in savestates (32 bytes for each 8×8 tile, 128 bytes for the item). | |
− | + | Blinking items are located at: {{SMS}} <tt>$15180</tt> – <tt>$1557F</tt> {{GG}} <tt>$15200</tt> – <tt>$15600</tt> | |
− | + | Here are the items you can edit : | |
− | + | {| class="prettytable" style="width:auto;" | |
− | + | ! ID || Description | |
− | {|class="prettytable" | ||
− | ! | ||
|- | |- | ||
− | | | + | |1 || Super Rings |
− | | | ||
|- | |- | ||
− | | | + | |2 || Power Sneakers |
− | | | ||
|- | |- | ||
− | | | + | |3 || One-Up |
− | | | ||
|- | |- | ||
− | | | + | |4 || Shield |
− | | | ||
|- | |- | ||
− | | | + | |5 || Invincible |
− | | | ||
|- | |- | ||
− | | | + | |6 || Chaos Emerald |
− | | | ||
|- | |- | ||
− | | | + | |7 || Starpost (Checkpoint) |
− | | | ||
|- | |- | ||
− | | | + | |8 || Continue |
− | | | ||
|} | |} | ||
− | Level | + | ==Level art== |
− | { | + | The level art starts at: {{SMS}} <tt>$32FE6</tt> {{GG}} <tt>$32ED5</tt>. The "Level Art" value in the [[#Level_Headers|Level Header]] specifies how far from {{SMS}}{{GG}} <tt>$30000</tt> the level art for that zone begins. See the [[#ROM_Map|ROM Map]] for a full list of level art addresses. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |$ | ||
− | |||
− | |||
− | |||
− | | | ||
− | |||
− | + | The graphics for a level consist of 256 tiles. Each tile consists of 8 rows (of 8 pixels). See the [[#Art_Compression|Art Compression]] section for how to fully read and decompress the tile graphics. | |
− | + | ==Game text== | |
− | + | Strings of text in the game are stored in a simple format that begins with an X / Y location on the screen to begin printing, are terminated with <tt>FF</tt> and may contain special control-codes, such as <tt>FE</tt> to move the cursor. | |
− | + | Note that the character codes used for the letters are dependent on the tile map currently being used! There are two tile maps used, one for each of the map screens in the game. | |
− | + | The first map screen shows the overview of the island and is used for the first three zones (Green Hill, Bridge & Jungle). | |
+ | These are the character codes used on this screen: | ||
− | + | {| class="prettytable" style="width:auto;" | |
+ | ! A !! B !! C !! D !! E !! F !! G !! H !! I !! J !! K !! L !! M !! N !! O !! P !! Q !! R !! S !! T !! U !! V !! W !! X !! Y !! Z !! © !! ␣ | ||
+ | |- | ||
+ | | <tt>34</tt> || <tt>35</tt> || <tt>36</tt> || <tt>37</tt> || <tt>44</tt> || <tt>45</tt> || <tt>46</tt> || <tt>47</tt> || <tt>40</tt> || <tt>41</tt> || <tt>42</tt> || <tt>43</tt> || <tt>50</tt> || <tt>51</tt> || <tt>52</tt> || <tt>60</tt> || <tt>61</tt> || <tt>62</tt> || <tt>70</tt> || <tt>80</tt> || <tt>81</tt> || <tt>54</tt> || <tt>3C</tt> || <tt>3D</tt> || <tt>3E</tt> || <tt>3F</tt> || <tt>CF</tt> || <tt>EB</tt> | ||
+ | |} | ||
− | + | The second map screen shows the close-up of the mountain top with Robotnik's fortress, and uses the following character codes: | |
− | + | {| class="prettytable" style="width:auto;" | |
− | {|class="prettytable" | + | ! A !! B !! C !! D !! E !! F !! G !! H !! I !! J !! K !! L !! M !! N !! O !! P !! Q !! R !! S !! T !! U !! V !! W !! X !! Y !! Z !! © !! ␣ |
− | ! | ||
|- | |- | ||
− | | | + | | <tt>1E</tt> || <tt>1F</tt> || <tt>2E</tt> || <tt>2F</tt> || <tt>3E</tt> || <tt>3F</tt> || <tt>4E</tt> || <tt>4F</tt> || <tt>5E</tt> || <tt>5F</tt> || <tt>6E</tt> || <tt>6F</tt> || <tt>7E</tt> || <tt>7F</tt> || <tt>8E</tt> || <tt>8F</tt> || <tt>9E</tt> || <tt>9F</tt> || <tt>AE</tt> || <tt>AF</tt> || <tt>BE</tt> || <tt>BF</tt> || <tt>CE</tt> || <tt>CF</tt> || <tt>DE</tt> || <tt>DF</tt> || <tt>AB</tt> || <tt>EB</tt> |
− | | | + | |} |
+ | |||
+ | ===Zone titles=== | ||
+ | The zone titles ("GREEN HILL", "BRIDGE", …) shown on the map screen are stored at {{SMS}} <tt>$0122D</tt> – <tt>$01286</tt>. Each title is padded with spaces so that all titles are always 12 bytes long. | ||
+ | |||
+ | The first three zones use the character codes from the first map screen, therefore the data looks like this: | ||
+ | |||
+ | {| class="prettytable" style="width:auto;" | ||
+ | ! Address !! Bytes !! Text | ||
|- | |- | ||
− | | | + | | <tt>$0122D</tt> || <tt>10 13 46 62 44 44 51 EB 47 40 43 43 EB EB FF</tt> || <tt>GREEN HILL</tt> |
− | | | ||
|- | |- | ||
− | | | + | | <tt>$0123C</tt> || <tt>10 13 35 62 40 37 46 44 EB EB EB EB EB EB FF</tt> || <tt>BRIDGE</tt> |
− | | | ||
|- | |- | ||
− | | | + | | <tt>$0124B</tt> || <tt>10 13 41 81 51 46 43 44 EB EB EB EB EB EB FF</tt> || <tt>JUNGLE</tt> |
− | | | + | |} |
+ | |||
+ | The next three zones use the second map screen, therefore the letters appear differently: | ||
+ | |||
+ | {| class="prettytable" style="width:auto;" | ||
+ | ! Address !! Bytes !! Text | ||
|- | |- | ||
− | | | + | | <tt>$0125A</tt> || <tt>10 13 6F 1E 1F DE 9F 5E 7F AF 4F EB EB EB FF</tt> || <tt>LABYRINTH</tt> |
− | | | ||
|- | |- | ||
− | | | + | | <tt>$01269</tt> || <tt>10 13 AE 2E 9F 1E 8F EB 1F 9F 1E 5E 7F EB FF</tt> || <tt>SCRAP BRAIN</tt> |
− | | | ||
|- | |- | ||
− | | | + | | <tt>$01278</tt> || <tt>10 13 AE 6E DE EB 1F 1E AE 3E EB EB EB EB FF</tt> || <tt>SKY BASE</tt> |
− | | | ||
− | | | ||
− | | | ||
− | | | ||
|} | |} | ||
− | === | + | ===Final Score titles=== |
+ | Upon completion of the game, a final score screen is shown and bonuses are awarded for the number of emeralds, lives remaining and a "Special Bonus". These titles are stored at {{SMS}} <tt>$0197E</tt> – <tt>$019AD</tt>. | ||
− | + | Each string is padded with spaces to be 13 characters in length. The first tile set is used. | |
− | + | {| class="prettytable" style="width:auto;" | |
+ | ! Address !! Bytes !! Text | ||
+ | |- | ||
+ | | <tt>$0197E</tt> || <tt>08 0A 36 47 34 61 70 EB 44 50 44 62 34 43 37 FF</tt> || <tt>CHAOS EMERALD</tt> | ||
+ | |- | ||
+ | | <tt>$0198E</tt> || <tt>08 0A 70 52 51 40 36 EB 43 44 45 80 EB EB EB FF</tt> || <tt>SONIC LEFT</tt> | ||
+ | |- | ||
+ | | <tt>$0199E</tt> || <tt>08 0A 70 60 44 36 40 34 43 EB 35 52 51 81 70 FF</tt> || <tt>SPECIAL BONUS</tt> | ||
+ | |} | ||
− | The | + | ===Credits text=== |
+ | The text for the credits that roll at the end of the game is stored at {{SMS}} <tt>$02905</tt> – <tt>$02AD5</tt>. | ||
− | + | Additional control codes appear in the credits: | |
− | + | :<tt>FE XX YY</tt>: Moves the cursor to XX, YY on the screen | |
+ | :<tt>FD XX 00</tt>: Pauses for XX length. Values <tt>3C</tt>, <tt>4B</tt> & <tt>F0</tt> are used in the credits roll | ||
+ | :<tt>FC XX</tt>: Number of lines to scroll the credits screen | ||
− | + | Note that the credits use the second tile map. | |
− | + | Here is a full decode of the credits roll: | |
− | + | $02905 14 03 AE 9E 7F 5E 2E SONIC | |
+ | FE 15 04 AF 4F 3E THE | ||
+ | FE 13 05 4F 3E 2F 4E 3E 4F 9E 4E HEDGEHOG | ||
+ | FD 3C 00 | ||
+ | FE 12 0C 7E 1E AE AF 3E 9F MASTER | ||
+ | FE 13 0D AE DE AE AF 3E 7E SYSTEM | ||
+ | FE 14 0E BF 3E 9F AE 5E 9E 7F VERSION | ||
+ | FD 3C 00 | ||
+ | FC 09 | ||
+ | FE 14 0B AE 9E 7F 5E 2E SONIC | ||
+ | FE 15 0C AF 4F 3E THE | ||
+ | FE 13 0D 4F 3E 2F 4E 3E 4F 9E 4E HEDGEHOG | ||
+ | FD 3C 00 | ||
+ | FE 12 0F 8E 9F 5E 4E 5E 7F 1E 6F ORIGINAL | ||
+ | FE 13 10 2E 4F 1E 9F 1E 2E AF 3E 9F CHARACTER | ||
+ | FE 14 11 2F 3E AE 5E 4E 7F DESIGN | ||
+ | FD 3C 00 | ||
+ | FC 04 | ||
+ | FE 14 10 AB AE 3E 4E 1E ©SEGA | ||
+ | FD B4 00 | ||
+ | FC 09 | ||
+ | FE 14 0E AE AF 1E 3F 3F STAFF | ||
+ | FD B4 00 | ||
+ | FC 09 | ||
+ | FE 12 0B 4E 1E 7E 3E GAME | ||
+ | FE 13 0C 8F 9F 9E 4E 9F 1E 7E PROGRAM | ||
+ | FD 3C 00 | ||
+ | FE 13 0E AE 4F 5E 7F 9E 1F BE SHINOBU | ||
+ | FE 14 0F 4F 1E DE 1E AE 4F 5E HYASHI | ||
+ | FD F0 00 | ||
+ | FC 09 | ||
+ | FE 12 0B 4E 9F 1E 8F 4F 5E 2E GRAPHIC | ||
+ | FE 14 0C 2F 3E AE 5E 4E 7F DESIGN | ||
+ | FD 3C 00 | ||
+ | FE 13 0E 1E DE 1E 7F 9E AYANO | ||
+ | FE 14 0F 6E 9E AE 4F 5E 9F 9E KOSHIRO | ||
+ | FD 3C 00 | ||
+ | FE 13 11 AF 1E CF 3E 3F BE 7F 5E TAKEFUNI | ||
+ | FE 14 12 DE BE 7F 9E BE 3E YUNOUE | ||
+ | FD F0 00 | ||
+ | FC 09 | ||
+ | FE 12 0B AE 9E BE 7F 2F SOUND | ||
+ | FE 13 0C 8F 9F 9E 2F BE 2E 3E PRODUCE | ||
+ | FD 3C 00 | ||
+ | FE 13 0E 7E 1E AE 1E AF 9E MASATO | ||
+ | FE 14 0F 7F 1E CF 1E 7E BE 9F 1E NAKAMURA | ||
+ | FD F0 00 | ||
+ | FC 09 | ||
+ | FE 12 0B 9F 3E 1E 9F 9F 1E 7F 4E 3E REARRANGE | ||
+ | FE 15 0C 1E 7F 2F AND | ||
+ | FE 12 0D 9E 9F 5E 4E 5E 7F 1E 6F ORIGINAL | ||
+ | FE 16 0E 7E BE AE 5E 2E MUSIC | ||
+ | FD 3C 00 | ||
+ | FE 13 10 DE BE DF 9E YUZO | ||
+ | FE 14 11 6E 9E AE 4F 5E 9F 9E KOSHIRO | ||
+ | FD F0 00 | ||
+ | FC 09 | ||
+ | FE 13 0D AE 8F 3E 2E 5E 1E 6F SPECIAL | ||
+ | FE 15 0E AF 4F 1E 7F 6E AE THANKS | ||
+ | FD B4 00 | ||
+ | FC 02 | ||
+ | FE 13 0E DE 8E AE 4F 5E 8E EB DE YOSHIO Y | ||
+ | FD 3C 00 | ||
+ | FE 13 11 6F BE 7F 1E 9F 5E 1E 7F LUNARIAN | ||
+ | FE 1A 12 AE 4E SG | ||
+ | FD B4 00 | ||
+ | FC 09 | ||
+ | FE 12 0C 8F 9F 3E AE 3E 7F AF 3E 2F PRESENTED | ||
+ | FE 16 0E 1F DE BY | ||
+ | FE 15 10 AE 3E 4E 1E SEGA | ||
+ | FD B4 00 | ||
+ | FE 19 13 3E 7F 2F END | ||
+ | $02AD5 FF | ||
− | + | ==RAM editing== | |
− | + | To convert offset values to [[Gens Plus]] 0.0.9.61 savestate values, add <tt>$00A4</tt>. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | {| class="prettytable" style="width:auto;" | |
− | |||
− | |||
− | |||
− | {|class="prettytable" | ||
! Offset || Description | ! Offset || Description | ||
|- | |- | ||
− | |$0000 | + | |<tt>$0000</tt> |
|Tile Layout Data | |Tile Layout Data | ||
|- | |- | ||
− | |$1400 | + | |<tt>$1400</tt> |
|Object Status Table (?) | |Object Status Table (?) | ||
|- | |- | ||
− | |$1403 | + | |<tt>$1403</tt> |
|Sonic's X speed | |Sonic's X speed | ||
|- | |- | ||
− | |$1406 | + | |<tt>$1406</tt> |
|Sonic's Y speed | |Sonic's Y speed | ||
|- | |- | ||
− | |$202C | + | |<tt>$202C</tt> |
|Palette | |Palette | ||
|- | |- | ||
− | |$206C | + | |<tt>$206C</tt> |
|Tile Graphics Data | |Tile Graphics Data | ||
|} | |} | ||
− | + | ===Tile Layout data=== | |
− | Unlike in the ROM, the data here is uncompressed. | + | Unlike in the ROM, the data here is uncompressed. Each byte directly corresponds to one 32×32 tile. |
− | The number of tiles in a horizontal line before they wrap around differs depending on the width of the Zone. | + | The number of tiles in a horizontal line before they wrap around differs depending on the width of the Zone. Here is table of the values. |
− | {|class="prettytable" | + | {| class="prettytable" style="width:auto;" |
! Zone || Tile Line Data Size in Bytes | ! Zone || Tile Line Data Size in Bytes | ||
|- | |- | ||
Line 1,397: | Line 1,842: | ||
|} | |} | ||
− | + | ==Music editing== | |
− | + | ===Music locations=== | |
− | * Music Pointers (These add to $8000): $C716 | + | * Music Pointers (These add to <tt>$8000</tt>): <tt>$C716</tt> |
** Specifics... | ** Specifics... | ||
− | {| class="prettytable" | + | {|class="prettytable" style="width:auto;" |
! Song ID || Location (SMS) || Location (GG) || Song | ! Song ID || Location (SMS) || Location (GG) || Song | ||
|- | |- | ||
− | |00||C7D0||C7D0||Green Hill Zone | + | | <tt>00</tt> || <tt>C7D0</tt> || <tt>C7D0</tt> || Green Hill Zone |
|- | |- | ||
− | |01||D74A||D74A||Bridge Zone | + | | <tt>01</tt> || <tt>D74A</tt> || <tt>D74A</tt> || Bridge Zone |
|- | |- | ||
− | |02||D24A||D24A||Jungle Zone | + | | <tt>02</tt> || <tt>D24A</tt> || <tt>D24A</tt> || Jungle Zone |
|- | |- | ||
− | |03||F60C||F60C||Labyrinth Zone | + | | <tt>03</tt> || <tt>F60C</tt> || <tt>F60C</tt> || Labyrinth Zone |
|- | |- | ||
− | |04||DB4F||DB4F||Scrap Brain Zone | + | | <tt>04</tt> || <tt>DB4F</tt> || <tt>DB4F</tt> || Scrap Brain Zone |
|- | |- | ||
− | |05||E1A7||E1A7||Sky Base Zone | + | | <tt>05</tt> || <tt>E1A7</tt> || <tt>E1A7</tt> || Sky Base Zone |
|- | |- | ||
− | |06||E4C3||E4C3||Title Screen | + | | <tt>06</tt> || <tt>E4C3</tt> || <tt>E4C3</tt> || Title Screen |
|- | |- | ||
− | |07||E63C||E63C||Map Screen (Act Intro) | + | | <tt>07</tt> || <tt>E63C</tt> || <tt>E63C</tt> || Map Screen (Act Intro) |
|- | |- | ||
− | |08||E704||E704||Invincible | + | | <tt>08</tt> || <tt>E704</tt> || <tt>E704</tt> || Invincible |
|- | |- | ||
− | |09||E8B4||E8B4||Act Complete | + | | <tt>09</tt> || <tt>E8B4</tt> || <tt>E8B4</tt> || Act Complete |
|- | |- | ||
− | |0A||E991||E991||Death | + | | <tt>0A</tt> || <tt>E991</tt> || <tt>E991</tt> || Death |
|- | |- | ||
− | |0B||EAC0||EAC0||Boss Theme | + | | <tt>0B</tt> || <tt>EAC0</tt> || <tt>EAC0</tt> || Boss Theme |
|- | |- | ||
− | |0C||EAC0||EAC0||Boss Theme | + | | <tt>0C</tt> || <tt>EAC0</tt> || <tt>EAC0</tt> || Boss Theme |
|- | |- | ||
− | |0D||EAC0||EAC0||Boss Theme | + | | <tt>0D</tt> || <tt>EAC0</tt> || <tt>EAC0</tt> || Boss Theme |
|- | |- | ||
− | |0E||ED54||ED54||Ending | + | | <tt>0E</tt> || <tt>ED54</tt> || <tt>ED54</tt> || Ending |
|- | |- | ||
− | |0F||C7D0||C7D0||Green Hill Zone | + | | <tt>0F</tt> || <tt>C7D0</tt> || <tt>C7D0</tt> || Green Hill Zone |
|- | |- | ||
− | |10||F12C||F12C||Bonus Zone | + | | <tt>10</tt> || <tt>F12C</tt> || <tt>F12C</tt> || Bonus Zone |
|- | |- | ||
− | |11||C7D0||C7D0||Green Hill Zone | + | | <tt>11</tt> || <tt>C7D0</tt> || <tt>C7D0</tt> || Green Hill Zone |
|- | |- | ||
− | |12||C7D0||C7D0||Green Hill Zone | + | | <tt>12</tt> || <tt>C7D0</tt> || <tt>C7D0</tt> || Green Hill Zone |
|- | |- | ||
− | |13||F98C||F98C|| | + | | <tt>13</tt> || <tt>F98C</tt> || <tt>F98C</tt> || Good Ending SFX |
|- | |- | ||
− | |14||FA26||FA32||Chaos Emerald | + | | <tt>14</tt> || <tt>FA26</tt> || <tt>FA32</tt> || Chaos Emerald |
|- | |- | ||
+ | | <tt>--</tt> || <tt>CD0A</tt> || <tt>CD0A</tt> || Marble Zone (Unused and unreferenced) | ||
|} | |} | ||
+ | |||
The only difference in the music section of the SMS and GG version is, that the GG version of song 13 has an additional 83 (vibrato) command. | The only difference in the music section of the SMS and GG version is, that the GG version of song 13 has an additional 83 (vibrato) command. | ||
− | + | ===Song format=== | |
All pointers in a song are absolute (i.e. relative to the beginning of the song) 16-bit pointers stored in Little Endian (Intel) format. | All pointers in a song are absolute (i.e. relative to the beginning of the song) 16-bit pointers stored in Little Endian (Intel) format. | ||
− | + | ====Song header==== | |
− | {| class="prettytable" | + | {|class="prettytable" style="width:auto;" |
! Offset || Size || Description | ! Offset || Size || Description | ||
|- | |- | ||
− | |00||Word||Pointer to Channel 1 Data (usually points to 000A) | + | |<tt>00</tt>||Word||Pointer to Channel 1 Data (usually points to <tt>000A</tt>) |
|- | |- | ||
− | |02||Word||Pointer to Channel 2 Data | + | |<tt>02</tt>||Word||Pointer to Channel 2 Data |
|- | |- | ||
− | |04||Word||Pointer to Channel 3 Data | + | |<tt>04</tt>||Word||Pointer to Channel 3 Data |
|- | |- | ||
− | |06||Word||Pointer to Channel 4/Noise Data | + | |<tt>06</tt>||Word||Pointer to Channel 4/Noise Data |
|- | |- | ||
− | |08||Word|| | + | |<tt>08</tt>||Word||Pointer to Channel 5/SFX data (always zero and ignored) |
|- | |- | ||
|} | |} | ||
− | + | ====Channel data==== | |
There's no header for channel data. Channel setup is done via commands.<br> | There's no header for channel data. Channel setup is done via commands.<br> | ||
The commands start directly at the offset specified in the header. | The commands start directly at the offset specified in the header. | ||
− | {| class="prettytable" | + | {|class="prettytable" style="width:auto;" |
! Command || Description | ! Command || Description | ||
|- | |- | ||
− | |00 | + | |<tt>00</tt>–<tt>7F</tt> <tt>xx</tt>||Play Note with length <tt>xx</tt> |
− | *if dd is 0, the value set by 8A is used | + | *if dd is <tt>0</tt>, the value set by <tt>8A</tt> is used |
*Note Values: | *Note Values: | ||
**Tone: first nibble is the octave, second nibble is the key<br>Key is a signed value with A = -3 .. C = -0, C = +0 .. B = +11 (-0 is the same C as +0) | **Tone: first nibble is the octave, second nibble is the key<br>Key is a signed value with A = -3 .. C = -0, C = +0 .. B = +11 (-0 is the same C as +0) | ||
− | **Noise: 70 - Bass Drum, 71 - Snare Drum, others | + | **Noise: <tt>70</tt> - Bass Drum, <tt>71</tt> - Snare Drum, others read from the code section |
− | **7F - Rest | + | **<tt>7F</tt> - Rest |
|- | |- | ||
− | |80 aaaa bbbb||Set song tempo (only present in channel 1) | + | |<tt>80 aaaa bbbb</tt>||Set song tempo (only present in channel 1) |
− | *aa = Tempo Divider | + | *<tt>aa</tt> = Tempo Divider |
− | *bb = Tempo Multipler | + | *<tt>bb</tt> = Tempo Multipler |
− | *aa gets copied to $DC08 and bb gets copied to $DC0A and $DC0C<br>collecting a Speed Shoe increases the Tempo Multipler at $DC0A by 1 | + | *<tt>aa</tt> gets copied to <tt>$DC08</tt> and <tt>bb</tt> gets copied to <tt>$DC0A</tt> and <tt>$DC0C</tt><br>collecting a Speed Shoe increases the Tempo Multipler at <tt>$DC0A</tt> by 1 |
− | *BPM = 120 * aa / bb (120 for 30 Ticks per Quarter) | + | *BPM = 120 * <tt>aa</tt> / <tt>bb</tt> (120 for 30 Ticks per Quarter) |
|- | |- | ||
− | |81 aa||Set volume (0F = max, 00 = min) | + | |<tt>81 aa</tt>||Set volume (<tt>0F</tt> = max, <tt>00</tt> = min) |
|- | |- | ||
− | |82 aa bb cc dd ee ff||Envelope Setup (only present in channels 1-3) | + | |<tt>82 aa bb cc dd ee ff</tt>||Envelope Setup (only present in channels 1-3) |
− | *aa = attack rate (usually FF) | + | *<tt>aa</tt> = attack rate (usually <tt>FF</tt>) |
− | *bb = decay 1 rate (00 - slow, FF - fast) | + | *<tt>bb</tt> = decay 1 rate (<tt>00</tt> - slow, <tt>FF</tt> - fast) |
− | *cc = decay 1 level (00 - min, FF - max) | + | *<tt>cc</tt> = decay 1 level (<tt>00</tt> - min, <tt>FF</tt> - max) |
− | *dd = decay 2 rate | + | *<tt>dd</tt> = decay 2 rate |
− | *ee = decay 2 level | + | *<tt>ee</tt> = decay 2 level |
− | *ff = decay 3 rate | + | *<tt>ff</tt> = decay 3/sustain rate |
|- | |- | ||
− | |83 aa bb cc | + | |<tt>83 aa bb cc dddd</tt>||Modulation (only present in channels 1-3) |
− | *aa = Delay | + | *<tt>aa</tt> = Delay |
− | *bb = Speed | + | *<tt>bb</tt> = Speed |
− | *cc = Step Count + 1 | + | *<tt>cc</tt> = Step Count + 1 |
− | **Note: Step 0 (dd=01) stops instead of reversing the counter's direction | + | **Note: Step 0 (<tt>dd</tt>=<tt>01</tt>) stops instead of reversing the counter's direction |
− | * | + | *<tt>dddd</tt> = Change per Step |
− | |||
− | |||
|- | |- | ||
− | |84 aaaa||Set Detune value to aaaa (aaaa is a signed byte that modifies the FNum) | + | |<tt>84 aaaa</tt>||Set Detune value to <tt>aaaa</tt> (<tt>aaaa</tt> is a signed byte that modifies the FNum) |
*positive value = higher FNum = lower note | *positive value = higher FNum = lower note | ||
|- | |- | ||
− | |85 aa|| | + | |<tt>85 aa</tt>||does nothing (only present in channel 1) |
− | *aa is always FF (with very few excpetions) | + | *<tt>aa</tt> is always <tt>FF</tt> (with very few excpetions) |
|- | |- | ||
− | |86||Loop Start Marker | + | |<tt>86</tt>||Loop Start Marker |
− | *increases Loop Stack Pointer | + | *increases Loop Stack Pointer and initializes Loop Counter |
|- | |- | ||
− | |87 aa bbbb||Loop back | + | |<tt>87 aa bbbb</tt>||Loop back |
− | *aa - number of times to repeat | + | *<tt>aa</tt> - number of times to repeat |
− | *bbbb - Position to loop back to (usually points to the byte after the 86 command) | + | *<tt>bbbb</tt> - Position to loop back to (usually points to the byte after the <tt>86</tt> command) |
*Note: When leaving the loop, the Loop Stack Pointer is decreased. | *Note: When leaving the loop, the Loop Stack Pointer is decreased. | ||
|- | |- | ||
− | |88||Master Loop Start | + | |<tt>88</tt>||Master Loop Start |
*sets the master loop address for this channel | *sets the master loop address for this channel | ||
|- | |- | ||
− | | | + | |<tt>89 aa</tt>||Set Noise Mode to <tt>aa</tt> |
+ | *Note: When a note is played, this value gets ORed with $E0 and is sent to the PSG chip. | ||
|- | |- | ||
− | | | + | |<tt>8A aa</tt>||Set default note length to <tt>aa</tt> |
|- | |- | ||
− | | | + | |<tt>8B</tt>||Increase volume by 1 |
|- | |- | ||
− | | | + | |<tt>8C</tt>||Decrease volume by 1 |
|- | |- | ||
− | |FF||Track End | + | |<tt>8D</tt>||no attack for next note |
− | *When this command is enountered and the master loop address is set, the driver jumps back to the address set by the 88 command. | + | |- |
+ | |<tt>FE</tt>||SFX Track End | ||
+ | *Equal to <tt>FF</tt>, but resets the sound priority byte instead of checking for the master loop address. | ||
+ | |- | ||
+ | |<tt>FF</tt>||Track End | ||
+ | *When this command is enountered and the master loop address is set, the driver jumps back to the address set by the <tt>88</tt> command. | ||
|- | |- | ||
|} | |} | ||
− | + | ====Note on <tt>86</tt>/<tt>87</tt>==== | |
− | The 86 command is used the make nested loops possible.<br> | + | The <tt>86</tt> command is used the make nested loops possible.<br> |
− | Example: 86 86 ... 87 04 aaaa ... 87 02 bbbb | + | Example: <tt>86 86 ... 87 04 aaaa ... 87 02 bbbb</tt> |
− | + | ====Note on <tt>88</tt>/<tt>FF</tt>==== | |
− | There's no need for an 88 command in non-looping songs.<br> | + | There's no need for an <tt>88</tt> command in non-looping songs.<br> |
However every jingle (with exception of the Death-Jingle) has a master loop, consisting of a rest. | However every jingle (with exception of the Death-Jingle) has a master loop, consisting of a rest. | ||
+ | |||
+ | {{S1GGOmni}} | ||
+ | |||
+ | ==References== | ||
+ | <references /> | ||
{{SCHGuides}} | {{SCHGuides}} | ||
[[Category:Sonic Community Hacking Guide]] | [[Category:Sonic Community Hacking Guide]] |
Latest revision as of 16:38, 24 March 2020
- Back to: [[]]. The Guide is based on work by David Declerck[1][2], Kroc Camen and Penta Penguin. The Music Hacking Guide is based on notes by ValleyBell.
Contents
Community Help
A great deal is not yet understood about the ROM. In order to help with the building of tools (such as level / sprite editors), here is a list of some of the things that need investigating:
- Sprite Mappings: How sprites are mapped from their object values to the actual sprite art tile indices is not known. Whilst we can load sprite art, we do not know how to read from the ROM where the enemy sprite is in the sprite art, how it is constructed and how the Object Layout relates to that. This knowledge is needed to create a level editor that allows changing of sprite sets for existing levels
- Solidity Data: The Level Headers contain a "Solidity Pointer" -- an index to somewhere in the ROM where data defines which tiles are solid / passable. This data is most likely 256 bytes long (one byte for each tile) and will need to define various states such as sloped tiles, water tiles (with current) and possibly much more. It is not known where the solidity data is stored, nor what format it is in. This knowledge is needed to modify Level Art.
- Level Headers: Various portions of the Level Headers are undocumented. Experiments are needed to work out the effects of the undocumented header bytes and to better understand existing ones. A full chart of the level header values is here. This knowledge is needed to create a level editor with the ability to work from a blank canvas
- Disassembly: The ROM has not been fully disassembled. For a total understanding of the game to allow complete control over every facet, a full disassembly is recommended. Moderate Z80 skills are required for this. There are many reasons why a disassembly would be beneficial:
- Fix bugs / slowdown
- Add new features such as a spin dash
- Move the ROM to 512K so that content can have room to grow
- Add new badnicks, traps bosses and more
If you have anything to contribute regarding these unknowns:
- Update this page, add to the discussion page or post on the forums if you have an account
- Contact Kroc Camen here
ROM map
Master System
Offset | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
$00000 – ? | Main Game Code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$0024B – $0026A | Labyrinth Act 1-2 Underwater Palette | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$0026B – $0028A | Labyrinth Act 3 Underwater Palette | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$00F0E – $00F2D | Map Screen 1 Palette | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$00F2E – $00F4D | Map Screen 2 Palette | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$01209 – $0122C | Zone Title Pointers:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$0122D – $01286 | Zone Titles: (Text Format)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$013E1 – $01400 | Title Screen Palette | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$0197E – $019AD | Final Score Titles: (Text Format) The text used for the score bonuses given on the completion of the game
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$01F9D – $01FA8 | Lightning Palette Control | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$01B8D – $01BAC | "Sonic Has Passed" Screen Palette | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$02905 – $02AD5 | Credits Text (Text Format) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$02AD6 – $02AF5 | Credits Screen Palette | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$0626C – $0627B | End Sign Sprite Palette | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$0627C – $0628B | Palette Pointers:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$0628C – $0629D | Palette Cycle Pointers:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$0629E – $065ED | Palettes:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$0731C – $0732B | Boss Sprite Palette (including end capsule) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$0C7F0 – $0FFB0 | Music, sounds, and other stuff | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$0FFB1 – $0FFFF | EMPTY SPACE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$10000 – $14C9F | Block Mappings:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$15180 – $1557F | Blinking Items Art (Box, etc...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$15580 – $155C9 | Level Header Pointers:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$155CA – $15AB3 | Level Headers:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$15AB4 – $15FFF | Object Layout:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$16000 – $16DE9 | Misc Mappings: (RLE Compressed)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$16DEA – $1FFFF | Level Layout: (RLE Compressed)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$20000 – $25FFF | UNKNOWN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$26000 – $32FE5 | Tile and Sprite Sets: (Compressed Art)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$32FE6 – $3DA27 | Level Art: (Compressed Art)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$3DA28 – $3FF20 | Contains sprite art and/or sprite mappings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$3FF21 – $40000 | EMPTY SPACE |
Game Gear
Offset | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
$00000 – $10000 | Main Game Code, musics, sounds... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$10000 – $14D00 | Block Mappings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$14D00 – $15200 | Unknown | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$15200 – $15600 | Blinking Items Art (Box, etc...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$15600 – $1564A | Level Headers Pointers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$1564A – $15B34 | Level Headers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$15B34 – $16200 | Object Layout:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$16200 – $16738 | UNKNOWN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$16738 – $17430 | Misc Mappings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$17430 – $1F600 | Level Layout | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$1F600 – $20000 | Sega Screen Art / Mappings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$20000 – $23440 | Sonic Art / Mappings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$23400 – $23450 | Palette Cycle Pointers:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$23450 – $23C00 | Palettes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$23C00 – $25500 | 'Sega' sound | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$25500 – $30000 | Art : Title Screen / Map / Levels / Stats / Sprites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$30000 – $40000 | Art : Sega Screen / Map / Levels | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$3DA28 – $40000 | Contains sprite art and/or sprite mappings |
Compressed data
RLE compression
Some data (level layouts, misc. mappings) in the ROM is compressed using a form of Run-Length-Encoding, where bytes that repeat themselves many times in a row are reduced by specifying the number of times to repeat a byte.
In practice, the ROM stores this data normally byte-for-byte but indicates a value to repeat by a duplicate byte followed by another byte that specifies the number of successive bytes to repeat.
A bug / oversight made by the developers means that the byte that specifies the number of times to repeat is off-by-one (causing an overflow (255 → 0). This means that a repeating-value of 01 means zero repeats (therefore wasting space!), 02 means 1 repeat, FF means 255 repeats, but 00 actually means 256 repeats! Be keenly aware of this when de/compressing!
Example:
- 06 7C 32 2E 2E 01 D1 → 06 7C 32 2E 2E D1
- 6B 3F 3F 02 51 2D C0 → 6B 3F 3F 3F 51 2D C0
- 05 07 5A 5A 03 08 B2 → 05 07 5A 5A 5A 5A 08 B2
- 05 07 5A 5A 03 08 B2 → 05 07 5A 5A 5A 5A 08 B2
- 29 EF 00 00 00 BB D2 → 29 EF 00 00 […00x256…] BB D2
As you can see, this format wastes one byte of space if a byte is only repeated twice. If a byte is repeated three times, there is no size difference. Only when a byte is repeated four or more times is there a savings in space usage.
Art compression
WARNING: Here comes the science bit! If you want to understand how this works then read very carefully. First, some background info: The Master System uses character-based graphics, that is, 8×8 pixel tiles arranged into a 32×24 grid. The screen is not drawn to directly, instead up to 448 tiles can be defined and images are crafted by arranging different tiles on the grid.
The graphics for a level consist of 256 tiles and sprite sets are 128 tiles. Each tile consists of 8 rows (of 8 pixels), each row is 4 bytes (more on that later). The graphic art is compressed in a very complex, but effective, manner. The rows of all the tiles are divided into unique rows and duplicate rows. The data is stored like this:
- Header (8-bytes)
- List of unique rows
- List of duplicate rows
- Art Data (the actual graphics)
Header
The 8-byte header is in the format of:
- 48 59 DR DR AD AD RC RC
(Note that dual-byte values "DR", "AD" and "RC" are Little-Endian, the lowest byte first. e.g. "08 01" = "0108")
- DR: "Duplicate Rows". An offset from the start of the level art header, to the where the duplicate rows list begins. For tile sets this value is always "0108" (256 + 8 in hexadecimal). For sprite sets it's "0088" (128 + 8 in hexadecimal)
- AD: "Art Data". An offset, from the beginning of the level art header (e.g. $32FE6), to the start of the Art Data section. This is critically important because the length of the duplicate rows list can vary
- RC: "Row Count". The number of rows in the tileset; 0800 (2048, 256×8) for tile sets, 0400 (1024, 128×8) for sprite sets.
Unique Rows list
The list of unique rows is one byte for each tile we are defining (256 for tile sets, 128 for sprite sets). To process this data begin with the first byte of the unique rows list. Each bit in this byte refers to a row in the first tile of the tile set that we are decompressing.
Note that bits in a byte are ordered right to left, as such:
Bit# | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
---|---|---|---|---|---|---|---|---|
Value: | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 1 |
Therefore bit #1 (on the right), refers to the first row of the current tile we are decoding and bit #8 (on the left) refers to the 8th row of the tile.
When a bit value is 0, it means that the tile row it corresponds to is a unique row. Read in 4 bytes from the Art Data section and decode into the 8 pixels for that row (see the Art Data heading below). In the example above, rows 3, 4 & 6 and of the tile are unique, and 4 bytes would be read from the Art Data for each.
Walk through the whole unique rows list decoding in this way and you should have a partial tile set with all the unique rows filled in.
Duplicate Rows list
The list of duplicate rows "fills in the blanks" in the rows missed by the unique list. For each row in the tile set that was missed by the unique rows list the duplicate rows list will contain an index value to where in the Art Data the row is.
Begin by walking the unique rows list again in the same order as before, but this time when a bit value is 1 it means that row is a duplicate: read a byte from the duplicate rows list. This value is an index to where in the art data the row is located, i.e. a value of 80 (hex) means:
$30000 Base address (Master System) + 2FE6 "Level Art" pointer in the level header, Green Hill for example + 7C2 Art Data pointer in the level art header, again Green Hill + 80*4 Skip to the 128th, decimal, row in the art data
For values 00 to EF (0 to 239), there is only one byte, indicating the row index in the Art Data. However, for values after EF, there are two bytes. The first one starts with an F, so the actual line number is the two bytes number minus F0 00. E.g.: F3 A2 is for art data row number 3A2. Note that you can also write line numbers 00 to EF using two bytes numbers, but this is a waste of space (that's why they are stored with one byte!).
Once you've walked the unique rows list a second time, reading the duplicate row list for each bit-value of 1 you see, all the blank rows in the title set should be filled in and you should have a complete tile set — if you've understood everything correctly!
Art data
The SMS uses a palette of 16 colours for tiles, therefore the data that defines the tile graphics do not specify the actual R/G/B values, but just an index (0-15) to the palette colour to use. Therefore an 8-pixel row is stored as 4 bytes, where 4 bits (values 0-15) are assigned to each pixel.
However, instead of being stored as nybbles (4-bits in a row), the data is stored across 4 bit-planes. To understand what bit-planes are, imagine 4 bytes stacked on top of each other like layers in a cake. A bit plane would be a slice of the cake — 1 bit from each of the 4 bytes.
To decode the 4 bytes into 8 colour pixels, slice the bit-planes to get the index values (0-15) for each pixel and then look up the final colour from the palette.
In pseudo code, something like this:
input byte1, byte2, byte3, byte4 pixel = array (0 to 7) for bit = 0 to 7 if byte1 AND 2 ^ (7-bit) then pixel[bit] = pixel[bit] OR 1 if byte2 AND 2 ^ (7-bit) then pixel[bit] = pixel[bit] OR 2 if byte3 AND 2 ^ (7-bit) then pixel[bit] = pixel[bit] OR 4 if byte4 AND 2 ^ (7-bit) then pixel[bit] = pixel[bit] OR 8 pixel[bit] = palette-color-from-index: pixel[bit] next bit
Level Headers / Level Headers pointers
Each level has a header. This header contains several pieces of data, such as starting position, music location, etc. Each level header is 37 bytes long and is referenced by a pointer.
Level Headers pointers
A level header pointer is comprised of two bytes. The data for the pointer is stored in little endian format. The value stored by this pointer specifies the number of bytes away a level header is from $15580 $15600.There are 37 Level Headers in total. Some levels have more than one pointer because they can be accessed from different locations, and Sonic's starting position differs at level start. Also two invalid level pointers exist that act as dividers between the main sequence of levels and the out-of-sequence levels (Scrap Brain's sub-maps and the Special Stages). See the ROM map for the full list of level pointers.
Example:
The two first bytes are 4A 00. So, at $15580 + $004A, we will find the level header for the first level (Green Hill 1).Level Headers
The level headers are located at $155CA – $15AB3 $1564A – $15B34.Each level header use 37 bytes. Here is the format (partial):
- SP FW FW FH FH LX LX ?? LW LY LY XH LH
- SX SY FL FL FS FS BM BM LA LA 09 SA SA
- IP CS CC CP OL OL SR UW TL 00 MU
- SP: Solidity Pointer
- Indicates what solidity data to use. The location of this data and its format is undocumented
- FW, FH: Floor Width / Height (Little-Endian)
- Number of blocks wide / high the Floor Layout is. Levels can share the same Floor Layout (such as the special stages), and the specific level can occupy a subset of the Floor Layout. The LX / LY / LW / LH values specify the offset and size of the level within the Floor Layout
- LX: Level X Offset
- Left-hand offset position of the level in the Floor Layout (see "FW" above), in pixels, i.e. where, horizontally, the left hand side of the level is. There is always effectively 8 added to this value due to the hidden scrolling zone on the left side of the screen
- ??: Unknown Byte
- The 8th byte in the header appears to be some kind of flag-bits. Only Green Hill Act 1 & 2 use it, and changing the value appears to make no discernible difference to the level
- LW: Level Width
- Although named "Level Width", it is actually a little more complicated than that. This value sets the right hand limit of the level, and everything thereafter is cropped out. The value is multiplied by 8 and 14 is added on top (the minimum width of a Floor Layout is apparently 14 blocks) to determine the right-most limit (in blocks)
- LY: Level Y Offset
- Top offset position of the level in the Floor Layout (see "FH" above), in pixels, i.e. where, vertically, the top of the level is
- XH: Extend Height
- Due to the nature of the bottom of the level being at "6+(LH×8)" blocks this may not align desirably. This is notable in Green Hill Act 1 in which the level height is 2 blocks short of the Floor Layout and causes Sonic to die when hitting the jump ramp as it is now touching the bottom of the level. The Extend Height value adds a number of pixels to the height of the level to compensate, ideally this should be in multiples of 20 (hex), 32 (decimal)
- LH: Level Height
- This value sets the bottom-most limit of the level, and everything thereafter is cropped out. The value is multiplied by 8 and 6 is added on top (the minimum height of a Floor Layout is apparently 6 blocks — one screen height) to determine the bottom-most limit (in blocks)
- SX, SY: Sonic starting position X/Y
- Position, in blocks, where the player starts
- FL: Floor Layout (Little Endian)
- How many bytes away from $14000 the Floor Layout is located
- FS: Floor Data Size (Little Endian)
- Length, in bytes, of the compressed Floor Layout data
- BM: Block Mapping (Little Endian)
- How many bytes away from $10000 the mappings for this level are located
- LA: Level Art (Little Endian)
- How many bytes away from $30000 the level art is located
- SA: Sprite Art (Little Endian)
- How many bytes away from $24000 is the sprite art located
- 09: Unknown Byte
- The 24th byte in the header always has a value of 9, it's purpose is unknown
- IP: Initial Palette
- Indicates the number of the initial palette pointer to use, in the pointer order of appearance
- CS: Cycle Speed
- Determines the speed of the palette cycle. 0 = no cycle, 1 = change every frame, 2 = change every second frame, and so on
- CC: Color Cycles
- Indicates the number of color cycles for the level palette
- CP: Cycle Palette
- Indicates the number of the cyclic palette pointer to use, in the pointer order of appearance
- OL: Object Layout (Little Endian)
- How many bytes away from $15580 $15600 the Object layout is located
- SR Scrolling / Ring HUD Flags
-
Bit flags that control how the level scrolls and the presence of the ring count in the HUD.
Combine any of the hex values below:- 01 Sonic immediately dies, the game hangs and doesn't reload the level; purpose unknown
- 02 The demo play data controls Sonic
- 04 Shows ring count in HUD and rings are displayed. When this value is not included no rings are visible, even though the sparkle effect occurs when you collect them
- 08 The level automatically scrolls to the right (ala Bridge Act 2)
- 10 After a pause, the level automatically scrolls upwards! If you get caught at the bottom of the screen, you die
- 20 The screen scrolls smoothly, allowing you to get ahead of it
- 40 Slow up and down wave effect (ala Sky Base Act 2)
- 80 Screen does not scroll down (ala Jungle Act 2). If you get caught at the bottom of the screen, you die
- UW: Under Water Flag
- Controls the under-water effect (slow movement / water colour / drowning) in Labyrinth (80 is on, 00 is off). The presence of Object $40 in the Object Layout sets the water height at its Y-level
- TL: Time HUD / Lightning effect flags
-
Bit flags that control the presence of the time counter in the HUD, and the use of the lightning effect
Combine any of the hex values below:- 01 Centers the time display when on a special stage. Outside of the special stage causes the game to switch to the special stage
- 02 Uses the lightning effect. This overrides the level's own palette
- 04 / 08 No effect?
- 10 Use the boss underwater palette (ala Labyrinth Act 3)
- 20 Displays the time
- 40 Locks the screen, no scrolling occurs
- 80 No effect?
- 00: Unknown Byte
- The 36th byte in the header always has a value of 0, it's purpose is unknown
- MU: Music
-
- 00–05: Level Music
- 06: Title Music
- 08: Invincibility
- 09: Level Complete
- 0A: Dead
- 0B/0C/0D: Boss
- 0E: Credits
- 10: Bonus Stage
This is a table of the complete level headers for the Master System version: (all values are hexadecimal)
Name | SP | FW | FH | LX | ?? | LW | LY | XH | LH | SX | SY | FL | FS | BM | LA | 09 | SA | IP | CS | CC | CP | OL | SR | UW | TL | 00 | MU | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Green Hill Act 1 | 0 | 0100 | 0010 | 0040 | C0 | 18 | 0020 | 40 | 01 | 08 | 0B | 2DEA | 083E | 0000 | 2FE6 | 9 | 612A | 0 | A | 3 | 0 | 0534 | 04 | 0 | 20 | 0 | 0 | |||||||
Green Hill Act 2 | 0080 | 0020 | 0001 | A0 | 0C | 0001 | 40 | 03 | 02 | 03 | 3628 | 0661 | 0580 | 04 | 20 | |||||||||||||||||||
Green Hill Act 3 | 0080 | 0020 | 0001 | 00 | 0A | 00E8 | 40 | 03 | 07 | 16 | 3C89 | 032D | 05C3 | 00 | 00 | |||||||||||||||||||
Bridge Act 1 | 1 | 0100 | 0010 | 0001 | 00 | 1F | 0001 | 40 | 01 | 03 | 0C | 7ED1 | 0694 | 0B80 | 4578 | 9 | 6C3D | 1 | 8 | 3 | 1 | 05D6 | 04 | 0 | 20 | 0 | 1 | |||||||
Bridge Act 2 | 0080 | 0020 | 0F | 0001 | 40 | 03 | 02 | 1C | A2A8 | 0499 | 061C | 0C | 20 | |||||||||||||||||||||
Bridge Act 3 | 0080 | 0020 | 0F | 0300 | 40 | 03 | 06 | 1B | B301 | 0140 | 0656 | 00 | 00 | |||||||||||||||||||||
Name | SP | FW | FH | LX | ?? | LW | LY | XH | LH | SX | SY | FL | FS | BM | LA | 09 | SA | IP | CS | CC | CP | OL | SR | UW | TL | 00 | MU | |||||||
Jungle Act 1 | 2 | 0100 | 0010 | 0001 | 00 | 1F | 0001 | 20 | 01 | 02 | 0B | 3FB6 | 0AAC | 1480 | 5B00 | 9 | 77CD | 2 | 5 | 3 | 2 | 066C | 04 | 0 | 20 | 0 | 2 | |||||||
Jungle Act 2 | 0010 | 0100 | 01 | 0001 | 20 | 1F | 02 | FA | 4A62 | 08DB | 06C4 | 84 | 20 | |||||||||||||||||||||
Jungle Act 3 | 0080 | 0020 | 0F | 0300 | 40 | 03 | 06 | 1B | B301 | 0140 | 0656 | 00 | 00 | |||||||||||||||||||||
Labyrinth Act 1 | 3 | 0040 | 0040 | 0001 | 00 | 07 | 0001 | 40 | 07 | 02 | 05 | 8565 | 08C2 | 1E80 | 71BF | 9 | 83B6 | 3 | 5 | 3 | 3 | 0723 | 04 | 80 | 20 | 0 | 3 | |||||||
Labyrinth Act 2 | 0040 | 0040 | 03 | 09 | 8E27 | 0D13 | 0772 | 04 | 20 | |||||||||||||||||||||||||
Labyrinth Act 3 | 0040 | 0040 | 03 | 25 | AFF6 | 030B | 07CA | 00 | 10 | |||||||||||||||||||||||||
Name | SP | FW | FH | LX | ?? | LW | LY | XH | LH | SX | SY | FL | FS | BM | LA | 09 | SA | IP | CS | CC | CP | OL | SR | UW | TL | 00 | MU | |||||||
Scrap Brain Act 1 | 4 | 0100 | 0010 | 0001 | 00 | 1E | 0001 | 20 | 01 | 03 | 0B | 533D | 069A | 2980 | 884B | 9 | 8F75 | 4 | 6 | 4 | 4 | 07E9 | 04 | 0 | 20 | 0 | 4 | |||||||
Scrap Brain Act 2 | 0080 | 0020 | 0F | 0001 | 40 | 03 | 04 | 16 | 59D7 | 0904 | 082C | 20 | ||||||||||||||||||||||
Scrap Brain Act 3 | 0040 | 0040 | 07 | 0220 | 40 | 07 | 03 | 36 | 7282 | 08B2 | 08CE | 00 | ||||||||||||||||||||||
Sky Base Act 1 | 5 | 0080 | 0020 | 0001 | 00 | 0F | 0001 | 40 | 03 | 02 | 1D | 9B3A | 076E | 3580 | 9CEE | 9 | 99E0 | 5 | 6 | 4 | 5 | 091A | 04 | 0 | 22 | 0 | 4 | |||||||
Sky Base Act 2 | 5 | 0040 | 0040 | 07 | 40 | 06 | 0A | 17 | 7B34 | 039D | 3580 | 9CEE | 5 | 6 | 8 | 0954 | 40 | 20 | 5 | |||||||||||||||
Sky Base Act 3 | 7 | 0040 | 0040 | 07 | 20 | 01 | 02 | 01 | A741 | 04C0 | 4300 | B3B5 | 6 | 8 | 6 | 0997 | 00 | 00 | 4 | |||||||||||||||
End Sequence | 0 | 0100 | 0010 | 1A40 | 00 | 1D | 00E0 | E8 | 00 | D9 | 0A | 2DEA | 083E | 0000 | 2FE6 | 9 | AEB1 | 0 | A | 3 | 0 | 0A3A | 00 | 0 | 00 | 0 | FF | |||||||
Name | SP | FW | FH | LX | ?? | LW | LY | XH | LH | SX | SY | FL | FS | BM | LA | 09 | SA | IP | CS | CC | CP | OL | SR | UW | TL | 00 | MU | |||||||
Scrap Brain Act 2 (Emerald Maze), From Corridor |
4 | 0040 | 0040 | 0001 | 00 | 07 | 0001 | 40 | 07 | 03 | 3D | 62DB | 08F8 | 2980 | 884B | 9 | 8F75 | 4 | 6 | 4 | 4 | 0869 | 04 | 0 | 20 | 0 | 4 | |||||||
Scrap Brain Act 2 (Ballhog Area) |
0020 | 0080 | 03 | A0 | 0A | 03 | 03 | 6BD3 | 06AF | 08B5 | ||||||||||||||||||||||||
Scrap Brain Act 2, From Transporter |
0080 | 0020 | 0F | 40 | 03 | 50 | 10 | 59D7 | 0904 | 082C | ||||||||||||||||||||||||
Scrap Brain Act 2 (Emerald Maze), From Transporter |
0040 | 0040 | 07 | 40 | 07 | 27 | 1C | 62DB | 08F8 | 0869 | ||||||||||||||||||||||||
Scrap Brain Act 2, From Emerald Maze |
0080 | 0020 | 0F | 40 | 03 | 7B | 03 | 59D7 | 0904 | 082C | ||||||||||||||||||||||||
Scrap Brain Act 2, From Ballhog Area |
0080 | 0020 | 0F | 40 | 03 | 7B | 1B | 59D7 | 0904 | 082C | ||||||||||||||||||||||||
Sky Base Act 2 (Interior) | 7 | 0040 | 0040 | 0001 | 00 | 07 | 0001 | 40 | 07 | 03 | 3B | A741 | 04C0 | 4300 | B3B5 | 9 | 99E0 | 6 | 8 | 4 | 6 | 09A1 | 00 | 0 | 00 | 0 | 4 | |||||||
Name | SP | FW | FH | LX | ?? | LW | LY | XH | LH | SX | SY | FL | FS | BM | LA | 09 | SA | IP | CS | CC | CP | OL | SR | UW | TL | 00 | MU | |||||||
Special Stage 1 | 6 | 0040 | 0040 | 0001 | 00 | 07 | 0001 | 40 | 02 | 02 | 06 | B441 | 0760 | 4890 | C7FE | 9 | A511 | 7 | 1 | 1 | 7 | 09A5 | 4 | 0 | 21 | 0 | 10 | |||||||
Special Stage 2 | 0040 | 0040 | 07 | 0320 | C0 | 05 | 02 | 1E | B441 | 0760 | 09AC | |||||||||||||||||||||||
Special Stage 3 | 0040 | 0040 | 07 | 0680 | 40 | 07 | 03 | 3B | B441 | 0760 | 09B6 | |||||||||||||||||||||||
Special Stage 4 | 0010 | 0100 | 01 | 0001 | 20 | 1F | 06 | 40 | 4A62 | 08DB | 09C0 | |||||||||||||||||||||||
Special Stage 5 | 0040 | 0040 | 07 | 0001 | 40 | 02 | 02 | 06 | B441 | 0760 | 09D3 | |||||||||||||||||||||||
Special Stage 6 | 0040 | 0040 | 07 | 0320 | C0 | 05 | 02 | 1E | B441 | 0760 | 09E6 | |||||||||||||||||||||||
Special Stage 7 | 0040 | 0040 | 07 | 0680 | 40 | 07 | 03 | 3B | B441 | 0760 | 09FF | |||||||||||||||||||||||
Special Stage 8 | 0010 | 0100 | 01 | 0001 | 20 | 1F | 06 | 04 | 4A62 | 08DB | 0A15 |
Palettes
A palette of 32 colors is used, the first 16 reserved for the level and the second 16 for the sprites.
The Master System uses 6-bit colors, each colour in a palette is one byte (32 bytes for a full palette, 16 bytes for a half-palette). 2 bits are assigned to each color (R:0–2, G:0–2, B:0–2), for a total of 64 possible colors. The extra two bits in the byte are unused, therefore the format of the byte is: 00BBGGRR. The corresponding 24-bit color byte value for the 2-bit numbers are: 0 = 0, 1 = 80, 2 = 175, 3 = 255.
The Game Gear uses 9-bit colors, so each color use two bytes (the first nybble of the second byte is 0, and values for the color nybble are in steps of 2). This color can be defined like that : R(0–7), G(0–7), B(0–7). So, there are only 8 possible values for each primary color. Here are the RGB correspondence : 0/1 = 0, 2/3 = 36, 4/5 = 72, 6/7 = 109, 8/9 = 145, A/B = 182, C/D = 218, E/F = 255. So, you can have a maximum of 512 colors. The format for the two bytes is : GGGGRRRR 0000BBBB
Level palettes
A table of Level Palette Pointers are located at: $0627C – $0628B $23440 – $23450. Each pointer (2 bytes, little-endian) in the table points to the beginning of a palette in the ROM. On the Master System, these pointers are absolute (give the actual ROM address), but on the Game Gear, are relative, specifying how many bytes from $23400 the palette can be found. Each level palette is a full-palette (Tiles and Sprites) of 32-colours. The level palettes are located at: $0629E – $065ED $23450 – $23C00. See the ROM map for a more detailed listing.The Initial Palette ("IP") value of a Level Header is an index to the level palette pointers, i.e. 0–7, specifying which palette to load.
Level Cycle palettes
To create a simple animation effect, such as flowing water, the palettes are "cycled" through a list of other palettes allowing the colours to rapidly change without having to change actual pixel data.
A table of cycle palette pointers exists at $0628C – $0629D $23400 – $23450. Each pointer (2 bytes, little-endian) in the table points to the beginning of a cycle palette. Each cycle palette is a half-palette of 16 colours and the number of cycle palettes in a cycle is determined in the Level Header by the Cycle Count ("CC") value. The Cycle Palette ("CP") value in the Level Header is an index to the Cycle Palette Pointers table, determining which palette cycle to use.Note that the Level Palettes and Cycle Palettes are intermixed, which is why the pointer tables are necessary. See the ROM Map for a detailed listing of the palette locations.
Labyrinth's Under Water palettes
Labyrinth uses an under water effect created by a raster line trick, that is, the palette is changed as the TV's electron beam is half-way down the screen. Since a level can only specify one palette, the "under water" palette is stored elsewhere in the ROM.
For Labyrinth Acts 1 & 2 a full 32 color palette is located at $0024B. Labyrinth Act 3 is unusual in that the entire level is underwater but Sonic doesn't drown. Even though the Level Header specifies the normal Labyrinth palette, this is overridden by the palette stored at $0026B, which is necessary to include the under water coloured Boss sprite palette that is normally loaded in on-demand.Sky Base Act 1 Lightning palettes
Sky Base 1 has a unique feature in that, as well as the regular palette, a "lightning" flashing effect occurs every few seconds. This is managed entirely separately from the regular palette cycle (i.e. the lightning is not a very long palette cycle list).
Locations $01F9D – $01FA8 control the different palettes used for the lightning effect and looks like this:- 02 04 5E 64 02 04 9E 64 02 04 DE 64
This can be broken down into three stages:
- 02 04 5E 64 (normal palette)
- 02 04 9E 64 (pre-lightning flash)
- 02 04 DE 64 (lightning flashing)
"02" controls the frequency of the palette swaps (flashing). Increasing this number will slow the flashing down.
"04" specifies the number of cycle palettes in the palette to be swapped. The next two bytes are a little-endian address to the palette to use. $645E is the default Sky Base 1 palette, $649E is the pre-lightning flash where the electricity beams appear and $64DE is the lightning flash.On-Demand Sprite palettes
The end sign and boss objects have their own palettes separate from the sprite palette used on a level. When these objects are near their palettes are automatically loaded into the level's sprite palette (the last 16 colors in the 32-color system palette).
The end sign palette is located at $0626C – $0627B. The Boss palette, which also includes the Capsule, is located at $0731C – $0732BBlock mappings
The floor layout for each level is comprised of "blocks": prearranged 4×4 tile (32×32 px) patterns. This reduces the amount of memory required for storing levels ("Floor Layouts") as levels are constructed out of these larger blocks rather than storing every tile seen.
Each block is composed of 16 smaller 8×8 px tiles. The block is 16 bytes, each byte is an index to which tile to display in the Level Art. The bytes are arranged on screen in this order:
And the corresponding data is:
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Block Mappings are stored uncompressed in the ROM. The number of blocks in each mapping is apparently not stored in the ROM, so to determine the number of blocks in each mapping you need to compare the distance between "Mapping Location" Level Headers. For your convenience the size of the mappings are charted below.
Offset | Description | Offset | Description | |
---|---|---|---|---|
$10000 – $10B80 | Green Hill (184 blocks) | $10000 – $10BB0 | Green Hill (187 blocks) | |
$10B80 – $11480 | Bridge (144 blocks) | $10BB0 – $11510 | Bridge (150 blocks) | |
$11480 – $11E80 | Jungle (160 blocks) | $11510 – $11FE0 | Jungle (128 blocks) | |
$11E80 – $12980 | Labyrinth (176 blocks) | $11FE0 – $12A10 | Labyrinth (208 blocks) | |
$12980 – $13580 | Scrap Brain (192 blocks) | $12A10 – $135B0 | Scrap Brain (186 blocks) | |
$13580 – $14300 | Sky Base 1-2 (216 blocks) | $135B0 – $14330 | Sky Base 1-2 (216 blocks) | |
$14300 – $14980 | Sky Base 3 (104 blocks) | $14330 – $149B0 | Sky Base 3 (104 blocks) | |
$14980 – $1517F | Bonus Stage (128 blocks) | $149B0 – $14D00? | Bonus Stage (53 blocks?) |
Floor layout
The floor layout is composed of multiple 4×4 tile blocks (See Block Mappings). Each byte indicates the index of the tile to which to use. However, the data is compressed, so you will have to decompress it first.
Floor layouts are located at: $16DEA – $1FFFF $17430 – $1F600. You'll have to use the pointers (Level Headers), in order to determine their starting address.Object layout
Objects are special parts of a level. They can move, attack, give you rings, and do a lot of other things, even if they are not visible. Objects are distinct from "sprites" in that some objects are invisible (have no sprite associated) and have some meta effect (such as setting the water-level in Labyrinth), or load their sprite art on-demand.
Object Layout Data begins with one byte, which is the total number of objects in the zone plus one. Immediately following is the object data itself. Each object uses 3 bytes, in the format:
- OO XX YY
XX and YY are the object's coordinates divided by 32. OO is one of the objects listed below. (Both the Game Gear and Master System versions share the same Object Layout Data). There are a total of 452 objects throughout the game's levels (though some of these are invalid — 00 / FF).
ID | Description |
---|---|
00 | NONE |
01 | Super Ring monitor |
02 | Power Sneakers monitor |
03 | One-Up monitor |
04 | Shield monitor |
05 | Invincibility monitor |
06 | Chaos Emerald |
07 | End sign |
08 | Badnik "Crabmeat" (GH) |
09 | Wooden platform - Swinging (GH) |
0A | Explosion |
0B | Wooden platform (GH) |
0C | Wooden platform - Falls when touched (GH) |
0E | Badnik "Buzz Bomber" (GH/B) |
0F | Wooden platform - Sliding left-right (GH) |
10 | Badnik "Moto Bug" (GH) |
11 | Badnik "Newtron" (GH) |
12 | Robotnik - Green Hill Boss (GH) |
16 | Flame Thrower (SB) |
17 | Door - Opens from left only (SB) |
18 | Door - Opens from right only (SB) |
19 | Door - Two ways (SB) |
1A | Electric sphere (SB) |
1B | Badnik "Ball Hog" (SB) |
1C | Unknown - Ball from the "Ball Hog" ? |
1D | Switch (SB, L, others ?) |
1E | Switch Activated Door (SB) |
1F | Badnik "Caterkiller" (SB) |
21 | Bumper - Sliding left-right (Bonus Stage ?) |
22 | Robotnik - Scrap Brain Boss (SB) |
23 | Free animal - Rabbit |
24 | Free animal - Bird |
25 | Animal Cell |
26 | Badnik "Chopper" (J, B) |
27 | Vertical Step - Falling from a waterfall (J) |
28 | Horizontal Step - Falling from a waterfall (J) |
29 | Floating Step - Sonic can travel with it (J) |
2C | Robotnik - Jungle Boss (J) |
2D | Badnik "Yadrin" (B) |
2E | Falling Bridge (B) |
30 | Passing Clouds (SKYB) |
31 | Propeller (SKYB) |
32 | Badnik "Bomb" (SKYB) |
33 | Large Cannons in Sky Base Act 2 (SKYB) |
33 | Cannon Ball (SKYB) |
35 | Badnik "Unidus" (SKYB) |
37 | Rotating cannon (SKYB) |
38 | Flying platform (SKYB) |
39 | Spiked wall slowly moving right (SKYB) |
3A | Small cannon in Sky Base Act 1 (SKYB) |
3B | Flying platform moving up-down (SKYB) |
3C | Badnik "Jaws" (L) |
3D | Rotating spiked ball (L) |
3E | Spear, shifting up-down (L) |
3F | Fire ball thrower (L) |
40 | Water Level Object (L) |
41 | Bubble Maker (L) |
44 | Badnik "Burrobot" (L) |
45 | Platform, move up when touched (L) |
46 | Electrical Hazard for the Sky Base Boss (SKYB) |
48 | Robotnik - Bridge Boss (SB) |
49 | Robotnik - Labyrinth Boss (L) |
4A | Robotnik - Sky Base Boss (SKYB) |
4B | Zone that makes you fall (like in GH2) |
4C | Flipper (Bonus Stage) |
4D | RESET! |
4E | Balance (B) |
4F | RESET! |
50 | Flower (GH) |
51 | Box - Starpost |
52 | Box - Continue |
53 | Final animation in GH, when Sonic falls on Robotnik (then, goes to the next level) |
54 | Emeralds animation (on the map), when Sonic has them all (and goes to the next level) |
55 | Makes Sonic blink for a short time |
FF | NONE |
Misc mappings
This section contains the mappings for some screens. It looks like the Blocks Mappings, except that the 8×8 tiles are written to the screen, so there is more than 16 tiles. Another thing is that they are compressed (see The compression format).
Mappings Offset | Description |
---|---|
$16738 – $16865 | Title Screen |
$16962 – $163F6 | Map 1 Background |
$163F6 – $16AFD | Map 1 Foreground |
Blinking Items art
In the game, there are some blinking items. The most common are the box items. You can easily edit them. Each of these items is 16×16, but you must understand that it is composed of four 8×8 tiles. The tiles are displayed from up to down and from left to right. The format is the same as the art in savestates (32 bytes for each 8×8 tile, 128 bytes for the item).
Blinking items are located at: $15180 – $1557F $15200 – $15600Here are the items you can edit :
ID | Description |
---|---|
1 | Super Rings |
2 | Power Sneakers |
3 | One-Up |
4 | Shield |
5 | Invincible |
6 | Chaos Emerald |
7 | Starpost (Checkpoint) |
8 | Continue |
Level art
The level art starts at: $32FE6 $32ED5. The "Level Art" value in the Level Header specifies how far from $30000 the level art for that zone begins. See the ROM Map for a full list of level art addresses.The graphics for a level consist of 256 tiles. Each tile consists of 8 rows (of 8 pixels). See the Art Compression section for how to fully read and decompress the tile graphics.
Game text
Strings of text in the game are stored in a simple format that begins with an X / Y location on the screen to begin printing, are terminated with FF and may contain special control-codes, such as FE to move the cursor.
Note that the character codes used for the letters are dependent on the tile map currently being used! There are two tile maps used, one for each of the map screens in the game.
The first map screen shows the overview of the island and is used for the first three zones (Green Hill, Bridge & Jungle). These are the character codes used on this screen:
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | © | ␣ |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
34 | 35 | 36 | 37 | 44 | 45 | 46 | 47 | 40 | 41 | 42 | 43 | 50 | 51 | 52 | 60 | 61 | 62 | 70 | 80 | 81 | 54 | 3C | 3D | 3E | 3F | CF | EB |
The second map screen shows the close-up of the mountain top with Robotnik's fortress, and uses the following character codes:
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | © | ␣ |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1E | 1F | 2E | 2F | 3E | 3F | 4E | 4F | 5E | 5F | 6E | 6F | 7E | 7F | 8E | 8F | 9E | 9F | AE | AF | BE | BF | CE | CF | DE | DF | AB | EB |
Zone titles
The zone titles ("GREEN HILL", "BRIDGE", …) shown on the map screen are stored at $0122D – $01286. Each title is padded with spaces so that all titles are always 12 bytes long.The first three zones use the character codes from the first map screen, therefore the data looks like this:
Address | Bytes | Text |
---|---|---|
$0122D | 10 13 46 62 44 44 51 EB 47 40 43 43 EB EB FF | GREEN HILL |
$0123C | 10 13 35 62 40 37 46 44 EB EB EB EB EB EB FF | BRIDGE |
$0124B | 10 13 41 81 51 46 43 44 EB EB EB EB EB EB FF | JUNGLE |
The next three zones use the second map screen, therefore the letters appear differently:
Address | Bytes | Text |
---|---|---|
$0125A | 10 13 6F 1E 1F DE 9F 5E 7F AF 4F EB EB EB FF | LABYRINTH |
$01269 | 10 13 AE 2E 9F 1E 8F EB 1F 9F 1E 5E 7F EB FF | SCRAP BRAIN |
$01278 | 10 13 AE 6E DE EB 1F 1E AE 3E EB EB EB EB FF | SKY BASE |
Final Score titles
Upon completion of the game, a final score screen is shown and bonuses are awarded for the number of emeralds, lives remaining and a "Special Bonus". These titles are stored at $0197E – $019AD.Each string is padded with spaces to be 13 characters in length. The first tile set is used.
Address | Bytes | Text |
---|---|---|
$0197E | 08 0A 36 47 34 61 70 EB 44 50 44 62 34 43 37 FF | CHAOS EMERALD |
$0198E | 08 0A 70 52 51 40 36 EB 43 44 45 80 EB EB EB FF | SONIC LEFT |
$0199E | 08 0A 70 60 44 36 40 34 43 EB 35 52 51 81 70 FF | SPECIAL BONUS |
Credits text
The text for the credits that roll at the end of the game is stored at $02905 – $02AD5.Additional control codes appear in the credits:
- FE XX YY: Moves the cursor to XX, YY on the screen
- FD XX 00: Pauses for XX length. Values 3C, 4B & F0 are used in the credits roll
- FC XX: Number of lines to scroll the credits screen
Note that the credits use the second tile map.
Here is a full decode of the credits roll:
$02905 14 03 AE 9E 7F 5E 2E SONIC FE 15 04 AF 4F 3E THE FE 13 05 4F 3E 2F 4E 3E 4F 9E 4E HEDGEHOG FD 3C 00 FE 12 0C 7E 1E AE AF 3E 9F MASTER FE 13 0D AE DE AE AF 3E 7E SYSTEM FE 14 0E BF 3E 9F AE 5E 9E 7F VERSION FD 3C 00 FC 09 FE 14 0B AE 9E 7F 5E 2E SONIC FE 15 0C AF 4F 3E THE FE 13 0D 4F 3E 2F 4E 3E 4F 9E 4E HEDGEHOG FD 3C 00 FE 12 0F 8E 9F 5E 4E 5E 7F 1E 6F ORIGINAL FE 13 10 2E 4F 1E 9F 1E 2E AF 3E 9F CHARACTER FE 14 11 2F 3E AE 5E 4E 7F DESIGN FD 3C 00 FC 04 FE 14 10 AB AE 3E 4E 1E ©SEGA FD B4 00 FC 09 FE 14 0E AE AF 1E 3F 3F STAFF FD B4 00 FC 09 FE 12 0B 4E 1E 7E 3E GAME FE 13 0C 8F 9F 9E 4E 9F 1E 7E PROGRAM FD 3C 00 FE 13 0E AE 4F 5E 7F 9E 1F BE SHINOBU FE 14 0F 4F 1E DE 1E AE 4F 5E HYASHI FD F0 00 FC 09 FE 12 0B 4E 9F 1E 8F 4F 5E 2E GRAPHIC FE 14 0C 2F 3E AE 5E 4E 7F DESIGN FD 3C 00 FE 13 0E 1E DE 1E 7F 9E AYANO FE 14 0F 6E 9E AE 4F 5E 9F 9E KOSHIRO FD 3C 00 FE 13 11 AF 1E CF 3E 3F BE 7F 5E TAKEFUNI FE 14 12 DE BE 7F 9E BE 3E YUNOUE FD F0 00 FC 09 FE 12 0B AE 9E BE 7F 2F SOUND FE 13 0C 8F 9F 9E 2F BE 2E 3E PRODUCE FD 3C 00 FE 13 0E 7E 1E AE 1E AF 9E MASATO FE 14 0F 7F 1E CF 1E 7E BE 9F 1E NAKAMURA FD F0 00 FC 09 FE 12 0B 9F 3E 1E 9F 9F 1E 7F 4E 3E REARRANGE FE 15 0C 1E 7F 2F AND FE 12 0D 9E 9F 5E 4E 5E 7F 1E 6F ORIGINAL FE 16 0E 7E BE AE 5E 2E MUSIC FD 3C 00 FE 13 10 DE BE DF 9E YUZO FE 14 11 6E 9E AE 4F 5E 9F 9E KOSHIRO FD F0 00 FC 09 FE 13 0D AE 8F 3E 2E 5E 1E 6F SPECIAL FE 15 0E AF 4F 1E 7F 6E AE THANKS FD B4 00 FC 02 FE 13 0E DE 8E AE 4F 5E 8E EB DE YOSHIO Y FD 3C 00 FE 13 11 6F BE 7F 1E 9F 5E 1E 7F LUNARIAN FE 1A 12 AE 4E SG FD B4 00 FC 09 FE 12 0C 8F 9F 3E AE 3E 7F AF 3E 2F PRESENTED FE 16 0E 1F DE BY FE 15 10 AE 3E 4E 1E SEGA FD B4 00 FE 19 13 3E 7F 2F END $02AD5 FF
RAM editing
To convert offset values to Gens Plus 0.0.9.61 savestate values, add $00A4.
Offset | Description |
---|---|
$0000 | Tile Layout Data |
$1400 | Object Status Table (?) |
$1403 | Sonic's X speed |
$1406 | Sonic's Y speed |
$202C | Palette |
$206C | Tile Graphics Data |
Tile Layout data
Unlike in the ROM, the data here is uncompressed. Each byte directly corresponds to one 32×32 tile.
The number of tiles in a horizontal line before they wrap around differs depending on the width of the Zone. Here is table of the values.
Zone | Tile Line Data Size in Bytes |
---|---|
Green Hill Act 1 | 256 |
Green Hill Act 2 | 128 |
Green Hill Act 3 | 128 |
Bridge Act 1 | 256 |
Bridge Act 2 | 128 |
Bridge Act 3 | 128 |
Jungle Act 1 | 256 |
Jungle Act 2 | 16 |
Jungle Act 3 | 64 |
Labyrinth Act 1 | 64 |
Labyrinth Act 2 | 64 |
Labyrinth Act 3 | 64 |
Scrap Brain Act 1 | 256 |
Scrap Brain Act 2 | 128 |
Scrap Brain Act 2 (Emerald Maze) | 64 |
Scrap Brain Act 2 (Ballhog Area) | 32 |
Scrap Brain Act 3 | 64 |
Sky Base Act 1 | 128 |
Sky Base Act 2 | 64 |
Sky Base Act 2 (Interior) | 64 |
Sky Base Act 3 | 64 |
Music editing
Music locations
- Music Pointers (These add to $8000): $C716
- Specifics...
Song ID | Location (SMS) | Location (GG) | Song |
---|---|---|---|
00 | C7D0 | C7D0 | Green Hill Zone |
01 | D74A | D74A | Bridge Zone |
02 | D24A | D24A | Jungle Zone |
03 | F60C | F60C | Labyrinth Zone |
04 | DB4F | DB4F | Scrap Brain Zone |
05 | E1A7 | E1A7 | Sky Base Zone |
06 | E4C3 | E4C3 | Title Screen |
07 | E63C | E63C | Map Screen (Act Intro) |
08 | E704 | E704 | Invincible |
09 | E8B4 | E8B4 | Act Complete |
0A | E991 | E991 | Death |
0B | EAC0 | EAC0 | Boss Theme |
0C | EAC0 | EAC0 | Boss Theme |
0D | EAC0 | EAC0 | Boss Theme |
0E | ED54 | ED54 | Ending |
0F | C7D0 | C7D0 | Green Hill Zone |
10 | F12C | F12C | Bonus Zone |
11 | C7D0 | C7D0 | Green Hill Zone |
12 | C7D0 | C7D0 | Green Hill Zone |
13 | F98C | F98C | Good Ending SFX |
14 | FA26 | FA32 | Chaos Emerald |
-- | CD0A | CD0A | Marble Zone (Unused and unreferenced) |
The only difference in the music section of the SMS and GG version is, that the GG version of song 13 has an additional 83 (vibrato) command.
Song format
All pointers in a song are absolute (i.e. relative to the beginning of the song) 16-bit pointers stored in Little Endian (Intel) format.
Song header
Offset | Size | Description |
---|---|---|
00 | Word | Pointer to Channel 1 Data (usually points to 000A) |
02 | Word | Pointer to Channel 2 Data |
04 | Word | Pointer to Channel 3 Data |
06 | Word | Pointer to Channel 4/Noise Data |
08 | Word | Pointer to Channel 5/SFX data (always zero and ignored) |
Channel data
There's no header for channel data. Channel setup is done via commands.
The commands start directly at the offset specified in the header.
Command | Description |
---|---|
00–7F xx | Play Note with length xx
|
80 aaaa bbbb | Set song tempo (only present in channel 1)
|
81 aa | Set volume (0F = max, 00 = min) |
82 aa bb cc dd ee ff | Envelope Setup (only present in channels 1-3)
|
83 aa bb cc dddd | Modulation (only present in channels 1-3)
|
84 aaaa | Set Detune value to aaaa (aaaa is a signed byte that modifies the FNum)
|
85 aa | does nothing (only present in channel 1)
|
86 | Loop Start Marker
|
87 aa bbbb | Loop back
|
88 | Master Loop Start
|
89 aa | Set Noise Mode to aa
|
8A aa | Set default note length to aa |
8B | Increase volume by 1 |
8C | Decrease volume by 1 |
8D | no attack for next note |
FE | SFX Track End
|
FF | Track End
|
Note on 86/87
The 86 command is used the make nested loops possible.
Example: 86 86 ... 87 04 aaaa ... 87 02 bbbb
Note on 88/FF
There's no need for an 88 command in non-looping songs.
However every jingle (with exception of the Death-Jingle) has a master loop, consisting of a rest.
Sonic the Hedgehog (8-bit) | |
---|---|
Manuals |
show;hide
|
References