User Tools

Site Tools


sm:technical_information:data_structures

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
sm:technical_information:data_structures [2024/11/14 23:04] – created felixwrightsm:technical_information:data_structures [2024/11/16 08:12] (current) felixwright
Line 1: Line 1:
-Room header+====== Room header ======
  
- ____________________________________ Room index +   ____________________________________ Room index 
-|   _________________________________ Area index +  |   _________________________________ Area index 
-|  |   ______________________________ X position (of top left corner) on the map +  |  |   ______________________________ X position (of top left corner) on the map 
-|  |  |   ___________________________ Y position (of top left corner) on the map +  |  |  |   ___________________________ Y position (of top left corner) on the map 
-|  |  |  |   ________________________ Room width (in units of screens = 16 blocks = 256 pixels) +  |  |  |  |   ________________________ Room width (in units of screens = 16 blocks = 256 pixels) 
-|  |  |  |  |   _____________________ Room height (in units of screens = 16 blocks = 256 pixels) +  |  |  |  |  |   _____________________ Room height (in units of screens = 16 blocks = 256 pixels) 
-|  |  |  |  |  |   __________________ Up scroller +  |  |  |  |  |  |   __________________ Up scroller 
-|  |  |  |  |  |  |   _______________ Down scroller +  |  |  |  |  |  |  |   _______________ Down scroller 
-|  |  |  |  |  |  |  |   ____________ CRE bitset +  |  |  |  |  |  |  |  |   ____________ CRE bitset 
-|  |  |  |  |  |  |  |  |   _________ Door list pointer +  |  |  |  |  |  |  |  |  |   _________ Door list pointer 
-|  |  |  |  |  |  |  |  |  |     ____ State conditions list +  |  |  |  |  |  |  |  |  |  |     ____ State conditions list 
-|  |  |  |  |  |  |  |  |  |    | +  |  |  |  |  |  |  |  |  |  |    | 
-|  |  |  |  |  |  |  |  |  |    | +  |  |  |  |  |  |  |  |  |  |    | 
-ii aa xx yy ww hh uu dd cc dddd [...]+  ii aa xx yy ww hh uu dd cc dddd [...]
  
 Room headers define rooms, they exist in bank $8F and room header pointers are what SMILE displays as a dropdown box for room selection. They are variable length (due to the event header list) with E5E6 as a terminator. Room headers define rooms, they exist in bank $8F and room header pointers are what SMILE displays as a dropdown box for room selection. They are variable length (due to the event header list) with E5E6 as a terminator.
Line 21: Line 21:
  
 Area indices Area indices
- Crateria +|0|Crateria     | 
- Brinstar +|1|Brinstar     | 
- Norfair +|2|Norfair      | 
- Wrecked Ship +|3|Wrecked Ship | 
- Maridia +|4|Maridia      | 
- Tourian +|5|Tourian      | 
- Ceres +|6|Ceres        | 
- Debug+|7|Debug        |
  
    
Line 34: Line 34:
 Notes: Notes:
  
-    The room index is almost unused, aside from some specific checks to do with atmospheric graphics in some areas. +  *     The room index is almost unused, aside from some specific checks to do with atmospheric graphics in some areas. 
-    The room width may not exceed 15 due to the way block collision calculations are implemented +      The room width may not exceed 15 due to the way block collision calculations are implemented 
-    Room width * room height may not exceed 50 due to memory constraints +      Room width * room height may not exceed 50 due to memory constraints 
-    The up scroller defines the threshold Y position that Samus needs to exceed (relative to the screen) for the screen to start scrolling downwards when the camera is at the top of the room +      The up scroller defines the threshold Y position that Samus needs to exceed (relative to the screen) for the screen to start scrolling downwards when the camera is at the top of the room 
-    The down scroller defines the threshold Y position that Samus needs to exceed (relative to the screen) for the screen to start scrolling upwards when the camera is at the bottom of the room +      The down scroller defines the threshold Y position that Samus needs to exceed (relative to the screen) for the screen to start scrolling upwards when the camera is at the bottom of the room 
-    The CRE bitset defines some flags that affect how the CRE is loaded during door transitions:+      The CRE bitset defines some flags that affect how the CRE is loaded during door transitions:
  
- Disable layer 1 during door transitions into and out of the room +|1|Disable layer 1 during door transitions into and out of the room | 
- Reload the CRE +|2|Reload the CRE                                                   | 
- Load extra large tileset +|4|Load extra large tileset                                         |
-State conditions list+
  
- ______________ State condition +===== State conditions list ===== 
-|     _________ State condition parameters + 
-|    |      ___ State header pointer +   ______________ State condition 
-|    |     | +  |     _________ State condition parameters 
-eeee [...] ssss ; First state condition +  |    |      ___ State header pointer 
-eeee [...] ssss ; Second state condition +  |    |     | 
-[...]           ; Other state conditions +  eeee [...] ssss ; First state condition 
-E5E6            ; Default state condition (terminator)+  eeee [...] ssss ; Second state condition 
 +  [...]           ; Other state conditions 
 +  E5E6            ; Default state condition (terminator)
  
 State conditions are two-byte pointers to code in bank $8F that may have parameters. If the check defined in the state conditions is passed, the state header pointer in that state condition header is used to load the room. The only exception is state condition $E5E6, the default, which doesn't have a state header pointer (the default state header simply follows this state condition header instead). State conditions are two-byte pointers to code in bank $8F that may have parameters. If the check defined in the state conditions is passed, the state header pointer in that state condition header is used to load the room. The only exception is state condition $E5E6, the default, which doesn't have a state header pointer (the default state header simply follows this state condition header instead).
  
 List of state conditions used in Super Metroid List of state conditions used in Super Metroid
-Condition  Parameters  Description +^Condition^Parameters^Description                                        ^ 
-$E5E6  Default +|$E5E6|    |Default                                                      | 
-$E5EB  dddd  Check passes if the current door pointer = d +|$E5EB|dddd|Check passes if the current door pointer = d                 | 
-$E5FF  Check passes if main area boss is dead +|$E5FF|    |Check passes if main area boss is dead                       | 
-$E612  ee  Check passes if event e is set +|$E612ee |Check passes if event e is set                               | 
-$E629  bb  Check passes if area boss b is dead +|$E629bb |Check passes if area boss b is dead                          | 
-$E640  Check passes if morph ball has been collected +|$E640|    |Check passes if morph ball has been collected                | 
-$E652  Check passes if morph ball and missiles have been collected +|$E652|    |Check passes if morph ball and missiles have been collected  | 
-$E669  Check passes if power bombs have been collected +|$E669|    |Check passes if power bombs have been collected              | 
-$E678  Check passes if speed booster has been collected+|$E678|    |Check passes if speed booster has been collected             |
  
 Event numbers are given as follows: Event numbers are given as follows:
- Zebes is awake +|0|Zebes is awake                            | 
- Shitroid ate sidehopper +|1|Shitroid ate sidehopper                   | 
- Mother Brain's glass is broken +|2|Mother Brain's glass is broken            | 
- Zebetite 1 is destroyed +|3|Zebetite 1 is destroyed                   | 
- Zebetite 2 is destroyed +|4|Zebetite 2 is destroyed                   | 
- Zebetite 3 is destroyed +|5|Zebetite 3 is destroyed                   | 
- Phantoon statue is grey +|6|Phantoon statue is grey                   | 
- Ridley statue is grey +|7|Ridley statue is grey                     | 
- Draygon statue is grey +|8|Draygon statue is grey                    | 
- Kraid statue is grey +|9|Kraid statue is grey                      | 
-Ah  Entrance to Tourian is unlocked +|Ah|Entrance to Tourian is unlocked          | 
-Bh  Maridia noobtube is broken +|Bh|Maridia noobtube is broken               | 
-Ch  Lower Norfair chozo has lowered the acid +|Ch|Lower Norfair chozo has lowered the acid | 
-Dh  Shaktool cleared a path +|Dh|Shaktool cleared a path                  | 
-Eh  Zebes timebomb set +|Eh|Zebes timebomb set                       | 
-Fh  Critters escaped +|Fh|Critters escaped                         | 
-10h  1st Metroid hall cleared +|10h|1st Metroid hall cleared                | 
-11h  1st Metroid shaft cleared +|11h|1st Metroid shaft cleared               | 
-12h  2nd Metroid hall cleared +|12h|2nd Metroid hall cleared                | 
-13h  2nd Metroid shaft cleared +|13h|2nd Metroid shaft cleared               | 
-14h  Unused +|14h|Unused                                  | 
-15h  Outran speed booster lavaquake+|15h|Outran speed booster lavaquake          |
  
 Boss bits are given as follows: Boss bits are given as follows:
