We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS

SMW level data format: Difference between revisions

From SnesLab
Jump to: navigation, search
(italicize SMW)
(Fixed more formatting and turned text-tables into Wiki tables.)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
This article contains information about how levels are stored in ''Super Mario World''.
This article contains information about how levels are stored in [[Super Mario World]].


Pointer tables
== Pointer tables ==


x2E200/$05E000 Layer 1 data 0x200 levels, 3  bytes each. (1,536 bytes)
{| class="wikitable"
x2E800/$05E600 Layer 2 data 0x200 levels, 3*  bytes each. (1,536 bytes)
|-
x2EE00/$05EC00 Sprite data 0x200 levels, 2** bytes each. (1,024 bytes)
!    Address    !!      Usage  !!    Amount    !! Bytes per level !! Total bytes
|-
| x2E200/$05E000 || Layer 1 data || 0x200 levels || 3  bytes       || 1,536 bytes
|-
| x2E800/$05E600 || Layer 2 data || 0x200 levels || 3*  bytes       || 1,536 bytes
|-
| x2EE00/$05EC00 || Sprite data || 0x200 levels || 2** bytes       || 1,024 bytes
|}


*)  Layer 2 BG only uses the two lower bytes. The upper byte should be FF.
<nowiki>*)</nowiki> Layer 2 BG only uses the two lower bytes. The upper byte should be FF. The backgrounds are stored in bank 0C.<br>
    The backgrounds are stored in bank 0C.
<nowiki>**)</nowiki> The sprite data is located in bank 07.<br>
**) The sprite data is located in bank 07.


Primary level header
== Primary level header ==


The first five bytes of the Layer 1 data is the primary level header.
The first five bytes of the Layer 1 data is the primary level header.


|First | |Second| |Third | |Fourth| |Last |
{| class="wikitable"
BBBLLLLL CCCOOOOO 3MMMSSSS TTPPPFFF IIVVZZZZ
|-
First !!  Second !!  Third !!  Fourth !!  Last
|-
| BBBLLLLL || CCCOOOOO || 3MMMSSSS || TTPPPFFF || IIVVZZZZ
|}


BBB  =BG palette
{| class="wikitable"
LLLLL =Length of level (amount of screens)
|-
CCC  =BG color
!  Bits !! Description
OOOOO =Level mode
|-
3    =Layer 3 Priority
| BBB  || BG palette
MMM  =Music
|-
SSSS  =Sprite set
| LLLLL || Length of level (amount of screens)
TT    =Time
|-
PPP  =Sprite palette
| CCC  || BG color
FFF  =FG palette
|-
II    =Item memory
| OOOOO || Level mode
VV    =Vertical scroll
|-
ZZZZ  =Tile set
| 3    || Layer 3 Priority
|-
| MMM  || Music
|-
| SSSS  || Sprite set
|-
| TT    || Time
|-
| PPP  || Sprite palette
|-
| FFF  || FG palette
|-
| II    || Item memory
|-
| VV    || Vertical scroll
|-
| ZZZZ  || Tile set
|}


Secondary level header
== Secondary level header ==


The secondary level header consists of four bytes.
The secondary level header consists of four bytes (These four bytes are not stored together):
(These four bytes are not stored together)
* Location of Byte 1: x2F200/$05F000 + level number
Location of Byte 1: x2F200/$05F000 + level number
* Location of Byte 2: x2F400/$05F200 + level number
Location of Byte 2: x2F400/$05F200 + level number
* Location of Byte 3: x2F600/$05F400 + level number
Location of Byte 3: x2F600/$05F400 + level number
* Location of Byte 4: x2F800/$05F600 + level number
Location of Byte 4: x2F800/$05F600 + level number


|Byte 1| |Byte 2| |Byte 3| |Byte 4|
{| class="wikitable"
SSSSYYYY 33TTTXXX MMMMFFBB IUVEEEEE
|-
Byte 1 !!  Byte 2 !!  Byte 3 !!  Byte 4
|-
| SSSSYYYY || 33TTTXXX || MMMMFFBB || IUVEEEEE
|}


S = Layer 2 scroll settings
{| class="wikitable"
Y = Level entrance Y position
|-
3 = Layer 3 settings
!  Bits !! Description
T = Level entrance type
|-
X = Level entrance X position
| SSSS  || Layer 2 scroll settings
M = Level entrance midway screen
|-
F = Level entrance FG init position
| YYYY  || Level entrance Y position
B = Level entrance BG init position
|-
I = Disable no-Yoshi intro flag
| 33    || Layer 3 settings
U = Unknown vertical position flag
|-
V = Vertical positioning flag
| TTT  || Level entrance type
E = Level entrance screen number
|-
| XXX  || Level entrance X position
|-
| MMMM  || Level entrance midway screen
|-
| FF    || Level entrance FG init position
|-
| BB    || Level entrance BG init position
|-
| I     || Disable no-Yoshi intro flag
|-
| U     || Unknown vertical position flag
|-
| V     || Vertical positioning flag
|-
| EEEEE || Level entrance screen number
|}


Sprite header
=== Sprite header ===


The sprite header is the first byte of sprite data.
The sprite header is the first byte of sprite data.


|Byte |
{| class="wikitable"
SBMMMMMM
|-
! Byte
|-
| SBMMMMMM
|}


