Super Mario Bros.
Nintendo's 1985 side-scrolling platformer for the Famicom and NES.
On this page
The atlas reads Super Mario Bros. through doppelganger’s annotated disassembly, SMBDIS.ASM, in Xkeeper’s reorganized copy for asm6f. Every label and most comments cited here are doppelganger’s. Jdaster64’s chart, “A Complete Guide to SMB’s Physics Engine”, is the secondary cross-check. It matches the code on every vertical value here but differs on the fast-jump threshold1 and the top speeds2 (see Super Mario Bros. (1985)).
#Jumping
A jump starts only on the frame A goes down while Mario is standing3. His speed then picks one of three distinct jumps1. Variable jump height comes from two gravities: a light one while A is held, and a heavier one for the rest of the jump after release4.
Vertical motion is 8.8 fixed point with a byte of subpixel position5. Falling speed is capped at 4 px/frame6. Nothing in the jump code gives a coyote time window after Mario walks off a ledge7.
References
- ^ ab
InitJSpicks one of five jump rows by take-off horizontal speed, stepping up at$09,$10,$19, and$1C. T3Xkeeper0/smb1 · src/prg.asm L4943–4955Jdaster64 n.d. · JUMPING/VERTICAL PHYSICS, Mario table - ^Mario's top ground speed is
$18walking and$28running (B held). T3Xkeeper0/smb1 · src/prg.asm L4873–4874, L5000–5014Jdaster64 n.d. · SMB PHYSICS 101 / GROUND PHYSICS, Mario table - ^A jump starts only on the frame A goes down while Mario is grounded;
InitJSzeroes the vertical subpixel and sets the jumping state. T3Xkeeper0/smb1 · src/prg.asm L4913–4923, L4931–4942, L4139–4141 - ^
JumpSwimSubswaps in falling gravity, never back, once speed is zero or downward, or once A is not held both this frame and last after aDiffToHaltJumprise. T3Xkeeper0/smb1 · src/prg.asm L4756–4769Jdaster64 n.d. · JUMPING/VERTICAL PHYSICS - ^Vertical motion is 8.8 fixed point; each frame,
ImposeGravityadds speed to position, the fraction via theYMF_Dummysubpixel byte, then gravity to speed. T3Xkeeper0/smb1 · src/prg.asm L6666–6687 - ^
MovePlayerVerticallygivesImposeGravitya maximum fall speed of 4 px/frame for Mario. T3Xkeeper0/smb1 · src/prg.asm L6547–6550, L6688–6696Jdaster64 n.d. · JUMPING/VERTICAL PHYSICS - ^Mario gets no grace window after leaving a ledge;
ProcJumpingrefuses airborne jumps unless he is swimming. T3Xkeeper0/smb1 · src/prg.asm L4921–4925 - ^Swimming jumps use row 5 of the jump tables, or row 6 in a whirlpool. T3Xkeeper0/smb1 · src/prg.asm L4959–4964
Sources
Code
- doppelganger and Xkeeper. 2022. “smb1: Super Mario Bros. disassembly for asm6f (Xkeeper0/smb1).” Commit 1cc3c92. Xkeeper0/smb1 @ 1cc3c92 · licence, all uses
Secondary
- Jdaster64. n.d. “A Complete Guide to SMB's Physics Engine.” original · archived · licence, all uses