- Area boss (Kraid, Phantoon, Draygon, both Ridleys) +|1|Area boss (Kraid, Phantoon, Draygon, both Ridleys)             | 
- Area mini-boss (Spore Spawn, Botwoon, Crocomire, Mother Brain) +|2|Area mini-boss (Spore Spawn, Botwoon, Crocomire, Mother Brain) | 
- Area torizo (Bomb Torizo, Golden Torizo)+|4|Area torizo (Bomb Torizo, Golden Torizo)                       |
  
    
-Door list+===== Door list =====
  
- _________________ First door pointer (door BTS 0) +   _________________ First door pointer (door BTS 0) 
-|     ____________ Second door pointer (door BTS 1) +  |     ____________ Second door pointer (door BTS 1) 
-|    |     _______ Other door pointers (door BTS 2+) +  |    |     _______ Other door pointers (door BTS 2+) 
-|    |    | +  |    |    | 
-aaaa bbbb [...]+  aaaa bbbb [...]
  
 Door lists are a list of door pointers that can be used in a room, they exist in bank $8F. They are variable length with no terminator, and are indexed by door BTS (thus, there is an effective maximum of 128 door pointers). Door lists are a list of door pointers that can be used in a room, they exist in bank $8F. They are variable length with no terminator, and are indexed by door BTS (thus, there is an effective maximum of 128 door pointers).
  
 The door pointers themselves are two-byte pointers to door headers in bank $83. The door pointers themselves are two-byte pointers to door headers in bank $83.
-Door header 
  
- _____________________________ Destination room header pointer (bank $8F) +==== Door header ==== 
-|     ________________________ Elevator properties + 
-|    |   _____________________ Orientation +   _____________________________ Destination room header pointer (bank $8F) 
-|    |  |   __________________ X position low byte +  |     ________________________ Elevator properties 
-|    |  |  |   _______________ Y position low byte +  |    |   _____________________ Orientation 
-|    |  |  |  |   ____________ X position high byte +  |    |  |   __________________ X position low byte 
-|    |  |  |  |  |   _________ Y position high byte +  |    |  |  |   _______________ Y position low byte 
-|    |  |  |  |  |  |   ______ Distance from door to spawn Samus +  |    |  |  |  |   ____________ X position high byte 
-|    |  |  |  |  |  |  |     _ Custom door ASM to execute (bank $8F) +  |    |  |  |  |  |   _________ Y position high byte 
-|    |  |  |  |  |  |  |    | +  |    |  |  |  |  |  |   ______ Distance from door to spawn Samus 
-rrrr ee oo xx yy XX YY dddd aaaa+  |    |  |  |  |  |  |  |     _ Custom door ASM to execute (bank $8F) 
 +  |    |  |  |  |  |  |  |    | 
 +  rrrr ee oo xx yy XX YY dddd aaaa
  
 Door headers define doors, they exist in bank $83 and have a fixed length of 12 bytes. The door ASM can execute any arbitrary ASM and is often used to set scroll values for the new room where the door would normally be hidden inside a red scroll. If the distance from door to spawn Samus is negative (8000h..FFFFh), the standard value of 0x00C8 is used for horizontal doors or 0x0180 for vertical doors. Door headers define doors, they exist in bank $83 and have a fixed length of 12 bytes. The door ASM can execute any arbitrary ASM and is often used to set scroll values for the new room where the door would normally be hidden inside a red scroll. If the distance from door to spawn Samus is negative (8000h..FFFFh), the standard value of 0x00C8 is used for horizontal doors or 0x0180 for vertical doors.
  
 The elevator properties are as follows: The elevator properties are as follows:
-0x80  Door is an elevator +|0x80|Door is an elevator                             | 
-0x40  Switch map to new area +|0x40|Switch map to new area                          | 
-0x0i  Marks elevator index i as used (for debug mode)+|0x0i|Marks elevator index i as used (for debug mode) |
  
 The orientation values are as follows: The orientation values are as follows:
- Right +|0|Right                           | 
- Left +|1|Left                            | 
- Down +|2|Down                            | 
- Up +|3|Up                              | 
-4+  Door spawns a closing door cap +|4+|Door spawns a closing door cap |
-State header+
  
- _______________________________________________________________ Level data +===== State header ===== 
-|       ________________________________________________________ Tileset + 
-|      |   _____________________________________________________ Music data index +   _______________________________________________________________ Level data 
-|      |  |   __________________________________________________ Music track +  |       ________________________________________________________ Tileset 
-|      |  |  |   _______________________________________________ FX ($83) +  |      |   _____________________________________________________ Music data index 
-|      |  |  |  |     __________________________________________ Enemy population ($A1) +  |      |  |   __________________________________________________ Music track 
-|      |  |  |  |    |     _____________________________________ Enemy set ($B4) +  |      |  |  |   _______________________________________________ FX ($83) 
-|      |  |  |  |    |    |     ________________________________ Layer 2 scroll X +  |      |  |  |  |     __________________________________________ Enemy population ($A1) 
-|      |  |  |  |    |    |    |   _____________________________ Layer 2 scroll Y +  |      |  |  |  |    |     _____________________________________ Enemy set ($B4) 
-|      |  |  |  |    |    |    |  |   __________________________ Scroll +  |      |  |  |  |    |    |     ________________________________ Layer 2 scroll X 
-|      |  |  |  |    |    |    |  |  |     _____________________ Special x-ray blocks +  |      |  |  |  |    |    |    |   _____________________________ Layer 2 scroll Y 
-|      |  |  |  |    |    |    |  |  |    |     ________________ Main ASM (FX2 in old SMILE) +  |      |  |  |  |    |    |    |  |   __________________________ Scroll 
-|      |  |  |  |    |    |    |  |  |    |    |     ___________ PLM population +  |      |  |  |  |    |    |    |  |  |     _____________________ Special x-ray blocks 
-|      |  |  |  |    |    |    |  |  |    |    |    |     ______ Library background +  |      |  |  |  |    |    |    |  |  |    |     ________________ Main ASM (FX2 in old SMILE) 
-|      |  |  |  |    |    |    |  |  |    |    |    |    |     _ Setup ASM (Layer1_2 in old SMILE) +  |      |  |  |  |    |    |    |  |  |    |    |     ___________ PLM population 
-|      |  |  |  |    |    |    |  |  |    |    |    |    |    | +  |      |  |  |  |    |    |    |  |  |    |    |    |     ______ Library background 
-llllll tt MM mm ffff eeee EEEE xx yy ssss xxxx AAAA pppp bbbb aaaa+  |      |  |  |  |    |    |    |  |  |    |    |    |    |     _ Setup ASM (Layer1_2 in old SMILE) 
 +  |      |  |  |  |    |    |    |  |  |    |    |    |    |    | 
 +  llllll tt MM mm ffff eeee EEEE xx yy ssss xxxx AAAA pppp bbbb aaaa
  
 State headers define the parts of rooms that can change due to different events. State headers define the parts of rooms that can change due to different events.
  
 Tilesets Tilesets
- Upper Crateria +|0|Upper Crateria                      | 
- Red Crateria +|1|Red Crateria                        | 
- Lower Crateria +|2|Lower Crateria                      | 
- Old Tourian +|3|Old Tourian                         | 
- Wrecked Ship - power on +|4|Wrecked Ship - power on             | 
- Wrecked Ship - power off +|5|Wrecked Ship - power off            | 
- Green/blue Brinstar +|6|Green/blue Brinstar                 | 
- Red Brinstar / Kraid's lair +|7|Red Brinstar / Kraid's lair         | 
- Pre Tourian entrance corridor +|8|Pre Tourian entrance corridor       | 
- Heated Norfair +|9|Heated Norfair                      | 
-Ah  Unheated Norfair +|Ah|Unheated Norfair                   | 
-Bh  Sandless Maridia +|Bh|Sandless Maridia                   | 
-Ch  Sandy Maridia +|Ch|Sandy Maridia                      | 
-Dh  Tourian +|Dh|Tourian                            | 
-Eh  Mother Brain's room +|Eh|Mother Brain's room                | 
-Fh  Blue Ceres +|Fh|Blue Ceres                         | 
-10h  White Ceres +|10h|White Ceres                       | 
-11h  Blue Ceres elevator +|11h|Blue Ceres elevator               | 
-12h  White Ceres elevator +|12h|White Ceres elevator              | 
-13h  Blue Ceres Ridley's room +|13h|Blue Ceres Ridley's room          | 
-14h  White Ceres Ridley's room +|14h|White Ceres Ridley's room         | 
-15h  Map room / Tourian entrance +|15h|Map room / Tourian entrance       | 
-16h  Wrecked Ship map room - power off +|16h|Wrecked Ship map room - power off | 
-17h  Blue refill room +|17h|Blue refill room                  | 
-18h  Yellow refill room +|18h|Yellow refill room                | 
-19h  Save room +|19h|Save room                         | 
-1Ah  Kraid's room +|1Ah|Kraid's room                      | 
-1Bh  Crocomire's room +|1Bh|Crocomire's room                  | 
-1Ch  Draygon's room+|1Ch|Draygon's room                    |
  
 Music data indices Music data indices