S      = Sprite buoyancy
{| class="wikitable"
B      = Sprite buoyancy (no sprite-L2 interaction)
|-
MMMMMM = Sprite memory*
!  Bits  !! Header text
|-
| S      || Sprite buoyancy
|-
| B      || Sprite buoyancy (no sprite-L2 interaction)
|-
| MMMMMM || Sprite memory*
|}


*) Values up to 0x3F are possible, but only up to 0x12 are valid according to Lunar Magic.
<nowiki>*)</nowiki> Values up to 0x3F are possible, but only up to 0x12 are valid according to Lunar Magic.


Layer 1
== Layer 1 ==


(Note that MAP16 is not documented, as it's a feature added by Lunar Magic)
(Note that Direct Map16 is not documented, as it's a feature added by Lunar Magic)
The Layer 1 data begins with the primary level header, followed by the actual Layer 1 data.
<br>
Each block is three bytes long, with the exception of the screen exit objects.
The Layer 1 data begins with the primary level header, followed by the actual Layer 1 data. Each block is three bytes long, with the exception of the screen exit objects.


Standard objects
=== Standard objects ===


|First | |Second| |Last |
{| class="wikitable"
NBBYYYYY bbbbXXXX SSSSSSSS
|-
First !!  Second !!  Last
|-
| NBBYYYYY || bbbbXXXX || SSSSSSSS
|}


N        = New Screen flag
{| class="wikitable"
BBbbbb  = Object number
|-
YYYYY    = Y position
!  Bits  !! Descripton
XXXX    = X position
|-
SSSSSSSS = Settings byte
| N        || New Screen flag
|-
| BBbbbb  || Object number
|-
| YYYYY    || Y position
|-
| XXXX    || X position
|-
| SSSSSSSS || Settings byte
|}


(Note: The first byte being FF marks the end of the data)
(Note: The first byte being FF marks the end of the data)


    Settings byte
Num Desc Upper 4       Lower 4
------------------------------------------------------
00 (Extended Objects) Extended object number
01 Water (Blue) Height Width
02 Invisible coin blocks Height Width
03 Invisible note blocks Height Width
04 Invisible POW coins Height Width
05 Coins Height Width
06 Walk-through dirt Height Width
07 Water (Other color) Height Width
08 Note blocks Height Width
09 Turn blocks Height Width
0A Coin ? blocks Height Width
0B Throw blocks Height Width
0C Black piranha plants Height Width
0D Cement blocks Height Width
0E Brown blocks Height Width
0F Vertical pipes Height Type
10 Horizontal pipes Type Width
11 Bullet shooter Height Unused
12 Slopes Height Type
13 Ledge edges Height Type
14 Ground ledge Height Width
15 Midway/Goal point Height Type
16 Blue coins Height Width
17 Rope/Clouds Type Width
18 Water surface (ani) Height Width
19 Water surface (not ani) Height Width
1A Lava surface (ani) Height Width
1B Net top edge Height Width
1C Donut bridge Unused Width
1D Net bottom edge Height Width
1E Net vertical edge Height Type
1F Vert. Pipe/Bone/Log Height Unused
20 Horiz. Pipe/Bone/Log Unused Width
21 Long ground ledge         Width
22 Special - Used by LM
23 Special - Used by LM
24 Special - Used by LM
25 Special - Used by LM
26 Special - Used by LM
27 Special - Used by LM
28 Special - Used by LM
29 Special - Reserved
2A Special - Reserved
2B Special - Reserved
2C Special - Reserved
2D Special - Used by LM
2E Tileset Specific 1
2F Tileset Specific 2
30 Tileset Specific 3
31 Tileset Specific 4
32 Tileset Specific 5
33 Tileset Specific 6
34 Tileset Specific 7
35 Tileset Specific 8
36 Tileset Specific 9
37 Tileset Specific 10
38 Tileset Specific 11
39 Tileset Specific 12
3A Tileset Specific 13
3B Tileset Specific 14
3C Tileset Specific 15
3D Tileset Specific 16
3E Tileset Specific 17
3F Tileset Specific 18


Extended objects
{| class="wikitable"
|-
! Num !!      Descripton        ||      Settings Byte
|-
| 00  || (Extended Objects)      || Extended object number
|-
| 01  || Water (Blue)            || {Height},{Width}
|-
| 02  || Invisible coin blocks  || {Height},{Width}
|-
| 03  || Invisible note blocks  || {Height},{Width}
|-
| 04  || Invisible POW coins    || {Height},{Width}
|-
| 05  || Coins                  || {Height},{Width}
|-
| 06  || Walk-through dirt      || {Height},{Width}
|-
| 07  || Water (Other color)    || {Height},{Width}
|-
| 08  || Note blocks            || {Height},{Width}
|-
| 09  || Turn blocks            || {Height},{Width}
|-
| 0A  || Coin ? blocks          || {Height},{Width}
|-
| 0B  || Throw blocks            || {Height},{Width}
|-
| 0C  || Black piranha plants    || {Height},{Width}
|-
| 0D  || Cement blocks          || {Height},{Width}
|-
| 0E  || Brown blocks            || {Height},{Width}
|-
| 0F  || Vertical pipes          || {Height},{Type}
|-
| 10  || Horizontal pipes        || {Type},{Width}
|-
| 11  || Bullet shooter          || {Height},{Unused}
|-
| 12  || Slopes                  || {Height},{Type}
|-
| 13  || Ledge edges            || {Height},{Type}
|-
| 14  || Ground ledge            || {Height},{Width}
|-
| 15  || Midway/Goal point      || {Height},{Type}
|-
| 16  || Blue coins              || {Height},{Width}
|-
| 17  || Rope/Clouds            || {Type},{Width}
|-
| 18  || Water surface (ani)    || {Height},{Width}
|-
| 19  || Water surface (not ani) || {Height},{Width}
|-
| 1A  || Lava surface (ani)      || {Height},{Width}
|-
| 1B  || Net top edge            || {Height},{Width}
|-
| 1C  || Donut bridge            || {Unused},{Width}
|-
| 1D  || Net bottom edge        || {Height},{Width}
|-
| 1E  || Net vertical edge      || {Height},{Type}
|-
| 1F  || Vert. Pipe/Bone/Log    || {Height},{Unused}
|-
| 20  || Horiz. Pipe/Bone/Log    || {Unused},{Width}
|-
| 21  || Long ground ledge      || Width
|-
| 22  || Special - Used by LM    ||
|-
| 23  || Special - Used by LM    ||
|-
| 24  || Special - Used by LM    ||
|-
| 25  || Special - Used by LM    ||
|-
| 26  || Special - Used by LM    ||
|-
| 27  || Special - Used by LM    ||
|-
| 28  || Special - Used by LM    ||
|-
| 29  || Special - Reserved      ||
|-
| 2A  || Special - Reserved      ||
|-
| 2B  || Special - Reserved      ||
|-
| 2C  || Special - Reserved      ||
|-
| 2D  || Special - Used by LM    ||
|-
| 2E  || Tileset Specific 1      ||
|-
| 2F  || Tileset Specific 2      ||
|-
| 30  || Tileset Specific 3      ||
|-
| 31  || Tileset Specific 4      ||
|-
| 32  || Tileset Specific 5      ||
|-
| 33  || Tileset Specific 6      ||
|-
| 34  || Tileset Specific 7      ||
|-
| 35  || Tileset Specific 8      ||
|-
| 36  || Tileset Specific 9      ||
|-
| 37  || Tileset Specific 10    ||
|-
| 38  || Tileset Specific 11    ||
|-
| 39  || Tileset Specific 12    ||
|-
| 3A  || Tileset Specific 13    ||
|-
| 3B  || Tileset Specific 14    ||
|-
| 3C  || Tileset Specific 15    ||
|-
| 3D  || Tileset Specific 16    ||
|-
| 3E  || Tileset Specific 17    ||
|-
| 3F  || Tileset Specific 18    ||
|}
 
Note: Most objects separate their nibbles into upper and lower bytes with separate functions. They're specified as {Upper Nibble},{Lower Nibble} in this table.
 
=== Extended objects ===


(Standard object 00)
(Standard object 00)


|First | |Second| |Last |
{| class="wikitable"
N00YYYYY 0000XXXX BBBBBBBB
|-
First !!  Second !!  Last
|-
| N00YYYYY || 0000XXXX || BBBBBBBB
|}


N        = New Screen flag
{| class="wikitable"
YYYYY    = Y position
|-
XXXX    = X position
!  Bits  !! Description
BBBBBBBB = Extended object number
|-
| N        || New Screen flag
|-
| YYYYY    || Y position
|-
| XXXX    || X position
|-
| BBBBBBBB || Extended object number
|}


Num Desc
{| class="wikitable"
----------------------------------------------------
|-
00 Special - Screen Exit
Num || Desc
01 Special - Screen Jump
|-
02-0F Unused?
| 00   ||Special - Screen Exit
10 Small door
|-
11 Invisible ? block (1-UP)
| 01   || Special - Screen Jump
12 Invisible note block
|-
13 Top left corner edge tile 1
| 02-0F || Unused?
14 Top right corner edge tile 1
|-
15 Small POW door
| 10   || Small door
16 Invisible POW ? block
|-
17 Green star block
| 11   || Invisible ? block (1-UP)
18 3-UP moon
|-
19 Invisible 1-UP #1
| 12   || Invisible note block
1A Invisible 1-UP #2
|-
1B Invisible 1-UP #3
| 13   || Top left corner edge tile 1
1C Invisible 1-UP #4
|-
1D Red berry
| 14   || Top right corner edge tile 1
1E Pink berry
|-
1F Green berry
| 15   || Small POW door
20 Always turning block
|-
21 Bottom right of midway point (unused)
| 16   || Invisible POW ? block
22 Bottom right of midway point (unused)
|-
23 Note block (flower/feather/star)
| 17   || Green star block
24 ON/OFF block
|-
25 Direction coins ? block
| 18   || 3-UP moon
26 Note block
|-
27 Note block, bounce on all sides
| 19   || Invisible 1-UP #1
28 Turn block (Flower)
|-
29 Turn block (Feather)
| 1A   || Invisible 1-UP #2
2A Turn block (Star)
|-
2B Turn block (Star 2/1-UP/Vine)
| 1B   || Invisible 1-UP #3
2C Turn block (Multiple coins)
|-
2D Turn block (Coin)
| 1C   || Invisible 1-UP #4
2E Turn block (Nothing)
|-
2F Turn block (POW)
| 1D   || Red berry
30 ? block (Flower)
|-
31 ? block (Feather)
| 1E   || Pink berry
32 ? block (Star)
|-
33 ? block (Star 2)
| 1F   || Green berry
34 ? block (Multiple coins)
|-
35 ? block (Key/Wings/Balloon/Shell)
| 20   || Always turning block
36 ? block (Yoshi)
|-
37 ? block (Shell)
| 21   || Bottom right of midway point (unused)
38 ? block (Shell)
|-
39 Turn block, unbreakable (Feather)
| 22   || Bottom right of midway point (unused)
3A Top left corner edge tile 2
|-
3B Top right corner edge tile 2
| 23   || Note block (flower/feather/star)
3C Top left corner edge tile 3
|-
3D Top right corner edge tile 3
| 24   || ON/OFF block
3E Top left corner edge tile 4
|-
3F Top right corner edge tile 4
| 25   || Direction coins ? block
40 Transculent block
|-
41 Yoshi Coin
| 26   || Note block
42 Top left slope
|-
43 Top right slope
| 27   || Note block, bounce on all sides
44 Purple triangle, left
|-
45 Purple triangle, right
| 28   || Turn block (Flower)
46 Midway point rope
|-
47 Door
| 29   || Turn block (Feather)
48 Invisible POW door
|-
49 Ghost house exit
| 2A   || Turn block (Star)
4A Climbing net door
|-
4B Conveyor end tile 1
| 2B   || Turn block (Star 2/1-UP/Vine)
4C Conveyor end tile 2
|-
4D Line guide, top left 1/4 large circle
| 2C   || Turn block (Multiple coins)
4E Line guide, top right 1/4 large circle
|-
4F Line guide, bottom left 1/4 large circle
| 2D   || Turn block (Coin)
50 Line guide, bottom right 1/4 large circle
|-
51 Line guide, top left 1/4 small circle
| 2E   || Turn block (Nothing)
52 Line guide, top right 1/4 small circle
|-
53 Line guide, bottom left 1/4 small circle
| 2F   || Turn block (POW)
54 Line guide, bottom right 1/4 small circle
|-
55 Line guide end, for horizontal line
| 30   || ? block (Flower)
56 Line guide end, for vertical line
|-
57 Switch palace bottom right corner tile
| 31   || ? block (Feather)
58 Switch palace bottom left corner tile
|-
59 Switch palace top right corner tile
| 32   || ? block (Star)
5A Switch palace top left corner tile
|-
5B Bit of brick background tile 1
| 33   || ? block (Star 2)
5C Bit of brick background tile 2
|-
5D Bit of brick background tile 3
| 34   || ? block (Multiple coins)
5E Bit of brick background tile 4
|-
5F Large background area
| 35   || ? block (Key/Wings/Balloon/Shell)
60 Lava/mud top right corner edge
|-
61 Ghost house clock
| 36   || ? block (Yoshi)
62 Ghost house top left to bottom right beam 1
|-
63 Ghost house top right to bottom left beam 1
| 37   || ? block (Shell)
64 Ghost house cobweb, top right
|-
65 Ghost house cobweb, top left
| 38   || ? block (Shell)
66 Ghost house top right to bottom left beam 2
|-
67 Ghost house top left to bottom right beam 2
| 39   || Turn block, unbreakable (Feather)
68 Cloud fringe, bottom and right edge
|-
69 Cloud fringe, bottom and left edge
| 3A   || Top left corner edge tile 2
6A Cloud fringe, bottom right
|-
6B Cloud fringe, bottom left
| 3B   || Top right corner edge tile 2
6C Cloud fringe on white, bottom and right edge
|-
6D Cloud fringe on white, bottom and left edge
| 3C   || Top left corner edge tile 3
6E Cloud fringe on white, bottom right
|-
6F Cloud fringe on white, bottom left
| 3D   || Top right corner edge tile 3
70 Bit of canvass 1
|-
71 Canvass 1
| 3E   || Top left corner edge tile 4
72 Canvass 2
|-
73 Canvass 3
| 3F   || Top right corner edge tile 4
74 Canvass 4
|-
75 Canvass tile 1
| 40   || Transculent block
76 Canvass tile 2
|-
77 Canvass tile 3
| 41   || Yoshi Coin
78 Canvass tile 4
|-
79 Canvass tile 5
| 42   || Top left slope
7A Canvass tile 6
|-
7B Canvass tile 7
| 43   || Top right slope
7C Bit of canvas 2
|-
7D Bit of canvas 3
| 44   || Purple triangle, left
7E Bit of canvas 4
|-
7F Torpedo launcher
| 45   || Purple triangle, right
80 Ghost house entrance
|-
81 Water weed
| 46   || Midway point rope
82 Big bush 1
|-
83 Big bush 2
| 47   || Door
84 Castle entrance
|-
85 Yoshi's house
| 48   || Invisible POW door
86 Arrow sign
|-
87 ! block, green
| 49   || Ghost house exit
88 Tree branch, left
|-
89 Tree branch, right
| 4A   || Climbing net door
8A Switch, green
|-
8B Switch, yellow
| 4B   || Conveyor end tile 1
8C Switch, blue
|-
8D Switch, red
| 4C   || Conveyor end tile 2
8E ! block, yellow
|-
8F Ghost house window
| 4D   || Line guide, top left 1/4 large circle
90 Boss door
|-
91 Steep left slope (vert. lev.)
| 4E   || Line guide, top right 1/4 large circle
92 Steep right slope (vert. lev.)
|-
93 Normal left slope (vert. lev.)
| 4F   || Line guide, bottom left 1/4 large circle
94 Normal right slope (vert. lev.)
|-
95 Very steep left slope (vert. lev.)
| 50   || Line guide, bottom right 1/4 large circle
96 Very steep right slope (vert. lev.)
|-
97 Switch palace right and bottom edge tile
| 51   || Line guide, top left 1/4 small circle
98-FF Unused?
|-
| 52   || Line guide, top right 1/4 small circle
|-
| 53   || Line guide, bottom left 1/4 small circle
|-
| 54   || Line guide, bottom right 1/4 small circle
|-
| 55   || Line guide end, for horizontal line
|-
| 56   || Line guide end, for vertical line
|-
| 57   || Switch palace bottom right corner tile
|-
| 58   || Switch palace bottom left corner tile
|-
| 59   || Switch palace top right corner tile
|-
| 5A   || Switch palace top left corner tile
|-
| 5B   || Bit of brick background tile 1
|-
| 5C   || Bit of brick background tile 2
|-
| 5D   || Bit of brick background tile 3
|-
| 5E   || Bit of brick background tile 4
|-
| 5F   || Large background area
|-
| 60   || Lava/mud top right corner edge
|-
| 61   || Ghost house clock
|-
| 62   || Ghost house top left to bottom right beam 1
|-
| 63   || Ghost house top right to bottom left beam 1
|-
| 64   || Ghost house cobweb, top right
|-
| 65   || Ghost house cobweb, top left
|-
| 66   || Ghost house top right to bottom left beam 2
|-
| 67   || Ghost house top left to bottom right beam 2
|-
| 68   || Cloud fringe, bottom and right edge
|-
| 69   || Cloud fringe, bottom and left edge
|-
| 6A   || Cloud fringe, bottom right
|-
| 6B   || Cloud fringe, bottom left
|-
| 6C   || Cloud fringe on white, bottom and right edge
|-
| 6D   || Cloud fringe on white, bottom and left edge
|-
| 6E   || Cloud fringe on white, bottom right
|-
| 6F   || Cloud fringe on white, bottom left
|-
| 70   || Bit of canvass 1
|-
| 71   || Canvass 1
|-
| 72   || Canvass 2
|-
| 73   || Canvass 3
|-
| 74   || Canvass 4
|-
| 75   || Canvass tile 1
|-
| 76   || Canvass tile 2
|-
| 77   || Canvass tile 3
|-
| 78   || Canvass tile 4
|-
| 79   || Canvass tile 5
|-
| 7A   || Canvass tile 6
|-
| 7B   || Canvass tile 7
|-
| 7C   || Bit of canvas 2
|-
| 7D   || Bit of canvas 3
|-
| 7E   || Bit of canvas 4
|-
| 7F   || Torpedo launcher
|-
| 80   || Ghost house entrance
|-
| 81   || Water weed
|-
| 82   || Big bush 1
|-
| 83   || Big bush 2
|-
| 84   || Castle entrance
|-
| 85   || Yoshi's house
|-
| 86   || Arrow sign
|-
| 87   || ! block, green
|-
| 88   || Tree branch, left
|-
| 89   || Tree branch, right
|-
| 8A   || Switch, green
|-
| 8B   || Switch, yellow
|-
| 8C   || Switch, blue
|-
| 8D   || Switch, red
|-
| 8E   || ! block, yellow
|-
| 8F   || Ghost house window
|-
| 90   || Boss door
|-
| 91   || Steep left slope (vert. lev.)
|-
| 92   || Steep right slope (vert. lev.)
|-
| 93   || Normal left slope (vert. lev.)
|-
| 94   || Normal right slope (vert. lev.)
|-
| 95   || Very steep left slope (vert. lev.)
|-
| 96   || Very steep right slope (vert. lev.)
|-
| 97   || Switch palace right and bottom edge tile
|-
| 98-FF || Unused?
|}


Screen exits
=== Screen exits ===


(Extended object 00)
(Extended object 00)


|First | |Second| |Third | |Last |
{| class="wikitable"
000PPPPP 0000WUSH 00000000 DDDDDDDD
|-
First !!  Second !!  Third !!  Last
|-
| 000PPPPP || 0000WUSH || 00000000 || DDDDDDDD
|}


PPPPP    = Page number
{| class="wikitable"
W        = Water (secondary exit)
|-
U        = Secondary Exit? *
!  Bits  !! Page number
S        = Secondary Exit
|-
H        = Unused **
| PPPPP    || Example
DDDDDDDD = Lower 8 bits of destination level
|-
| W        || Water (secondary exit)
|-
| U        || Secondary Exit? *
|-
| S        || Secondary Exit
|-
| H        || Unused **
|-
| DDDDDDDD || Lower 8 bits of destination level
|}


Creates a screen exit. Should be placed right before the end of the level.
Creates a screen exit. Should be placed right before the end of the level.


*)  Used by a Lunar Magic ASM hack: If set, the H bit will be used
<nowiki>*)</nowiki> Used by a Lunar Magic ASM hack: If set, the H bit will be used
**) Used by a Lunar Magic ASM hack: High bit of destination level (only if the U bit is set)
<br>
<nowiki>**)</nowiki> Used by a Lunar Magic ASM hack: High bit of destination level (only if the U bit is set)


