View Page Source

Revision (current)
Last Updated by feos on 1/7/2023 12:17 PM
Back to Page

The purpose of this page is to document tricks and information of the games based on the Super Mario Bros. engine, including the Japanese version of Super Mario Bros. 2 (also known as "Lost levels").

[if:0][module:diggbutton|urn=gaming_news/Super_Mario_Bros_Tricks_in_Animated_GIFS]
[module:diggbutton|urn=gaming_news/Over_30_Super_Mario_Bros._Glitches_Explained][endif]

To have a fuller list of known tricks, and because of the nature of this site, we introduce here from the easiest tricks
to ones that are nearly impossibly difficult to play in real play, but are useful
in the making of tool-assisted speedruns. For some of the tricks,
a [Glossary|frame advance] feature in an emulator is required.

Due to the similarity of the game engine between SMB and SMB2J, all of the tricks below also apply to SMB2J, if not specifically stated.

%%TAB Table of contents%%

%%TOC%%

%%TAB List of games%%

Games:
* SMB1  = NES Super Mario Bros
* SMB2J = [FDS] Super Mario Bros 2 (also known as "Lost levels")

The SNES ports of these games contain almost the same physics
as their NES/FDS counterparts, so you can use most of them
in SNES Super Mario All Stars as well.

__Note: To see movies of game completions using these tricks, click [Movies-1715M-1882M-1962M-2627M-1365M-1336M-2210M-2977M-2676M|here].__

This page focuses mainly on Super Mario Bros. and Super Mario Bros. 2 (J).
See here for trick pages of other Mario games:

* [GameResources/NES/SuperMarioBros3|NES Super Mario Bros 3]
* [GameResources/SNES/SuperMarioWorld|SNES Super Mario World]
* [GameResources/NES/SuperMarioBros2|NES Super Mario Bros 2 (USA)]
* [GameResources/GB/SuperMarioLand|GB Super Mario Land]

%%TAB_END%%

!! Walljump