- No change +|0|No change                              | 
- Title sequence +|3|Title sequence                         | 
- Empty Crateria +|6|Empty Crateria                         | 
- Lower Crateria +|9|Lower Crateria                         | 
-Ch  Upper Crateria +|Ch|Upper Crateria                        | 
-Fh  Green Brinstar +|Fh|Green Brinstar                        | 
-12h  Red Brinstar +|12h|Red Brinstar                         | 
-15h  Upper Norfair +|15h|Upper Norfair                        | 
-18h  Lower Norfair +|18h|Lower Norfair                        | 
-1Bh  Maridia +|1Bh|Maridia                              | 
-1Eh  Tourian +|1Eh|Tourian                              | 
-21h  Mother Brain +|21h|Mother Brain                         | 
-24h  Boss fight 1 +|24h|Boss fight 1                         | 
-27h  Boss fight 2 +|27h|Boss fight 2                         | 
-2Ah  Miniboss fight +|2Ah|Miniboss fight                       | 
-2Dh  Ceres +|2Dh|Ceres                                | 
-30h  Wrecked Ship +|30h|Wrecked Ship                         | 
-33h  Zebes boom +|33h|Zebes boom                           | 
-36h  Intro +|36h|Intro                                | 
-39h  Death +|39h|Death                                | 
-3Ch  Credits +|3Ch|Credits                              | 
-3Fh  “The last Metroid is in captivity” +|3Fh|“The last Metroid is in captivity”   | 
-42h  “The galaxy is at peace” +|42h|“The galaxy is at peace”             | 
-45h  Shitroid (same as boss fight 2) +|45h|Shitroid (same as boss fight 2)      | 
-48h  Samus theme (same as upper Crateria)+|48h|Samus theme (same as upper Crateria) |
  
 Music track values Music track values
- No change +|0|No change       | 
- Samus fanfare +|1|Samus fanfare   | 
- Item fanfare +|2|Item fanfare    | 
- Elevator +|3|Elevator        | 
- Pre-statue hall +|4|Pre-statue hall | 
- Song 0 +|5|Song 0          | 
- Song 1 +|6|Song 1          | 
- Song 2+|7|Song 2          |
  
    
Line 231: Line 234:
 Notes: Notes:
  
-    Level data is a three-byte pointer to compressed data defining the placement of layer 1 tiles, block properties (including BTS) and optionally custom layer 2 tile placement +  *     Level data is a three-byte pointer to compressed data defining the placement of layer 1 tiles, block properties (including BTS) and optionally custom layer 2 tile placement 
-    The tileset is an index into a table that defines the tile table, tile graphics and palette +      The tileset is an index into a table that defines the tile table, tile graphics and palette 
-    The music data index is an index into a music pointers that define songs 0, 1 and 2 +      The music data index is an index into a music pointers that define songs 0, 1 and 2 
-    The FX is an (optional) pointer to data defining graphical effects such as animated tiles, palette glows and layer 3 (e.g. water, lava, spores) +      The FX is an (optional) pointer to data defining graphical effects such as animated tiles, palette glows and layer 3 (e.g. water, lava, spores) 
-    The enemy population is a pointer to data defining enemy placement and other parameters +      The enemy population is a pointer to data defining enemy placement and other parameters 
-    The enemy set is a pointer to data defining which enemies use which palettes +      The enemy set is a pointer to data defining which enemies use which palettes 
-    The layer 2 scroll X/Y is a value that determines whether or not custom layer 2 is used, and how fast layer 2 scrolls compared to layer 1 (parallax effect) +      The layer 2 scroll X/Y is a value that determines whether or not custom layer 2 is used, and how fast layer 2 scrolls compared to layer 1 (parallax effect) 
-        In binary, let layer 2 scroll X/Y = sssssssb +          In binary, let layer 2 scroll X/Y = sssssssb 
-        If b = 1, then the library background is used, otherwise custom layer 2 (defined in level data) is used +          If b = 1, then the library background is used, otherwise custom layer 2 (defined in level data) is used 
-        s = 0 is a special case that depends on b +          s = 0 is a special case that depends on b 
-            If b = 0 (custom layer 2), then layer 2 and layer 1 scroll together at the same speed (like an extension of layer 1) +              If b = 0 (custom layer 2), then layer 2 and layer 1 scroll together at the same speed (like an extension of layer 1) 
-            If b = 1 (library background), then layer 2 does not scroll at all (static image background) +              If b = 1 (library background), then layer 2 does not scroll at all (static image background) 
-        Otherwise (if s != 0), layer 2 scroll speed = (layer 1 scroll speed) * (s / 0x80) +          Otherwise (if s != 0), layer 2 scroll speed = (layer 1 scroll speed) * (s / 0x80) 
-    The scroll is an (optional) pointer to data defining which 16×16 regions are scrollable +      The scroll is an (optional) pointer to data defining which 16×16 regions are scrollable 
-        If scroll = 0, then every scroll region is set to green, except for the bottom row, which is set to blue +          If scroll = 0, then every scroll region is set to green, except for the bottom row, which is set to blue 
-        If scroll = 1, then every scroll region is set to green +          If scroll = 1, then every scroll region is set to green 
-    The special x-ray blocks is an (optional) pointer to data defining custom x-ray block graphics +      The special x-ray blocks is an (optional) pointer to data defining custom x-ray block graphics 
-    The main ASM is an (optional) pointer to code run every frame +      The main ASM is an (optional) pointer to code run every frame 
-    The PLM population is an (optional) pointer to data defining PLM placement and parameters +      The PLM population is an (optional) pointer to data defining PLM placement and parameters 
-    The library background is an (optional) pointer to data defining operations for loading layer 2 +      The library background is an (optional) pointer to data defining operations for loading layer 2 
-    The setup ASM is an (optional) pointer to code run upon loading the room +      The setup ASM is an (optional) pointer to code run upon loading the room
- +
-Level data +
- +
-ssssssssssssssss ; Size of decompressed layer 1 data (2 x the number of blocks) +
- +
- _______ Block type +
-|    ___ Y flip +
-|   | __ X flip +
-|   || _ Block number +
-|   ||| +
-ttttyxnnnnnnnnnn ; First block +
-ttttyxnnnnnnnnnn ; Second block +
-[...]            ; Other blocks+
  
-bbbbbbbb         ; First block BTS +==== Level data ====
-bbbbbbbb         ; Second block BTS +
-[...]+
  
-Optional: +  ssssssssssssssss ; Size of decompressed layer 1 data (2 x the number of blocks) 
-0000yxnnnnnnnnnn ; First block layer 2 +   
-0000yxnnnnnnnnnn ; Second block layer 2 +   _______ Block type 
-[...]            ; Other blocks layer 2+  |    ___ Y flip 
 +  |   | __ X flip 
 +  |   || _ Block number 
 +  |   ||| 
 +  ttttyxnnnnnnnnnn ; First block 
 +  ttttyxnnnnnnnnnn ; Second block 
 +  [...]            ; Other blocks 
 +   
 +  bbbbbbbb         ; First block BTS 
 +  bbbbbbbb         ; Second block BTS 
 +  [...] 
 +   
 +  Optional: 
 +  0000yxnnnnnnnnnn ; First block layer 2 
 +  0000yxnnnnnnnnnn ; Second block layer 2 
 +  [...]            ; Other blocks layer 2
  
 Level data is defined by specifying data for each 16px x 16px block in the room. This data is split into layer 1 blocks, BTS and optionally layer 2 blocks. Layer 1/2 are two bytes per block, BTS is one byte per block, and a two byte “decompressed layer 1” size. The decompressed size is followed by layer 1 data, followed by BTS, followed by layer 2 (if used) in that order. Level data is compressed in ROM. Level data is defined by specifying data for each 16px x 16px block in the room. This data is split into layer 1 blocks, BTS and optionally layer 2 blocks. Layer 1/2 are two bytes per block, BTS is one byte per block, and a two byte “decompressed layer 1” size. The decompressed size is followed by layer 1 data, followed by BTS, followed by layer 2 (if used) in that order. Level data is compressed in ROM.