Screen jump
=== Screen jump ===


(Extended object 01)
(Extended object 01)


|First | |Second| |Last |
{| class="wikitable"
000PPPPP 0000???? 00000001
|-
First !!  Second !!  Last
|-
| 000PPPPP || 0000???? || 00000001
|}


PPPPP   = Page to jump to
{| class="wikitable"
????     = Unused?
|-
!  Bit  !!  Description
|-
| PPPPP || Page to jump to
|-
| ???? || Unused?
|}


The loading routine jumps to another screen.
The loading routine jumps to another screen.


Layer 2
== Layer 2 ==
Background
=== Background ===


Layer 2 backgrounds are compressed using a simple RLE system.
Layer 2 backgrounds are compressed using a simple RLE system.
Line 350: Line 667:
A background consists of any number of "lines". There are two types: Normal line and RLE line
A background consists of any number of "lines". There are two types: Normal line and RLE line


Each line begins with a start byte. The highest bit decides what kind of line it is.
Each line begins with a start byte. The highest bit decides what kind of line it is (0 = Normal, 1 = RLE). The other 7 bits are the "length" setting, which is the amount of tiles in the line minus 1.
(0 = Normal, 1 = RLE)
The other 7 bits are the "length" setting, which is the amount of tiles in the line minus 1.


