v0.1 ⌊ALPHA⌉
Cite as
Xkeeper0/smb1
Original
https://github.com/Xkeeper0/smb1
Pinned
Xkeeper0/smb1 @ 1cc3c92cbbe8cda44903657f3da332688e806a89
Accessed
2026-10-20
Licence
none stated (doppelganger's header says the file "is provided for your own use as-is")
Credit
Disassembly and comments by doppelganger (SMBDIS.ASM, "A Comprehensive Super Mario Bros. Disassembly"), who in turn thanks the nesdev scene, the authors of x816 and SMB Utility, and the reverse-engineers of the Super Mario Bros. Hacking Project. Xkeeper split it into files and made it build with asm6f.
Notes
Same code and comments as doppelganger's SMBDIS.ASM (mirrored at https://gist.github.com/1wErt3r/4048722, gist head 59e88c0028a58c6d7b9156749230ccac647bc7d4), reorganized; line numbers here refer to src/prg.asm and src/ram.asm in this repo.

Cited on

Claims (21)

A jump starts only on the frame A goes down while Mario is grounded; InitJS zeroes the vertical subpixel and sets the jumping state.src/prg.asm L4913–4923src/prg.asm L4931–4942src/prg.asm L4139–4141T3
InitJS picks one of five jump rows by take-off horizontal speed, stepping up at $09, $10, $19, and $1C.src/prg.asm L4943–4955T3
Horizontal speeds are 4.4 fixed point, whole pixels and sixteenths per frame; MoveObjectHorizontally shifts the sixteenths into the subpixel byte.src/prg.asm L6492–6503T3
Mario's top ground speed is $18 walking and $28 running (B held).src/prg.asm L4873–4874src/prg.asm L5000–5014T3
PlayerYSpdData starts a jump at −4 px/frame (rows 0–2) or −5 px/frame (rows 3–4).src/prg.asm L4864–4865src/prg.asm L4972–4973T3
InitMForceData gives jump rows 0–4 a zero speed fraction, so take-off is exactly −4.00 or −5.00 px/frame.src/prg.asm L4867–4868src/prg.asm L4970–4971T3
While a jump rises with A held, gravity is JumpMForceData's $20, $20, $1E, $28, $28 subpixels/frame² for rows 0–4.src/prg.asm L4858–4859src/prg.asm L4966–4967T3
After the switch, gravity is FallMForceData's $70, $70, $60, $90, $90 subpixels/frame² for rows 0–4.src/prg.asm L4861–4862src/prg.asm L4968–4969T3
In rows 0–1, the standing and slow jumps, held gravity is $20/256 = 0.125 px/frame².src/prg.asm L4858–4859src/prg.asm L6681–6687T3
In rows 0–1, falling gravity is $70/256 = 0.4375 px/frame².src/prg.asm L4861–4862src/prg.asm L6681–6687T3
In rows 0–1, falling gravity ($70) is 3.5 times held gravity ($20).src/prg.asm L4858–4862T4
JumpSwimSub swaps in falling gravity, never back, once speed is zero or downward, or once A is not held both this frame and last after a DiffToHaltJump rise.src/prg.asm L4756–4769T3
InitJS sets DiffToHaltJump to 1, so a release switches gravity only once Mario has risen at least 1 pixel.src/prg.asm L4957–4958T3
The press frame already moves Mario, since PlayerPhysicsSub starts the jump before the state dispatch runs JumpSwimSub and MovePlayerVertically.src/prg.asm L4713–4725src/prg.asm L4796T3
Vertical motion is 8.8 fixed point; each frame, ImposeGravity adds speed to position, the fraction via the YMF_Dummy subpixel byte, then gravity to speed.src/prg.asm L6666–6687T3
MovePlayerVertically gives ImposeGravity a maximum fall speed of 4 px/frame for Mario.src/prg.asm L6547–6550src/prg.asm L6688–6696T3
Mario gets no grace window after leaving a ledge; ProcJumping refuses airborne jumps unless he is swimming.src/prg.asm L4921–4925T3
Simulating the jump code on flat ground gives apexes, tapped/held, of 24/66 px standing, 27/71 px walking (row 2), and 29/83 px running (row 4).src/prg.asm L4756–4769src/prg.asm L6664–6696T4
Simulated with A held, Mario's jumps peak at 66 px standing, 71 px walking, and 83 px running.src/prg.asm L4756–4769src/prg.asm L6664–6696T4
ImposeGravity clamps a fall of 4 px/frame or more only when the fraction byte is at least $80.src/prg.asm L6688–6696T3
Swimming jumps use row 5 of the jump tables, or row 6 in a whirlpool.src/prg.asm L4959–4964T3