AddressDescriptionTypeSize
$7E0072Player is in the air flag, as well as the actual pose value to store to $13E0 while the player is in midair. This is set to a certain value depending on how the player got in the air in the first place, and in what state they are currently (rising or sinking). This address is not affected by phases such as climbing. It is, however, also used in swimming animation. Notable values: #$0B = Jumping/swimming upwards. #$0C = Shooting out of a slanted pipe, running at maximum speed. #$24 = Descending/sinking. NOTE: Hitting bottom-solid sprites like invisible solid block, message block etc. does NOT set $72 to this value as cape mario. 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 they're 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.Player1
$7E0077Player blocked status. Used to check which sides of Mario are being blocked by solid tiles. Format: S--M^v<>
  • M - Mario is inside of a tile (BodyInside).
  • ^ - There is a tile above Mario (MarioBelow / HeadInside).
  • v - There is a tile below Mario (MarioAbove).
  • < - There is a tile to the left of Mario (MarioSide).
  • > - There is a tile to the right of Mario (MarioSide / HeadInside).
  • S - Special bit indicating Mario is touching the side of the screen in a level that has horizontal scrolling disabled. Intended for autoscrollers.
The game kills Mario if the M, ^, and v bits are all set. If either the < or > bits are set, it will push Mario 1 pixel to the side per frame until he's out of the block. Note that tiles 11E (turnblock) and 152 (invisible solid block) are explicitly coded to never set the M bit.
Player1
$7E0098Position (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).Misc.4
$7E0D8216-bit pointer to the player palette. #$B2C8 = regular Mario; #$B2DC = regular Luigi; #$B2F0 = fire Mario; #$B304 = fire Luigi. Always uses #$00 for bank byte (the first bank).Pointer2
$7E0DA4Copy of controller data 2 ($7E:0017). Format: axlr----. a = A; x = X; l = L; r = R, 0 = null/unused. Note that the upper two bits are also used by controller data 1 at $7E:0015, so that A/B and X/Y are combined. Used by player 1 (Mario).I/O1
$7E0DA8Copy of controller data 2, one frame ($7E:0018). Format: axlr----. a = A; x = X; l = L; r = R, 0 = null/unused. Note that the sixth bit is also used by controller data 1 at $7E:0016, so that X/Y are combined. Used by player 1 (Mario).I/O1
$7E0DB3Which character is in play. #$00 = Mario; #$01 = Luigi. If you prefer Luigi to be #$04, use $7E:0DD6.Player1
$7E0F3424-bit scores for each player. $0F34 = Mario's score. $0F37 = Luigi's score. Note: This value is in hexadecimal and not decimal, so it needs to be converted before it can be displayed in-game. Additionally, this value is actually the score seen in the status bar divided by 10, as the "ones digit" SMW displays is actually just a static 0 tile.Counter6
$7E13DAAccumulating fraction bits for the player's X position. Generally, only the upper four bits are used (i.e. %xxxx0000), with the player's X speed ([url=https://smwc.me/m/smw/ram/7E007B]$7B[/url]) being added to it after shifting 4 bits to the left. This value can be thought of as "subpixels", or fractions of a pixel. The game shifts Mario's X position an extra pixel any time the value overflows after adding his X speed in the routine at [url=https://smwc.me/m/smw/rom/00DC2D]$00DC4F[/url]. Note that the lower 4 bits may still end up non-zero if the player is pushed by the sides of the screen in an autoscrolling level.Player1
$7E13DBPlayer walking/running frame. As the player runs, this will cycle between 0 and the maximum defined by the table at [url=https://smwc.me/m/smw/rom/00DC78]$00DC78[/url] (indexed by the player's powerup). By default, small Mario cycles between 0 and 1, while other powerups cycle 0-2-1-0. The speed at which it cycles is managed by [url=https://smwc.me/m/smw/ram/7E1496]$1496[/url], which obtains its rate from the table at [url=https://smwc.me/m/smw/rom/00DC7C]$00DC7C[/url].Player1
$7E13DCAccumulating fraction bits for the player's Y position, though the game only ever uses the the upper four bits (i.e. %yyyy0000), with the player's Y speed ([url=https://smwc.me/m/smw/ram/7E007D]$7D[/url]) being added to it after shifting 4 bits to the left. This value can be thought of as "subpixels", i.e. fractions of a pixel. The game shifts Mario's Y position an extra pixel any time the value overflows after adding his Y speed in the routine at [url=https://smwc.me/m/smw/rom/00DC2D]$00DC4F[/url].Player1
$7E13E0This address controls the pose of Mario and Luigi. Writing to it will draw the player with the corresponding image. Notably:
  • Poses 40 and 41 are blank; the player is "invisible". These are indicated with a large red cross in the diagram.
  • Poses 2A-2F (flying) require the player to have a cape powerup, or they won't display properly.
  • Pose 42 (inflated, small) can be shown regardless of powerup. It is obviously not recommended to be used as such. The same can be said about pose 43 (inflated, big).
  • Poses 00, 3D and 46 are all used in the powerup animation.
  • Poses 14, 20, 21, 27, 28 and 29 are all used when riding Yoshi.
  • Poses 00-3C may differ in appearance between small, big/fire, and cape powerups. Poses 3D onwards do not.
  • Poses beyond 45 are not properly defined and are generally not recommended to use.
Player1
$7E13F9Used to control the graphical layer priority of the player. 01 will send him behind objects, 02 will send him behind objects and sprites, and 03 will only send him behind sprites. #$01 is also used to indicate Mario as being behind a net, meaning he'll only interact with sprites also behind nets (indicated by [url=https://smwc.me/m/smw/ram/7E1632]$1632[/url]). #$02 is used when entering pipes and #$03 is used on the overworld and after killing Bowser. Both of these disable sprite interaction entirely.Player1
$7E144ALayer 2 X speed used in the scrolling codes. #$0001-#$7FFF = move left; #$8000-#$FFFF = move right. #$0000 means there is no movement. $144A specifically is also used in the castle destruction cutscenes to indicate what sprite Mario is holding, if any, 00 indicates the egg, 01 indicates nothing, and anything greater indicates something else (e.g. the hammer or broom).Sprites2
$7E17BFHow much the X position of Layer 2 changed in the current frame. Used for moving Mario horizontally with Layer 2 when it has interaction. When using the Layer 3 tides with one of the horizontal autoscroll settings of LM's advanced Layer 3 bypass, this tracks the same information but for Layer 3 instead.Misc.1
$7E19B8Screen exit table, low bytes. Combined with the table at [url=https://smwc.me/m/smw/ram/7E19D8]$19D8[/url], this connects doors and exit-enabled pipes to their correct entrances. This table specifically contains the lower 8 bits of the destination level/secondary exit. This table is indexed by the screen number Mario is on. In regular horizontal levels, this is the high byte of his X position, and in vertical levels, the high byte of his Y position. With the expanded horizontal level mode setting added by LM v3.00+, the current screen number the player is on can be obtained by calling the routine at [url=https://smwc.me/m/smw/rom/03BA02]$03BCDC[/url].Misc.32
$7E19D8Screen exit table, high bytes. Combined with the table at [url=https://smwc.me/m/smw/ram/7E19B8]$19B8[/url], this connects doors and exit-enabled pipes to their correct entrances. This table specifically contains the upper 5 bits of the destination level/secondary exit, as well as some additional information about the exit, in the format HHHHwush:     h: High bit of destination level     HHHHh: High byte of destination secondary exit     s: Secondary exit flag     u: LM-modified flag (if unset, the entire byte is ignored and SMW's original exit system is used instead)     w: Water level flag (secondary exits) or midway flag* (primary exits) [size=8]* Only used if the destination level has "use seperate settings for midway entrance" set[/size] This table is indexed by the screen number Mario is on. In regular horizontal levels, this is the high byte of his X position, and in vertical levels, the high byte of his Y position. With the expanded horizontal level mode setting added by LM v3.00+, the current screen number the player is on can be obtained by calling the routine at [url=https://smwc.me/m/smw/rom/03BA02]$03BCDC[/url]. This table goes unused in the original game, although the h bit for each screen is still written. Instead, the original game just calculates high bit of the destination level/secondary exit based on whether the level is on the main map (0) or submap (1), and the s bit is controlled globally for the entire level by [url=https://smwc.me/m/smw/ram/7E1B93]$1B93[/url].Misc.32
$7E1F13Player animation on the overworld. $7E:1F13/4 form Mario's image and $7E:1F15/6 form Luigi's image. Note that the high bytes of the two (bytes 2 and 4, $7E:1F14 and $7E:1F16) are actually unused.Player4
$7EC800Map16 Low Byte Table. For the high bytes, see [url=https://smwc.me/m/smw/ram/7FC800]$7FC800[/url]. In horizontal levels, $1B0 tiles per screen, where each screen can be indexed using the format [code inline]%-------y yyyyxxxx[/code]. Addresses $7EFE00-$7EFFFF (512 bytes) are unused. In vertical levels, $200 bytes per screen, with the format [code inline]%--sssssx yyyyxxxx[/code]. All bytes are used. If Layer 2 or 3 is interactive in the level, it uses screens 10-1F (0E-1B in vertical levels). On Lunar Magic version 3+, refer to [url=https://www.smwcentral.net/?p=section&a=details&id=19816]this document[/url] for the layout in other level dimensions. [b]On the overworld:[/b] [code inline]$7EC800-$7ECFFF[/code] (2048 bytes) is used as the Layer 1 tilemap for the overworld. To index this table, use [url=https://smwc.me/m/smw/ram/7E1F11]$1F11[/url], [url=https://smwc.me/m/smw/ram/7E1F1F]$1F1F[/url], and [url=https://smwc.me/m/smw/ram/7E1F21]$1F21[/url] to find Mario (or [url=https://smwc.me/m/smw/ram/7E1F12]$1F12[/url], [url=https://smwc.me/m/smw/ram/7E1F23]$1F23[/url], and [url=https://smwc.me/m/smw/ram/7E1F25]$1F25[/url] for Luigi). X position / 16: [code inline]%---- ---- ---X xxxx[/code] Y position / 16: [code inline]%---- ---- ---Y yyyy[/code] Index to this table: [code inline]%---- -SYX yyyy xxxx[/code] * If the player is on a submap, the S bit is set. [code inline]$7ED000-$7ED7FF[/code] (2048 bytes) is used as a table that contains the translevel numbers for every Layer 1 tile, in the format of [url=https://smwc.me/m/smw/ram/7E13BF]$13BF[/url]. [code inline]$7ED800-$7EDFFF[/code] (2048 bytes) is used as a table that contains the path direction settings for every Layer 1 tile, in the format of [url=https://smwc.me/m/smw/rom/04D678]$04D678[/url]. [code inline]$7EE400-$7EEBFF[/code] (2048 bytes) is used for uploading the Layer 1 tile map to VRAM in 2KB chunks. One chunk is uploaded per frame for four frames during transitions between the main overworld and submaps. Data is refreshed after each DMA.Blocks14336