A normal line is then followed by (length+1) bytes, each being a tile in the background.
A normal line is then followed by (length+1) bytes, each being a tile in the background. An RLE line is only followed by a single byte which is repeated (length+1) times.
An RLE line is only followed by a single byte which is repeated (length+1) times.


The entire left half of the background is stored first, followed by the entire right half.
The entire left half of the background is stored first, followed by the entire right half.
Line 361: Line 675:
The line "FFFF" marks the end of the data.
The line "FFFF" marks the end of the data.


Level
=== Level ===


Layer 2 levels are stored in exactly the same way as Layer 1.
Layer 2 levels are stored in exactly the same way as Layer 1. The five byte header is there as well, but doesn't seem to be used.
The five byte header is there as well, but doesn't seem to be used.


Sprites
== Sprites ==


The first byte of the sprite data is the sprite header.
The first byte of the sprite data is the sprite header. Each sprite is three bytes long.
Each sprite is three bytes long.


|First | |Second| |Last |
{| class="wikitable"
YYYYEEsy XXXXSSSS NNNNNNNN
|-
First !!  Second !!  Last
|-
| YYYYEEsy || XXXXSSSS || NNNNNNNN
|}


yYYYY    = Y position
{| class="wikitable"
EE      = Extra bits
|-
XXXX    = X position
!  Bits  !!  Description
sSSSS    = Screen number
|-
NNNNNNNN = Enemy number
! yYYYY    || Y position
|-
| EE      || Extra bits
|-
| XXXX    || X position
|-
| sSSSS    || Screen number
|-
| NNNNNNNN || Enemy number
|}


