Variable jump height
A jump whose height depends on how long the jump button is held.
Facts
- Games
- 28 · 1985–2018
- Evidence
- Code (63)
Verified (26)
Code notes (1)
Dev blog (1)
Developer (1)
Wiki (1) - Sources
- 37
On this page
Tap jump for a hop; hold it for a full jump. Super Mario Bros., Mega Man 2, Super Mario World, Sonic the Hedgehog, and Celeste all do this, by four different mechanisms. Castlevania doesn’t: Simon’s jump is the same however the button is pressed1.
Mario falls under lighter gravity while the button is held2. Super Mario World applies the lighter gravity on any frame the button is down3. Releasing it caps Sonic’s upward speed4, and cuts Mega Man’s to 1 px/frame5. Celeste holds Madeline’s take-off speed on a timer, then halves gravity near the apex6,7.
Sonic the Hedgehog 2 and Sonic 3 & Knuckles keep Sonic’s cap8,9, and Sonic Advance 2 cuts a released rise to −3 px/frame10, three quarters of it. Metroid Fusion and Metroid: Zero Mission set the rise to 0 at any height11,12, where Metroid’s release works only once Samus has risen a set height13. Banjo-Kazooie swaps in the heavier gravity for the rest of the jump, as Super Mario Bros. does14,2. Super Mario Bros. 3 lightens gravity only while A is held and Mario still rises fast15. In a decompilation that doesn’t yet match, Super Mario Sunshine shrinks a released rise by a factor each update in place of gravity16, as Super Mario 64 divides its own17.
On every rising frame without A, Mega Man 3 sets the speed to 0.25 px/frame down before the move, where Mega Man 2 lowers only a fast rise, after it18. A Rush Coil bounce’s rise isn’t cut19. Mega Man 4 cuts the rise to 0 instead20, and Mega Man 5 keeps Mega Man 4’s jump21.
Castlevania II: Simon’s Quest’s jumping state reads only B, for the whip, so holding A changes nothing22. In Castlevania III: Dracula’s Curse, every character but Grant keeps Castlevania’s table23. Grant’s routine reads his own table two entries a frame once A is up during the rise; computed from the table, not measured, his rise runs 30 to 58 px24. Super Castlevania IV holds the take-off speed with no gravity for up to 4 frames while the button stays down25. In Castlevania: Symphony of the Night, letting go of Cross cuts a rise faster than 1 px/frame to 126. Sonic’s release clamps a rise faster than 4 px/frame to 44.
- NoneCastlevania (1986). A tap and a held button give the same jump.1Castlevania II: Simon's Quest (1987). A tap and a hold rise the same height.22,27Castlevania III: Dracula's Curse (1989), Trevor, Sypha, and Alucard. Every jump is the same height, however long A is held.23
- Release capMega Man 2 (1988). Letting go of A stops the rise almost at once.5,28,29,30,31Mega Man 3 (1990). Letting go of A on the way up starts the fall at once.18Mega Man 4 (1991). Letting go of A stops the rise at once.20Mega Man 5 (1992). Letting go of A stops the rise at once.21Sonic the Hedgehog 2 (1992). Letting go of the button slows a fast rise to a set speed.8Sonic 3 & Knuckles (1994). Letting go cuts a fast rise short; a second press in the air uses the shield.9Castlevania: Symphony of the Night (1997). Letting go of the button cuts the rise short at once.26
- Release cutSuper Mario 64 (1996). Letting go above 20 units/frame quarters the rise at once; the triple jump, backflip, and side flip can't be cut.17
- Gravity switchSuper Mario Bros. (1985). Gravity stays light while A is held on the way up, and turns heavier for good on release or at the top.2,32,33,34,35
- Held gravitySuper Mario World (1990). A lighter gravity on any frame the button is held.3,36,37
- Hold timerSuper Castlevania IV (1991). Holding the button keeps the full take-off speed a few frames longer.25Celeste (2018). Speed held for a timer, plus half gravity near the apex.38,6,7,39,40,41,42,43
- Table skipCastlevania III: Dracula's Curse (1989), Grant. Letting go of A early cuts his jump short.24
#How it works
Five of the games run one loop per update (one frame): gravity reduces the upward speed, and the speed moves the position. The button changes a different term in each. Castlevania has no speed to change; a table moves Simon44.
| Super Mario Bros. | Castlevania | Mega Man 2 | Super Mario World | Sonic the Hedgehog | Celeste | |
|---|---|---|---|---|---|---|
| Holding | lighter gravity, 0.117–0.156 px/frame² ($1E–$28)32 | nothing; a fixed table of steps44 | nothing; one gravity, 0.25 px/frame² ($40)45 | lighter gravity, rising or falling: 0.1875 px/frame² held, 0.375 released3 | nothing; one gravity, 0.21875 px/frame² ($38)46 | keeps the take-off speed for up to 0.2 s38; half gravity near the apex7 |
| Releasing | heavier gravity, 0.375–0.5625 px/frame² ($60–$90)33, for the rest of the jump2 | nothing1 | cuts a rise of 2 px/frame28 or more to 1 px/frame5 | heavier gravity until the button goes down again3 | clamps upward speed to −4 px/frame (-$400)4 | ends the hold; the current speed carries on6 |
| Apex, held vs tapped | 66–83 px held, 24–29 px tapped35 | 36 px, tapped or held1 | 50 px held, 8 px tapped31 | 64.2 px held, 33.3 px tapped36 | 100 px held, 39 px tapped47 | 27 px held, 7 px tapped43 |
Heights are native pixels at the character’s feet, from flat ground. Super Mario Bros., Castlevania, Mega Man 2, Super Mario World, and Sonic the Hedgehog are measured in the running games; Celeste is simulated frame by frame in its own number format and update order. Super Mario World’s heights are exact sixteenths of a pixel, since its drawn height depends on a subpixel the jump doesn’t reset48.
#Implementations
#Super Mario Bros. (1985)
A jump starts on the frame A goes down while Mario is on the ground49. His horizontal speed picks a row of four small tables50. The rows give three distinct jumps, for standing, walking, and running51. Each sets a take-off speed of −4 px/frame (−5 running)52,53, a held gravity, and a falling gravity.
on the frame A goes down while standing: # CheckForJumping → InitJS
row = jump row for |x speed|
speed = TAKEOFF[row] # px/frame, fraction zero
gravity = HELD[row]
fallGrav = FALL[row]
every frame in the air: # JumpSwimSub
if speed >= 0: # at or past the apex
gravity = fallGrav
else if not (A held now and A held last frame) and risen >= HALT:
gravity = fallGrav # released; never switched back
position += speed # ImposeGravity, 8.8 fixed point
speed += gravity
if speed has reached MAX_FALL + 1/2: speed = MAX_FALL
The button never pushes Mario up; it picks only the gravity. Once the jump-and-swim routine swaps in the falling gravity, nothing swaps it back that jump2. The swap waits until Mario has risen 1 px34, which the press frame already covers54.
Held gravity is 0.117–0.156 px/frame² ($1E–$28)32 across the rows; falling gravity is 0.375–0.5625 px/frame² ($60–$90)33. For a standing jump, they are 0.125 px/frame²55 and 0.4375 px/frame²56.
Vertical speeds are 8.8 fixed point, with a third byte for the subpixel position57. Falling speed is capped at 4 px/frame58, but the clamp fires only once the speed’s fraction byte reaches $80, as at 4.5 px/frame59.
Jdaster64’s chart of SMB’s physics engine agrees on the take-off speeds and gravities52,32,33. It starts the fast jump at a higher horizontal speed than the code; the ledger follows the code50.
#Castlevania (1986)
Castlevania is the baseline: a jump whose height the player can’t change. Pressing A starts it and copies the d-pad’s direction60. After that a table moves Simon by whole pixels, 36 px in 20 steps44 up, then the same steps backward61.
every frame while jumping: # bank 6 $9482, $9B1E
step = JUMP_TABLE[pointer] # whole pixels, no speed, no gravity
if step is the turn marker: falling = true; step back one and reread
height += falling ? -step : step
pointer += falling ? -1 : 1
Nothing in the jumping state reads the button. Measured in the game with A held from one frame to the whole jump, every standing jump is 36 px, tapped or held1, and the arc matches the table frame for frame62.
#Mega Man 2 (1988)
Mega Man’s jump is one parabola with a release cut, like Sonic’s but harder. A fresh A press sets his upward speed to 4.87 px/frame ($04.$DF)63,64, and one gravity, 0.25 px/frame² ($40)45, applies held or not. On every rising frame without A, a speed of 2 px/frame28 or more drops to 1 px/frame5. Sonic’s cap, −4 px/frame (-$400)4, leaves a faster rise.
on the frame A goes down while grounded: # _run_megaman_landing_common_1
speed = JUMP # px/frame, positive up
every frame while jumping: # _run_megaman_jumping
y -= speed # move first,
speed -= GRAVITY # then gravity
if A not held and whole part of speed > 1: # the release check comes last
speed = 1
The check follows the frame’s move and gravity29. After 12 frames30, gravity has slowed the rise below the threshold, so a later release changes nothing. lsmmega’s disassembly makes this code readable, and it builds the measured ROM byte for byte65.
#Super Mario World (1990)
Super Mario World keeps Super Mario Bros.’ two gravities and drops the switch. Gravity is 0.1875 px/frame² held, 0.375 released3, chosen every frame by whether A or B is down, rising or falling. SMB1 swaps in the heavier gravity once, for good2. In Super Mario World, pressing again brings the lighter gravity back, and holding the button also slows the fall to 4.375 px/frame (4.1875 holding the button)66.
every frame: # CODE_00CD24
y += speed # sixteenths of a pixel
if on the ground and B or A goes down:
speed = TAKEOFF[|x speed| / 8]
if speed > 0: speed = min(speed, FALL_CLAMP)
speed += A or B held ? GRAVITY_HELD : GRAVITY
The take-off speed grows with Mario’s horizontal speed, one step per band of the table67. So a run adds height: held jumps climb 64.2 px standing, 72.6 px walking, 81.6 px running, and 85.3 or 91.1 px sprinting37. The move comes before the jump check and gravity each frame68. SMWDisX, IsoFrieze’s disassembly built on mikeyk’s, makes this code readable.
#Sonic the Hedgehog (1991)
Sonic jumps along the ground’s normal, so on flat ground all 6.5 px/frame ($680)69 goes upward70. The press frame doesn’t move him: the jump routine drops its return address, skipping the rest of the grounded routine71. Curling into a ball lowers his center 5 px, keeping his feet on the same row72.
on the frame a jump button goes down on the ground: # Sonic_Jump
ySpeed -= JUMP # along the ground normal
curl into a ball # height radius 19 → 14, y += 5
skip the rest of this frame # no movement yet
every frame in the air: # Sonic_MdJump2
if jumping and no jump button held and ySpeed < -CAP:
ySpeed = -CAP # Sonic_JumpHeight
y += ySpeed # ObjectFall: old speed first,
ySpeed += GRAVITY # then gravity
One gravity, 0.21875 px/frame² ($38)46, applies held or not. The release check runs every airborne frame, before the move73. With no jump button held, it clamps any faster rise to −4 px/frame (-$400)4. Gravity brings the take-off speed under the cap in 12 updates74, so later releases change nothing.
Speeds are 8.8 and positions 16.16 fixed point75, and nothing limits the fall76. The Sonic Retro community’s Sonic Physics Guide matches the disassembly, down to the release check4 and the motionless press frame71.
#Celeste (2018)
Celeste works in pixels per second and multiplies by each update’s time step41. A jump sets the vertical speed to -105 px/s77 and starts a 0.2 s38 timer40.
every update:
if varJumpTimer > 0: varJumpTimer -= dt # Player.Update, before the state runs
# NormalUpdate:
if airborne:
mult = 1/2 if |speed| < HALF_GRAV and jump held else 1
speed = approach(speed, MAX_FALL, GRAVITY * mult * dt)
if varJumpTimer > 0:
if jump held: speed = min(speed, varJumpSpeed) # up is negative: keep take-off speed
else: varJumpTimer = 0 # release ends the hold, cuts nothing
if jump pressed and jumpGraceTimer > 0: # Jump()
speed = JUMP_SPEED; varJumpSpeed = speed; varJumpTimer = VAR_JUMP_TIME
moveV(speed * dt) # whole pixels, fraction kept
Holding jump while the timer runs cancels each update’s gravity, so Madeline rises at a constant -105 px/s77,6. Gravity, 900 px/s²78,79, applies once the hold ends. Unlike Sonic’s clamp, an early release cuts no speed6.
A separate rule halves gravity while jump is held and her vertical speed is under 40 px/s39,7. The fall limit is 160 px/s80. Positions are whole pixels, with the fraction kept in a remainder81.
At 60 Hz82, the hold nominally spans 12 updates38, but the timer is a float and its last update rests on rounding. A 0.0166667 s step gives 11 updates; an exact 1/60 s step gives 1242, and 2 px more height43. The released code doesn’t set the step. The widget defaults to 0.0166667 s83, the likelier value (Coyote time explains why).
#Comparing the arcs
- Super Mario Bros. is lopsided: a long, gentle rise, then a fall under 3.5×84 the gravity (standing). A release bends the rise into an early, steep descent2. Held jumps peak at 66 px standing, 71 px walking, and 83 px running85.
- Castlevania never changes: the same arc of whole-pixel steps every time, with a flat top where the table’s steps are zero44.
- Mega Man 2 is a symmetric parabola under one gravity45. A release flattens the rise at once to 1 px/frame5.
- Super Mario World rises and falls under the same light gravity while the button stays down3. Letting go steepens the rest of the arc, rising or falling.
- Sonic the Hedgehog is a symmetric parabola under one gravity46. A release cuts the rise to −4 px/frame (
-$400)4 at once, starting a smaller parabola. - Celeste rises in a straight ramp while the hold lasts6, then follows a parabola with a flattened top7.
#History
#Variants and combinations
Celeste also has coyote time, a grace window for late jumps86. Super Mario Bros., Mega Man 2, and Sonic have none87,88,89.
Air control varies as much as the jump. Castlevania fixes Simon’s direction at take-off90, Mega Man steers freely91, and Super Mario World keeps Mario’s momentum and lets him steer against it92,93.
Games
| Game | Year | How | Note |
|---|---|---|---|
| Metroid | 1986 | Release cap | past 32 px of rise, letting go sets the vertical speed to 0, so a tap still rises 32 px |
| Mega Man | 1987 | Release cap | letting go of A stops the rise almost at once |
| Mega Man 2 | 1988 | Release cap | letting go of A stops the rise almost at once |
| Mega Man 3 | 1990 | Release cap | letting go of A on the way up starts the fall at once |
| Mega Man 4 | 1991 | Release cap | letting go of A stops the rise at once |
| Sonic the Hedgehog | 1991 | Release cap | letting go of the button slows a fast rise to a set speed |
| Mega Man 5 | 1992 | Release cap | letting go of A stops the rise at once |
| Sonic the Hedgehog 2 | 1992 | Release cap | letting go of the button slows a fast rise to a set speed |
| Mega Man 6 | 1993 | Release cap | letting go of A turns the rise into a slow fall at once |
| Sonic 3 & Knuckles | 1994 | Release cap | letting go cuts a fast rise short; a second press in the air uses the shield |
| Super Metroid | 1994 | Release cap | letting go during the rise sets the vertical speed to 0 |
| Castlevania: Symphony of the Night | 1997 | Release cap | letting go of the button cuts the rise short at once |
| Metroid Fusion | 2002 | Release cap | letting go during the rise sets the vertical speed to 0 at any height |
| Sonic Advance 2 | 2002 | Release cap | a release cuts a rise faster than 3 px/frame to 3, three quarters of Sonic 1's cap |
| Metroid: Zero Mission | 2004 | Release cap | letting go during the rise sets the vertical speed to 0 at any height |
| Super Mario 64 | 1996 | Release cut | letting go above 20 units/frame quarters the rise at once; the triple jump, backflip, and side flip can't be cut |
| Super Mario Sunshine | 2002 | Release cut | with A up while Mario rises faster than 20, in a status without bits 0x1000 and 0x20000, each update multiplies the rise by 0.75 in place of the gravity; the triple jump can't be cut |
| Super Mario Bros. | 1985 | Gravity switch | gravity stays light while A is held on the way up, and turns heavier for good on release or at the top |
| Super Mario Bros.: The Lost Levels | 1986 | Gravity switch | Super Mario Bros.'s held jump; Luigi's lighter gravity carries him higher |
| Banjo-Kazooie | 1998 | Gravity switch | A up while rising doubles the gravity for the rest of the jump, once Banjo has learned the move |
| Super Mario Bros. 2 | 1988 | Held gravity | a lighter gravity on every frame the button is held |
| Super Mario Bros. 3 | 1988 | Held gravity | held, a standing jump rises 71 px; tapped, 21 px |
| Super Mario World | 1990 | Held gravity | a lighter gravity on any frame the button is held |
| Super Mario Land | 1989 | Hold timer | the rise keeps its 2 px steps while A is held, and a release skips ahead in the table |
| Metroid II: Return of Samus | 1991 | Hold timer | A holds a 2 px/frame rise for up to 15 frames, 31 at 3 px/frame with the Hi-Jump Boots |
| Super Castlevania IV | 1991 | Hold timer | holding the button keeps the full take-off speed a few frames longer |
| Celeste | 2018 | Hold timer | speed held for a timer, plus half gravity near the apex |
| Castlevania III: Dracula's Curse | 1989 | Table skip | Grant · letting go of A early cuts his jump short |
Every claim about this mechanic, by game (56)
References
- ^ abcdeVerified“Castlevania (USA) (Rev 1)”
How we know
Measured in the game, Simon's standing jump is the same with A held 1, 2, 5, 10, 20, or 40 frames, 36 px high on frame 17 and back on the ground on frame 41.
In the cartridge (“Castlevania (USA) (Rev 1)”): bank 6 $9B1E-$9B8A; the arc routine reads no buttons; bank 6 $94C5-$94C9, where the jumping state runs the arc routine every frame. We don't reproduce the bytes.
Measured by a script in MesenCE 2.2.1 (build 4b8a196), on Castlevania (USA) (Rev 1) (SHA-1
4e3ef47de86a…). It fails if the result disagrees with the claim. - ^ abcdefgCodeXkeeper0/smb1 · Jdaster64 n.d.prg.asm 4756–4769
How we know
The jump-and-swim routine swaps in falling gravity, never back, once speed is zero or downward, or once the jump has risen at least a set minimum (smb1/diff-to-halt-jump) on a frame when A is not held, or was not held the frame before.
4757 BPL DumpFall ; or moving downwards, branch to falling ⋮ 4760 AND PreviousA_B_Buttons ; and was pressed in previous frame 4761 BNE ProcSwim ; if so, branch elsewhere ⋮ 4765 CMP DiffToHaltJump ; compare to value set here to see if player is in mid-jump ⋮ 4768 LDA VerticalForceDown ; otherwise dump falling into main fractional 4769 STA VerticalForce
src/prg.asm lines 4756–4769 at 1cc3c92 · upstream ↗ so long as they are moving upward in a jump, holding “A” will make them rise more slowly
JUMPING/VERTICAL PHYSICS · archived copy ↗ - ^ abcdefCodeSMWDisX · “Super Mario World (USA)”bank_00.asm 10167–10169, 10439–10444, 10457–10459, 821–824
How we know
Each frame the gravity routine adds 3/16 px/frame to Mario's vertical speed while A or B is held and 6/16 otherwise, rising or falling.
10167DATA_00D7A5: ;!bank_00.asm lines 10167–10169 at 30643c7 · upstream ↗ 10439CODE_00D928: 10440 LDY.B #$01 10441 LDA.B byetudlrHold 10442 BMI + 10443CODE_00D92E: 10444 LDY.B #$00
bank_00.asm lines 10439–10444 at 30643c7 · upstream ↗ 10457CODE_00D948: ;! 10458 CLC ;! 10459 ADC.W DATA_00D7A5,Y ;!
bank_00.asm lines 10457–10459 at 30643c7 · upstream ↗ In the cartridge (“Super Mario World (USA)”): DATA_00D7A5. We don't reproduce the bytes.
- ^ abcdefgVerifiedsonicretro/s1disasm · Sonic Retro, “Sonic Physics Guide: Jumping”01 Sonic.asm 1273–1288; sub ObjectFall & SpeedToPos.asm 16–20
How we know
In the running game, on flat ground out of water, letting go of the button while a jump still rises faster than 4 px/frame sets Sonic's Y speed to exactly −
$400: the release check runs before the move and gravity, so a release on any of airborne updates 1 to 12 moves him up exactly 4 px that frame and leaves −$3C8after gravity (−$400+$38, computed).1274 tst.b jumping(a0) ; is Sonic airborne specifically from a jump? ⋮ 1276 move.w #-$400,d1 ; set max jump height ⋮ 1283 cmp.w obVelY(a0),d1 ; get current y speed 1284 ble.s .return ; is Sonic moving up slower than the cap speed? if yes, branch 1285 move.b (v_jpadhold2).w,d0 ; get currently held buttons 1286 andi.b #btnABC,d0 ; is A, B or C still held after jumping? 1287 bne.s .return ; if yes, branch 1288 move.w d1,obVelY(a0) ; otherwise, cap Sonic's maximum jump height
_incObj/01 Sonic.asm lines 1273–1288 at 15dfa3a · upstream ↗ 16 move.w obVelY(a0),d0 ; load vertical speed 17 addi.w #gravity,obVelY(a0) ; increase vertical speed (apply gravity) ⋮ 20 add.l d0,d3 ; add speed to Y-axis position
_incObj/sub ObjectFall & SpeedToPos.asm lines 16–20 at 15dfa3a · upstream ↗ the computer checks to see if Y Speed is less than -4 (e.g. -5 is "less" than -4). If it is, then Y Speed is set to -4.
Variable Jump Height · archived copy ↗ - Rests on In the running game, Sonic's airborne-mode routine runs the release check before the object fall routine moves Sonic and adds gravity, so a release frame moves him by the capped speed, exactly 4 px up, and gravity adds to the cap.
- Rests on In the running game, the object fall routine adds a gravity of
$38(0.21875 px/frame²) to Sonic's Y speed on every airborne frame, rising or falling, after a jump or off a ledge, button held or not.
Measured by a script. It fails if the result disagrees with the claim.
- ^ abcdeCodelsmmega/mm2run_megaman.asm 208–219
How we know
In the jumping state, with A not held, the jumping state's routine drops an upward speed of 2 px/frame or more to exactly 1 px/frame.
208 LDA z:zjoy1_pressed 209 AND #a_button 210 BNE @skip 211 LDA aobject_ycoord_speed 212 BMI @skip 213 CMP #$01 214 BCC @skip 215 BEQ @skip 216 LDA #$01 217 STA aobject_ycoord_speed 218 LDA #$00 219 STA aobject_ycoord_speed_fraction
engine/run_megaman.asm lines 208–219 at 94f0bf3 · upstream ↗ - ^ abcdefCodeNoelFB/CelestePlayer.cs 2960–2966
How we know
While the variable-jump timer runs, holding jump keeps Madeline rising no slower than the speed saved at take-off, canceling gravity; releasing zeroes the timer and cuts no speed.
2960 //Variable Jumping 2961 if (varJumpTimer > 0) ⋮ 2963 if (AutoJump || Input.Jump.Check) 2964 Speed.Y = Math.Min(Speed.Y, varJumpSpeed); 2965 else 2966 varJumpTimer = 0;
Source/Player/Player.cs lines 2960–2966 at 1b0ce45 · upstream ↗ - ^ abcdeCodeNoelFB/CelestePlayer.cs 2952
How we know
Gravity halves while the absolute vertical speed is under the half-gravity threshold and jump is held (or auto-jump is on), so a held jump hangs at the top.
2952 float mult = (Math.Abs(Speed.Y) < HalfGravThreshold && (Input.Jump.Check || AutoJump)) ? .5f : 1f;Source/Player/Player.cs line 2952 at 1b0ce45 · upstream ↗ - ^ abCodesonicretro/s2disasm · sonicretro/s1disasms2.asm 37465–37475; 01 Sonic.asm 1276–1288
How we know
With no jump button held, the jump-height check cuts a rise faster than 4 px/frame to exactly
-$400(-$200underwater), as in Sonic 1.37465 move.w #-$400,d1 ⋮ 37468 move.w #-$200,d1 ⋮ 37470 cmp.w y_vel(a0),d1 ; is Sonic going up faster than d1? ⋮ 37475 move.w d1,y_vel(a0) ; immediately reduce Sonic's upward speed to d1
s2.asm lines 37465–37475 at 4ef457c · upstream ↗ 1276 move.w #-$400,d1 ; set max jump height ⋮ 1279 move.w #-$200,d1 ; set underwater jump height ⋮ 1288 move.w d1,obVelY(a0) ; otherwise, cap Sonic's maximum jump height
_incObj/01 Sonic.asm lines 1276–1288 at 15dfa3a · upstream ↗ - ^ abCodesonicretro/skdisasmsonic3k.asm 23404–23415
How we know
With no jump button held, the jump-height routine cuts a rise faster than 4 px/frame to exactly
-$400(-$200underwater); a press once the rise is no faster than that starts a shield move instead.23404 move.w #-$400,d1 ⋮ 23407 move.w #-$200,d1 ; Underwater-specific ⋮ 23410 cmp.w y_vel(a0),d1 ; is y speed greater than 4? (2 if underwater) 23411 ble.w Sonic_ShieldMoves ; if not, branch ⋮ 23415 move.w d1,y_vel(a0) ; cap jump height
sonic3k.asm lines 23404–23415 at 73de97c · upstream ↗ - ^CodeSAT-R/sa2 · sonicretro/s1disasmcharacters.h 28–29; player.c 6965, 7006–7027; +1 files
How we know
In a jump (a move-state flag the jump start routine sets), on any frame the jump button isn't held, the jumping state's routine cuts a rise faster than 3 px/frame to exactly −3 (−1.5 in water). Outside the Collect Rings multiplayer mode it first tries Sonic's forward thrust and the mid-air moves, and a frame on which one starts skips the cap. Sonic 1's release cap cuts to 4 px/frame (
-$400), so this cap too is three quarters of Sonic 1's (computed).28#define PLAYER_MAX_NOT_HELD_JUMP_FORCE (3.0) 29#define PLAYER_MAX_NOT_HELD_JUMP_FORCE_UNDER_WATER (1.5)
include/game/shared/parameters/characters.h lines 28–29 at 393357f · upstream ↗ 6965 p->moveState |= (MOVESTATE_100 | MOVESTATE_IN_AIR);src/game/shared/stage/player.c line 6965 at 393357f · upstream ↗ 7006void Player_Jumping(Player *p) ⋮ 7009 s16 maxJumpSpeed = -Q(PLAYER_MAX_NOT_HELD_JUMP_FORCE); ⋮ 7012 if (p->moveState & MOVESTATE_IN_WATER) { 7013 maxJumpSpeed = -Q(PLAYER_MAX_NOT_HELD_JUMP_FORCE_UNDER_WATER); ⋮ 7017 if (p->moveState & MOVESTATE_100) { ⋮ 7019 if (gGameMode != GAME_MODE_MULTI_PLAYER_COLLECT_RINGS) 7020 if (Player_Sonic_TryForwardThrust(p) || Player_TryMidAirAction(p)) 7021 return; ⋮ 7024 // Caps the jump force if the player lets go of the jump button 7025 if (p->qSpeedAirY < maxJumpSpeed && !(p->heldInput & gPlayerControls.jump)) { 7026 p->qSpeedAirY = maxJumpSpeed;
src/game/shared/stage/player.c lines 7006–7027 at 393357f · upstream ↗ - ^Codemetroidret/mf · metroidret/mzmsamus.c 2124–2130, 2195–2196, 2596–2597, 3025–3032, 4572–4578, 4645–4647, 4774–4776; samus_data.c 162–189
How we know
On any frame Samus rises (vertical velocity above 0) without A held, the mid-air handlers set the velocity to 0, at any height: the handlers of the mid-air pose, the mid-air turn, spinning (which runs the spin jump, the Space Jump, and the Screw Attack), and the wall jump, which also drops a wall jump into a spin. The test is each handler's last step but the wall jump's, so a frame whose earlier branch returns skips it. Zero Mission's first three handlers end with the same test.
src/samus.c at a6d6187 Our readingturning: the mid-air turn pose, return2125–2126A not held, rising: vertical speed ← 02129–2130A not held, rising: vertical speed ← 02195–2196A not held, rising: vertical speed ← 02596–2597A not held:3025–3026 rising: vertical speed ← 03028–3029 pose ← spinning3031–3032163 [SPOSE_MID_AIR] = SamusMidAir, 164 [SPOSE_TURNING_AROUND_MID_AIR] = SamusTurningAroundMidAir, ⋮ 169 [SPOSE_STARTING_SPIN_JUMP] = SamusSpinning, 170 [SPOSE_SPINNING] = SamusSpinning, ⋮ 181 [SPOSE_WALL_JUMPING] = SamusWallJumping, ⋮ 188 [SPOSE_SPACE_JUMPING] = SamusSpinning, 189 [SPOSE_SCREW_ATTACKING] = SamusSpinning,
src/data/samus_data.c lines 162–189 at a6d6187 · upstream ↗ src/samus.c at 2aae289 Our readingturning: the mid-air turn pose, return4573–4574A not held, rising: vertical speed ← 04577–4578A not held, rising: vertical speed ← 04646–4647A not held, rising: vertical speed ← 04775–4776 - ^Codemetroidret/mzm · nmikstas/metroid-disassemblysamus.c 4572–4578, 4645–4647, 4774–4776, 36–43, 4716–4726; Bank07.asm 2701–2709
How we know
On any frame Samus rises (vertical velocity above 0) without A held, the mid-air handlers set the vertical velocity to 0, at any height: the handlers for the mid-air pose, for turning around in mid-air, and for spinning, which runs the spin jump, the Space Jump, and the Screw Attack. The check is each handler's last step, so a frame whose earlier branch returns, such as a Space Jump or wall jump press, skips it. Metroid lets a release stop the rise only after 32 px.
src/samus.c at 2aae289 Our readingturning: the mid-air turn pose, return4573–4574A not held, rising: vertical speed ← 04577–4578A not held, rising: vertical speed ← 04646–4647A not held, rising: vertical speed ← 04775–477636 [SPOSE_MIDAIR] = SamusMidAir, 37 [SPOSE_TURNING_AROUND_MIDAIR] = SamusTurningAroundMidAir, ⋮ 39 [SPOSE_STARTING_SPIN_JUMP] = SamusSpinning, 40 [SPOSE_SPINNING] = SamusSpinning, ⋮ 42 [SPOSE_SPACE_JUMPING] = SamusSpinning, 43 [SPOSE_SCREW_ATTACKING] = SamusSpinning,
src/samus.c lines 36–43 at 2aae289 · upstream ↗ src/samus.c at 2aae289 Our readingSpace Jump, not slowed by liquid:4716 A pressed, falling fast enough:4719 High Jump's jump speed, else the low one (by its label)4721–4724 return4726Source_Files/Bank07.asm at 4270d57 Our readingfalling: skip (by the comment)2702–2704under 32 px risen: skip (by the comment)2705–2706jump held: skip (by the comment)2707–2708stop the rise (by its label)2709 - ^Codenmikstas/metroid-disassemblyBank07.asm 2701–2709, 2271–2280, 2867–2870
How we know
Once a jump has carried Samus 32 px up (her jump-height counter at
$20), letting go of jump while she still rises calls a routine that sets her vertical speed to 0. The running-jump handler does the same past 32 px.Source_Files/Bank07.asm at 4270d57 Our readingA ← the jump height2702rising (by the comment)2703–2704 $20 or more2705–2706 the pad's top bit clear, jump released (by the comment)2707–2708 StopVertMovement2709Y at $20 or more2271–2272 pad bit 3 set: pose ← jump pointing up (not quoted)2273–2277 the pad's top bit clear2278–2279 StopVertMovement2280vertical speed ← 0; vertical counter ← 02868–2870 - ^Codebanjo.decomp/banjo-kazooie · n64decomp/sm64jump.c 20–21, 25, 41, 47–54, 55, 69–76, 101–104, 121–128, 143–144, 171–173; bakey.c 50–52, 79–81; +4 files
How we know
A jump sets Banjo's vertical speed to 710 units/s (610 from water) and his gravity to −1350 units/s², half the usual −2700, and sets his horizontal speed at once to the target speed the stick gives on the ground (banjo-kazooie/walking-speed). On a frame of the jump with A up while he still rises, the jump state's update resets the gravity to −2700 for the rest of the jump; nothing sets −1350 again, and with A held the lighter gravity lasts past the peak. Until Banjo has learned a particular ability, it resets the gravity every frame. A jump entered from a peck sets neither the speed nor the gravity. A take-off from a spring pad sets a flag that skips the reset; the first frame with A up clears it after the check, so the reset starts the frame after. While that flag is set, the jump's second phase turns into the Shock Spring Jump's charge. Leaving the jump state for anything but a peck restores −2700. Computed without the frame steps, a held jump rises about 187 units in 0.53 s, and one released at once about 93. Super Mario 64 instead adds a quarter of the forward speed to its take-off (sm64/jump-speed) and divides the rise by 4 on each frame A is up while Mario rises faster than 20 units/frame (sm64/jump-release).
20f32 D_80364CD0 = 710.0f; 21f32 D_80364CD4 = -1350.0f;
src/core2/bs/jump.c lines 20–21 at e8d31fa · upstream ↗ 25f32 D_80364CE4 = 610.0f;src/core2/bs/jump.c line 25 at e8d31fa · upstream ↗ src/core2/bs/jump.c at e8d31fa Our readingspring-pad flag ← on a spring pad41from a peck: peck flag ← 147–52from water ← came from swimming idle or swimming55an unnamed routine69horizontal speed ← target speed, toward the ideal facing70from water: vertical speed ← 61071–72else: 71073–74gravity ← −135076velocity ← the current one101A up, rising, no spring-pad flag: reset gravity102–104ability not learned: reset gravity102–104second phase:121 more than 500 above an unnamed height: fall122–124 spring-pad flag: clear it, Shock Spring charge125–128A up: spring-pad flag ← 0143–144next state not a peck: reset gravity171–173src/core2/bakey.c at e8d31fa Our readingeach button: released count ← 0 if pressed, else + 150–52the button's released count79–8110f32 baphysics_default_gravity = -2700.0f; //defaultGravity 11f32 baphysics_default_terminal_velocity = -4000.0f;
src/core2/ba/physics.c lines 10–11 at e8d31fa · upstream ↗ src/core2/ba/physics.c at e8d31fa Our readinggravity ← the default397–399src/core2/playerutils.c at e8d31fa Our readinglearned the A-hold-higher ability67–68src/game/mario.c at 9921382 Our readingjump: vertical speed from 42 and 0.25 of forward speed821–824forward speed × 0.8825src/game/mario_step.c at 9921382 Our readingstronger rise gravity: vertical speed ÷ 4559–560A not held, rising above 20: the jump-height flag528–529 - ^VerifiedSouthbird's SMB3 disassemblyprg008.asm 2644–2672
How we know
In the air the jump routine adds 5 to Mario's vertical speed each update, or 1 while A is held and he rises faster than
$20; a Micro-Goomba stuck to him keeps the 5 even with A held. A tail wag can then overwrite the speed (flight-time, tail-wag), and a Tanooki statue skips this routine (tanooki-statue). Measured in Mesen from power-on as Raccoon Mario at World 1-1's start, a jump with A held gains 1 a frame until the rise slows to-$20, then 5 a frame; with A pressed for one frame it gains 5 a frame from the frame after the take-off.2644PRG008_ACB3: ⋮ 2646 ; Player is mid air... ⋮ 2648 LDY #$05 ; Y = 5 ⋮ 2650 LDA <Player_YVel 2651 CMP #-$20 2652 BGS PRG008_ACC8 ; If Player's Y velocity >= -$20, jump to PRG008_ACC8 ⋮ 2654 LDA Player_mGoomba 2655 BNE PRG008_ACCD ; If Player has got a microgoomba stuck to him, jump to PRG008_ACCD ⋮ 2657 LDA <Pad_Holding 2658 BPL PRG008_ACC8 ; If Player is NOT pressing 'A', jump to PRG008_ACC8 ⋮ 2660 LDY #$01 ; Y = 1 2661 BNE PRG008_ACCD ; Jump (technically always) to PRG008_ACCD ⋮
PRG/prg008.asm lines 2644–2672 at 09b1bd8 · upstream ↗ Measured by a script in MesenCE 2.2.1 (build 4b8a196), on . It fails if the result disagrees with the claim.
- ^Code notesdoldecomp/sms · n64decomp/sm64configure.py 949–950; MarioMove.cpp 764–772, 420–423, 434–456, 647–654, 663–673, 1482–1483, 733–738, 2175–2181, 191–208, 1510–1552, 1556–1568; +5 files
How we know
In Super Mario Sunshine, by the decompilers' Player code, which doesn't yet match, a press that starts a jump first becomes a miss jump if a miss test passes, then a spin jump if the stick's recorded directions, recorded only while it is pushed, fall in all four quarter-turn sectors, a right spin when the angles mostly rose and a left one otherwise (the four sector marks are never cleared before the test, which the decompilers' comment calls a bug, so a leftover value could count as a mark), and otherwise the status it asks for. Every jumping status goes through one take-off routine. The single jump and an unnamed jumping status, 0x89C, which Mario takes when he gets off Yoshi in one of its two ways, share a case there: his vertical speed becomes 42 plus a quarter of his forward speed, and the forward speed is multiplied by 0.8, constants in the code rather than parameters, and the same take-off as Super Mario 64's single jump (sm64/jump-speed). On two kinds of floor, which the code doesn't name, the speed is replaced or added to and the jump becomes the forced jump; on Yoshi it is multiplied by a Yoshi parameter, and while Mario is sinking both speeds are scaled by a factor from his sinking parameters. When the new jumping status carries bit 0x2000000, as the single jump, the double jump, and the wall kick do, the take-off sets bit 0x100 of an unnamed field, and it clears that bit for any other jumping status, 0x89C among them (computed; other code clears it too). While that bit is set, the status has neither bit 0x1000 nor 0x20000, A isn't held, and Mario rises faster than 20, the fall code multiplies his vertical speed by 0.75 on each update in place of the gravity. Super Mario 64 divides it by 4 on each frame when A isn't held and Mario rises faster than 20, if an unnamed flag of Mario's is set, the action is neither intangible nor invulnerable, and the action has the flag named for controlling jump height, the same bit, 0x02000000 (sm64/jump-release). The status numbers line up too: Sunshine's single jump is 0x2000000 | 0x800 | 0x080 (computed 0x2000880), and Super Mario 64's single jump is 0x03000880.
949 PCHObject(NonMatching, "Player/MarioMove.cpp"), 950 Object(NonMatching, "Player/MarioPhysics.cpp"),
configure.py lines 949–950 at d2cc8f5 · upstream ↗ src/Player/MarioMove.cpp at d2cc8f5 Our readingmiss jump: the miss jump764–767else, a rotate-jump start: return 1 (by its label)768–770else: change to the status asked for772vertical speed ← forward speed × multiplier + force420–423single jump, or status 0x89C:434–436 vertical speed ← forward speed × 0.25 + 42437 forward speed × 0.8438 if the floor data is valid (not quoted)440 isThing2: speed ← 0.01 × its jump power, force jump441–444 isThing3: speed + Mario's ground jump power − unkBC445–446 trample the floor's actor, a voice, force jump448–454sinking: a scale from the sink timer (not quoted)647–651both speeds × the scale653–654on Yoshi:663 vertical speed × the Yoshi multiplier664 Yoshi's flutter state and timer reset665–666next status has 0x2000000: unk78 bit 0x100 on670–671else: off672–673A held: input bit 0x80 (by its label)1482–1483src/Player/MarioPhysics.cpp at d2cc8f5 Our readingunk78 bit 0x100 off: no452–453status bit 0x1000 or 0x20000: no455–456A not held, vertical speed above 20: yes458–459not diving:470 fall cancel: vertical speed × 0.75471–472 else a falling spin jump: − the spin gravity473–476 else: − the gravity477–4787 MARIO_STATUS_FLAG_JUMPING = 0x800,include/Player/MarioStatus.hpp line 7 at d2cc8f5 · upstream ↗ 17 MARIO_STATUS_FLAG_UNK2000000 = 0x2000000,include/Player/MarioStatus.hpp line 17 at d2cc8f5 · upstream ↗ src/game/mario.c at 9921382 Our readingjump: vertical speed from 42 and 0.25 of forward speed821–824forward speed × 0.8825y speed ← initial + a stub's 0 + forward × multiplier (by the comment)763–766src/game/mario_step.c at 9921382 Our readingflag MARIO_UNKNOWN_08 off: no520–521intangible or invulnerable: no524–525A not held, rising above 20: the jump-height flag528–529then: vertical speed ÷ 4559–560src/Player/MarioMove.cpp at d2cc8f5 Our readingby the status's type:733 running: the running set-up (by its label)734–736 jumping: the take-off routine737–738getting off Yoshi:2175 clear input bit 0x80002177 the flying case: status 0x89C, then off2179–2181a stick rotation (routine quoted next):195 2: the right spin jump197–199 3: the left spin jump200–202 return 1204the stick rotation:1510 four sector marks, not cleared (a bug, by the comment)1514–1516 each recorded direction but the last:1518 mark which quarter of the circle it points into1521–1528 the next one higher: up count + 1; else down count + 11530–1533 all four quarters marked:1542 up count larger: 2, else 3; a rotation1543–1547the history:1556 only while the stick is pushed:1558 record the stick's direction1562–1563 at the stick-rotate time: drop the oldest1565–1568 - ^ abCoden64decomp/sm64mario_step.c 519–533, 559–560; sm64.h 256–263; +2 files
How we know
Releasing A cuts a jump short: on a frame with A up and the rise above 20 units/frame, the gravity routine divides the vertical speed by 4 instead of subtracting gravity. Only actions flagged as controlling jump height do this, among them the single and double jumps and the wall kick; the triple jump, backflip, and side flip lack the flag and keep their full height. The check also needs a flag that every airborne action sets and bouncing off an enemy clears.
519u32 should_strengthen_gravity_for_jump_ascent(struct MarioState *m) { 520 if (!(m->flags & MARIO_UNKNOWN_08)) { 521 return FALSE; ⋮ 525 return FALSE; ⋮ 528 if (!(m->input & INPUT_A_DOWN) && m->vel[1] > 20.0f) { 529 return (m->action & ACT_FLAG_CONTROL_JUMP_HEIGHT) != 0; ⋮ 532 return FALSE;
src/game/mario_step.c lines 519–533 at 9921382 · upstream ↗ 559 } else if (should_strengthen_gravity_for_jump_ascent(m)) { 560 m->vel[1] /= 4.0f;
src/game/mario_step.c lines 559–560 at 9921382 · upstream ↗ 256#define ACT_JUMP 0x03000880 // (0x080 | ACT_FLAG_AIR | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION | ACT_FLAG_CONTROL_JUMP_HEIGHT) 257#define ACT_DOUBLE_JUMP 0x03000881 // (0x081 | ACT_FLAG_AIR | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION | ACT_FLAG_CONTROL_JUMP_HEIGHT) 258#define ACT_TRIPLE_JUMP 0x01000882 // (0x082 | ACT_FLAG_AIR | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION) 259#define ACT_BACKFLIP 0x01000883 // (0x083 | ACT_FLAG_AIR | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION) ⋮ 261#define ACT_WALL_KICK_AIR 0x03000886 // (0x086 | ACT_FLAG_AIR | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION | ACT_FLAG_CONTROL_JUMP_HEIGHT) 262#define ACT_SIDE_FLIP 0x01000887 // (0x087 | ACT_FLAG_AIR | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION) 263#define ACT_LONG_JUMP 0x03000888 // (0x088 | ACT_FLAG_AIR | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION | ACT_FLAG_CONTROL_JUMP_HEIGHT)
include/sm64.h lines 256–263 at 9921382 · upstream ↗ - ^ abCodeplasticsmoke/megaman3-disassembly-ca65 · lsmmega/mm2player_ground.asm 260–267, 272–277; movement.asm 424–428; +3 files
How we know
On every rising frame without A held, unless the flag that forces a full jump is set, Mega Man 3 sets the vertical speed to
$FF.$C0, 0.25 px/frame downward, whatever the speed was, before the frame's move. Mega Man 2 also tests A held on every rising frame, but only lowers a rise of 2 px/frame or more to 1, and after the move.src/fixed/player_ground.asm at 58ca1c3 Our readingspeed negative, falling: no cut (by the comment)260–261force-full-jump flag set: no cut (by the comment)262–263A held: keep rising (by the comment)264–266else: reset the speed (by its label)267src/fixed/movement.asm at 58ca1c3 Our readingvertical speed ← $FF.C0424–427src/fixed/player_ground.asm at 58ca1c3 Our readingwall check at foot height (by the comment)272–275then gravity and the move (by its label)276–277engine/run_megaman.asm at 94f0bf3 Our readingA held: no cut208–210speed negative: no cut211–2121 or less: no cut213–215else: speed ← $01.00216–219home/joy.asm at 94f0bf3 Our readingeach button (8, set before the loop, not quoted):11 read the controller's bit12–16 roll it into that controller's held byte17home/nmi_wait.asm at 94f0bf3 Our readinglast frame's held byte kept2–3read the controller13new presses ← held and not held last frame14–17 - ^Codeplasticsmoke/megaman3-disassembly-ca65player_ground.asm 32–38, 260–263
How we know
Landing on Rush Coil launches Mega Man at
$06.$EE, 6.93 px/frame, once per bounce, and sets a flag that keeps releasing A from cutting that rise.32 lda $05A1 ; if Rush already bounced: skip 33 bne player_ground_normal_walk ; already bounced, normal walk 34 inc force_full_jump ; force full jump (no variable-jump cutoff) 35 lda #$EE ; Y speed = $06.EE (Rush Coil bounce) 36 sta ent_yvel_sub ; strong upward bounce 37 lda #$06 ; Y velocity whole = $06 (upward) 38 sta ent_yvel ; store Y velocity whole
src/fixed/player_ground.asm lines 32–38 at 58ca1c3 · upstream ↗ 260player_airborne: lda ent_yvel ; check Y velocity sign 261 bmi player_airborne_variable_jump ; negative (falling) → skip to clear flag 262 lda force_full_jump ; check force-full-jump flag 263 bne player_airborne_wall_check ; nonzero → skip variable jump
src/fixed/player_ground.asm lines 260–263 at 58ca1c3 · upstream ↗ - ^ abCodeplasticsmoke/megaman4-disassembly-ca65 · “Mega Man 4 (USA) (Rev 1)” · plasticsmoke/megaman3-disassembly-ca65bank3C.asm 179–190, 420–431; player_ground.asm 74–77; +1 files
How we know
Mega Man 4 takes off at exactly 5 px/frame (
$05.$00), up from Mega Man 3's$04.$E5, and a release cuts any rise to a speed of 0 where Mega Man 3 sets 0.25 px/frame downward. Both cut on every rising frame without A.src/bank3C.asm at a63bb6e Our readingflag clear and Down held: slide (by the comment)180–184else: vertical speed ← $05.00186–189on to the airborne code (by the comment)190moving down: keep falling (by the comment)421–422no-cut flag set: no cut (by the comment)423–424A held: no cut (by the comment)425–427else: vertical speed ← $00.00428–430then on, always (by the comment)431In the cartridge (“Mega Man 4 (USA) (Rev 1)”): bank $3C $8149, the take-off in the Rev 1 ROM; bank $3C $8312, the cut in the Rev 1 ROM. We don't reproduce the bytes.
src/fixed/player_ground.asm at 58ca1c3 Our readingvertical speed ← $04.E574–77src/fixed/movement.asm at 58ca1c3 Our readingvertical speed ← $FF.C0424–427 - ^ abCodeplasticsmoke/megaman5-disassembly-ca65 · plasticsmoke/megaman4-disassembly-ca65bank1B.asm 122–128, 330–343; bank3C.asm 186–189, 421–430; +2 files
How we know
Mega Man 5 keeps Mega Man 4's jump. Both write 5 px/frame (
$05.$00) into the vertical speed at$03F0/$03D8on a jump, and set it to 0 on any rising frame without A held; Mega Man 4 skips that cut while a flag the disassembly's comment calls a no-jump-cut flag is set, and in Gravity Man's stage ($AFset), Mega Man 5 tests the other sign instead.L80A4: lda $AF bne L80B5 lda #$00 sta $03D8 lda #$05 sta $03F0 jmp player_st_air
src/bank1B.asm#L122-L128 · upstream ↗ Our reading$AF not 0: to L80B5 (not quoted)122–123vertical speed $03F0.$03D8 ← $05.$00124–127then player_st_air128src/bank1B.asm at 7fd6512 Our reading$AF 0: to L8259330–331$03F0 0 or more: to L8283 (not quoted)332–333negative: to L825E334L8259: $03F0 negative: to L8283 (not quoted)335–336L825E: A held, $16 bit $80: to L8283 (not quoted)337–339else: vertical speed ← 0340–342then to L8283 (not quoted)343src/bank3C.asm at a63bb6e Our readingvertical speed ← 5 px/frame up, subspeed 0 (by the comment)186–189moving down: to L_8338, keep falling (by the comment)421–422no-jump-cut flag set: to L_833D, no cut (by the comment)423–424A still held: to L_8338 (by the comment)425–427else: vertical speed ← 0428–43030joy1_held := $16 ; controller 1 held buttonsinclude/zeropage.inc line 30 at 7fd6512 · upstream ↗ 46BTN_A = $80include/constants.inc line 46 at 7fd6512 · upstream ↗ - ^ abCode“Castlevania II - Simon's Quest (USA)” · “Castlevania (USA) (Rev 1)”
How we know
In Simon's Quest the take-off sets Simon's horizontal speed to 1 px/frame toward a held Left or Right, or 0, and the jumping state reads only B, for the whip, so the jump keeps its direction as in Castlevania.
In the cartridge (“Castlevania II - Simon's Quest (USA)”): bank 3 $8905-$8928: held Right ($F7 bit 0) sets X speed $6D.$6C = 1.0, Left −1.0 and facing left, neither 0; bank 3 $89CD-$8A0D, the jumping state: a new B press ($F5 AND $40) goes to the whip; the rest is the vertical speed. We don't reproduce the bytes.
In the cartridge (“Castlevania (USA) (Rev 1)”): Castlevania's take-off copying the held Left and Right into Simon's direction (castlevania/jump-start). We don't reproduce the bytes.
- ^ abCodevinheim3/castlevania3-disasm · “Castlevania III - Dracula's Curse (USA)” · “Castlevania (USA) (Rev 1)”playerStateProcessing_b1c.s 3740–3751, 4187–4225, 3242–3250, 4751–4759, 4784–4792; playerStateProcessing_b1d.s 918–927
How we know
Dracula's Curse keeps Castlevania's jump for every character but Grant; the take-off starts the arc at entry 9 of a longer table whose entries from there are Castlevania's 20 rises, 5, 5, 3, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 1, 0, 0, 0, and 0 px, and the 8 entries before it, 6 then 5 px, carry a fall below the take-off height down to 6 px/frame, where Castlevania falls at 8 px/frame once its table runs out.
3740playerState06_jumpStart_exceptGrant:code/playerStateProcessing_b1c.s lines 3740–3751 at 3272648 · upstream ↗ lda $9874, y … cmp #$81 … sta wEntityVertSpeed.w, x … inc $05d8, x … cmp #$80 … dec $05d8, x … eor #$ff … lda $9875, y
code/playerStateProcessing_b1c.s#L4187-L4225 · upstream ↗ 3242processTrevorState: ⋮ 3249 .dw playerState06_jumpStart_exceptGrant 3250 .dw playerState08_jumping_exceptGrant
code/playerStateProcessing_b1c.s lines 3242–3250 at 3272648 · upstream ↗ 4751processSyphaState: ⋮ 4758 .dw playerState06_jumpStart_exceptGrant
code/playerStateProcessing_b1c.s lines 4751–4759 at 3272648 · upstream ↗ In the cartridge (“Castlevania III - Dracula's Curse (USA)”): bank $1C $9874-$9891: $80, five $FA (−6), five $FB (−5), five $FD, three $FE, four $FF, $00, $FF, four $00, and $81; the disassembly lists these bytes partly as instructions. We don't reproduce the bytes.
In the cartridge (“Castlevania (USA) (Rev 1)”): Castlevania's table of 20 steps (castlevania/jump-table); Castlevania's 8 px fall past the table (castlevania/table-end-fall). We don't reproduce the bytes.
- ^ abCodevinheim3/castlevania3-disasm · “Castlevania III - Dracula's Curse (USA)”playerStateProcessing_b1c.s 5156–5172; playerStateProcessing_b1d.s 128–141, 154–213
How we know
Grant's jump reads its own table from entry 30, one entry a frame while A is held; once A is up during the rise, or once he falls, the routine moves two entries a frame, so letting go shortens the rise, from 58 px held to the top to 30 px with A up on the first frame, by the table.
lda #$1e … sta $05d8 … lda #$01 … sta wPixelsToWalkToStairs.w
code/playerStateProcessing_b1c.s#L5156-L5172 · upstream ↗ lda wEntityPhase.w … lda $9d … lda wJoy1ButtonsPressed … and #$80 … inc $9d … lda #$02 … sta wPixelsToWalkToStairs.w
code/playerStateProcessing_b1d.s#L128-L141 · upstream ↗ lda $9e58, y … cmp #$81 … sta wEntityVertSpeed.w … adc wPixelsToWalkToStairs.w … cmp #$39 … sbc wPixelsToWalkToStairs.w … eor #$ff
code/playerStateProcessing_b1d.s#L154-L213 · upstream ↗ In the cartridge (“Castlevania III - Dracula's Curse (USA)”): bank $1C $9E58-$9E91: $80, nineteen $F9 (−7), six $FA, five $FB, five $FC, six $FD, five $FE, five $FF, five $00, and $81. We don't reproduce the bytes.
- ^ abCode“Super Castlevania IV (USA)”
How we know
Super Castlevania IV's jump holds the take-off speed with no gravity while the jump button stays down, for up to 4 frames, then adds 0.375 px/frame² each frame until the rise stops, holds Simon still at the top for about 9 frames, and falls under the same gravity, capped at 8 px/frame.
In the cartridge (“Super Castlevania IV (USA)”): $00:A3FA-$A409, state 4 each frame: animation, facing ($A792), air control ($A8DE), then the phase routine $A94D; $00:A94D-$A9CF: phases by $1F86. 0: while the button in $BE is held, count $0564 to 4, else go on; 1–2: gravity ($A739) until the speed is ≥ 0, then 0; 3–4: speed 0, count to 9; 5–6: gravity; $00:A739-$A769: Y speed + $0000.$6000 (0.375); a fall at or past 8.0 is set to 8.0. We don't reproduce the bytes.
- ^ abCodeXeeynamo/sotn-decomp71830.c 575–585
How we know
While Alucard rises faster than 1 px/frame in a jump, letting go of the jump button (Cross) sets his upward speed to 1 px/frame.
575void PlayerStepJump(void) { ⋮ 581 if (PLAYER.velocityY < FIX(-1)) { ⋮ 583 !(g_Player.padPressed & PAD_CROSS)) { 584 PLAYER.velocityY = FIX(-1);
src/dra/71830.c lines 575–585 at 2be55ee · upstream ↗ - ^Code“Castlevania II - Simon's Quest (USA)” · “Castlevania (USA) (Rev 1)”
How we know
Simon's Quest replaces Castlevania's step table with a speed and gravity; a jump from the ground takes off at 4 px/frame up, every airborne frame adds 0.21875 px/frame² of gravity, and a fall is capped at 3 px/frame, where Castlevania steps a fixed 20-entry table and falls past its end at 8 px/frame.
In the cartridge (“Castlevania II - Simon's Quest (USA)”): bank 3 $88D9-$892A, the take-off: Y speed $036C.$037E = −4.0 ($FC.$00), the action set to jumping, and the held d-pad read into the X speed and facing; bank 3 $89D6-$8A0D, each jumping frame: zero the speed on a ceiling, add $38 to the speed's fraction ($DFE4), and cap a fall at 3.0; bank 7 $DFE4-$DFF9, a 16-bit add of $0008 to object X's Y speed. We don't reproduce the bytes.
In the cartridge (“Castlevania (USA) (Rev 1)”): Castlevania's jump table, 20 signed steps between a $80 and a $81 marker (castlevania/jump-table); Castlevania's fall past the table's end, 8 px per frame (castlevania/table-end-fall). We don't reproduce the bytes.
- ^ abcCodelsmmega/mm2run_megaman.asm 211–215
How we know
The release cut tests only the speed's whole byte, so it applies at 2 px/frame or more and leaves a slower rise alone.
211 LDA aobject_ycoord_speed 212 BMI @skip 213 CMP #$01 214 BCC @skip 215 BEQ @skip
engine/run_megaman.asm lines 211–215 at 94f0bf3 · upstream ↗ - ^ abCodelsmmega/mm2run_megaman.asm 203–210
How we know
The jumping state's routine checks the release after the frame's move and gravity, so the capped speed first moves Mega Man on the next frame.
203 LDA aobject_ycoord_speed 204 BMI @jump_down 205 JSR _check_object_vertical_move 206 LDA z:z00 207 BNE @landing 208 LDA z:zjoy1_pressed 209 AND #a_button 210 BNE @skip
engine/run_megaman.asm lines 203–210 at 94f0bf3 · upstream ↗ - ^ abVerifiedlsmmega/mm2 · “Mega Man 2 (USA)”run_megaman.asm 201–219, 84–101; check_object_horizontal_move.asm 175–185; +3 files
How we know
Gravity brings the 4.87 px/frame take-off under 2 px/frame on frame 13, so letting go of A after 12 frames changes nothing (computed: the press frame sets 1247/256 px/frame after its move, and each later frame takes 64/256 off before the release test, leaving 543/256 on frame 12 and 479/256 on frame 13).
201@continue: 202 JSR _check_object_horizontal_move 203 LDA aobject_ycoord_speed 204 BMI @jump_down 205 JSR _check_object_vertical_move 206 LDA z:z00 207 BNE @landing 208 LDA z:zjoy1_pressed 209 AND #a_button 210 BNE @skip 211 LDA aobject_ycoord_speed 212 BMI @skip ⋮
engine/run_megaman.asm lines 201–219 at 94f0bf3 · upstream ↗ 175tsa_ycoord_speed_accelerate_fraction_table: ⋮ 181tsa_regular_water_jump_speed_table: ⋮ 184tsa_regular_water_jump_speed_fraction_table:
engine/check_object_horizontal_move.asm lines 175–185 at 94f0bf3 · upstream ↗ 78 LDA tsa_ycoord_speed_accelerate_fraction_table, X 79 STA z:zobject_ycoord_speed_accelerate_fraction ⋮ 82 LDA tsa_regular_water_jump_speed_table, X 83 STA z:zjump_speed 84 LDA tsa_regular_water_jump_speed_fraction_table, X 85 STA z:zjump_speed_fraction
engine/tsa.asm lines 78–85 at 94f0bf3 · upstream ↗ In the cartridge (“Mega Man 2 (USA)”): tsa_ycoord_speed_accelerate_fraction_table; tsa_regular_water_jump_speed_table, tsa_regular_water_jump_speed_fraction_table. We don't reproduce the bytes.
Measured by a script in MesenCE 2.2.1 (build 4b8a196), on Mega Man 2 (USA) (SHA-1
54d53b46b961…). It fails if the result disagrees with the claim. - ^ abVerifiedlsmmega/mm2run_megaman.asm 160–223; check_object_vertical_move.asm 1–90
How we know
Measured in the game, Mega Man's jump peaks at 8 px on frame 5 when A is tapped and at 50 px on frame 19 when it is held 12 frames or more, landing on frames 15 and 41.
165 LDA z:zjoy1_pressed ⋮ 203 LDA aobject_ycoord_speed ⋮ 205 JSR _check_object_vertical_move ⋮ 208 LDA z:zjoy1_pressed 209 AND #a_button 210 BNE @skip 211 LDA aobject_ycoord_speed 212 BMI @skip 213 CMP #$01 214 BCC @skip 215 BEQ @skip 216 LDA #$01 ⋮
engine/run_megaman.asm lines 160–223 at 94f0bf3 · upstream ↗ 2 LDA aobject_ycoord ⋮ 8 LDA aobject_ycoord_speed ⋮ 13 SEC ⋮ 17 LDA aobject_ycoord ⋮ 19 STA aobject_ycoord ⋮ 47 LDA aobject_ycoord_speed ⋮ 49 SEC 50 LDA aobject_ycoord ⋮ 64 SEC ⋮ 66 STA aobject_ycoord ⋮ 70 STA aobject_ycoord_speed_fraction 71 STA aobject_ycoord_speed ⋮
engine/check_object_vertical_move.asm lines 1–90 at 94f0bf3 · upstream ↗ Measured by a script in MesenCE 2.2.1 (build 4b8a196), on . It fails if the result disagrees with the claim.
- ^ abcdCodeXkeeper0/smb1 · Jdaster64 n.d. · “Super Mario Bros. (World)”prg.asm 4858–4859, 4966–4967
How we know
While a jump rises with A held, gravity is the rising-gravity table's
$20,$20,$1E,$28,$28subpixels/frame² for rows 0–4.4858JumpMForceData:src/prg.asm lines 4858–4859 at 1cc3c92 · upstream ↗ 4966 LDA JumpMForceData,y ; store appropriate jump/swim 4967 STA VerticalForce ; data here
src/prg.asm lines 4966–4967 at 1cc3c92 · upstream ↗ 00200 | 001E0 | 00280
JUMPING/VERTICAL PHYSICS, Mario table, Holding “A” Gravity (+Y) · archived copy ↗ In the cartridge (“Super Mario Bros. (World)”): JumpMForceData. We don't reproduce the bytes.
- ^ abcdCodeXkeeper0/smb1 · Jdaster64 n.d. · “Super Mario Bros. (World)”prg.asm 4861–4862, 4968–4969
How we know
After the switch, gravity is the falling-gravity table's
$70,$70,$60,$90,$90subpixels/frame² for rows 0–4.4861FallMForceData:src/prg.asm lines 4861–4862 at 1cc3c92 · upstream ↗ 4968 LDA FallMForceData,y 4969 STA VerticalForceDown
src/prg.asm lines 4968–4969 at 1cc3c92 · upstream ↗ 00700 | 00600 | 00900
JUMPING/VERTICAL PHYSICS, Mario table, Falling Gravity (+Y) · archived copy ↗ In the cartridge (“Super Mario Bros. (World)”): FallMForceData. We don't reproduce the bytes.
- ^ abCodeXkeeper0/smb1prg.asm 4957–4958
How we know
The jump setup sets the minimum rise for a release to 1, so a release switches gravity only once Mario has risen at least 1 pixel.
4957 LDA #$01 ; set value here (apparently always set to 1) 4958 STA DiffToHaltJump
src/prg.asm lines 4957–4958 at 1cc3c92 · upstream ↗ - ^ abVerifiedXkeeper0/smb1prg.asm 4756–4769, 6664–6696, 4957–4958
How we know
Measured in the game on flat ground, the apexes, tapped/held, are 24/66 px standing, 27/71 px walking, and 29/83 px running.
4758 LDA A_B_Buttons ⋮ 4763 SEC ⋮ 4767DumpFall: ⋮ 4769 STA VerticalForce
src/prg.asm lines 4756–4769 at 1cc3c92 · upstream ↗ 6681 LDA SprObject_Y_MoveForce,x 6682 CLC ⋮ 6684 STA SprObject_Y_MoveForce,x ⋮ 6686 ADC #$00 6687 STA SprObject_Y_Speed,x ⋮ 6690 LDA SprObject_Y_MoveForce,x
src/prg.asm lines 6664–6696 at 1cc3c92 · upstream ↗ 4958 STA DiffToHaltJumpsrc/prg.asm lines 4957–4958 at 1cc3c92 · upstream ↗ - Rests on Measured in the game with A held, Mario's jumps peak at 66 px standing, 71 px walking, and 83 px running. (the same run, whose held peaks name the second row walking and the fourth running)
Measured by a script in MesenCE 2.2.1 (build 4b8a196), on . It fails if the result disagrees with the claim.
- ^ abVerifiedSMWDisXbank_00.asm 10439–10459
How we know
Measured in the game from a standstill, Mario's climb grows over the sampled holds of B, from 33.3 px for a 1-frame tap up to 64.2 px, and every sampled hold of 28 frames or more gives 64.2 px.
10440 LDY.B #$01 10441 LDA.B byetudlrHold 10442 BMI + ⋮ 10444 LDY.B #$00
bank_00.asm lines 10439–10459 at 30643c7 · upstream ↗ Measured by a script in MesenCE 2.2.1 (build 4b8a196), on . It fails if the result disagrees with the claim.
- ^ abVerifiedSMWDisX · “Super Mario World (USA)”bank_00.asm 9673–9675, 10439–10459
How we know
Measured in the game, Mario climbs 64.2 px held and 33.3 px tapped from a standstill, 72.6 px held at walking speed, 81.6 px held running, and 85.3 or 91.1 px held sprinting.
9673DATA_00D2BD:bank_00.asm lines 9673–9675 at 30643c7 · upstream ↗ 10440 LDY.B #$01 10441 LDA.B byetudlrHold 10442 BMI + ⋮ 10444 LDY.B #$00
bank_00.asm lines 10439–10459 at 30643c7 · upstream ↗ In the cartridge (“Super Mario World (USA)”): DATA_00D2BD. We don't reproduce the bytes.
Measured by a script in MesenCE 2.2.1 (build 4b8a196), on Super Mario World (USA) (SHA-1
6b47bb75d165…). It fails if the result disagrees with the claim. - ^ abcdCodeNoelFB/CelestePlayer.cs 51
How we know
The variable-jump time, how long holding jump can keep the take-off speed, is 0.2 s.
51 private const float VarJumpTime = .2f;Source/Player/Player.cs line 51 at 1b0ce45 · upstream ↗ - ^ abCodeNoelFB/CelestePlayer.cs 25
How we know
The half-gravity threshold is 40 px/s, the vertical speed below which (in either direction) holding jump halves gravity.
25 private const float HalfGravThreshold = 40f;Source/Player/Player.cs line 25 at 1b0ce45 · upstream ↗ - ^ abCodeNoelFB/CelestePlayer.cs 1660–1673
How we know
The jump function sets vertical speed to the jump speed plus any platform lift boost, saves it as the variable-jump speed, starts the variable-jump timer at the variable-jump time, and zeroes the grace timer.
1663 jumpGraceTimer = 0; 1664 varJumpTimer = VarJumpTime; ⋮ 1671 Speed.Y = JumpSpeed; 1672 Speed += LiftBoost; 1673 varJumpSpeed = Speed.Y;
Source/Player/Player.cs lines 1660–1673 at 1b0ce45 · upstream ↗ - ^ abCodeNoelFB/Celeste · JamesMcMahon/monocle-enginePlayer.cs 742–744, 908, 934–935, 322–323; Entity.cs 95–98
How we know
In each update, the player's update ticks both jump timers, the state machine runs the normal state's update (gravity, hold, and new jump), and then the vertical move applies the vertical speed times the time step.
742 //Var Jump 743 if (varJumpTimer > 0) 744 varJumpTimer -= Engine.DeltaTime;
Source/Player/Player.cs lines 742–744 at 1b0ce45 · upstream ↗ 908 base.Update();Source/Player/Player.cs line 908 at 1b0ce45 · upstream ↗ 935 MoveV(Speed.Y * Engine.DeltaTime, onCollideV);Source/Player/Player.cs lines 934–935 at 1b0ce45 · upstream ↗ - ^ abCodeNoelFB/Celeste · WPI DGMI wiki, “Coyote Time”Player.cs 713–720, 742–744, 1664
How we know
The 0.1 s grace and 0.2 s variable-jump timers end on float rounding: a 0.0166667 s step gives 5 and 11 updates, and an exact 1/60 s step gives 6 and 12.
717 jumpGraceTimer = JumpGraceTime; ⋮ 719 else if (jumpGraceTimer > 0) 720 jumpGraceTimer -= Engine.DeltaTime;
Source/Player/Player.cs lines 713–720 at 1b0ce45 · upstream ↗ 743 if (varJumpTimer > 0) 744 varJumpTimer -= Engine.DeltaTime;
Source/Player/Player.cs lines 742–744 at 1b0ce45 · upstream ↗ The player character can jump up to 5 frames after leaving a ledge.
Examples · archived copy ↗ 1664 varJumpTimer = VarJumpTime;Source/Player/Player.cs line 1664 at 1b0ce45 · upstream ↗ - Rests on The jump grace time, Celeste's coyote time, is 0.1 s.
- Rests on The variable-jump time, how long holding jump can keep the take-off speed, is 0.2 s.
Measured by a script. It fails if the result disagrees with the claim.
- ^ abcCodeNoelFB/CelestePlayer.cs 2952–2966, 1660–1673
How we know
Simulating the jump code (flat ground, no lift boost, a 0.0166667 s step) gives apexes of 7 px tapped and 27 px held, airtimes 15 and 39 updates; an exact 1/60 s step gives 29 px held in 40.
2952 float mult = (Math.Abs(Speed.Y) < HalfGravThreshold && (Input.Jump.Check || AutoJump)) ? .5f : 1f; ⋮ 2954 if (level.InSpace) 2955 mult *= SpacePhysicsMult; ⋮ 2957 Speed.Y = Calc.Approach(Speed.Y, max, Gravity * mult * Engine.DeltaTime); ⋮ 2961 if (varJumpTimer > 0) ⋮ 2963 if (AutoJump || Input.Jump.Check) 2964 Speed.Y = Math.Min(Speed.Y, varJumpSpeed); 2965 else 2966 varJumpTimer = 0;
Source/Player/Player.cs lines 2952–2966 at 1b0ce45 · upstream ↗ 1664 varJumpTimer = VarJumpTime; ⋮ 1671 Speed.Y = JumpSpeed; 1672 Speed += LiftBoost; 1673 varJumpSpeed = Speed.Y;
Source/Player/Player.cs lines 1660–1673 at 1b0ce45 · upstream ↗ - Rests on A normal jump sets Madeline's vertical speed to the jump speed, −105 px/s.
- Rests on Celeste's gravity is 900 px/s²; each airborne update moves vertical speed toward the fall limit by the gravity times a multiplier times the update's time step.
- Rests on The half-gravity threshold is 40 px/s, the vertical speed below which (in either direction) holding jump halves gravity.
- Rests on The variable-jump time, how long holding jump can keep the take-off speed, is 0.2 s.
- Rests on The normal limit on falling speed is 160 px/s; entering the normal state starts the current limit there and gravity approaches it.
Measured by a script. It fails if the result disagrees with the claim.
- ^ abcdCode“Castlevania (USA) (Rev 1)”
How we know
Simon's jump rises by a fixed table of per-frame steps, 5, 5, 3, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 1, 0, 0, 0, and 0 px, 36 px in all.
In the cartridge (“Castlevania (USA) (Rev 1)”): bank 6 $9B8D-$9BA4, the table's address, a $80 start marker, 20 signed steps ($FB = −5, up), and a $81 turn marker; bank 6 $9B1E-$9B8A, the routine that adds one step to Simon's Y each frame and moves the table pointer. We don't reproduce the bytes.
- ^ abcCodelsmmega/mm2 · “Mega Man 2 (USA)”check_object_horizontal_move.asm 175–176; check_object_vertical_move.asm 73–80; +2 files
How we know
Gravity takes
$40/256 = 0.25 px/frame from Mega Man's upward speed each frame out of water ($1E/256 in water).175tsa_ycoord_speed_accelerate_fraction_table:engine/check_object_horizontal_move.asm lines 175–176 at 94f0bf3 · upstream ↗ 73@air: 74 SEC 75 LDA aobject_ycoord_speed_fraction 76 SBC z:zobject_ycoord_speed_accelerate_fraction 77 STA aobject_ycoord_speed_fraction 78 LDA aobject_ycoord_speed 79 SBC z:zobject_ycoord_speed_accelerate 80 STA aobject_ycoord_speed
engine/check_object_vertical_move.asm lines 73–80 at 94f0bf3 · upstream ↗ 24 LDX #$00 25 LDA z:zboss_ai_pointer 26 BEQ @no_bosses 27 LDA z:zcurrent_boss 28 CMP #$03 29 BEQ @skip_jump_into_water_anim ⋮ 31@no_bosses: 32 LDA z:ztsa_blockset_pointers + 1 33 CMP #water 34 BNE @not_water 35 LDA z:zwater 36 BNE @skip_jump_into_water_anim
engine/tsa.asm lines 24–36 at 94f0bf3 · upstream ↗ In the cartridge (“Mega Man 2 (USA)”): tsa_ycoord_speed_accelerate_fraction_table. We don't reproduce the bytes.
- ^ abcVerifiedsonicretro/s1disasm · Sonic Retro, “Sonic Physics Guide: Air State”sub ObjectFall & SpeedToPos.asm 5; 01 Sonic.asm 363
How we know
In the running game, the object fall routine adds a gravity of
$38(0.21875 px/frame²) to Sonic's Y speed on every airborne frame, rising or falling, after a jump or off a ledge, button held or not.5gravity: equ $38 ; gravity constant used by many objects_incObj/sub ObjectFall & SpeedToPos.asm line 5 at 15dfa3a · upstream ↗ 363 jsr (ObjectFall).l ; apply gravity and update Sonic's position based on his current velocities_incObj/01 Sonic.asm line 363 at 15dfa3a · upstream ↗ gravity_force 0.21875 (56 subpixels)
Constants · archived copy ↗ Measured by a script. It fails if the result disagrees with the claim.
- ^Verifiedsonicretro/s1disasm01 Sonic.asm 8, 1273–1288; sub ObjectFall & SpeedToPos.asm 16–20
How we know
In the running game (flat ground, out of water), a standing jump peaks 39 px up tapped (the button held on the press frame only) and 100 px held (not let go before the peak), landing on frames 39 and 62.
8son_jumpspeed: equ $680 ; Sonic's jump speed_incObj/01 Sonic.asm line 8 at 15dfa3a · upstream ↗ 1276 move.w #-$400,d1 ; set max jump height_incObj/01 Sonic.asm lines 1273–1288 at 15dfa3a · upstream ↗ 16 move.w obVelY(a0),d0 ; load vertical speed 17 addi.w #gravity,obVelY(a0) ; increase vertical speed (apply gravity) ⋮ 20 add.l d0,d3 ; add speed to Y-axis position
_incObj/sub ObjectFall & SpeedToPos.asm lines 16–20 at 15dfa3a · upstream ↗ - Rests on In the running game, on flat ground out of water, letting go of the button while a jump still rises faster than 4 px/frame sets Sonic's Y speed to exactly −
$400: the release check runs before the move and gravity, so a release on any of airborne updates 1 to 12 moves him up exactly 4 px that frame and leaves −$3C8after gravity (−$400+$38, computed). - Rests on In the running game, the object fall routine adds a gravity of
$38(0.21875 px/frame²) to Sonic's Y speed on every airborne frame, rising or falling, after a jump or off a ledge, button held or not. - Rests on In the running game, landing on flat ground keeps Sonic's horizontal speed: on the landing frame his ground speed is that frame's X speed, after its air steering, drag, and move, his Y speed is 0, and he stands uncurled.
Measured by a script. It fails if the result disagrees with the claim.
- Rests on In the running game, on flat ground out of water, letting go of the button while a jump still rises faster than 4 px/frame sets Sonic's Y speed to exactly −
- ^CodeSMWDisXbank_00.asm 10909–10933
How we know
The motion routine adds a speed's low nybble to a subpixel byte and its high nybble, sign-extended, plus the carry to the 16-bit position, so Mario moves in sixteenths of a pixel.
10909CODE_00DC4F: ;! 10910 LDA.B PlayerXSpeed+1,X ;! 10911 ASL A ;! 10912 ASL A ;! 10913 ASL A ;! 10914 ASL A ;! 10915 CLC ;! 10916 ADC.W PlayerXPosSpx,X ;! ⋮ 10920 LDA.B PlayerXSpeed+1,X ;! ⋮ 10930 ADC.B PlayerXPosNext,X ;!
bank_00.asm lines 10909–10933 at 30643c7 · upstream ↗ - ^CodeXkeeper0/smb1prg.asm 4913–4923, 4931–4942, 4139–4141
How we know
A jump starts only on the frame A goes down while Mario is grounded; the jump setup zeroes the vertical subpixel and sets the jumping state.
4913 LDA A_B_Buttons ; check for A button press ⋮ 4916 AND PreviousA_B_Buttons ; if button not pressed in previous frame, branch ⋮ 4922 LDA Player_State ; check player state 4923 BEQ InitJS ; if on the ground, branch
src/prg.asm lines 4913–4923 at 1cc3c92 · upstream ↗ 4935 STY Player_YMF_Dummy ⋮ 4941 LDA #$01 ; set player state to jumping/swimming
src/prg.asm lines 4931–4942 at 1cc3c92 · upstream ↗ 4141 STA PreviousA_B_Buttons ; into temp variable to be used on next framesrc/prg.asm lines 4139–4141 at 1cc3c92 · upstream ↗ - ^ abCodeXkeeper0/smb1 · Jdaster64 n.d.prg.asm 4943–4955
How we know
The jump setup picks one of five jump rows by take-off horizontal speed, stepping up at
$09,$10,$19, and$1C.4943 LDA Player_XSpeedAbsolute ; check value related to walking/running speed 4944 CMP #$09 ⋮ 4947 CMP #$10 4948 BCC ChkWtr ⋮ 4950 CMP #$19 4951 BCC ChkWtr ⋮ 4953 CMP #$1c 4954 BCC ChkWtr ; note that for jumping, range is 0-4 for Y
src/prg.asm lines 4943–4955 at 1cc3c92 · upstream ↗ Less than 01000 | 01000 – 024FF | 02500 or greater
JUMPING/VERTICAL PHYSICS, Mario table · archived copy ↗ - ^CodeXkeeper0/smb1 · Jdaster64 n.d. · “Super Mario Bros. (World)”prg.asm 4873–4874, 5000–5014
How we know
Mario's top ground speed is
$18walking and$28running (B held).4873MaxRightXSpdData:src/prg.asm lines 4873–4874 at 1cc3c92 · upstream ↗ 5009 AND #B_Button 5010 BNE SetRTmr ; if pressed, skip ahead to set timer ⋮ 5014 INY ; if running timer not set or level type is water,
src/prg.asm lines 5000–5014 at 1cc3c92 · upstream ↗ Maximum walk speed (normal, castle cutscene) 01900 | Maximum running speed 02900
SMB PHYSICS 101 / GROUND PHYSICS, Mario table · archived copy ↗ In the cartridge (“Super Mario Bros. (World)”): MaxRightXSpdData. We don't reproduce the bytes.
- ^ abCodeXkeeper0/smb1 · Jdaster64 n.d. · “Super Mario Bros. (World)”prg.asm 4864–4865, 4972–4973
How we know
The jump-speed table starts a jump at −4 px/frame (rows 0–2) or −5 px/frame (rows 3–4).
4864PlayerYSpdData:src/prg.asm lines 4864–4865 at 1cc3c92 · upstream ↗ 4972 LDA PlayerYSpdData,y 4973 STA Player_Y_Speed
src/prg.asm lines 4972–4973 at 1cc3c92 · upstream ↗ 04000 | 04000 | 05000
JUMPING/VERTICAL PHYSICS, Mario table, Initial Velocity (−Y) · archived copy ↗ In the cartridge (“Super Mario Bros. (World)”): PlayerYSpdData. We don't reproduce the bytes.
- ^CodeXkeeper0/smb1 · “Super Mario Bros. (World)”prg.asm 4867–4868, 4970–4971
How we know
The jump's starting-fraction table gives jump rows 0–4 a zero speed fraction, so take-off is exactly −4.00 or −5.00 px/frame.
4867InitMForceData:src/prg.asm lines 4867–4868 at 1cc3c92 · upstream ↗ 4970 LDA InitMForceData,y 4971 STA Player_Y_MoveForce
src/prg.asm lines 4970–4971 at 1cc3c92 · upstream ↗ In the cartridge (“Super Mario Bros. (World)”): InitMForceData. We don't reproduce the bytes.
- ^CodeXkeeper0/smb1prg.asm 4713–4725, 4796
How we know
The press frame already moves Mario, since the player physics routine starts the jump before the state dispatch runs the jump-and-swim routine and the vertical move.
4713 JSR PlayerPhysicsSub ; run sub related to jumping and swimming ⋮ 4722 JSR JumpEngine ⋮ 4724 .dw OnGroundStateSub 4725 .dw JumpSwimSub
src/prg.asm lines 4713–4725 at 1cc3c92 · upstream ↗ 4796 JMP MovePlayerVertically ; jump to move player vertically, then leavesrc/prg.asm line 4796 at 1cc3c92 · upstream ↗ - ^CodeXkeeper0/smb1 · “Super Mario Bros. (World)”prg.asm 4858–4859, 6681–6687
How we know
In rows 0–1, the standing and slow jumps, held gravity is
$20/256 = 0.125 px/frame².4858JumpMForceData:src/prg.asm lines 4858–4859 at 1cc3c92 · upstream ↗ 6681 LDA SprObject_Y_MoveForce,x 6682 CLC 6683 ADC $00 ; add downward movement amount to contents of $0433 6684 STA SprObject_Y_MoveForce,x 6685 LDA SprObject_Y_Speed,x ; add carry to vertical speed and store 6686 ADC #$00
src/prg.asm lines 6681–6687 at 1cc3c92 · upstream ↗ In the cartridge (“Super Mario Bros. (World)”): JumpMForceData. We don't reproduce the bytes.
- ^CodeXkeeper0/smb1 · “Super Mario Bros. (World)”prg.asm 4861–4862, 6681–6687
How we know
In rows 0–1, falling gravity is
$70/256 = 0.4375 px/frame².4861FallMForceData:src/prg.asm lines 4861–4862 at 1cc3c92 · upstream ↗ 6683 ADC $00 ; add downward movement amount to contents of $0433 6684 STA SprObject_Y_MoveForce,x
src/prg.asm lines 6681–6687 at 1cc3c92 · upstream ↗ In the cartridge (“Super Mario Bros. (World)”): FallMForceData. We don't reproduce the bytes.
- ^CodeXkeeper0/smb1prg.asm 6666–6687
How we know
Vertical motion is 8.8 fixed point; each frame, the gravity routine adds speed to position, the fraction via a subpixel byte, then gravity to speed.
6668 ADC SprObject_Y_MoveForce,x 6669 STA SprObject_YMF_Dummy,x ⋮ 6676 ADC SprObject_Y_Position,x ; add vertical position to vertical speed plus carry ⋮ 6683 ADC $00 ; add downward movement amount to contents of $0433 ⋮ 6685 LDA SprObject_Y_Speed,x ; add carry to vertical speed and store
src/prg.asm lines 6666–6687 at 1cc3c92 · upstream ↗ - ^CodeXkeeper0/smb1 · Jdaster64 n.d.prg.asm 6547–6550, 6688–6696
How we know
The vertical-move routine gives the gravity routine 4 px/frame as Mario's maximum fall speed; the clamp sets the speed back to 4 only when its whole part is at least 4 and its fraction byte at least
$80.6549 LDA #$04 ; set maximum vertical speed here 6550 JMP ImposeGravitySprObj ; then jump to move player vertically
src/prg.asm lines 6547–6550 at 1cc3c92 · upstream ↗ 6688 CMP $02 ; compare to maximum speed ⋮ 6691 CMP #$80 ; if less positively than preset maximum, skip this part ⋮ 6694 STA SprObject_Y_Speed,x ; keep vertical speed within maximum value ⋮ 6696 STA SprObject_Y_MoveForce,x ; clear fractional
src/prg.asm lines 6688–6696 at 1cc3c92 · upstream ↗ their vertical downward velocity caps at 04800 in most cases, wrapping back to 04000 when exceeded
JUMPING/VERTICAL PHYSICS · archived copy ↗ - ^CodeXkeeper0/smb1 · Jdaster64 n.d.prg.asm 6688–6696
How we know
The gravity routine clamps a fall of 4 px/frame or more only when the fraction byte is at least
$80.6688 CMP $02 ; compare to maximum speed 6689 BMI ChkUpM ; if less than preset value, skip this part 6690 LDA SprObject_Y_MoveForce,x 6691 CMP #$80 ; if less positively than preset maximum, skip this part 6692 BCC ChkUpM
src/prg.asm lines 6688–6696 at 1cc3c92 · upstream ↗ their vertical downward velocity caps at 04800 in most cases, wrapping back to 04000 when exceeded
JUMPING/VERTICAL PHYSICS · archived copy ↗ - ^Code“Castlevania (USA) (Rev 1)”
How we know
In Simon's standing state, the frame A goes down starts a jump, unless a block is over his head (ceiling-takeoff); the take-off code points his arc at a fixed table and sets his direction to his facing combined with any Left or Right held.
In the cartridge (“Castlevania (USA) (Rev 1)”): bank 6 $9366-$9381, the dispatch on Simon's state; state 0 (standing) runs $9380, state 1 (jumping) $9482; bank 6 $9401-$943B: A pressed this frame, a ceiling check, the table pointer from $9B8D, state 1, then direction = facing | (held Right/Left). We don't reproduce the bytes.
- ^Code“Castlevania (USA) (Rev 1)”
How we know
At the table's turn marker the arc routine reverses and reads the same steps backward, negated, so Simon falls the way he rose.
In the cartridge (“Castlevania (USA) (Rev 1)”): bank 6 $9B31-$9B40: on $81, flip the direction flag ($0514), step the pointer back, and read again; bank 6 $9B1E-$9B8A; with the flag set, each step is negated and the pointer moves back. We don't reproduce the bytes.
- ^Verified“Castlevania (USA) (Rev 1)”
How we know
Measured frame by frame, Simon's standing jump follows the table exactly, from a motionless press frame to a landing 40 frames later.
In the cartridge (“Castlevania (USA) (Rev 1)”): the table. We don't reproduce the bytes.
Measured by a script in MesenCE 2.2.1 (build 4b8a196), on Castlevania (USA) (Rev 1) (SHA-1
4e3ef47de86a…). It fails if the result disagrees with the claim. - ^Codelsmmega/mm2 · “Mega Man 2 (USA)”check_object_horizontal_move.asm 181–185; tsa.asm 73–85, 24–36
How we know
Mega Man's jump speed is
$04.$DF, 4.87 px/frame upward, out of water ($05.$80in water).181tsa_regular_water_jump_speed_table: ⋮ 184tsa_regular_water_jump_speed_fraction_table:
engine/check_object_horizontal_move.asm lines 181–185 at 94f0bf3 · upstream ↗ 73@hidden: 74 LDX #$00 75 INX ⋮ 77@not_water: ⋮ 82 LDA tsa_regular_water_jump_speed_table, X 83 STA z:zjump_speed 84 LDA tsa_regular_water_jump_speed_fraction_table, X 85 STA z:zjump_speed_fraction
engine/tsa.asm lines 73–85 at 94f0bf3 · upstream ↗ 24 LDX #$00 25 LDA z:zboss_ai_pointer 26 BEQ @no_bosses 27 LDA z:zcurrent_boss 28 CMP #$03 29 BEQ @skip_jump_into_water_anim ⋮ 31@no_bosses: 32 LDA z:ztsa_blockset_pointers + 1 33 CMP #water 34 BNE @not_water 35 LDA z:zwater 36 BNE @skip_jump_into_water_anim
engine/tsa.asm lines 24–36 at 94f0bf3 · upstream ↗ In the cartridge (“Mega Man 2 (USA)”): tsa_regular_water_jump_speed_table, tsa_regular_water_jump_speed_fraction_table. We don't reproduce the bytes.
- ^Codelsmmega/mm2run_megaman.asm 94–103, 84–88; nmi_wait.asm 13–17
How we know
In the standing, walking, running, and landing states, a fresh A press copies the stored jump speed into Mega Man's vertical speed after the frame's move, so the press frame doesn't lift him.
94_run_megaman_landing_common_1: 95 LDA z:zjoy1_pressed_bits 96 AND #a_button 97 BEQ @not_pressed 98 LDA z:zjump_speed_fraction 99 STA aobject_ycoord_speed_fraction 100 LDA z:zjump_speed 101 STA aobject_ycoord_speed 102 LDA #$06 103 STA z:zmegaman_status
engine/run_megaman.asm lines 94–103 at 94f0bf3 · upstream ↗ 84 JSR _megaman_status_parameter 85 JSR _check_object_horizontal_move 86 JSR _check_object_vertical_move 87 LDA z:z00 88 BNE _run_megaman_landing_common_1
engine/run_megaman.asm lines 84–88 at 94f0bf3 · upstream ↗ 13 JSR _joy 14 LDA z:zjoy1_pressed 15 EOR z:zjoy1_pressed_frame 16 AND z:zjoy1_pressed 17 STA z:zjoy1_pressed_bits
home/nmi_wait.asm lines 13–17 at 94f0bf3 · upstream ↗ - ^Verifiedlsmmega/mm2header.asm 8–19; README.md 5
How we know
lsmmega's disassembly builds this exact ROM; with the iNES header its
header.asmwrites in place of the ROM's own header, the ROM's SHA-1 is the build's.8 prg_rom = 256 9 chr_rom = 0 10 mapper = 1 11 mirroring = vertical
header.asm lines 8–19 at 94f0bf3 · upstream ↗ 5It builds on `Megaman II (U) [!].nes` `SHA1: 6B5B9235C3F630486ED8F07A133B044EAA2E22B2`README.md line 5 at 94f0bf3 · upstream ↗ Measured by a script in MesenCE 2.2.1 (build 4b8a196), on . It fails if the result disagrees with the claim.
- ^VerifiedSMWDisX · “Super Mario World (USA)”bank_00.asm 10171–10173, 10446–10459, 10167–10168, 10439–10444
How we know
Gravity's routine cuts a downward speed of 4 px/frame or more back to 4 px/frame before adding gravity, so Mario falls at most 70/16 px/frame, or 67/16 holding the button.
10171DATA_00D7AF: ;!bank_00.asm lines 10171–10173 at 30643c7 · upstream ↗ 10446 + LDA.B PlayerYSpeed+1 ;! \ If Mario's Y speed is negative (up), 10447 BMI CODE_00D948 ;! / branch to $D948 10448 CMP.W DATA_00D7AF,Y ;! 10449 BCC + ;! 10450 LDA.W DATA_00D7AF,Y ;! 10451 + LDX.B PlayerInAir ;! 10452 BEQ CODE_00D948 ;! 10453 CPX.B #$0B ;! 10454 BNE CODE_00D948 ;! 10455 LDX.B #$24 ;! 10456 STX.B PlayerInAir ;! 10457CODE_00D948: ;! ⋮
bank_00.asm lines 10446–10459 at 30643c7 · upstream ↗ 10167DATA_00D7A5: ;!bank_00.asm lines 10167–10168 at 30643c7 · upstream ↗ In the cartridge (“Super Mario World (USA)”): DATA_00D7AF; DATA_00D7A5. We don't reproduce the bytes.
Measured by a script in MesenCE 2.2.1 (build 4b8a196), on Super Mario World (USA) (SHA-1
6b47bb75d165…). It fails if the result disagrees with the claim. - ^CodeSMWDisX · “Super Mario World (USA)”bank_00.asm 9673–9675
How we know
The jump-speed table (at
$00D2BD) gives a normal jump −80/16 to −97/16 px/frame ($B0–$9F) and a spin jump −74/16 to −90/16 ($B6–$A6), faster for every 0.5 px/frame of horizontal speed.9673DATA_00D2BD:bank_00.asm lines 9673–9675 at 30643c7 · upstream ↗ In the cartridge (“Super Mario World (USA)”): DATA_00D2BD. We don't reproduce the bytes.
- ^CodeSMWDisXbank_00.asm 8897–8905, 8946–8949
How we know
Each frame the player routine moves Mario by his current speed, then handles a jump press, then adds gravity, so the press frame doesn't lift him and his first step up is the take-off speed plus held gravity.
8897CODE_00CD24: ⋮ 8904 + JSR CODE_00DC2D 8905 JSR CODE_00E92B
bank_00.asm lines 8897–8905 at 30643c7 · upstream ↗ 8946CODE_00CD82: 8947 JSR CODE_00D5F2 8948 JSR CODE_00D062 8949 JSR CODE_00D7E4
bank_00.asm lines 8946–8949 at 30643c7 · upstream ↗ - ^Verifiedsonicretro/s1disasm · Sonic Retro, “Sonic Physics Guide: Jumping”01 Sonic.asm 8, 1218
How we know
In the running game, on flat ground out of water, a jump's press frame sets Sonic's Y speed to −
$680(6.5 px/frame), whether he stands, runs, or rolls.8son_jumpspeed: equ $680 ; Sonic's jump speed_incObj/01 Sonic.asm line 8 at 15dfa3a · upstream ↗ 1218 move.w #son_jumpspeed,d2 ; set initial jump force_incObj/01 Sonic.asm line 1218 at 15dfa3a · upstream ↗ jump_force 6.5 (6 pixels and 128 supbixels)
Constants · archived copy ↗ Measured by a script. It fails if the result disagrees with the claim.
- ^Verifiedsonicretro/s1disasm · Sonic Retro, “Sonic Physics Guide: Jumping”01 Sonic.asm 1224–1233; sub CalcSine.asm 53
How we know
In the running game, a jump pressed on a 45° ramp built from Green Hill's
$E0ramp block adds the jump speed along the ground normal (the sine and cosine of his angle −$40) to both his X and Y speeds, and he doesn't move that frame: standing on the ramp, both went from 0 to −1177; running up it, from 395 and −396 to −782 and −1573.1226 subi.b #$40,d0 ; rotate it perpendicularly for jump trajectory 1227 jsr (CalcSine).l ; find the direction Sonic should jump 1228 muls.w d2,d1 ; apply jump force to the cosine angle 1229 asr.l #8,d1 ; shift it to upper word 1230 add.w d1,obVelX(a0) ; apply to X speed 1231 muls.w d2,d0 ; apply jump force to the sine angle 1232 asr.l #8,d0 ; shift it to upper word 1233 add.w d0,obVelY(a0) ; apply to Y speed
_incObj/01 Sonic.asm lines 1224–1233 at 15dfa3a · upstream ↗ 53 dc.w -$100,-$FF,-$FF,-$FF,-$FE,-$FE,-$FD,-$FC ; =_incObj/sub CalcSine.asm line 53 at 15dfa3a · upstream ↗ both X Speed and Y Speed must have jump_force subtracted from them, using cos() and sin() to get the right values.
Jump Velocity · archived copy ↗ Measured by a script. It fails if the result disagrees with the claim.
- ^ abVerifiedsonicretro/s1disasm · Sonic Retro, “Sonic Physics Guide: Jumping”01 Sonic.asm 1236, 317–323
How we know
In the running game, on flat ground, Sonic doesn't move on a jump's press frame, even at top speed: X stays put and Y changes only by the curl (roll-shift), because the jump routine drops its return address, skipping the rest of the grounded routine, the speed-to-position move included.
1236 addq.l #4,sp ; run in-air subroutines when we return_incObj/01 Sonic.asm line 1236 at 15dfa3a · upstream ↗ 317Sonic_MdNormal: ; While Sonic is on the ground and not rolling 318 bsr.w Sonic_Jump ; check if we need to jump ⋮ 323 jsr (SpeedToPos).l ; update Sonic's position based on his current velocities
_incObj/01 Sonic.asm lines 317–323 at 15dfa3a · upstream ↗ If you do press the jump button, it exits the rest of the cycle - so the Player doesn't move at all during the step in which you jump, vertically or horizontally.
Bugs when Jumping · archived copy ↗ Measured by a script. It fails if the result disagrees with the claim.
- ^Verifiedsonicretro/s1disasm · Sonic Retro, “Sonic Physics Guide: Characters”01 Sonic.asm 1250–1254; _Constants.asm 312–314
How we know
In the running game, on flat ground, a standing or running jump curls Sonic up on the press frame, shrinking his height radius by 5 px, from 19 to 14, and adding 5 px to Y, so his feet stay put.
1250 move.b #sonic_roll_height,obHeight(a0) ; set height to rolling size ⋮ 1254 addq.w #sonic_height-sonic_roll_height,obY(a0) ; adjust Y-position to align Sonic to the floor
_incObj/01 Sonic.asm lines 1250–1254 at 15dfa3a · upstream ↗ 312sonic_height: equ 38/2 ; Sonic's height ⋮ 314sonic_roll_height: equ 28/2 ; Sonic's height (rolling)
_Constants.asm lines 312–314 at 15dfa3a · upstream ↗ When Jumping or rolling, his Width Radius is 7 and his Height Radius is 14, resulting in 15 pixels wide and 29 pixels tall.
Sonic · archived copy ↗ Measured by a script. It fails if the result disagrees with the claim.
- ^Verifiedsonicretro/s1disasm · Sonic Retro, “Sonic Physics Guide: Jumping”01 Sonic.asm 359–363
How we know
In the running game, Sonic's airborne-mode routine runs the release check before the object fall routine moves Sonic and adds gravity, so a release frame moves him by the capped speed, exactly 4 px up, and gravity adds to the cap.
359Sonic_MdJump2: ; While Sonic is in the air and rolling (usually, but not limited to, jumping) 360 bsr.w Sonic_JumpHeight ; handle Sonic's jump height based on whether the jump button is still held ⋮ 363 jsr (ObjectFall).l ; apply gravity and update Sonic's position based on his current velocities
_incObj/01 Sonic.asm lines 359–363 at 15dfa3a · upstream ↗ The check to see if the button is not being held is performed before the Player is moved to his new position and gravity_force is added to Y Speed.
Variable Jump Height · archived copy ↗ Measured by a script. It fails if the result disagrees with the claim.
- ^Verifiedsonicretro/s1disasm01 Sonic.asm 8, 1276–1284; sub ObjectFall & SpeedToPos.asm 5, 16–17
How we know
In the running game, out of water, gravity slows a held jump's 6.5 px/frame take-off below the 4 px/frame release cap on its 12th airborne update, to −
$3E0(computed, −$680+ 12 ×$38; the press frame itself runs no airborne update).8son_jumpspeed: equ $680 ; Sonic's jump speed_incObj/01 Sonic.asm line 8 at 15dfa3a · upstream ↗ 5gravity: equ $38 ; gravity constant used by many objects_incObj/sub ObjectFall & SpeedToPos.asm line 5 at 15dfa3a · upstream ↗ 1276 move.w #-$400,d1 ; set max jump height ⋮ 1283 cmp.w obVelY(a0),d1 ; get current y speed 1284 ble.s .return ; is Sonic moving up slower than the cap speed? if yes, branch
_incObj/01 Sonic.asm lines 1276–1284 at 15dfa3a · upstream ↗ - Rests on In the running game, on flat ground, Sonic doesn't move on a jump's press frame, even at top speed: X stays put and Y changes only by the curl (roll-shift), because the jump routine drops its return address, skipping the rest of the grounded routine, the speed-to-position move included. (the press frame runs no airborne update)
- Rests on In the running game, Sonic's airborne-mode routine runs the release check before the object fall routine moves Sonic and adds gravity, so a release frame moves him by the capped speed, exactly 4 px up, and gravity adds to the cap.
Measured by a script. It fails if the result disagrees with the claim.
- ^Verifiedsonicretro/s1disasm · Sonic Retro, “Sonic Physics Guide: Calculations (Pixel and Subpixel)”sub ObjectFall & SpeedToPos.asm 16–20
How we know
In the running game, the object fall routine and the speed-to-position routine move Sonic's 32-bit position each frame by his speed shifted left 8 bits, X by this frame's X speed and Y, in the air, by the Y speed before gravity, so positions are 16.16 and speeds 8.8 fixed point.
16 move.w obVelY(a0),d0 ; load vertical speed 17 addi.w #gravity,obVelY(a0) ; increase vertical speed (apply gravity) 18 ext.l d0 ; extend speed to longword 19 asl.l #8,d0 ; shift speed up a byte (16.16 fixed point) 20 add.l d0,d3 ; add speed to Y-axis position
_incObj/sub ObjectFall & SpeedToPos.asm lines 16–20 at 15dfa3a · upstream ↗ Each pixel is effectively split into 256 slices along both axis and this means the finest fidelity available for movement is 1/256th of a pixel (aka 0.00390625).
Pixel and Subpixel · archived copy ↗ Measured by a script. It fails if the result disagrees with the claim.
- ^Verifiedsonicretro/s1disasm · Sonic Retro, “Sonic Physics Guide: Air State”01 Sonic.asm 1291–1302
How we know
In the running game, a Y speed written into a jump, −
$1100rising or$FC0falling, is neither capped nor clamped: gravity keeps adding$38, to −$10C8a frame later and to$1068before he lands, because the jump-height routine skips its −$FC0cap after jumps (with the disassembly's bug fixes off, as in the original game).1291.return: 1292 if FixBugs=0 1293 ; This prevents the max Y-vel cap from running while jumping 1294 rts ; return ⋮ 1300 cmpi.w #-$FC0,obVelY(a0) ; is Sonic moving up just below the maximum screen scroll speed? (-$1000)
_incObj/01 Sonic.asm lines 1291–1302 at 15dfa3a · upstream ↗ In Sonic 1, the Player's Y Speed is not limited.
Top Y Speed · archived copy ↗ Measured by a script. It fails if the result disagrees with the claim.
- ^ abCodeNoelFB/CelestePlayer.cs 49
How we know
A normal jump sets Madeline's vertical speed to the jump speed, −105 px/s.
49 private const float JumpSpeed = -105f;Source/Player/Player.cs line 49 at 1b0ce45 · upstream ↗ - ^CodeNoelFB/CelestePlayer.cs 24, 2957
How we know
Celeste's gravity is 900 px/s²; each airborne update moves vertical speed toward the fall limit by the gravity times a multiplier times the update's time step.
24 private const float Gravity = 900f;Source/Player/Player.cs line 24 at 1b0ce45 · upstream ↗ 2957 Speed.Y = Calc.Approach(Speed.Y, max, Gravity * mult * Engine.DeltaTime);Source/Player/Player.cs line 2957 at 1b0ce45 · upstream ↗ - ^CodeJamesMcMahon/monocle-engineCalc.cs 852–855
How we know
In the public Monocle source, the approach function moves a value toward a target by at most a given step without overshooting.
854 return val > target ? Math.Max(val - maxMove, target) : Math.Min(val + maxMove, target);Monocle/Util/Calc.cs lines 852–855 at 759c15a · upstream ↗ - ^CodeNoelFB/CelestePlayer.cs 23, 2760–2763
How we know
The normal limit on falling speed is 160 px/s; entering the normal state starts the current limit there and gravity approaches it.
23 public const float MaxFall = 160f;Source/Player/Player.cs line 23 at 1b0ce45 · upstream ↗ 2762 maxFall = MaxFall;Source/Player/Player.cs lines 2760–2763 at 1b0ce45 · upstream ↗ - ^Dev blogThorson 2020 · NoelFB/CelestePlayer.cs 935
How we know
Celeste's actors sit on whole pixels; the vertical move adds the float distance to a remainder, moves by its rounded value, and keeps the fraction.
xRemainder += amount; int move = Round(xRemainder); if (move != 0) { xRemainder -= move;
Actor Basics · archived copy ↗ 935 MoveV(Speed.Y * Engine.DeltaTime, onCollideV);Source/Player/Player.cs line 935 at 1b0ce45 · upstream ↗ - ^DeveloperNoelFB/CelesteEmulator.cs 268–270
How we know
Celeste's developers describe the game as locked to 60 updates per second, so the bundled PICO-8 port skips every second frame.
268 // this is a pretty dumb hack but because Celeste is locked to 60fps 269 // and PICO-8 runs at 30 ... we just skip every 2nd frame
Source/PICO-8/Emulator.cs lines 268–270 at 1b0ce45 · upstream ↗ - ^WikiFNA-XNA/FNA · NoelFB/Celeste · JamesMcMahon/monocle-engine · WPI DGMI wiki, “Coyote Time”Game.cs 247; Readme.md 28; +1 files
How we know
At normal speed, Celeste's time step per update is most likely
(float)0.0166667s, the XNA and FNA default 166,667-tick step, not an exact 1/60 s.247 TargetElapsedTime = TimeSpan.FromTicks(166667); // 60fpssrc/Game.cs line 247 at 00498b0 · upstream ↗ If you're playing on macOS or Linux you're on FNA, and on consoles you're on MonoGame.
Source/Player/Readme.md#L28 · upstream ↗ 198 RawDeltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; 199 DeltaTime = RawDeltaTime * TimeRate;
Monocle/Engine.cs lines 198–199 at 759c15a · upstream ↗ Celeste (2018) – The player character can jump up to 5 frames after leaving a ledge.
Examples · archived copy ↗ - ^Code“Super Mario Bros. (World)”
How we know
In rows 0–1, falling gravity (
$70) is 3.5 times held gravity ($20).In the cartridge (“Super Mario Bros. (World)”): JumpMForceData, FallMForceData. We don't reproduce the bytes.
Measured by a script. It fails if the result disagrees with the claim.
- ^VerifiedXkeeper0/smb1prg.asm 4756–4769, 6664–6696, 4957–4958
How we know
Measured in the game with A held, Mario's jumps peak at 66 px standing, 71 px walking, and 83 px running.
4758 LDA A_B_Buttons ⋮ 4763 SEC ⋮ 4767DumpFall: ⋮ 4769 STA VerticalForce
src/prg.asm lines 4756–4769 at 1cc3c92 · upstream ↗ 6681 LDA SprObject_Y_MoveForce,x 6682 CLC ⋮ 6684 STA SprObject_Y_MoveForce,x ⋮ 6686 ADC #$00 6687 STA SprObject_Y_Speed,x ⋮ 6690 LDA SprObject_Y_MoveForce,x
src/prg.asm lines 6664–6696 at 1cc3c92 · upstream ↗ 4958 STA DiffToHaltJumpsrc/prg.asm lines 4957–4958 at 1cc3c92 · upstream ↗ Measured by a script in MesenCE 2.2.1 (build 4b8a196), on . It fails if the result disagrees with the claim.
- ^CodeNoelFB/CelestePlayer.cs 713–720, 2970–2975
How we know
Grounded updates refill the jump grace timer; airborne ones subtract the update's time step before the normal state's update, which jumps on a press while it is above zero.
713 //Jump Grace 714 if (onGround) ⋮ 717 jumpGraceTimer = JumpGraceTime; ⋮ 719 else if (jumpGraceTimer > 0) 720 jumpGraceTimer -= Engine.DeltaTime;
Source/Player/Player.cs lines 713–720 at 1b0ce45 · upstream ↗ 2970 if (Input.Jump.Pressed) ⋮ 2973 if (jumpGraceTimer > 0) ⋮ 2975 Jump();
Source/Player/Player.cs lines 2970–2975 at 1b0ce45 · upstream ↗ - ^CodeXkeeper0/smb1prg.asm 4921–4925
How we know
Mario gets no grace window after leaving a ledge; the jump check refuses airborne jumps unless he is swimming.
4922 LDA Player_State ; check player state 4923 BEQ InitJS ; if on the ground, branch 4924 LDA SwimmingFlag ; if swimming flag not set, jump to do something else 4925 BEQ NoJump ; to prevent midair jumping, otherwise continue
src/prg.asm lines 4921–4925 at 1cc3c92 · upstream ↗ - ^Verifiedlsmmega/mm2run_megaman.asm 86–92, 203–242
How we know
Mega Man gets no grace window after leaving a ledge; a grounded state that finds no floor switches to the jumping state, which looks for a press only on the frame it lands.
86 JSR _check_object_vertical_move 87 LDA z:z00 88 BNE _run_megaman_landing_common_1 89 LDA #$06 90 STA z:zmegaman_status
engine/run_megaman.asm lines 86–92 at 94f0bf3 · upstream ↗ 203 LDA aobject_ycoord_speed 204 BMI @jump_down 205 JSR _check_object_vertical_move 206 LDA z:z00 207 BNE @landing 208 LDA z:zjoy1_pressed 209 AND #a_button ⋮ 211 LDA aobject_ycoord_speed ⋮ 221@landing: 222@skip: 223 RTS ⋮ 225@jump_down: ⋮
engine/run_megaman.asm lines 203–242 at 94f0bf3 · upstream ↗ Measured by a script in MesenCE 2.2.1 (build 4b8a196), on . It fails if the result disagrees with the claim.
- ^Verifiedsonicretro/s1disasm01 Sonic.asm 113–116, 318, 348
How we know
In the running game, on flat ground, when Sonic walks off a ledge a jump press on any of the next 5 frames gives him no upward speed, because only the grounded modes, the normal and rolling mode routines, call the jump routine.
113Sonic_Modes: dc.w Sonic_MdNormal-Sonic_Modes ; 0 - while on the ground and not rolling 114 dc.w Sonic_MdJump-Sonic_Modes ; 2 - while in the air and not rolling
_incObj/01 Sonic.asm lines 113–116 at 15dfa3a · upstream ↗ 318 bsr.w Sonic_Jump ; check if we need to jump_incObj/01 Sonic.asm line 318 at 15dfa3a · upstream ↗ 348 bsr.w Sonic_Jump ; check if we need to jump_incObj/01 Sonic.asm line 348 at 15dfa3a · upstream ↗ Measured by a script. It fails if the result disagrees with the claim.
- ^Verified“Castlevania (USA) (Rev 1)”
How we know
Measured in the game, a jump keeps the direction held at take-off, 1 px per frame that way or none, whatever the d-pad does in the air.
In the cartridge (“Castlevania (USA) (Rev 1)”): bank 6 $9401-$943B; take-off copies the held Right/Left bits into Simon's direction; bank 6 $9479-$9481: horizontal speed $3D/$3E = 0/1, 1 px per frame; bank 6 $948E-$9496, where the jumping state sets that speed and moves Simon each frame. We don't reproduce the bytes.
Measured by a script in MesenCE 2.2.1 (build 4b8a196), on Castlevania (USA) (Rev 1) (SHA-1
4e3ef47de86a…). It fails if the result disagrees with the claim. - ^Verifiedlsmmega/mm2run_megaman.asm 160–202; turn_megaman.asm 72–77, 222–246, 56–70, 207–216; +1 files
How we know
Measured in the game, Mega Man moves 1.3125 px/frame in the air, turns around on the frame the other direction is pressed, and stops on the frame the d-pad is let go.
162 LDA #$00 163 STA aobject_xcoord_speed_fraction 164 STA aobject_xcoord_speed 165 LDA z:zjoy1_pressed 166 AND #left_button | right_button 167 BNE @horizontal_jumping ⋮ 192 LDA #$00 ⋮ 197@horizontal_jumping: 198 JSR _turn_megaman 199 JSR _megaman_status_parameter
engine/run_megaman.asm lines 160–202 at 94f0bf3 · upstream ↗ 72_megaman_status_parameter: 73 LDX z:zmegaman_status 74 LDA megaman_status_xcoord_speed_table, X 75 STA aobject_xcoord_speed 76 LDA megaman_status_xcoord_speed_fraction_table, X 77 STA aobject_xcoord_speed_fraction
engine/turn_megaman.asm lines 72–77 at 94f0bf3 · upstream ↗ 222megaman_status_xcoord_speed_table: ⋮ 228 .BYTE $01 229 .BYTE $01 ⋮ 235megaman_status_xcoord_speed_fraction_table: ⋮ 241 .BYTE $60 242 .BYTE $50
engine/turn_megaman.asm lines 222–246 at 94f0bf3 · upstream ↗ Measured by a script in MesenCE 2.2.1 (build 4b8a196), on . It fails if the result disagrees with the claim.
- ^CodeSMWDisXbank_00.asm 9998–10000, 10021, 10125–10163, 10502–10515
How we know
In the air with neither Left nor Right held, Mario's horizontal routine returns before friction, so he keeps his speed.
9998 LDA.B byetudlrHold 9999 AND.B #$03 10000 BNE CODE_00D6B1
bank_00.asm lines 9998–10000 at 30643c7 · upstream ↗ 10021 + JMP CODE_00D764bank_00.asm line 10021 at 30643c7 · upstream ↗ 10125CODE_00D764: 10126 JSR CODE_00D968 10127 LDA.B PlayerInAir 10128 BNE Return00D7A4 10129CODE_00D76B: 10130 LDA.W SlopeType 10131 LSR A 10132 TAY 10133 LSR A 10134 TAX 10135CODE_00D772: 10136 LDA.B PlayerXSpeed+1 ⋮
bank_00.asm lines 10125–10163 at 30643c7 · upstream ↗ - ^CodeSMWDisX · “Super Mario World (USA)”bank_00.asm 9699, 9717, 10061–10075, 10107–10123
How we know
Holding a direction in the air accelerates Mario by the acceleration table's 1.5/16 px/frame each frame up to his top speed, or by 5/16 (2.5/16 without Y) while he still moves the other way.
;!
bank_00.asm#L9699 · upstream ↗ ;!
bank_00.asm#L9717 · upstream ↗ 10061 LDA.B PlayerXSpeed+1 10062 BEQ CODE_00D713 10063 EOR.W MarioAccel_+1,X 10064 BPL CODE_00D713 ⋮ 10072 + TXA 10073 CLC 10074 ADC.B #$90 10075 TAX
bank_00.asm lines 10061–10075 at 30643c7 · upstream ↗ 10107CODE_00D742: 10108 LDA.B PlayerXSpeed+1 10109 SEC 10110 SBC.W DATA_00D535,Y ⋮ 10115 LDA.W MarioAccel_,X
bank_00.asm lines 10107–10123 at 30643c7 · upstream ↗ In the cartridge (“Super Mario World (USA)”): MarioAccel_. We don't reproduce the bytes.
- ^CodeXkeeper0/smb1prg.asm 4959–4964
How we know
Swimming jumps use row 5 of the jump tables, or row 6 in a whirlpool.
4959 LDA SwimmingFlag ; if swimming flag disabled, branch 4960 BEQ GetYPhy 4961 LDY #$05 ; otherwise set Y to 5, range is 5-6 4962 LDA Whirlpool_Flag ; if whirlpool flag not set, branch 4963 BEQ GetYPhy 4964 INY ; otherwise increment to 6
src/prg.asm lines 4959–4964 at 1cc3c92 · upstream ↗
Sources
Code
- 1987. “Castlevania (USA) (Rev 1).” · licence, all uses
- doppelganger and Xkeeper. 2022. “smb1: Super Mario Bros. disassembly for asm6f (Xkeeper0/smb1).” Commit 1cc3c92. Xkeeper0/smb1 @ 1cc3c92 · licence, all uses
- IsoFrieze, kaizoman666, mikeyk, and loveemu. 2026. “SMWDisX: Super Mario World disassembly (IsoFrieze/SMWDisX).” Commit 30643c7. IsoFrieze/SMWDisX @ 30643c7 · licence, all uses
- 1991. “Super Mario World (USA).” · licence, all uses
- Sonic Retro contributors. 2026. “s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm).” Commit 15dfa3a. sonicretro/s1disasm @ 15dfa3a · licence, all uses
- lsmmega. 2026. “mm2: Mega Man 2 disassembly (lsmmega/mm2).” Commit 94f0bf3. lsmmega/mm2 @ 94f0bf3 · licence, all uses
- Thorson, Maddy and Noel Berry. 2021. “Celeste: released class files (NoelFB/Celeste).” Commit 1b0ce45. NoelFB/Celeste @ 1b0ce45 · licence, all uses
- Sonic Retro contributors. 2026. “s2disasm: Sonic the Hedgehog 2 (16-bit) disassembly (sonicretro/s2disasm).” Commit 4ef457c. sonicretro/s2disasm @ 4ef457c · licence, all uses
- Sonic Retro contributors. 2026. “skdisasm: Sonic 3 & Knuckles disassembly (sonicretro/skdisasm).” Commit 73de97c. sonicretro/skdisasm @ 73de97c · licence, all uses
- SAT-R contributors. 2026. “sa2: a decompilation of Sonic Advance 1 and 2 (SAT-R/sa2).” Commit 393357f. SAT-R/sa2 @ 393357f · licence, all uses
- metroidret contributors. 2026. “mf: a decompilation of Metroid Fusion (metroidret/mf).” Commit a6d6187. metroidret/mf @ a6d6187 · licence, all uses
- metroidret contributors. 2026. “mzm: a decompilation of Metroid: Zero Mission (metroidret/mzm).” Commit 2aae289. metroidret/mzm @ 2aae289 · licence, all uses
- nmikstas and Kent Hansen. 2025. “metroid-disassembly: Metroid software disassembly.” Commit 4270d57. nmikstas/metroid-disassembly @ 4270d57 · licence, all uses
- banjo.decomp. 2026. “banjo-kazooie: a decompilation of Banjo-Kazooie (banjo.decomp/banjo-kazooie).” Commit e8d31fa. banjo.decomp/banjo-kazooie @ e8d31fa · licence, all uses
- n64decomp. 2023. “sm64: a decompilation of Super Mario 64 (n64decomp/sm64).” Commit 9921382. n64decomp/sm64 @ 9921382 · licence, all uses
- Southbird. 2025. “smb3: Super Mario Bros. 3 disassembly for NESASM (captainsouthbird/smb3).” Commit 09b1bd8. captainsouthbird/smb3 @ 09b1bd8 · licence, all uses
- doldecomp. 2026. “sms: a decompilation of Super Mario Sunshine (doldecomp/sms).” Commit d2cc8f5. doldecomp/sms @ d2cc8f5 · licence, all uses
- plasticsmoke. 2026. “Mega Man 3 (U), annotated ca65 disassembly (plasticsmoke).” Commit 58ca1c3. plasticsmoke/megaman3-disassembly-ca65 @ 58ca1c3 · licence, all uses
- plasticsmoke. 2026. “Mega Man 4 (U), annotated ca65 disassembly (plasticsmoke).” Commit a63bb6e. plasticsmoke/megaman4-disassembly-ca65 @ a63bb6e · licence, all uses
- 1992. “Mega Man 4 (USA) (Rev 1).” · licence, all uses
- plasticsmoke. 2026. “Mega Man 5 (U), annotated ca65 disassembly (plasticsmoke).” Commit 7fd6512. plasticsmoke/megaman5-disassembly-ca65 @ 7fd6512 · licence, all uses
- 1988. “Castlevania II - Simon's Quest (USA).” · licence, all uses
- vinheim3. 2020. “castlevania3-disasm: a disassembly of Castlevania III: Dracula's Curse.” Commit 3272648. vinheim3/castlevania3-disasm @ 3272648 · licence, all uses
- 1990. “Castlevania III - Dracula's Curse (USA).” · licence, all uses
- 1991. “Super Castlevania IV (USA).” · licence, all uses
- Xeeynamo and sotn-decomp contributors. 2026. “sotn-decomp: a decompilation of Castlevania: Symphony of the Night.” Commit 2be55ee. Xeeynamo/sotn-decomp @ 2be55ee · licence, all uses
- 1985. “Super Mario Bros. (World).” · licence, all uses
- 1989. “Mega Man 2 (USA).” · licence, all uses
- Thorson, Maddy. 2018. “Monocle Engine (public source, GitHub mirror JamesMcMahon/monocle-engine).” Commit 759c15a. JamesMcMahon/monocle-engine @ 759c15a · licence, all uses
- Lee, Ethan and MonoGame Team. 2026. “FNA (XNA 4.0 reimplementation).” Commit 00498b0. FNA-XNA/FNA @ 00498b0 · licence, all uses
Primary
- Thorson, Maddy. 2020. “Celeste and TowerFall Physics.” Medium. original · archived · licence, all uses
Secondary
- Jdaster64. n.d. “A Complete Guide to SMB's Physics Engine.” original · archived · licence, all uses
- Sonic Retro contributors. 2023. “Sonic Physics Guide: Jumping.” Sonic Retro. original · archived · licence, all uses
- Sonic Retro contributors. n.d. “Sonic Physics Guide: Air State.” Sonic Retro. original · archived · licence, all uses
- Sonic Retro contributors. n.d. “Sonic Physics Guide: Characters.” Sonic Retro. original · archived · licence, all uses
- Sonic Retro contributors. n.d. “Sonic Physics Guide: Calculations (Pixel and Subpixel).” Sonic Retro. original · archived · licence, all uses
- DGMI wiki contributors. n.d. “Coyote Time (DGMI wiki).” Worcester Polytechnic Institute (dgmiwiki.wpi.edu). original · archived · licence, all uses