|SMW Memory Map|
|$7E005B||1 byte||Misc.||Screen mode: CD----Vv.
C = Collision with layer 2.
D = Disable collision with layer 1.
V = Vertical layer 2.
v = Vertical layer 1.
- = unused.
This address is set by a table at $05:8417, which is indexed by the level mode setting.
|$7E005C||1 byte||Empty||Empty. Cleared on reset, titlescreen load and overworld load.|
|$7E005D||1 byte||Misc.||Number of screens in level.|
|$7E005E||1 byte||Camera||In horizontal levels, used as the level's width in screens, i.e. the screen number (plus 1) at which the camera should stop scrolling rightwards. Equivalent to the "number of screens" dropdown in Lunar Magic's "Change Properties in Header" dialogue. Not used in vertical levels; see $5F instead.|
|$7E005F||1 byte||Camera||In vertical levels, used as the level's height in screens, i.e. the screen number (plus 1) at which the camera should stop scrolling downwards. Equivalent to the "number of screens" dropdown in Lunar Magic's "Change Properties in Header" dialogue. Not used in horizontal levels; see $5E instead.|
|$7E0060||4 bytes||Empty||Empty. Cleared on reset, titlescreen load and overworld load.|
|$7E0064||1 byte||Misc.||Properties (YXPPCCCT) byte for most sprites inside levels - including the player. Exceptions to this include sprites that mess with sprite priority in a different way, such as Piranha Plants, items coming out of a box (and inside the item box) and Net Koopas behind the nets.|
|$7E0065||3 bytes||Pointer||24-bit pointer to layer 1 data - both level and overworld.|
|$7E0068||3 bytes||Pointer||24-bit pointer to layer 2 data.|
|$7E006B||3 bytes||Pointer||24-bit pointer to low byte of Map16 block data. Used during level load.|
|$7E006E||3 bytes||Pointer||24-bit pointer to high byte of Map16 block data. Used during level load.|
|$7E0071||1 byte||Player||Player animation trigger.||Valid Values|
|$7E0072||1 byte||Player||Player is in the air flag. This is set to a certain value depending on how the player got in the air in the first place, and in what state he is currently (rising or sinking).
This address is not affected by phases such as climbing. It is, however, also used in swimming animation.
#$0B = Jumping/swimming upwards.
#$0C = Shooting out of a slanted pipe, running at maximum speed.
#$24 = Descending/sinking.
The address in general is used in many instances.
For example, the game checks if this address is #$0C. If not, the player cannot ascend properly with the cape. Furthermore, the Layer 3 smash won't hurt the player if he's not on the ground (any non-zero value) and this address prevents the player from locking in place when still airborne during the Morton/Roy/Ludwig battle.
Also, when airborne, the value in this address appears to be stored to $7E:13E0, which also explains the otherwise odd values used for the different airborne phases.
|$7E0073||1 byte||Flag||Player is ducking flag. #$00 = No; #$04 = Yes. However, any value that is not zero also counts as 'Yes', SMW just stores that specific value to it.|
|$7E0074||1 byte||Player||Player is climbing flag: format: n--sifhb
n: Net/vine flag. 1 - net, 0 - vine. Determines whether Mario can move diagonally.
s: Side body collision point with climbing. If clear, block horizontal movement.
i: Side head collision point with climbing.
f: Feet collision point with climbing.
h: Head collision point with climbing.
b: Body collision point with climbing.
|$7E0075||1 byte||Flag||Player is in water flag. #$00 = No; #$01 = Yes.|
|$7E0076||1 byte||Player||Player direction. #$00 = Left; #$01 = Right.|
|$7E0077||1 byte||Player||Player blocked status - Used to check if player is blocked in a certain direction. Format: SxxMUDLR
The M bit means that the player is in the middle of a block.
The S bit indicates that the player is touching the side of the screens while horizontal screen scrolling is disabled.
UDLR = up, down, left, right (contact with walls).
L is checked each 4 frames when the player have negative X speed. Others frames is zero.
R is checked each 4 frames when the player have positive X speed. Others frames is zero.
|$7E0078||1 byte||Player||Used to hide the player partially or fully. Format: dlucapLU.
d = used in conjunction with all other set bits in order to disable processes such as the star timer decrementing.
l = hide lower extra player tile when in flight (hovering with the cape).
u = hide upper extra player tile when in flight (hovering with the cape).
c = hide regular cape tile.
a = hide attributive 8x8 tile.
p = hide extra player tile that is shown during the inflated P-balloon pose (does not apply if the player is small).
L = hide lower half of the body.
U = hide upper half of the body.
|$7E0079||1 byte||Empty||Empty. Cleared on reset, titlescreen load, overworld load and level load.|
|$7E007A||1 byte||Player||Accumulating fraction bits for fixed point player X speed (fractions of 256, see code around $00D792, this handles horizontal movement with the player and when the player is on the slope).
Not to be confused with $7E13DA, which handles X position.
|$7E007B||1 byte||Player||Player X speed. #$7F is the fastest rightwards speed, while #$80 is the highest leftwards. +/-#$14 is fully walking, +/-#$2F is fully running. #$01-#$7F is right, #$80-#$FF is left, #$00 is standing still.|
|$7E007C||1 byte||Empty||Empty. Cleared on reset, titlescreen load, overworld load and level load.|
|$7E007D||1 byte||Player||Player Y speed. #$00-#$7F = falling, #$80-#$FF = rising. #$80 is the highest upwards speed, while #$7F is the highest downwards speed. #$46 is the maximum fall speed, #$B3 is the normal jump speed, and #$A4 is the jump speed when fully running.|
|$7E007E||2 bytes||Player||Player X position (16-bit), within the borders of the screen.|
|$7E0080||2 bytes||Player||Player Y position (16-bit), within the borders of the screen.
Note that this value may be displaced by $1888 (the screen shake), in addition to small one-pixel displacements based on Mario's powerup status and walking animation frame.
|$7E0082||3 bytes||Pointer||Points to how steep the various slopes are and which parts of the slopes they represent. Points to $00:E5C8 in tilesets 0 and 7, and $00:E55E in others.
The table this one points to has one byte per block, from tile 16E to tile 1D7.
The value in these tables is then multiplied by 16, the lowest nibble of the sprite/player X position is added, and this is then used as an index to $00:E632 to tell how many pixels the sprite/player should move down from the nearest 16x16 tile.
|$7E0085||1 byte||Flag||Water level flag. #$00 = No; #$01 = Yes.|
|$7E0086||1 byte||Flag||Slippery level flag. #$00 = No; #$01 through #$7F = Half-slippery; #$80 through #$FF = Yes. Possible values in the clean ROM are #$00 and #$80.|
|$7E0087||1 byte||Empty||Empty. Cleared on reset, titlescreen load, overworld load and level load.
Note that this address is used as freeram by the SA-1 patch.
|$7E0088||1 byte||Player||How long player goes into a pipe until he warps to another level.
Also used as a timer in the castle destruction scenes for holding inputs.
|$7E0089||1 byte||Player||Action to take when the player enters or exits from a pipe.
#$00 = Enter a right-facing horizontal pipe.
#$01 = Enter a left-facing horizontal pipe.
#$02 = Enter a down-facing vertical pipe.
#$03 = Enter an up-facing vertical pipe.
#$04 = Exit from a left-facing horizontal pipe.
#$05 = Exit from a right-facing horizontal pipe.
#$06 = Exit from an up-facing vertical pipe.
#$07 = Exit from a down-facing vertical pipe.
Serves as a timer for the No Yoshi cutscenes for each controller command (for the table at $00:C848).
|$7E008A||3 bytes||Misc.||Used for quite a number of things.
Altogether, it's a 24-bit pointer to the location of the compressed graphics files inside the ROM.
Furthermore, these addresses all appear to be used as scratch RAM. For example, solely $7E:008A is used as number of options to select in a blinking cursor menu.
|$7E008D||3 bytes||Misc.||This forms a 24-bit pointer to part of the decompressed graphics; starts at $7E:ACFE/F and keeps decrementing.
The three seperate RAM addresses have multiple purposes, however.
-During code at $00E940, $8F is a backup of $72 (player in the air flag). The code at $00EC06 is used for detecting when entering doors.
|$7E0090||1 byte||Player||Player Y position within a block. Calculated with $7E:0096 & #$0F. Indicates whether the player is touching the top or the bottom of the block.|
|$7E0091||1 byte||Player||The direction to move the player out of a block.
#$01-#$07 are up, #$08-#$0F are down. Directly storing to it is ineffective as $7E:0090 will be used to overwrite it at $00:EE19.
|$7E0092||1 byte||Player||Player X position within a block. Calculated with $7E:0094 + #$08 & #$0F.|
|$7E0093||1 byte||Player||The side of a block the player is on. It's set to #$00 for the right side and #$01 for the left side. This address is relative to the block the player is currently inside.|
|$7E0094||2 bytes||Player||Player X position (16-bit) within the level, next frame (calculates player position one frame ahead, as opposed to $7E:00D1).
It's also used as a player X position on-screen on the overworld border.
|$7E0096||2 bytes||Player||Player Y position (16-bit) within the level, next frame (calculates player position one frame ahead, as opposed to $7E:00D3).
It's also used as a player Y position on-screen on the overworld border.
|$7E0098||4 bytes||Misc.||Position (in pixels) of the collision point currently being processed for player interaction with blocks in the level. Also used in the creation of various sprite types/other blocks.
$98-$99: 16-bit Y position
$9A-$9B: 16-bit X position
Note that this position is with respect to the top left of the layer being processed. Hence, if Layer 1 and Layer 2 are offset from each other, this value will differ between the two, even when Mario is at the same position with respect to the level.
Also note that, in vertical levels, the X and Y position may be swapped after running certain block changing routines (e.g. $00BEB0 or the ChangeMap16 routine included with various tools).
|$7E009C||1 byte||Blocks||Map16 tile to generate (used with $00:BEB0).||Valid Values|
|$7E009D||1 byte||Flag||Lock animation and sprites flag. Most codes will still run if this is set, but almost nothing will move or animate.|
|$7E009E||12 bytes||Sprites||Sprite number, or Acts Like setting for custom sprites.|
|$7E00AA||12 bytes||Sprites||Sprite Y speed table.|
|$7E00B6||12 bytes||Sprites||Sprite X speed table.|
|$7E00C2||12 bytes||Sprites||Miscellaneous sprite table. In SMW, it's commonly used as a pointer to different parts of a sprite. More information can be found here.|
|$7E00CE||3 bytes||Pointer||24-bit pointer to level's sprite data.|
|$7E00D1||2 bytes||Player||Player X position (16-bit) within the level, current frame (as opposed to $7E:0094).|
|$7E00D3||2 bytes||Player||Player Y position (16-bit) within the level, current frame (as opposed to $7E:0096).|