(Note: The first byte being FF marks the end of the data)
(Note: The first byte being FF marks the end of the data)


Secondary entrances
== Secondary entrances ==


(Not yet documented.)
(Not yet documented.)


[[Category:Super Mario World]]
[[Category:Super Mario World]]

Latest revision as of 07:12, 6 May 2023

This article contains information about how levels are stored in Super Mario World.

Pointer tables

Address Usage Amount Bytes per level Total bytes
x2E200/$05E000 Layer 1 data 0x200 levels 3 bytes 1,536 bytes
x2E800/$05E600 Layer 2 data 0x200 levels 3* bytes 1,536 bytes
x2EE00/$05EC00 Sprite data 0x200 levels 2** bytes 1,024 bytes

*) Layer 2 BG only uses the two lower bytes. The upper byte should be FF. The backgrounds are stored in bank 0C.
**) The sprite data is located in bank 07.

Primary level header

The first five bytes of the Layer 1 data is the primary level header.

First Second Third Fourth Last
BBBLLLLL CCCOOOOO 3MMMSSSS TTPPPFFF IIVVZZZZ
Bits Description
BBB BG palette
LLLLL Length of level (amount of screens)
CCC BG color
OOOOO Level mode
3 Layer 3 Priority
MMM Music
SSSS Sprite set
TT Time
PPP Sprite palette
FFF FG palette
II Item memory
VV Vertical scroll
ZZZZ Tile set