Line 288: Line 291:
  
 Block types and BTS values Block types and BTS values
-Air types  Solid types +^Air types^^Solid types                        ^^ 
- Air  Solid block +|0|Air                   |8|Solid block         | 
- Slope  Door block +|1|Slope                 |9|Door block          | 
- Spike air  Ah  Spike block +|2|Spike air             |Ah|Spike block        | 
- Special air  Bh  Special block +|3|Special air           |Bh|Special block      | 
- Shootable air  Ch  Shootable block +|4|Shootable air         |Ch|Shootable block    | 
- Horizontal extension  Dh  Vertical extension +|5|Horizontal extension  |Dh|Vertical extension | 
- Unused air  Eh  Grapple block +|6|Unused air            |Eh|Grapple block      | 
- Bombable air  Fh  Bombable block +|7|Bombable air          |Fh|Bombable block     | 
-Block type BTS  Description + 
-2 / Ah  Spike  Solid only. Generic spike (60 damage) + 
- Solid only. Kraid's lair spike (10h damage) +^Block Type^^ BTS ^^Description                                                                                     ^ 
- Air only. Air spike (10h damage) +|2 / Ah|Spike|0||Solid only. Generic spike (60 damage)                                                              | 
- Solid only. Draygon's broken turret (10h damage) +| ::: | ::: |1||Solid only. Kraid's lair spike (10h damage)                                                         | 
-Eh  Solid only. X-rayable block (used in Blue Brinstar boulder room) +| ::: | ::: |2||Air only. Air spike (10h damage)                                                                    | 
-Fh  Solid only. Enemy breakable block (used in Shaktool's room) +| ::: | ::: |3||Solid only. Draygon's broken turret (10h damage)                                                    | 
-3 / Bh  Special  1×1 respawning crumble block +| ::: | ::: |Eh||Solid only. X-rayable block (used in Blue Brinstar boulder room)                                   | 
- 2×1 respawning crumble block +| ::: | ::: |Fh||Solid only. Enemy breakable block (used in Shaktool's room)                                        | 
- 1×2 respawning crumble block +|3 / Bh|Special|0||1×1 respawning crumble block                                                                     | 
- 2×2 respawning crumble block +| ::: | ::: |1||2×1 respawning crumble block                                                                        | 
- 1×1 crumble block +| ::: | ::: |2||1×2 respawning crumble block                                                                        | 
- 2×1 crumble block +| ::: | ::: |3||2×2 respawning crumble block                                                                        | 
- 1×2 crumble block +| ::: | ::: |4||1×1 crumble block                                                                                   | 
- 2×2 crumble block +| ::: | ::: |5||2×1 crumble block                                                                                   | 
- Air only. Rightwards treadmill, disabled in Wrecked Ship unless Phantoon is dead +| ::: | ::: |6||1×2 crumble block                                                                                   | 
- Air only. Leftwards treadmill, disabled in Wrecked Ship unless Phantoon is dead +| ::: | ::: |7||2×2 crumble block                                                                                   | 
-Ah  Air only. Rightwards treadmill, always on +| ::: | ::: |8||Air only. Rightwards treadmill, disabled in Wrecked Ship unless Phantoon is dead                    | 
-Bh  Air only. Leftwards treadmill, always on +| ::: | ::: |9||Air only. Leftwards treadmill, disabled in Wrecked Ship unless Phantoon is dead                     | 
-Eh  Respawning speed boost block +| ::: | ::: |Ah||Air only. Rightwards treadmill, always on                                                          | 
-Fh  Speed boost block +| ::: | ::: |Bh||Air only. Leftwards treadmill, always on                                                           | 
-44h  Generic PLM shot trigger +| ::: | ::: |Eh||Respawning speed boost block                                                                       | 
-45h  Item collision detection +| ::: | ::: |Fh||Speed boost block                                                                                  | 
-46h  Scroll PLM trigger +| ::: | ::: |44h||Generic PLM shot trigger                                                                          | 
-47h  Map station right access +| ::: | ::: |45h||Item collision detection                                                                          | 
-48h  Map station left access +| ::: | ::: |46h||Scroll PLM trigger                                                                                | 
-49h  Energy station right access +| ::: | ::: |47h||Map station right access                                                                          | 
-4Ah  Energy station left access +| ::: | ::: |48h||Map station left access                                                                           | 
-4Bh  Missile station right access +| ::: | ::: |49h||Energy station right access                                                                       | 
-4Ch  Missile station left access +| ::: | ::: |4Ah||Energy station left access                                                                        | 
-4Dh  Save station trigger +| ::: | ::: |4Bh||Missile station right access                                                                      | 
-Crateria/debug  80h  Air only. Ice physics +| ::: | ::: |4Ch||Missile station left access                                                                       | 
-Brinstar  80h  Floor plant +| ::: | ::: |4Dh||Save station trigger                                                                              | 
-81h  Ceiling plant +| ::: | ::: |Crateria/debug|80h|Air only. Ice physics                                                               | 
-82h  Respawning speed block, slower crumble animation +| ::: | ::: |Brinstar|80h|Floor plant                                                                               | 
-83h  Speed block, slower crumble animation +| ::: | ::: | ::: |81h|Ceiling plant                                                                                | 
-84h  Respawning speed block (used by dachora pit) +| ::: | ::: | ::: |82h|Respawning speed block, slower crumble animation                                             | 
-85h  Speed boost block +| ::: | ::: | ::: |83h|Speed block, slower crumble animation                                                        | 
-Norfair  83h  Lower Norfair chozo hand trigger +| ::: | ::: | ::: |84h|Respawning speed block (used by dachora pit)                                                 | 
-Wrecked Ship  80h  Wrecked Ship chozo hand trigger +| ::: | ::: | ::: |85h|Speed boost block                                                                            | 
-Maridia  80h  Quicksand surface, can run on without sinking (used in snail room) +| ::: | ::: |Norfair|83h|Lower Norfair chozo hand trigger                                                           | 
-81h  Quicksand surface +| ::: | ::: |Wrecked Ship|80h|Wrecked Ship chozo hand trigger                                                       | 
-82h  Quicksand surface +| ::: | ::: |Maridia|80h|Quicksand surface, can run on without sinking (used in snail room)                         | 
-83h  Submerging quicksand (used in sand falls rooms) +| ::: | ::: | ::: |81h|Quicksand surface                                                                            | 
-84h  Sand falls - slow. Used in the ceilings of pre-Draygon mochtroid rooms (so basically unused) +| ::: | ::: | ::: |82h|Quicksand surface                                                                            | 
-85h  Sand falls - fast +| ::: | ::: | ::: |83h|Submerging quicksand (used in sand falls rooms)                                              | 
-7 / Fh  Bombable  1×1 respawning bomb block +| ::: | ::: | ::: |84h|Sand falls - slow. Used in the ceilings of pre-Draygon mochtroid rooms (so basically unused) | 
- 2×1 respawning bomb block +| ::: | ::: | ::: |85h|Sand falls - fast                                                                            | 
- 1×2 respawning bomb block +|7 / Fh|Bombable|0||1×1 respawning bomb block                                                                       | 
- 2×2 respawning bomb block +| ::: | ::: |1||2×1 respawning bomb block                                                                           | 
- 1×1 bomb block +| ::: | ::: |2||1×2 respawning bomb block                                                                           | 
- 2×1 bomb block +| ::: | ::: |3||2×2 respawning bomb block                                                                           | 
- 1×2 bomb block +| ::: | ::: |4||1×1 bomb block                                                                                      | 
- 2×2 bomb block +| ::: | ::: |5||2×1 bomb block                                                                                      | 
-4 / Ch  Shootable  1×1 respawning shot block +| ::: | ::: |6||1×2 bomb block                                                                                      | 
- 2×1 respawning shot block +| ::: | ::: |7||2×2 bomb block                                                                                      | 
- 1×2 respawning shot block +|4 / Ch|Shootable|0||1×1 respawning shot block                                                                      | 
- 2×2 respawning shot block +| ::: | ::: |1||2×1 respawning shot block                                                                           | 
- 1×1 shot block +| ::: | ::: |2||1×2 respawning shot block                                                                           | 
- 2×1 shot block +| ::: | ::: |3||2×2 respawning shot block                                                                           | 
- 1×2 shot block +| ::: | ::: |4||1×1 shot block                                                                                      | 
- 2×2 shot block +| ::: | ::: |5||2×1 shot block                                                                                      | 
- Respawning power bomb block +| ::: | ::: |6||1×2 shot block                                                                                      | 
- Power bomb block +| ::: | ::: |7||2×2 shot block                                                                                      | 
-Ah  Respawning super missile block +| ::: | ::: |8||Respawning power bomb block                                                                         | 
-Bh  Super missile block +| ::: | ::: |9||Power bomb block                                                                                    | 
-Ch  Fake super missile block (solid block but shows super missile block when x-rayed) +| ::: | ::: |Ah||Respawning super missile block                                                                     | 
-Dh  Fake super missile block +| ::: | ::: |Bh||Super missile block                                                                                | 
-Eh  Fake super missile block +| ::: | ::: |Ch||Fake super missile block (solid block but shows super missile block when x-rayed)                  | 
-Fh  Fake super missile block +| ::: | ::: |Dh||Fake super missile block                                                                           | 
-10h  Gate blocks +| ::: | ::: |Eh||Fake super missile block                                                                           | 
-40h  Blue door facing left +| ::: | ::: |Fh||Fake super missile block                                                                           | 
-41h  Blue door facing right +| ::: | ::: |10h||Gate blocks                                                                                       | 
-42h  Blue door facing up +| ::: | ::: |40h||Blue door facing left                                                                             | 
-43h  Blue door facing down +| ::: | ::: |41h||Blue door facing right                                                                            | 
-44h  Generic shot trigger +| ::: | ::: |42h||Blue door facing up                                                                               | 
-45h  Item trigger +| ::: | ::: |43h||Blue door facing down                                                                             | 
-46h  Left blue gate trigger +| ::: | ::: |44h||Generic shot trigger                                                                              | 
-47h  Right blue gate trigger +| ::: | ::: |45h||Item trigger                                                                                      | 
-48h  Left red gate trigger +| ::: | ::: |46h||Left blue gate trigger                                                                            | 
-49h  Right red gate trigger +| ::: | ::: |47h||Right blue gate trigger                                                                           | 
-4Ah  Left green gate trigger +| ::: | ::: |48h||Left red gate trigger                                                                             | 
-4Bh  Right green gate trigger +| ::: | ::: |49h||Right red gate trigger                                                                            | 
-4Ch  Left orange gate trigger +| ::: | ::: |4Ah||Left green gate trigger                                                                           | 
-4Dh  Right orange gate trigger +| ::: | ::: |4Bh||Right green gate trigger                                                                          | 
-4Fh  Critters escape block +| ::: | ::: |4Ch||Left orange gate trigger                                                                          | 
-Eh  Grapple block  Generic grapple block +| ::: | ::: |4Dh||Right orange gate trigger                                                                         | 
- Respawning crumbling grapple block +| ::: | ::: |4Fh||Critters escape block                                                                             | 
- Non-respawning crumbling grapple block +|Eh|Grapple block|0||Generic grapple block                                                                          | 
-80h+  Grapple-through block+| ::: | ::: |1||Respawning crumbling grapple block                                                                  | 
 +| ::: | ::: |2||Non-respawning crumbling grapple block                                                              | 
 +| ::: | ::: |80h+||Grapple-through block                                                                            |
  
    
-FX+==== FX ====
  
- __________________________________________ Door pointer +   __________________________________________ Door pointer 
-|     _____________________________________ Base Y position +  |     _____________________________________ Base Y position 
-|    |     ________________________________ Target Y position +  |    |     ________________________________ Target Y position 
-|    |    |     ___________________________ Y velocity +  |    |    |     ___________________________ Y velocity 
-|    |    |    |     ______________________ Timer +  |    |    |    |     ______________________ Timer 
-|    |    |    |    |   ___________________ Layer 3 type +  |    |    |    |    |   ___________________ Layer 3 type 
-|    |    |    |    |  |   ________________ Default layer blending configuration (FX A) +  |    |    |    |    |  |   ________________ Default layer blending configuration (FX A) 
-|    |    |    |    |  |  |   _____________ FX layer 3 layer blending configuration (FX B) +  |    |    |    |    |  |  |   _____________ FX layer 3 layer blending configuration (FX B) 
-|    |    |    |    |  |  |  |   __________ Liquid options (FX C) +  |    |    |    |    |  |  |  |   __________ Liquid options (FX C) 
-|    |    |    |    |  |  |  |  |   _______ Palette FX bitset +  |    |    |    |    |  |  |  |  |   _______ Palette FX bitset 
-|    |    |    |    |  |  |  |  |  |   ____ Animated tiles bitset +  |    |    |    |    |  |  |  |  |  |   ____ Animated tiles bitset 
-|    |    |    |    |  |  |  |  |  |  |   _ Palette blend +  |    |    |    |    |  |  |  |  |  |  |   _ Palette blend 
-|    |    |    |    |  |  |  |  |  |  |  | +  |    |    |    |    |  |  |  |  |  |  |  | 
-dddd,bbbb,tttt,vvvv,tt,ff,AA,BB,CC,pp,aa,bb ; First FX entry +  dddd,bbbb,tttt,vvvv,tt,ff,AA,BB,CC,pp,aa,bb ; First FX entry 
-dddd,bbbb,tttt,vvvv,tt,ff,AA,BB,CC,pp,aa,bb ; Second FX entry +  dddd,bbbb,tttt,vvvv,tt,ff,AA,BB,CC,pp,aa,bb ; Second FX entry 
-[...]                                       ; Other FX entries +  [...]                                       ; Other FX entries 
-0000,bbbb,tttt,vvvv,tt,ff,AA,BB,CC,pp,aa,bb ; Default FX entry+  0000,bbbb,tttt,vvvv,tt,ff,AA,BB,CC,pp,aa,bb ; Default FX entry
  
 OR OR
  
-FFFF ; No FX+  FFFF ; No FX
  
 FX defines roomwide graphical effects, they're stored in bank $83. A room either has a two byte FFFF entry specifying there is no FX, or it has optional door-dependent FX entries followed by the default entry. A door-dependent FX entries is used if the door taken into the room matches the entry's door pointer, if no doors match (or if there are no entries) the default entry is used. FX defines roomwide graphical effects, they're stored in bank $83. A room either has a two byte FFFF entry specifying there is no FX, or it has optional door-dependent FX entries followed by the default entry. A door-dependent FX entries is used if the door taken into the room matches the entry's door pointer, if no doors match (or if there are no entries) the default entry is used.
  
 Layer 3 types Layer 3 types
- None +|0|None                      | 
- Lava +|2|Lava                      | 
- Acid +|4|Acid                      | 
- Water +|6|Water                     | 
- Spores +|8|Spores                    | 
-Ah  Rain +|Ah|Rain                     | 
-Ch  Fog +|Ch|Fog                      | 
-20h  Scrolling sky +|20h|Scrolling sky           | 
-22h  Unused +|22h|Unused                  | 
-24h  Fireflea +|24h|Fireflea                | 
-26h  Tourian entrance statue +|26h|Tourian entrance statue | 
-28h  Ceres Ridley +|28h|Ceres Ridley            | 
-2Ah  Ceres elevator +|2Ah|Ceres elevator          | 
-2Ch  Haze+|2Ch|Haze                    |
  
 Layer blending configurations Layer blending configurations
-2/Eh/20h  Normal. BG1/BG2/sprites are drawn with BG3 added on top   +|2/Eh/20h|Normal. BG1/BG2/sprites are drawn with BG3 added on top                                                                                                                                                                                    || 
- Normal, but BG2 is disabled  Used by Phantoon +|4|Normal, but BG2 is disabled|Used by Phantoon                                                                                                                                                                                                       | 
- Normal, but sprites aren't affected by BG3 and sprites are added to BG1/BG2 (instead of hidden)  Unused +|6|Normal, but sprites aren't affected by BG3 and sprites are added to BG1/BG2 (instead of hidden)|Unused                                                                                                                                             | 
- Normal, but BG1/sprites aren't affected by BG3 and sprites are added to BG2 (instead of hidden)  Used in some power off Wrecked Ship rooms +|8|Normal, but BG1/sprites aren't affected by BG3 and sprites are added to BG2 (instead of hidden)|Used in some power off Wrecked Ship rooms                                                                                                          | 
-Ah  Normal, but BG1 isn't affected by BG3  Used with FX layer 3 type = spores +|Ah|Normal, but BG1 isn't affected by BG3|Used with FX layer 3 type = spores                                                                                                                                                                          | 
-Ch  Normal, but BG3 is disabled and colour math is subtractive  Used with FX layer 3 type = fireflea +|Ch|Normal, but BG3 is disabled and colour math is subtractive|Used with FX layer 3 type = fireflea                                                                                                                                                   | 
-10h/12h  Normal, but BG3 is disabled inside window 1  Used by morph ball eye and varia/gravity suit pickup +|10h/12h|Normal, but BG3 is disabled inside window 1|Used by morph ball eye and varia/gravity suit pickup                                                                                                                                             | 
-14h/22h  Normal, but BG1 isn't affected by BG3 and colour math is subtractive  Sometimes use with FX layer 3 type = water +|14h/22h|Normal, but BG1 isn't affected by BG3 and colour math is subtractive|Sometimes use with FX layer 3 type = water                                                                                                                              | 
-16h  BG1/sprites are drawn after the result of drawing BG2/BG3 is subtracted  Sometimes use with FX layer 3 type = water +|16h|BG1/sprites are drawn after the result of drawing BG2/BG3 is subtracted|Sometimes use with FX layer 3 type = water                                                                                                                               | 
-18h/1Eh/30h  BG3 is drawn with the result of drawing BG1/BG2/sprites added on top  Used with FX layer 3 type = lava / acid / fog / Tourian entrance statue, sometimes use with FX layer 3 type = water +|18h/1Eh/30h|BG3 is drawn with the result of drawing BG1/BG2/sprites added on top|Used with FX layer 3 type = lava / acid / fog / Tourian entrance statue, sometimes use with FX layer 3 type = water                                                 | 
-1Ah  Normal, but BG2 and BG3 have reversed roles  Used by Phantoon +|1Ah|Normal, but BG2 and BG3 have reversed roles|Used by Phantoon                                                                                                                                                                                     | 
-1Ch  Normal, but BG2 and BG3 have reversed roles, colour addition is halved and backdrop is disabled  Unused +|1Ch|Normal, but BG2 and BG3 have reversed roles, colour addition is halved and backdrop is disabled|Unused                                                                                                                                           | 
-24h  BG1/BG2/sprites are drawn the backdrop is added on top inside window 1  Used by Mother Brain +|24h|BG1/BG2/sprites are drawn the backdrop is added on top inside window 1|Used by Mother Brain                                                                                                                                                      | 
-26h  Normal, but colour addition is halved  Unused +|26h|Normal, but colour addition is halved|Unused                                                                                                                                                                                                     | 
-28h  Normal, but BG3 is disabled, colour math is subtractive, and the backdrop subtracts red if there is no power bomb explosion  Used in some default state Crateria rooms, some power off Wrecked Ship rooms, pre plasma beam rooms +|28h|Normal, but BG3 is disabled, colour math is subtractive, and the backdrop subtracts red if there is no power bomb explosion|Used in some default state Crateria rooms, some power off Wrecked Ship rooms, pre plasma beam rooms                  | 
-2Ah  Normal, but BG3 is disabled, colour math is subtractive, and the backdrop subtracts orange if there is no power bomb explosion  Used in blue Brinstar rooms, Kraid's lair entrance, n00b tube side rooms, plasma beam room, some sand falls rooms +|2Ah|Normal, but BG3 is disabled, colour math is subtractive, and the backdrop subtracts orange if there is no power bomb explosion|Used in blue Brinstar rooms, Kraid's lair entrance, n00b tube side rooms, plasma beam room, some sand falls rooms | 
-2Ch  Normal, but BG3 is disabled  Used by FX layer 3 type = haze and torizos +|2Ch|Normal, but BG3 is disabled|Used by FX layer 3 type = haze and torizos                                                                                                                                                                           | 
-2Eh  Normal, but colour math is subtractive  Unused +|2Eh|Normal, but colour math is subtractive|Unused                                                                                                                                                                                                    | 
-32h  Normal, but BG1 isn't affected by BG3 and colour math is subtractive  Unused +|32h|Normal, but BG1 isn't affected by BG3 and colour math is subtractive|Unused                                                                                                                                                                      | 
-34h  Normal, but power bombs don't affect BG2  Unused+|34h|Normal, but power bombs don't affect BG2|Unused                                                                                                                                                                                                  |
  
 Liquid options Liquid options
- Liquid flows (leftwards) +|1|Liquid flows (leftwards)                                      | 
- Layer 2 is wavy +|2|Layer 2 is wavy                                               | 
- Liquid physics are disabled (used in n00b tube room) +|4|Liquid physics are disabled (used in n00b tube room)          | 
-40h  Big tide (liquid fluctuates up and down, a la the gauntlet) +|40h|Big tide (liquid fluctuates up and down, a la the gauntlet) | 
-80h  Small tide (liquid fluctuates up and down)+|80h|Small tide (liquid fluctuates up and down)                  |
  
-  +==== Enemy population ====
-Enemy population+
  
- ____________________________________ Enemy ID +   ____________________________________ Enemy ID 
-|     _______________________________ X position +  |     _______________________________ X position 
-|    |     __________________________ Y position +  |    |     __________________________ Y position 
-|    |    |     _____________________ Initialisation parameter (orientation in old SMILE, tilemaps in SMILE RF) +  |    |    |     _____________________ Initialisation parameter (orientation in old SMILE, tilemaps in SMILE RF) 
-|    |    |    |     ________________ Properties (special in SMILE) +  |    |    |    |     ________________ Properties (special in SMILE) 
-|    |    |    |    |     ___________ Extra properties (special GFX bitset in SMILE, graphics in SMILE RF) +  |    |    |    |    |     ___________ Extra properties (special GFX bitset in SMILE, graphics in SMILE RF) 
-|    |    |    |    |    |     ______ General purpose parameter (speed in SMILE) +  |    |    |    |    |    |     ______ General purpose parameter (speed in SMILE) 
-|    |    |    |    |    |    |     _ General purpose parameter (speed 2 in SMILE) +  |    |    |    |    |    |    |     _ General purpose parameter (speed 2 in SMILE) 
-|    |    |    |    |    |    |    | +  |    |    |    |    |    |    |    | 
-iiii xxxx yyyy oooo pppp gggg aaaa bbbb ; First enemy +  iiii xxxx yyyy oooo pppp gggg aaaa bbbb ; First enemy 
-iiii xxxx yyyy oooo pppp gggg aaaa bbbb ; Second enemy +  iiii xxxx yyyy oooo pppp gggg aaaa bbbb ; Second enemy 
-[...]                                   ; Other enemies +  [...]                                   ; Other enemies 
-FFFF                                    ; Terminator +  FFFF                                    ; Terminator 
-nn                                      ; Number of enemy deaths needed to clear current room+  nn                                      ; Number of enemy deaths needed to clear current room
  
 Enemy population defines the placement of enemies, as well as some generic and enemy specific properties. They're stored in bank $A1 with each enemy being 16 bytes, plus a 3 byte overhead. The initialisation parameter is overwritten by generic enemy routines and so is often only used during enemy initialisation, the other two general purpose parameters do not have this restriction. Enemy population defines the placement of enemies, as well as some generic and enemy specific properties. They're stored in bank $A1 with each enemy being 16 bytes, plus a 3 byte overhead. The initialisation parameter is overwritten by generic enemy routines and so is often only used during enemy initialisation, the other two general purpose parameters do not have this restriction.
  
 The properties are as follows: The properties are as follows:
-8000h  Hitbox solid to Samus +|8000h|Hitbox solid to Samus    | 
-4000h  Respawns if killed +|4000h|Respawns if killed       | 
-2000h  Process instructions +|2000h|Process instructions     | 
-1000h  Block plasma beam +|1000h|Block plasma beam        | 
-800h  Process whilst off-screen +|800h|Process whilst off-screen | 
-400h  Intangible +|400h|Intangible                | 
-200h  Delete +|200h|Delete                    | 
-100h  Invisible+|100h|Invisible                 |
  
 The extra properties are as follows: The extra properties are as follows:
- Enable extended spritemap format +|4|Enable extended spritemap format               | 
- Disable enemy AI. Isn't disabled if intangible +|1|Disable enemy AI. Isn't disabled if intangible | 
-Enemy set+==== Enemy set ====
  
- ______ Enemy ID + 
-|     _ Palette index +   ______ Enemy ID 
-|    | +  |     _ Palette index 
-iiii pppp ; First enemy +  |    | 
-iiii pppp ; Second enemy +  iiii pppp ; First enemy 
-[...]     ; Other enemies +  iiii pppp ; Second enemy 
-FFFF      ; Terminator+  [...]     ; Other enemies 
 +  FFFF      ; Terminator
  
 Enemy set defines which enemies are allowed inside the room and which palette slot to use. They're stored in bank $B4 with each enemy being 4 bytes, plus the 2 byte terminator. Enemies that use the same palette may share the same palette index. Valid palette indices are 1, 2, 3 and 7; note that only palette 7 is affected by colour math. Enemy set defines which enemies are allowed inside the room and which palette slot to use. They're stored in bank $B4 with each enemy being 4 bytes, plus the 2 byte terminator. Enemies that use the same palette may share the same palette index. Valid palette indices are 1, 2, 3 and 7; note that only palette 7 is affected by colour math.
-Scroll 
  
- _______ First scroll +==== Scroll ==== 
-|   ____ Second scroll + 
-|  |   _ Other scrolls +   _______ First scroll 
-|  |  | +  |   ____ Second scroll 
-aa bb [...]+  |  |   _ Other scrolls 
 +  |  |  | 
 +  aa bb [...]
  
 Scrolls define how the camera works for each 16×16 block (256px x 256px) area in left-to-right, top-down order (reading order). They're stored in bank $8F and are one byte per scroll. Scrolls define how the camera works for each 16×16 block (256px x 256px) area in left-to-right, top-down order (reading order). They're stored in bank $8F and are one byte per scroll.
  
 Scroll values are as follows: Scroll values are as follows:
- Red. Cannot scroll into this area +|0|Red. Cannot scroll into this area         | 
- Blue. Hides the bottom 2 rows of the area +|1|Blue. Hides the bottom 2 rows of the area | 
- Green. Unrestricted +|2|Green. Unrestricted                       | 
-Special x-ray blocks+ 
 +==== Special X-Ray Blocks ====
  
- _______ X position +   _______ X position 
-|   ____ Y position +  |   ____ Y position 
-|  |   _ Block +  |  |   _ Block 
-|  |  | +  |  |  | 
-xx yy nnnn ; First x-ray block +  xx yy nnnn ; First x-ray block 
-xx yy nnnn ; Second x-ray block +  xx yy nnnn ; Second x-ray block 
-[...]      ; Other x-ray blocks +  [...]      ; Other x-ray blocks 
-0000       ; Terminator+  0000       ; Terminator
  
 Special x-ray blocks display custom x-ray graphics for blocks at given positions in the room. They're stored in bank $8F with each block being 4 bytes, plus the 2 byte terminator. Special x-ray blocks display custom x-ray graphics for blocks at given positions in the room. They're stored in bank $8F with each block being 4 bytes, plus the 2 byte terminator.
Line 535: Line 542:
 The X/Y position is specified in (16px x 16px) block units. The block uses the level data block format, except that the block type is ignored. The X/Y position is specified in (16px x 16px) block units. The block uses the level data block format, except that the block type is ignored.
  
-Note that flexglow uses this pointer for the flexglow table instead. +Note that [[https://metroidconstruction.com/resource.php?id=54|flexglow]] uses this pointer for the flexglow table instead.
-PLM population+
  
- ____________ PLM ID +==== PLM population ==== 
-|     _______ X position + 
-|    |   ____ Y position +   ____________ PLM ID 
-|    |  |   _ Parameter +  |     _______ X position 
-|    |  |  | +  |    |   ____ Y position 
-iiii xx yy pppp ; First PLM +  |    |  |   _ Parameter 
-iiii xx yy pppp ; Second PLM +  |    |  |  | 
-[...]           ; Other PLMs +  iiii xx yy pppp ; First PLM 
-0000            ; Terminator+  iiii xx yy pppp ; Second PLM 
 +  [...]           ; Other PLMs 
 +  0000            ; Terminator
  
 PLM population defines the placement of PLMs, as well as some PLM specific properties. They're stored in bank $8F with each PLM being 6 bytes, plus the 2 byte terminator. PLM population defines the placement of PLMs, as well as some PLM specific properties. They're stored in bank $8F with each PLM being 6 bytes, plus the 2 byte terminator.
  
 PLMs with PLM ID >= $DF89 are considered to be “item PLMs”, meaning the PLM argument specified in the PLM populations will be used as a unique ID and cannot be negative. PLMs with PLM ID >= $DF89 are considered to be “item PLMs”, meaning the PLM argument specified in the PLM populations will be used as a unique ID and cannot be negative.
-Library background 
  
- ______ Type +==== Library Background ==== 
-|     _ Parameters + 
-|    | +   ______ Type 
-tttt [...] ; First background command +  |     _ Parameters 
-tttt [...] ; Second background command +  |    | 
-[...]      ; Other background commands +  tttt [...] ; First background command 
-0000       ; Terminator+  tttt [...] ; Second background command 
 +  [...]      ; Other background commands 
 +  0000       ; Terminator
  
 The list of commands used in Super Metroid is as follows: The list of commands used in Super Metroid is as follows:
-Type  Parameters  Description +^Type^Parameters^Description                                                                    ^ 
- ssssss dddd nnnn  Transfer n bytes from s to d in VRAM +|2|ssssss dddd nnnn|Transfer n bytes from s to d in VRAM                                        | 
- ssssss dddd  Decompress s to d in bank $7E +|4|ssssss dddd|Decompress s to d in bank $7E                                                    | 
- Clear layer 3 +|6| |Clear layer 3                                                                              | 
- ssssss dddd nnnn  Transfer n bytes from s to d in VRAM and set BG3 tiles base address = $2000 +|8|ssssss dddd nnnn|Transfer n bytes from s to d in VRAM and set BG3 tiles base address = $2000 | 
-Ah  Clear layer 2 +|Ah| |Clear layer 2                                                                             | 
-Ch  Clear Kraid's layer 2 +|Ch| |Clear Kraid's layer 2                                                                     | 
-Eh  DDDD ssssss dddd nnnn  Transfer n bytes from s to d in VRAM if the current door pointer = D +|Eh|DDDD ssssss dddd nnnn|Transfer n bytes from s to d in VRAM if the current door pointer = D  | 
-Object formats+ 
 +===== Object formats =====
  
 Super Metroid has lots of specialised object formats, which are defined with an instruction list possibly combined with an “initialisation ASM”. In general, object formats have a handler that, for each object, executes a pre-instruction and then interprets the instruction list. Super Metroid has lots of specialised object formats, which are defined with an instruction list possibly combined with an “initialisation ASM”. In general, object formats have a handler that, for each object, executes a pre-instruction and then interprets the instruction list.
Line 577: Line 587:
  
 Common ASM instructions include looping, conditional execution, setting the pre-instruction, deleting the object and sleeping. The pre-instruction is a function that's executed before the object's instruction list is processed for the current frame. Objects that are sleeping are suspended from handling until they are awakened (usually by a pre-instruction set earlier in the object instruction list). Common ASM instructions include looping, conditional execution, setting the pre-instruction, deleting the object and sleeping. The pre-instruction is a function that's executed before the object's instruction list is processed for the current frame. Objects that are sleeping are suspended from handling until they are awakened (usually by a pre-instruction set earlier in the object instruction list).
-PLMs+ 
 +==== PLMs ====
  
 PLMs (post-load modifications) are objects that modify level data blocks in real-time. They exist in bank $84 and are typically loaded with a room from a room header (e.g. items, doors) or spawned as part of a block interaction (e.g. shot block crumbling). PLMs (post-load modifications) are objects that modify level data blocks in real-time. They exist in bank $84 and are typically loaded with a room from a room header (e.g. items, doors) or spawned as part of a block interaction (e.g. shot block crumbling).
Line 583: Line 594:
 PLM header: PLM header:
  
- ______ Initialisation ASM pointer +   ______ Initialisation ASM pointer 
-|     _ Instruction list pointer +  |     _ Instruction list pointer 
-|    | +  |    | 
-aaaa iiii+  aaaa iiii
  
 Door PLM header: Door PLM header:
  
- ___________ Initialisation ASM pointer +   ___________ Initialisation ASM pointer 
-|     ______ Instruction list pointer +  |     ______ Instruction list pointer 
-|    |     _ Instruction list pointer - door closing +  |    |     _ Instruction list pointer - door closing 
-|    |    | +  |    |    | 
-aaaa iiii dddd+  aaaa iiii dddd
  
 The third pointer for door PLMs is used instead of the second pointer when the PLM is placed where a blue door would normally be closing when Samus enters a room. The third pointer for door PLMs is used instead of the second pointer when the PLM is placed where a blue door would normally be closing when Samus enters a room.
Line 600: Line 611:
 The special instructions for PLMs have the format: The special instructions for PLMs have the format:
  
- ______ Draw timer +   ______ Draw timer 
-|     _ Pointer to draw instruction +  |     _ Pointer to draw instruction 
-|    | +  |    | 
-tttt dddd+  tttt dddd
  
 The draw timer is how many frames to wait until the next instruction in the instruction list is proceeded to. The draw timer is how many frames to wait until the next instruction in the instruction list is proceeded to.
Line 609: Line 620:
 The draw instruction format is a list of: The draw instruction format is a list of:
  
-nnnn       ; Number of blocks +  nnnn       ; Number of blocks 
-bbbb [...] ; Blocks +  bbbb [...] ; Blocks 
-xx yy      ; X and Y offsets from origin to start drawing from+  xx yy      ; X and Y offsets from origin to start drawing from
  
 where the list is terminated by xx yy = 00 00. where the list is terminated by xx yy = 00 00.
  
 Blocks are drawn from the PLM's position, the direction they're drawn in is given by the most significant bit of n. If n < 8000h, the blocks are drawn in a horizontal line to the right. If n >= 8000h, n & 7FFFh blocks are drawn in a vertical line downwards. Blocks are drawn from the PLM's position, the direction they're drawn in is given by the most significant bit of n. If n < 8000h, the blocks are drawn in a horizontal line to the right. If n >= 8000h, n & 7FFFh blocks are drawn in a vertical line downwards.
-Enemy projectiles+ 
 +==== Enemy Projectiles ====
  
 Enemy projectiles exist in bank $86 and are typically spawned by enemies and can use their graphics and palette. Enemy projectiles exist in bank $86 and are typically spawned by enemies and can use their graphics and palette.
Line 622: Line 634:
 Enemy projectile header: Enemy projectile header:
  
- __________________________________ Initialisation AI +   __________________________________ Initialisation AI 
-|     _____________________________ (Initial) pre-instruction +  |     _____________________________ (Initial) pre-instruction 
-|    |     ________________________ Instruction list pointer +  |    |     ________________________ Instruction list pointer 
-|    |    |     ___________________ X radius +  |    |    |     ___________________ X radius 
-|    |    |    |   ________________ Y radius +  |    |    |    |   ________________ Y radius 
-|    |    |    |  |   _____________ Damage/properties +  |    |    |    |  |   _____________ Damage/properties 
-|    |    |    |  |  |     ________ Touch AI +  |    |    |    |  |  |     ________ Touch AI 
-|    |    |    |  |  |    |     ___ Shot AI +  |    |    |    |  |  |    |     ___ Shot AI 
-|    |    |    |  |  |    |    | +  |    |    |    |  |  |    |    | 
-iiii pppp IIII xx yy Pddd tttt ssss+  iiii pppp IIII xx yy Pddd tttt ssss
  
 The properties are as follows: The properties are as follows:
-8000h  Detect collisions with projectiles +8000h  Detect collisions with projectiles 
-4000h  Don't die on contact +4000h  Don't die on contact 
-2000h  Disable collisions with Samus +2000h  Disable collisions with Samus 
-1000h  Low priority (drawn under enemies/Samus/projectiles)+1000h  Low priority (drawn under enemies/Samus/projectiles)
  
 The special instructions for enemy projectiles have the format: The special instructions for enemy projectiles have the format:
  
- ______ Spritemap timer +   ______ Spritemap timer 
-|     _ Pointer to spritemap +  |     _ Pointer to spritemap 
-|    | +  |    | 
-tttt ssss+  tttt ssss
  
 The spritemap timer is how many frames to wait until the next instruction in the instruction list is proceeded to. Within the spritemap, the tile numbers added to the base tile number set when the enemy projectile was spawned (so the projectile can access enemy graphics). The spritemap timer is how many frames to wait until the next instruction in the instruction list is proceeded to. Within the spritemap, the tile numbers added to the base tile number set when the enemy projectile was spawned (so the projectile can access enemy graphics).
-Animated tiles objects+ 
 +==== Animated Tiles Objects ====
  
 Animated tiles objects are objects that modify tile graphics in real-time. They exist in bank $87 and are loaded with a room from an FX header. Animated tiles objects are objects that modify tile graphics in real-time. They exist in bank $87 and are loaded with a room from an FX header.
Line 653: Line 666:
 Animated tiles object header format: Animated tiles object header format:
  
- ___________ Instruction list pointer +   ___________ Instruction list pointer 
-|     ______ Size +  |     ______ Size 
-|    |     _ VRAM address +  |    |     _ VRAM address 
-|    |    | +  |    |    | 
-iiii ssss vvvv+  iiii ssss vvvv
  
 The special instructions for animated tiles objects have the format: The special instructions for animated tiles objects have the format:
  
- ______ Animation timer +   ______ Animation timer 
-|     _ Pointer to tile graphics +  |     _ Pointer to tile graphics 
-|    | +  |    | 
-tttt ssss+  tttt ssss
  
 The animation timer is how many frames to wait until the next instruction in the instruction list is proceeded to. The animation timer is how many frames to wait until the next instruction in the instruction list is proceeded to.
-HDMA objects+ 
 +==== HDMA Objects ====
  
 HDMA objects exist in bank $88 and are typically loaded with a room as part of FX or spawned by power bombs / x-ray. HDMA objects exist in bank $88 and are typically loaded with a room as part of FX or spawned by power bombs / x-ray.
Line 673: Line 687:
 HDMA object header format: HDMA object header format:
  
- _______ HDMA options +   _______ HDMA options 
-|   ____ PPU register index +  |   ____ PPU register index 
-|  |   _ Instruction list pointer +  |  |   _ Instruction list pointer 
-|  |  | +  |  |  | 
-dd pp iiii+  dd pp iiii
  
 The special instructions for HDMA objects have the format: The special instructions for HDMA objects have the format:
  
- ______ Table timer +   ______ Table timer 
-|     _ Pointer to HDMA table +  |     _ Pointer to HDMA table 
-|    | +  |    | 
-tttt ssss+  tttt ssss
  
 The table timer is how many frames to wait until the next instruction in the instruction list is proceeded to. The table timer is how many frames to wait until the next instruction in the instruction list is proceeded to.
-Palette FX objects+ 
 +==== Palette FX Objects ====
  
 Palette FX objects are objects that modify palette data in real-time. They exist in bank $8D and are loaded with a room from an FX header. Palette FX objects are objects that modify palette data in real-time. They exist in bank $8D and are loaded with a room from an FX header.
Line 693: Line 708:
 Palette FX object header format: Palette FX object header format:
  
- ______ Initialisation ASM pointer +   ______ Initialisation ASM pointer 
-|     _ Instruction list pointer +  |     _ Instruction list pointer 
-|    | +  |    | 
-aaaa iiii+  aaaa iiii
  
 The special instructions for palette FX objects have the format: The special instructions for palette FX objects have the format:
  
- ______ Palette timer +   ______ Palette timer 
-|     _ Palette instruction list +  |     _ Palette instruction list 
-|    | +  |    | 
-tttt [...]+  tttt [...]
  
 The palette timer is how many frames to wait until the next instruction in the instruction list is proceeded to. The palette timer is how many frames to wait until the next instruction in the instruction list is proceeded to.
Line 710: Line 725:
  
 Palette instructions are a mix of colours (which are positive values) and ASM instructions (negative values). Colours are written to successive positions in CGRAM starting from initial colour index. ASM instructions can modify the colour index between listed colour values, and the instruction $C595 is used to terminate the palette instruction list. Palette instructions are a mix of colours (which are positive values) and ASM instructions (negative values). Colours are written to successive positions in CGRAM starting from initial colour index. ASM instructions can modify the colour index between listed colour values, and the instruction $C595 is used to terminate the palette instruction list.
- 
sm/technical_information/data_structures.1731625457.txt.gz · Last modified: 2024/11/14 23:04 by felixwright