[https://files.tasvideos.org/gameresources/nes/smb/smb_walljump.gif|right]
[https://files.tasvideos.org/gameresources/nes/smb/smb_walljump2.gif|left]
Walljump is when you jump towards a wall and somehow Mario's foot catches
the wall and allows you to jump again, boosting from the wall.
The walljump in the left image is easy to try even on the real console.
In the right image (using a custom map), three walljumps are performed.
%%% %%% %%% %%% 

Theory: %%%
Walljump happens because the game does a floor check (a simple "is there a solid block below him?" test) even during a wall-ejection.
Wall-ejection is SMB's mechanism to push Mario out of a wall when he entered it partially. The game ejects Mario towards the opposite of his steering.

To perform a walljump, three things are required:
* Some horizontal speed towards the wall (facing right: X speed > 16, facing left: X speed < 240)
* Mario's feet must hit the wall at a block boundary (every 16 pixels)
* Some luck to make Mario go into the wall a little bit (at least for 1 pixel)

It's possible to perform walljump from any non-lethal solid material (bricks, pipes, etc.)
To do a walljump from entering the underground section of a level, hold Left for 6-7 frames, release for one frame, then press Left and hold it until you can jump.
----
[http://i.imgur.com/XSiuElM.gif|right]
!! Flagpole glitch

Complete the level without lowering the flag by glitching into the base block of the flagpole and touch the flapole from inside. Doing so is faster than lowering the flag. The points you get from the flagpole will be only 100. This trick isn't used in 8-3 of the [1715M|warped run], since the timer would turn 343 which results in fireworks. The flagpole glitch was originally found by [user:klmz].
%%% %%% %%% %%% %%% %%% %%% %%% %%% %%%

[http://i.imgur.com/zKaWQSL.gif|right]
!! Flagpole glitch using an enemy

Koopa Troopas and Bullet Bills can be useful for flagpole glitching. When Mario enters the block at the flagpole with proper height, the "walking to the castle" sequence will be skipped. Landing on shells results in a higher bounce than Bullet Bills, so in order to use shells for this version of the flagpole glitch, you need to be inside the block at the flagpole already, at the moment you bounce off.


%%% %%% %%% %%% %%% %%% %%% %%% %%% %%%
----
!! Vine teleporting glitch

[https://files.tasvideos.org/gameresources/nes/smb/smb_vinewrap.gif|right]
If you touch a vine at the extreme left edge of
the screen, you'll be transported to the right edge.

Uses: In 4-2 of SMB1, hit the vine block and get up on the ceiling.
Walk to the right so that about half of the vine block
gets scrolled off the screen, and the vine will disappear.
Go back to the left and touch the vine, and if you went the correct amount
to the right, you'll be teleported to the extreme right edge of the screen.
If you misestimated the amount, you'll get stuck in the left edge of the screen.
----
!! Alternate pipe glitches

The alternate pipe glitch occurs when a pipe takes you to
somewhere other than where it was intended to.

Theory: The game can have only one "entry point" (a pipe or vine) per screen.
The reason lies in how the game is designed: There is just one global variable
in the game RAM that determines where pipes or vines in the current screen lead.
Once the screen scrolls far enough for the next target label to be
loaded from the level data, all entry points in the current screen will
lead to that place.

* If Mario is far on the right side of the screen, the entry point variable will be out of date, so a new entry point will lead to the target of the previous one (Example: In 4-2 of SMB1, if Mario is far enough on the right side of the screen, he can use the pipe to go to the warp room since the destination info of the vine is still valid. Making the vine appear is not required for this glitch. The only thing needed is that the screen hasn't scrolled too far when the pipe is entered.)
* If the screen is ahead of Mario (Mario is on the left side of screen), the variable will have updated too soon, so you can access a future entry point's target from an earlier entry point. (Example: In 8-4 of SMB1, in the area before the water area, instead of going in the pipe after the lava pit, go a little past the previous pipe, and then turn around and go in that pipe, and it will take you to the water area instead of taking you back to the beginning of the level.)

! Methods of moving to the right side of the screen

* Teleport to the right edge of the screen the vine glitch (explained above).
* If you enter a wall, the wall will automatically transport Mario towards the right edge of the screen without scrolling.
* If Mario bumps into the left edge of an obstacle (wall, pipe, coin block etc.) while jumping, the screen scrolling will momentarily stop even if Mario continues to move to the right. Since Mario accelerates faster into the direction he doesn't face to, you should use this trick while jumping backwards (Mario faces to the left).

----
!! Going through bricks

There are several occasions when Mario can partially or even
completely enter a solid object (brick, question mark block, etc).

The easiest of them, though not very useful, is to stand under a brick
so that less than half of Mario is under the brick, and then jump up.
Mario will not hit the brick, and will get pushed away
from the brick instead. When the pushing away effect happens, if you try to manually steer away from the brick, the brick actually pulls you inside instead of ejecting.

This is a basic technique which has many uses.

[TODO]: Explain the flagpole glitches with images (might need to merge "Going through bricks" and "Flagpole glitch").

[https://files.tasvideos.org/gameresources/nes/smb/smb_toad.gif|right]
! Application: Catch a power-up before it appears

If you are quick enough, you can catch the bonus item through the block
even before it has completely exited from the block it came from.

In the example image on the right, you can see that it's also possible
to jump again after getting a mushroom or fire flower (have the "A"-button pressed at the end of the transformation).
%%%%

! Application: Jump into a solid object below a floor

[https://files.tasvideos.org/gameresources/nes/smb/smb_floor.gif|right]
For the purpose of this glitch, any solid object (including pipes) counts as a floor.

It is really difficult to perform (much harder than the walljump),
but here are the instructions.

# You need proper speed. If the object is only 2 blocks tall, such as the pipe in the end of 1-2, you can not jump into it while running. Use the left+right trick to deaccelerate quickly before jumping. If you have too high speed, you'll just find yourself standing on top of the object instead of inside it.
# You need the right position. The right position is: as near as possible. You are too near, if when you jump toward the object, you'll bump into it without getting ejected pixel by pixel.
# Immediately when the wall starts ejecting Mario, start steering away from it. This causes the wall to pull you in instead of push you out.
# Immediately after your vertical movement stops, start moving to the direction you want to go. If the wall is ejecting you now, you failed some of the previous steps.

The easiest way to perform this trick is into 2-block tall obstacles at walking speed.
[https://files.tasvideos.org/gameresources/nes/smb/smbtricks/smb_walljump_illustration.png|right]
# Do a minimal height jump (hold A for 1 frame) at the exactly right distance.
#* You are too close, if you bump into the wall without a chance to counter the ejection.
#* You held A for more than 1 frame (or your jumping platform was less than 2 block distance far from the floor), if you land on top of the floor.
# When the wall would start ejecting, hold to the opposite direction from the obstacle.
# Once Mario lands into the wall, start walking normally.
#* If the wall just ejects Mario, you were too far from the wall when you jumped.

[https://files.tasvideos.org/gameresources/nes/smb/smb_swimofdeath.gif|right]
This trick is apparently also possible in SMB3 (noticed against some water
level end pipes).

A special case of this trick is called 'the swim of death', as demonstrated
in the image on the right. The physics of Super Mario Bros is nearly the
same in air and in water, and thus walls can be entered in water too.

[TODO]: Add other swimming tricks.

%%%% %%%

! Application: Jump into a wall just below a solid ceiling and walk through it

[https://files.tasvideos.org/gameresources/nes/smb/smb_corner.gif|right]
-> __With small Mario__

To perform the trick, do a walljump into the wall position right
below the ceiling. When you get foothold, jump immediately.
When you land, jump again. When you land again, jump again. Usually
three or four jumps are enough before you can walk through the wall.
Each jump takes you deeper into the wall.

During each of the jumps, you need to steer heavily to the opposite
direction you're going to. Otherwise the wall will eject Mario.
[https://files.tasvideos.org/gameresources/nes/smb/smb_corner2.gif|right]
> Note: Steering only has effect during a jump (i.e. when Mario is not
> standing or walking). If Mario is standing, the direction of ejection
> is determined by the location of his upper body in relation to the
> left edge of the wall. (If it's partially out from the wall, he'll
> be ejected to the left (unstoppable unless you jump).
> Otherwise, he'll be ejected to the right (stoppable, speedable).
%%% %%% %%% %%%

[https://files.tasvideos.org/gameresources/nes/smb/smb_minusentry2.gif|right]
-> __With big Mario__

As demonstrated in the right image, ''big'' Mario doesn't need to
do any of the complicated stuff that applied to when he is small.
When he is big, he can simply perform a duck-jump into the corner
and start walking. This is because his head will be well inside the
ceiling, enabling the ejection to the right. (If he ducks again before
he is fully inside the wall, he'll be ejected to the left instead.)

%%% %%% %%% %%%%

! Application: Jump into a solid wall and walk through it

[https://files.tasvideos.org/gameresources/nes/smb/smb_wall.gif|right]
It is possible to perform the wall-entry trick even without a ceiling. However, it requires extremely precise positioning and efficient speed. This is the hardest of all of the tricks.

Instructions:
You will need to have a proper X-subpixel position value for this to work. A subpixel is a position component which is not rendered onscreen. In this game, 16 subpixels make up 1 pixel. Now when you jump into a wall (not doing this trick), you might be pushed out immediately without having entered the wall at all. At other times you might have been able to be inside the wall partially. This is the result that you want when optimizing your X-subpixel position. You can press "left" for 1 frame while running to the right to decrease your subpixel value by one unit. Do this until jumping into a wall will result in Mario being partially inside the wall. If this condition is met, you can follow these instructions.

# Jump towards a wall, approach its edge as closely as possible right before you enter it, and become embeded in it as deep as possible at the first frame you have entered it. The required minimum depth is 3 pixels.
# Immediately when the wall starts ejecting you, start steering away from it. This causes the wall to pull you in instead of pushing you out.
# As soon as you land inside the wall, jump while moving away from the wall for 1 frame. You have to hit the block above you inside the wall. You may have to repeat doing this until you are so deep inside the wall that you will not be ejected out while you are walking forwards inside the wall.
#* If you can't hit the solid block above when jumping, you will be ejected out. You will need to try again from the start.
# After you have entered the wall deep enough, start moving in the direction you want to go as soon as you land. If the wall is ejecting you now, you failed the previous steps.

[https://files.tasvideos.org/gameresources/nes/smb/smb_lefthole.gif|right]
! Application: Off-screen wall climbing

This trick is trivial to perform. When there is a hole on the left side of
the screen, you can cram Mario in between of the screen edge and the wall,
and climb upwards the hole. Mario will be unable to fall down. It can be
used to reach the ceiling of the dungeon in places where there normally
is no route to the ceiling.

By jumping repeatedly and steering to the left, it can also be used to
enter the wall, as shown in the right example image.

Aside from brick walls, it works with other solid walls too.
%%% %%% %%% %%%

----
!! Accelerating faster

When you need to accelerate from zero speed, you can do it faster if you
jump a ''small jump backwards'' and steer to the opposite direction Mario
is facing. This can be used to start a level faster, to accelerate faster after exiting a pipe and to complete a walljump faster.

Press "left" and "right" for 1 frame. Press the "A"-button for 1 frame to make a small jump to the right. Start holding the "B"-button. When landing on the ground you will need to face backwards for one frame (without holding the "B"-button). The next frame you can start jumping again, holding the "B"-button and you will have gained running speed.

[TODO]: Add images (level beginning & walljump)

----
!! Shooting faster

By pressing right+left at
the same time, you can shoot to the left and the shots travel
horizontally at twice the normal speed.
It looks very aggressive, compared to the normal
merrily bouncing fire balls. Though, this technique is more userful in water levels
since it doesn't slow down Mario.
%%% 

----
[https://files.tasvideos.org/gameresources/nes/smb/smb_hatstomp2.gif|right]
!! "Stomping" enemies from below

You don't need to land on the top of an enemy to kill it.
As long as you're moving downward as you hit the enemy, you'll kill it.
If you time it just right, sometimes you can even hit the bottom of the enemy.
This is useful for killing enemies that seem to be too high to jump on.
%%% %%% %%%

[https://files.tasvideos.org/gameresources/nes/smb/koopajump.gif|left]
%%% %%%
! Special case: Moustache stomp

This is not a walljump. This image illustrates how "landing" on a turtle at the %%%
right time can save Mario's life, even if it is only his moustache that lands
on the turtle.
%%% %%%

----
!! Walking inside enemies

[https://files.tasvideos.org/gameresources/nes/smb/smb_turtlewalk.gif|right]
When you stomp an enemy, the enemy becomes a friend for a short while,
so if you stomp it from below, %%% you don't need to worry about being
immediately killed by it when you bounce upwards.

In fact, you can sometimes get inside an enemy right after stomping it, %%%
and the enemy doesn't harm you as long as you are inside it.
----
!! Bouncing high off turtles

[https://files.tasvideos.org/gameresources/nes/smb/smb_talljump.gif|right]
How it's done: If you jump toward a turtle while it's in the air,
you can stomp it while moving upward and keep moving upward.
The maximum height that you'll be able to reach if you keep holding
down A depends on the exact frame that you made your jump and which
part of the turtle you hit, so if you aren't bouncing high enough,
keep adjusting your jump.

This is useful for being able to get over an obstacle or landing on
another enemy after bouncing off a turtle.

In SMB2j, due to the high bouncing force, when hitting
enemies like flying Koopa Troopas in upward motion, you'll gain a lot of vertical velocity that sometimes takes Mario or Luigi straight to the sky.

[https://files.tasvideos.org/gameresources/nes/smb3/smb3_talljump.gif]

----
!! Jumping through hammers

How it's done: The game does a very poor job of detecting collisions
with hammers, so sometimes you can go through a hammer without getting hit,
and sometimes you can completely miss a hammer and still get hit.

Bowser will start throwing hammers beginning from 6-4. Even if it looks
like there's no gap in the stream of hammers, it's still likely that
you'll be able to get through without taking a hit.

It is easier if you are small or ducking, due to the smaller hitbox.

[TODO]: Add image.

----
!! Turning around quickly

Press left and right simultaneously for 1 frame.

When you press left+right, you'll start walking backwards to the right.
The running speed
is instantly reduced to a walking speed or even slower.
This allows for a ''much'' more sudden braking. It can be applied
anywhere where you need to brake quickly.

----
!! Avoiding fireworks

In SMB1, fireworks come when a level is completed
with the last digit of the timer at 1, 3, or 6.

In SMB2j, fireworks come when the last digit of your coin counter
matches the last digit of the timer.

Getting more than one fireworks wastes time, therefore it should be avoid. For example, in 8-3 of the [1715M|warped run], the flagpole glitch is not used to avoid 3 fireworks, while in the console speedrun, usually the runners choose to slow down to wait for the last digit of the timer to turn to 2. However, a single firework usually doesn't waste time, except in some very special cases.

----
[https://files.tasvideos.org/gameresources/nes/smb/smb_sliding.gif|right]
!! Sliding on one foot

This is a well-known trick which requires the fiery Mario.
When you start a level or exit from a pipe, hold B and jump, and continue holding B. When you move, Mario will slide instead of running, for some time.
This trick is trivial to do on the real console.
%%% %%% %%% %%% %%%

----
[https://files.tasvideos.org/smbgameresources/nes/smb/smb_lip.gif|left]
!! Lip jumps

It is possible to stand on the edge of a pipe even where's a plant
coming out of the pipe. There are a few pixels of room at both sides
of the pipe. You can land on it, and jump immediately again.
%%% %%% %%% %%% %%% %%% %%%

----
!! The "21 frame rule"

In SMB1 and SMB2j, every time the screen blacks out (entering a new level), the game delays for a varying amount of time.

The delay is actually calculated so that the current playing
progress will be rounded up to next 21 frame boundary.

As an example, this means that if you complete a level in
* 1 frames, the level length will be N+21 frames
* 15 frames, the level length will be N+21 frames
* 20 frames, the level length will be N+21 frames
* 21 frames, the level length will be N+21 frames
* 22 frames, the level length will be N+42 frames
* 30 frames, the level length will be N+42 frames
* 42 frames, the level length will be N+42 frames
* 43 frames, the level length will be N+63 frames
And so on, where N is a constant minimum length of the black screen.

Therefore, the only part of the game that can be improved by a time
less than 21 frames is the entire last level.

----
[http://i.imgur.com/GmhxY5b.gif|right]
!! Walking in place (Moonwalking)

See level 8-4 of [user:HappyLee]'s [1332M|SMB walkathon TAS] for a demonstration.

This kind of moonwalk where Mario is walking in place without further input is a special state which can be achieved by pressing "left" and "right". It happens sometimes when you slow down the speed on the ground with "left" and "right". While walking in place, the X-speed goes "1, 255, 1, 255..."and it will never stop, so the X-subpixel goes "x, x-16 ,x, x-16...". When "x"=0, "x-16" turns to be 240, so the X-pixel has changed. Mario is shaking and the screen begins to scroll. This is what makes the moonwalk trick useful, because the screen scrolls without further actions.
%%% %%% %%% %%% %%%

----
[http://i.imgur.com/WgsOLjl.gif|right]
!! Firebar hiding trick 

Sometimes Mario can come out safe after seemly touching a Firebar, mostly because the spinning of the Firebar isn't as smooth as it seems. In the image on the right, The Firebar moves too fast to hurt Mario because there is no frame rendered where Mario is "inside" the firebar.
%%% %%% %%% %%% %%% %%% %%% %%% %%% %%% %%%

----
!! Small fiery Mario / negative Mushroom

(The following explanation is [http://en.wikipedia.org/w/index.php?title=Super_Mario_Bros.&oldid=27944018#Little_Fiery_Mario|copied from Wikipedia]. It is a good explanation, but someone seems to stick to that it is “fan cruft” and does not belong into an encyclopedia. Thus copying it here instead of linking to the Wikipedia article.)

Internal to the game, Mario’s powerup state is recorded
in two independent variables; one describes size (0=regular; 1=super) and
the other tracks the ‘upgrade state’ (0=need mushroom; 1=need flower; 2=has flower).
The ‘size’ decides the sprite (small on 0; big on 1) used for Mario;
the ‘upgrade state’ decides what powerup will come out of a block
(mushroom on 0; flower on 1 or 2) and what will happen when Mario
is hit (die on 0; switch ‘size' and clear ‘upgrade state’ on 1).

These states can be knocked out of synchronization.
The game checks for all sprite collisions, knocks the ‘upgrade state’ to 0
if it hits, and switches size only when all checks are done.
If Mario’s sprite strikes the King Koopa sprite and the bridge release
sprite in one frame, the game will register the collision between Mario and Koopa,
knock the ‘upgrade state’ to 0, register the collision between Mario and
the bridge release, and jump into the level complete loop that causes Mario
to walk to the right ― and never switches the ‘size’ variable.

If Mario was naturally large (state 1 or 2, size 1) when he hit the switch
he will stay large (state 0, size 1).
If he strikes an enemy he will die (because his ‘upgrade state’ is 0), but
he can break blocks. If he gets a mushroom, he will shrink and be unable
to hit blocks; if he is hit now, he will grow again.
If he gets a fire flower, his palette will be changed and he will be able
to shoot (but the game will use the large image for shooting; it will, however,
keep Mario’s small feet if Mario is moving). Mario will now be Little Fiery Mario.

If Mario was naturally small (state 0, size 0) when he hit the switch, he
will appear to die but the level will still be beat and he will not lose a life.
If Mario was unnaturally small (state 1 or 2, size 0) when he hit the switch
(that is, if he does this trick twice), he will revert to his normal form.
When Mario dies his size is set small and his state is set unupgraded,
no matter how he died or what his state was before.

Using the third part only of a 3-code Game Genie code for “Always Stay Big”
will produce similar results (the code is SZLIVO). As long as Mario has
gained a power-up, he will become small when hit, then grow when hit a
second time. This is a much simpler way to view the “Little Fiery Mario” quirk.

This glitch appears to have been fixed in the Super Mario All-Stars version,
though the two-variable mechanism behind it still exists.
----
!! The Minus World (SMB1)

This is a well-known glitch which occurs when Mario glitches behind the wall in 1-2 in SMB1 and enters the first pipe.

The minus world is basically just a random location of the game ROM,
it is not a real world. It wasn't designed that way ― it's just an oversight
of the programmers that you can get into the pipe before the correct warp labels
are assigned.

In the NES version of Super Mario Bros., the "minus world" was a looping, uncompleteable copy of world 2-2. In the [1105M|FDS version], however, it is an underwater 1-3, 2-3, and an underground 4-4, making it completable. Completing the game this way would give the "in another castle" message, but would return to the title screen as if 8-4 had been beaten; hard mode and the level become accessible, as well.

----
!! Low-Gravity Mario

When a level starts, Mario is in a special state regarding falling speed until he jumps for the first time. He regains this state whenever there is a screen transition (when a new level starts or after exiting a pipe). This is not useful for speedrunning, though it is featured in the [3556S|"minimum buttons pressed" submission].

[TODO]: Add image (1-1 after exiting the pipe, landing on the two goombas).

----
!! Koopa walking in mid-air

Usually, when a shell is being landed on in mid-air, it will just turn around and continue falling down. But if a shell is being landed on at the bottom of the screen (within the first two rows of blocks), the shell will not be falling down anymore, mysteriously. When the Koopa Troopa starts walking, he will be walking in mid-air and he will be able to walk through solid obstacles.

[TODO]: Add image.

----
!! Enemies, firebars, or platforms not appearing

Sometimes enemies or objects will not appear when they are supposed to normally. When there are 5 or more object sprites on the screen (this can include firebars, fireballs, and platforms) this will occur. One of the most bizarre cases of this is seen in level 4-4 of SMB2J. If you approach Bowser the moment 5 other sprites are on screen, Bowser will not spawn, as if you've already defeated him.

[TODO]: Add image.

----
!! Things to add in the future 

* items not appearing
* trampoline glitch
* Lift glitches (4-3 oddities)
* Transforming Spineys into Koopas + Goombas to dead Koopas
* "Silk glitch" (bullet stuck in mid-air)
* Vertical screen wraparound, also smb2j lift glitches
* Alternate music level ending (trick/glitch?)
* Inside flagpole without activating end
* Using screen edge+block to climb upwards
* Ducking in water
* Getting inside of enemies (few different ways)
* Killing enemies twice
* Dying twice
* Win/lose at same time
* Entering floors (use of invisible blocks)
* Shell combo-ing/interesting notes
* Flagpole death finish (die continuously and win)
* Jumping Koopas moving unusual directions
* Changing Enemy movement by getting hit
* Scaling walls vertically
* Making items/enemies fall through blocks
* Jumping through ceilings (use of mushroom jump)
* Vine types and other glitches (what vine does when L+R is used, strange vines)
* Running/walking over gaps
* Using springs to go through ceilings
* Falling downward through certain block patterns
* Stupid Squid
* Getting Stuck in odd places
* Going through walls (while on a moving platform or with wind - smb2j)
* Correct Maze patterns may not always work
* New area reload from mazes (disappearing enemies/fireballs)
* Bowser killed with 3 fireballs instead of 5
* 1-up appearances x-1 levels
* Above/below screen jumping/shooting won't work
* Getting too many lives
* Never ending levels (no timer trigger)
* Flagpole wraparound glitch
* getting hit while going to -1 world (firey small mario)

----
!!Background Blocks

%%TAB Item display script (FCEUX)

%%SRC_EMBED lua
-- NES Super Mario Bros. / FDS Super Mario Bros. 2 (Japan)
-- item display script
-- feos, 2023

local SMB   = false
local SMB2J = false

function CheckBlock(block)
	if SMB then
		if block == 0x55 or block == 0x5A or block == 0xC1 then return "MF" end
		if block == 0x57 or block == 0x5C                  then return "ST" end
		if block == 0x59 or block == 0x5E or block == 0x60 then return "1U" end
		if block == 0                                      then return ""   end
	--	return string.format("%X", block)
	elseif SMB2J then
		if block == 0x52 or block == 0x58 or block == 0x61 or block == 0xC1 then return "MF" end
		if block == 0x53 or block == 0x59 or block == 0x60 or block == 0xC2 then return "PO" end
		if block == 0x55 or block == 0x5B                                   then return "ST" end
		if block == 0x57 or block == 0x5D or block == 0x5F                  then return "1U" end
		if block == 0                                                       then return ""   end
	--	return string.format("%X", block)
	end
	return ""
end

gui.register(function()
	SMB   = memory.readbyte(0x8000) == 0x78
	SMB2J = memory.readbyte(0x8000) == 0xAD or memory.readbyte(0x8000) == 0
	local scroll = memory.readbyte(0x73f)+0x100*(memory.readbyte(0x71a)%2)
	for column = 0, 47 do
		local offset = 0x500 + column + (math.floor(column / 16) * 0xc0)
		if column > 31 then offset = offset - 0xd0*2 end		
		for row = 0, 12 do
			local address  = offset + row * 16
			local block    = memory.readbyte(address)
			local mnemonic = CheckBlock(block)
			if mnemonic ~= "" then
				gui.text(
					column * 16 + 2 - scroll,
					row    * 16 + 2 + 32,
					mnemonic)
				gui.drawbox(
					column * 16 - scroll,
					row    * 16 + 32,
					column * 16 - scroll + 15,
					row    * 16 + 32     + 15,
					0x00ff0000)
			end
		end
	end
end)
%%END_EMBED

%%TAB Block values (hexadecimal)

|| SMB || SMB2J || Meaning
| 00   | 00     | nothing
| 10   | 10     | PIPE top portal
| 11   | 11     | PIPE top portal
| 12   | 12     | PIPE top
| 13   | 13     | PIPE top
| 14   | 14     | PIPE
| 15   | 15     | PIPE
| 16   | 16     | TERRAIN hill
| 17   | 17     | TERRAIN hill
| 18   | 18     | TERRAIN hill
| 1C   | 19     | PIPE side portal
| 1D   | 1A     | PIPE
| 1E   | 1B     | PIPE
| 1F   | 1C     | PIPE side portal
| 20   | 1D     | PIPE
| 21   | 1E     | PIPE
| 22   | 1F     | TERRAIN water
| 23   | 20     | BLOCK jumping
| 24   | 21     | FLAGPOLE top
| 25   | 22     | FLAGPOLE
| 26   | 23     | vine
| 51   | 4F     | BRICK
| 52   | 50     | BRICK/exit
| 54   | 6B     | TERRAIN
| 55   | 52     | BRICK mushroom/flower
| --   | 53     | BRICK poison
| 56   | 54     | BRICK vine
| 57   | 55     | BRICK star
| 58   | 56     | BRICK coin bunch
| 59   | 57     | BRICK 1up
| 5A   | 58     | BRICK mushroom/flower
| --   | 59     | BRICK poison
| 5B   | 5A     | BRICK vine
| 5C   | 5B     | BRICK star
| 5D   | 5C     | BRICK coin bunch
| 5E   | 5D     | BRICK 1up
| 5F   | 5E     | HIDDEN coin
| 60   | 58     | HIDDEN 1up
| --   | 60     | HIDDEN poison
| --   | 61     | HIDDEN mushroom/flower
| 61   | 62     | TERRAIN metal
| 62   | 63     | TERRAIN boss
| 63   | 64     | TERRAIN bridge
| 64   | 65     | cannon
| 65   | 66     | cannon
| 66   | 67     | TERRAIN cannon
| 67   | 68     | SPRING
| 68   | 69     | SPRING
| 69   | 6A     | TERRAIN water
| 6B   | 6D     | PIPE side water
| 6C   | 6E     | PIPE side water
| --   | 8A     | TERRAIN cloud
| 88   | 8B     | TERRAIN cloud
| --   | 8C     | TERRAIN cloud
| 89   | 89     | TERRAIN bridge boss
| C0   | C0     | BLOCK coin
| C1   | C1     | BLOCK mushroom/flower
| C2   | C3     | coin
| --   | C2     | BLOCK poison
| C3   | C4     | coin water
| C4   | C5     | BLOCK empty
| C5   | C6     | boss exit

%%TAB_END

----
!!Memory Addresses
[/UserFiles/Info/637935922185822998|BizHawk .wch File]