Secondary level header

The secondary level header consists of four bytes (These four bytes are not stored together):

  • Location of Byte 1: x2F200/$05F000 + level number
  • Location of Byte 2: x2F400/$05F200 + level number
  • Location of Byte 3: x2F600/$05F400 + level number
  • Location of Byte 4: x2F800/$05F600 + level number
Byte 1 Byte 2 Byte 3 Byte 4
SSSSYYYY 33TTTXXX MMMMFFBB IUVEEEEE
Bits Description
SSSS Layer 2 scroll settings
YYYY Level entrance Y position
33 Layer 3 settings
TTT Level entrance type
XXX Level entrance X position
MMMM Level entrance midway screen
FF Level entrance FG init position
BB Level entrance BG init position
I Disable no-Yoshi intro flag
U Unknown vertical position flag
V Vertical positioning flag
EEEEE Level entrance screen number

Sprite header

The sprite header is the first byte of sprite data.

Byte
SBMMMMMM
Bits Header text
S Sprite buoyancy
B Sprite buoyancy (no sprite-L2 interaction)
MMMMMM Sprite memory*

*) Values up to 0x3F are possible, but only up to 0x12 are valid according to Lunar Magic.

Layer 1

(Note that Direct Map16 is not documented, as it's a feature added by Lunar Magic)
The Layer 1 data begins with the primary level header, followed by the actual Layer 1 data. Each block is three bytes long, with the exception of the screen exit objects.

Standard objects

First Second Last
NBBYYYYY bbbbXXXX SSSSSSSS
Bits Descripton
N New Screen flag
BBbbbb Object number
YYYYY Y position
XXXX X position
SSSSSSSS Settings byte

(Note: The first byte being FF marks the end of the data)


Num Descripton Settings Byte
00 (Extended Objects) Extended object number
01 Water (Blue) {Height},{Width}
02 Invisible coin blocks {Height},{Width}
03 Invisible note blocks {Height},{Width}
04 Invisible POW coins {Height},{Width}
05 Coins {Height},{Width}
06 Walk-through dirt {Height},{Width}
07 Water (Other color) {Height},{Width}
08 Note blocks {Height},{Width}
09 Turn blocks {Height},{Width}
0A Coin ? blocks {Height},{Width}
0B Throw blocks {Height},{Width}
0C Black piranha plants {Height},{Width}
0D Cement blocks {Height},{Width}
0E Brown blocks {Height},{Width}
0F Vertical pipes {Height},{Type}
10 Horizontal pipes {Type},{Width}
11 Bullet shooter {Height},{Unused}
12 Slopes {Height},{Type}
13 Ledge edges {Height},{Type}
14 Ground ledge {Height},{Width}
15 Midway/Goal point {Height},{Type}
16 Blue coins {Height},{Width}
17 Rope/Clouds {Type},{Width}
18 Water surface (ani) {Height},{Width}
19 Water surface (not ani) {Height},{Width}
1A Lava surface (ani) {Height},{Width}
1B Net top edge {Height},{Width}
1C Donut bridge {Unused},{Width}
1D Net bottom edge {Height},{Width}
1E Net vertical edge {Height},{Type}
1F Vert. Pipe/Bone/Log {Height},{Unused}
20 Horiz. Pipe/Bone/Log {Unused},{Width}
21 Long ground ledge Width
22 Special - Used by LM
23 Special - Used by LM
24 Special - Used by LM
25 Special - Used by LM
26 Special - Used by LM
27 Special - Used by LM
28 Special - Used by LM
29 Special - Reserved
2A Special - Reserved
2B Special - Reserved
2C Special - Reserved
2D Special - Used by LM
2E Tileset Specific 1
2F Tileset Specific 2
30 Tileset Specific 3
31 Tileset Specific 4
32 Tileset Specific 5
33 Tileset Specific 6
34 Tileset Specific 7
35 Tileset Specific 8
36 Tileset Specific 9
37 Tileset Specific 10
38 Tileset Specific 11
39 Tileset Specific 12
3A Tileset Specific 13
3B Tileset Specific 14
3C Tileset Specific 15
3D Tileset Specific 16
3E Tileset Specific 17
3F Tileset Specific 18

Note: Most objects separate their nibbles into upper and lower bytes with separate functions. They're specified as {Upper Nibble},{Lower Nibble} in this table.

Extended objects

(Standard object 00)

First Second Last
N00YYYYY 0000XXXX BBBBBBBB
Bits Description
N New Screen flag
YYYYY Y position
XXXX X position
BBBBBBBB Extended object number
Num Desc
00 Special - Screen Exit
01 Special - Screen Jump
02-0F Unused?
10 Small door
11 Invisible ? block (1-UP)
12 Invisible note block
13 Top left corner edge tile 1
14 Top right corner edge tile 1
15 Small POW door
16 Invisible POW ? block
17 Green star block
18 3-UP moon
19 Invisible 1-UP #1
1A Invisible 1-UP #2
1B Invisible 1-UP #3
1C Invisible 1-UP #4
1D Red berry
1E Pink berry
1F Green berry
20 Always turning block
21 Bottom right of midway point (unused)
22 Bottom right of midway point (unused)
23 Note block (flower/feather/star)
24 ON/OFF block
25 Direction coins ? block
26 Note block
27 Note block, bounce on all sides
28 Turn block (Flower)
29 Turn block (Feather)
2A Turn block (Star)
2B Turn block (Star 2/1-UP/Vine)
2C Turn block (Multiple coins)
2D Turn block (Coin)
2E Turn block (Nothing)
2F Turn block (POW)
30 ? block (Flower)
31 ? block (Feather)
32 ? block (Star)
33 ? block (Star 2)
34 ? block (Multiple coins)
35 ? block (Key/Wings/Balloon/Shell)
36 ? block (Yoshi)
37 ? block (Shell)
38 ? block (Shell)
39 Turn block, unbreakable (Feather)
3A Top left corner edge tile 2
3B Top right corner edge tile 2
3C Top left corner edge tile 3
3D Top right corner edge tile 3
3E Top left corner edge tile 4
3F Top right corner edge tile 4
40 Transculent block
41 Yoshi Coin
42 Top left slope
43 Top right slope
44 Purple triangle, left
45 Purple triangle, right
46 Midway point rope
47 Door
48 Invisible POW door
49 Ghost house exit
4A Climbing net door
4B Conveyor end tile 1
4C Conveyor end tile 2
4D Line guide, top left 1/4 large circle
4E Line guide, top right 1/4 large circle
4F Line guide, bottom left 1/4 large circle
50 Line guide, bottom right 1/4 large circle
51 Line guide, top left 1/4 small circle
52 Line guide, top right 1/4 small circle
53 Line guide, bottom left 1/4 small circle
54 Line guide, bottom right 1/4 small circle
55 Line guide end, for horizontal line
56 Line guide end, for vertical line
57 Switch palace bottom right corner tile
58 Switch palace bottom left corner tile
59 Switch palace top right corner tile
5A Switch palace top left corner tile
5B Bit of brick background tile 1
5C Bit of brick background tile 2
5D Bit of brick background tile 3
5E Bit of brick background tile 4
5F Large background area
60 Lava/mud top right corner edge
61 Ghost house clock
62 Ghost house top left to bottom right beam 1
63 Ghost house top right to bottom left beam 1
64 Ghost house cobweb, top right
65 Ghost house cobweb, top left
66 Ghost house top right to bottom left beam 2
67 Ghost house top left to bottom right beam 2
68 Cloud fringe, bottom and right edge
69 Cloud fringe, bottom and left edge
6A Cloud fringe, bottom right
6B Cloud fringe, bottom left
6C Cloud fringe on white, bottom and right edge
6D Cloud fringe on white, bottom and left edge
6E Cloud fringe on white, bottom right
6F Cloud fringe on white, bottom left
70 Bit of canvass 1
71 Canvass 1
72 Canvass 2
73 Canvass 3
74 Canvass 4
75 Canvass tile 1
76 Canvass tile 2
77 Canvass tile 3
78 Canvass tile 4
79 Canvass tile 5
7A Canvass tile 6
7B Canvass tile 7
7C Bit of canvas 2
7D Bit of canvas 3
7E Bit of canvas 4
7F Torpedo launcher
80 Ghost house entrance
81 Water weed
82 Big bush 1
83 Big bush 2
84 Castle entrance
85 Yoshi's house
86 Arrow sign
87 ! block, green
88 Tree branch, left
89 Tree branch, right
8A Switch, green
8B Switch, yellow
8C Switch, blue
8D Switch, red
8E ! block, yellow
8F Ghost house window
90 Boss door
91 Steep left slope (vert. lev.)
92 Steep right slope (vert. lev.)
93 Normal left slope (vert. lev.)
94 Normal right slope (vert. lev.)
95 Very steep left slope (vert. lev.)
96 Very steep right slope (vert. lev.)
97 Switch palace right and bottom edge tile
98-FF Unused?

Screen exits

(Extended object 00)

First Second Third Last
000PPPPP 0000WUSH 00000000 DDDDDDDD
Bits Page number
PPPPP Example
W Water (secondary exit)
U Secondary Exit? *
S Secondary Exit
H Unused **
DDDDDDDD Lower 8 bits of destination level

Creates a screen exit. Should be placed right before the end of the level.

*) Used by a Lunar Magic ASM hack: If set, the H bit will be used
**) Used by a Lunar Magic ASM hack: High bit of destination level (only if the U bit is set)

Screen jump

(Extended object 01)

First Second Last
000PPPPP 0000???? 00000001
Bit Description
PPPPP Page to jump to
???? Unused?

The loading routine jumps to another screen.

Layer 2

Background

Layer 2 backgrounds are compressed using a simple RLE system.

A background consists of any number of "lines". There are two types: Normal line and RLE line

Each line begins with a start byte. The highest bit decides what kind of line it is (0 = Normal, 1 = RLE). The other 7 bits are the "length" setting, which is the amount of tiles in the line minus 1.

A normal line is then followed by (length+1) bytes, each being a tile in the background. An RLE line is only followed by a single byte which is repeated (length+1) times.

The entire left half of the background is stored first, followed by the entire right half.

The line "FFFF" marks the end of the data.

Level

Layer 2 levels are stored in exactly the same way as Layer 1. The five byte header is there as well, but doesn't seem to be used.

Sprites

The first byte of the sprite data is the sprite header. Each sprite is three bytes long.

First Second Last
YYYYEEsy XXXXSSSS NNNNNNNN
Bits Description
yYYYY Y position
EE Extra bits
XXXX X position
sSSSS Screen number
NNNNNNNN Enemy number

(Note: The first byte being FF marks the end of the data)

Secondary entrances

(Not yet documented.)