data/claims/s1disasm.yamlSonic the Hedgehog (sonicretro/s1disasm)
Game: Sonic the Hedgehog.
Built with Revision = 0, s1disasm is Sonic The Hedgehog (USA, Europe) byte for byte; its default build, Revision = 1, is the later REV01. s1disasm/rom-is-disassembly
Value: 1bc674be034e43c96b86487ac69d9293 MD5 of the ROM
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·build_tools/chkbitperfect.lua#L23-L24if hash == "\x1B\xC6\x74\xBE\x03\x4E\x43\xC9\x6B\x86\x48\x7A\xC6\x9D\x92\x93" then
print "ROM is bit-perfect with REV00."s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · build_tools/chkbitperfect.lua#L25-L26elseif hash == "\x09\xDA\xDB\x50\x71\xEB\x35\x05\x00\x67\xA3\x24\x62\xE3\x9C\x5F" then
print "ROM is bit-perfect with REV01."s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · sonic.asm#L14-L16Revision = 1
; | If 0, build the original version of the game, dubbed REV00
; | If 1, build the later version, dubbed REV01, which includes various bugfixes and enhancementsChecked by claude, 2026-10-25 — built the pinned commit with Revision = 0 in a scratch copy (build.lua through build_tools/chkbitperfect.lua), which reported "bit-perfect with REV00", and its MD5 is the ROM's; the probe compares the ROM's MD5 with the REV00 line of chkbitperfect.luaChecked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the REV01 hash and the disassembly's REV01 line are quoted ("(USA, Europe)" still rests on the probe; a ROM entry needs the ROM).Probe: probes/jump-physics/sonic-mame.mjsSonic's object code and the files it calls that this set cites (_incObj/01 Sonic.asm, the collision, angle, and motion routines, _Constants.asm) have no revision conditionals, so the lines cited here are the code of the ROM the MAME probe runs.
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. s1disasm/jump-speed
About: Sonic the Hedgehog Jump
Value: 1664 1/256 px/frame
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L8son_jumpspeed: equ $680 ; Sonic's jump speeds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1218move.w #son_jumpspeed,d2 ; set initial jump forceSonic Physics Guide: Jumping · Constantsjump_force 6.5 (6 pixels and 128 supbixels)Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; the probe recomputes every press frame of its scripts (standing jumps, running jumps, a roll jump) from the claims' values, and on each the Y speed went from 0 to −$680. Read the equate and Sonic_Jump at the pinned commitChecked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-28.Probe: probes/jump-physics/sonic-mame.mjs1664/256 = 6.5 px/frame exactly. Underwater it is $380.
Cited by: Jump, Sonic the Hedgehog, Sonic the Hedgehog 2, Variable jump height
In the running game, a jump pressed on a 45° ramp built from Green Hill's $E0 ramp 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. s1disasm/jump-vector
About: Sonic the Hedgehog Jump
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1224-L1233subi.b #$40,d0 ; rotate it perpendicularly for jump trajectory
jsr (CalcSine).l ; find the direction Sonic should jump
muls.w d2,d1 ; apply jump force to the cosine angle
asr.l #8,d1 ; shift it to upper word
add.w d1,obVelX(a0) ; apply to X speed
muls.w d2,d0 ; apply jump force to the sine angle
asr.l #8,d0 ; shift it to upper word
add.w d0,obVelY(a0) ; apply to Y speeds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub CalcSine.asm#L53 — Sine_Data entry $C0 (the table starts at L29, eight entries per line)dc.w -$100,-$FF,-$FF,-$FF,-$FE,-$FE,-$FD,-$FC ; =Sonic Physics Guide: Jumping · Jump Velocityboth X Speed and Y Speed must have jump_force subtracted from them, using cos() and sin() to get the right values.Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-terrain.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, Green Hill Act 1 with its objects cleared and input written to the joypad bytes each game frame, its row 3 rebuilt from the act's own blocks, chosen by their heights and angles in the pinned collide/ files; on a 45° ramp of block 342 (angle $E0) with block 393 under it, a jump pressed standing on it, running up it, and running down it changed X and Y speed by the cosine and sine of $E0 − $40 (Sine_Data, read from the pinned CalcSine.asm) times $680, shifted right 8, and left x unchanged; read Sonic_Jump and CalcSine at the pinned commitChecked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-28.Probe: probes/jump-physics/sonic-terrain.mjsThe press frame's speeds are last frame's, which Sonic_AngleSpeed set from his ground speed along the ramp, plus the jump. At angle $E0 the normal is $A0, whose sine and cosine are both −$B5, so −$B5 × $680 / 256 = −1177 goes to each speed. On flat ground (angle 0) the normal is $C0, sine −$100 and cosine 0: exactly −$680 to Y speed and nothing to X, which sonic-mame.mjs measures (jump-speed).
Cited by: Jump, Sonic the Hedgehog, Variable jump height
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. s1disasm/gravity
About: Sonic the Hedgehog Gravity
Value: 56 1/256 px/frame²
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/sub ObjectFall & SpeedToPos.asm#L5gravity: equ $38 ; gravity constant used by many objectss1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L363jsr (ObjectFall).l ; apply gravity and update Sonic's position based on his current velocitiesSonic Physics Guide: Air State · Constantsgravity_force 0.21875 (56 subpixels)Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; on every airborne update of every scripted run and poke (jumps held and released, falls off the ledge) the new Y speed is the old one, or the release cap where it applies, plus $38. Read the equate, ObjectFall, and Sonic_MdJump2 at the pinned commitChecked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-28.Probe: probes/jump-physics/sonic-mame.mjs56/256 = 0.21875 px/frame² exactly. The same value applies whether or not the button is held.
Cited by: Gravity, Sonic the Hedgehog 2, Variable jump height
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 −$3C8 after gravity (−$400 + $38, computed). s1disasm/release-cap
About: Sonic the Hedgehog Variable jump height
Value: -1024 1/256 px/frame
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1273-L1288tst.b jumping(a0) ; is Sonic airborne specifically from a jump?
…
move.w #-$400,d1 ; set max jump height
…
cmp.w obVelY(a0),d1 ; get current y speed
ble.s .return ; is Sonic moving up slower than the cap speed? if yes, branch
move.b (v_jpadhold2).w,d0 ; get currently held buttons
andi.b #btnABC,d0 ; is A, B or C still held after jumping?
bne.s .return ; if yes, branch
move.w d1,obVelY(a0) ; otherwise, cap Sonic's maximum jump heightIn 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. VerifiedIn 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. Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub ObjectFall & SpeedToPos.asm#L16-L20 — the move uses the speed from before gravitymove.w obVelY(a0),d0 ; load vertical speed
addi.w #gravity,obVelY(a0) ; increase vertical speed (apply gravity)
…
add.l d0,d3 ; add speed to Y-axis positionSonic Physics Guide: Jumping · Variable Jump Heightthe 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.Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; standing jumps with A held for 1 to 13 frames: a release on airborne update 1 to 12 moved him up exactly 4 px and left −$3C8; on update 13, where the rise was already −$3E0, the release changed nothing. Read Sonic_JumpHeight at the pinned commitChecked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the move from the speed before gravity is quoted and gravity cited; out of water is added and the -$3C8 marked computed.Probe: probes/jump-physics/sonic-mame.mjs−1024/256 = −4 px/frame exactly. The check runs on every airborne frame without the button, not only on the release frame. Underwater, the cap is -$200.
Cited by: Sonic the Hedgehog, Sonic the Hedgehog 2, Variable jump height
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). s1disasm/release-window
About: Sonic the Hedgehog Variable jump height
Value: 12 updates
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L8son_jumpspeed: equ $680 ; Sonic's jump speeds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub ObjectFall & SpeedToPos.asm#L5gravity: equ $38 ; gravity constant used by many objectss1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1276-L1284move.w #-$400,d1 ; set max jump height
…
cmp.w obVelY(a0),d1 ; get current y speed
ble.s .return ; is Sonic moving up slower than the cap speed? if yes, branchIn 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. Verified — the press frame runs no airborne updateIn 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. Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub ObjectFall & SpeedToPos.asm#L16-L17 — every airborne update adds gravitymove.w obVelY(a0),d0 ; load vertical speed
addi.w #gravity,obVelY(a0) ; increase vertical speed (apply gravity)Checked by claude, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; on a held standing jump the Y speed is −$680 on the press frame, −$418 after the 11th airborne update, and −$3E0 after the 12th; that is −$680 + 12 × $38, as the jump speed, gravity, and Sonic_JumpHeight at the pinned commit giveChecked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; gravity on every airborne update is quoted and the press frame's skipped update cited; out of water added.Probe: probes/jump-physics/sonic-mame.mjsSo a release after the 12th airborne update changes nothing. Out of water only.
Cited by: Variable jump height
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. s1disasm/release-order
About: Sonic the Hedgehog Variable jump height
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L359-L363Sonic_MdJump2: ; While Sonic is in the air and rolling (usually, but not limited to, jumping)
bsr.w Sonic_JumpHeight ; handle Sonic's jump height based on whether the jump button is still held
…
jsr (ObjectFall).l ; apply gravity and update Sonic's position based on his current velocitiesSonic Physics Guide: Jumping · Variable Jump HeightThe 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.Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; on a release at airborne updates 1 to 12 he moved up exactly 4 px, the capped speed, and his Y speed after was −$400 + $38; had ObjectFall run first he would have moved by the uncapped speed. Read Sonic_Modes and Sonic_MdJump2 at the pinned commitChecked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-28.Probe: probes/jump-physics/sonic-mame.mjsCited by: Variable jump height
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. s1disasm/jump-frame-no-move
About: Sonic the Hedgehog Jump
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1236addq.l #4,sp ; run in-air subroutines when we returnA different reading: Dropping the return address returns from Sonic_MdNormal itself, skipping the rest of the grounded routine, SpeedToPos included. The in-air routines run from the next frame.s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L317-L323Sonic_MdNormal: ; While Sonic is on the ground and not rolling
bsr.w Sonic_Jump ; check if we need to jump
…
jsr (SpeedToPos).l ; update Sonic's position based on his current velocitiesSonic Physics Guide: Jumping · Bugs when JumpingIf 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.Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; on every press frame of its scripts, at speeds from 0 to $600, X is unchanged and Y moves only by the 5 px curl (0 for the roll jump). Read Sonic_Jump and Sonic_MdNormal at the pinned commitChecked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-28.Probe: probes/jump-physics/sonic-mame.mjsThe disassembly's comment says "run in-air subroutines when we return", but the code just returns from Sonic_MdNormal; the in-air mode runs from the next frame. The guide's account matches the code.
Cited by: Coyote time, Jump, Variable jump height
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. s1disasm/roll-shift
About: Sonic the Hedgehog Jump
Value: 5 px
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1250-L1254move.b #sonic_roll_height,obHeight(a0) ; set height to rolling size
…
addq.w #sonic_height-sonic_roll_height,obY(a0) ; adjust Y-position to align Sonic to the floors1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _Constants.asm#L312-L314sonic_height: equ 38/2 ; Sonic's height
…
sonic_roll_height: equ 28/2 ; Sonic's height (rolling)Sonic Physics Guide: Characters · SonicWhen Jumping or rolling, his Width Radius is 7 and his Height Radius is 14, resulting in 15 pixels wide and 29 pixels tall.Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; on every press frame of a standing or running jump the height radius went from 19 to 14 and Y grew by exactly 5 px; the feet stayed on y 959. Read Sonic_Jump and the size equates at the pinned commitChecked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-27.Probe: probes/jump-physics/sonic-mame.mjsThe probe measures jump height at the feet (Y + height radius), which this shift leaves unchanged.
Cited by: Variable jump height
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. s1disasm/fixed-point-motion
About: Sonic the Hedgehog Gravity
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/sub ObjectFall & SpeedToPos.asm#L16-L20move.w obVelY(a0),d0 ; load vertical speed
addi.w #gravity,obVelY(a0) ; increase vertical speed (apply gravity)
ext.l d0 ; extend speed to longword
asl.l #8,d0 ; shift speed up a byte (16.16 fixed point)
add.l d0,d3 ; add speed to Y-axis positionSonic Physics Guide: Calculations (Pixel and Subpixel) · Pixel and SubpixelEach 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).Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; on every airborne update and ground frame of every scripted run and poke, X moved by exactly 256 times the frame's X speed, and in the air Y by 256 times the Y speed before gravity. Read ObjectFall and SpeedToPos at the pinned commitChecked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-28.Probe: probes/jump-physics/sonic-mame.mjsBecause speeds are shifted into the upper half of the position's fraction, motion resolution is 1/256 px, as the guide says. The drawn pixel is the floor of the position.
Cited by: Fixed-point arithmetic, Gravity, Subpixel, Variable jump height
In the running game, a Y speed written into a jump, −$1100 rising or $FC0 falling, is neither capped nor clamped: gravity keeps adding $38, to −$10C8 a frame later and to $1068 before he lands, because the jump-height routine skips its −$FC0 cap after jumps (with the disassembly's bug fixes off, as in the original game). s1disasm/no-fall-cap
About: Sonic the Hedgehog Gravity
Value: rise -4296 · fall 4200 (1/256 px/frame: a frame after −$1100, and the last before landing from $FC0)
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1291-L1302.return:
if FixBugs=0
; This prevents the max Y-vel cap from running while jumping
rts ; return
…
cmpi.w #-$FC0,obVelY(a0) ; is Sonic moving up just below the maximum screen scroll speed? (-$1000)Sonic Physics Guide: Air State · Top Y SpeedIn Sonic 1, the Player's Y Speed is not limited.Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; in two runs, Y speed written ten frames into a held standing jump: −$1100 became −$10C8 the next frame, and $FC0 became $FF8, $1030, $1068, and then he landed. Read Sonic_JumpHeight and the FixBugs switch (sonic.asm L20) at the pinned commitRevised after a check by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-28.Checked by a second AI model, 2026-11-18.Probe: probes/jump-physics/sonic-mame.mjsA downward clamp to $FC0 exists only in the FixBugs build, and on landing on a steep slope, where Sonic_FloorDown caps the fall speed before turning it into ground speed (L1601-L1605).
Cited by: Gravity, Variable jump height
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. s1disasm/no-coyote-time
About: Sonic the Hedgehog Coyote time
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L113-L116Sonic_Modes: dc.w Sonic_MdNormal-Sonic_Modes ; 0 - while on the ground and not rolling
dc.w Sonic_MdJump-Sonic_Modes ; 2 - while in the air and not rollings1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L318bsr.w Sonic_Jump ; check if we need to jumps1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L348bsr.w Sonic_Jump ; check if we need to jumpChecked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; walking off a ledge, A pressed on the frame he leaves it jumps, and pressed on each of the next 5 frames it never gives an upward Y speed. Read Sonic_Modes and all four mode routines at the pinned commitRevised after a check by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-28.Probe: probes/jump-physics/sonic-mame.mjsCited by: Coyote time, Jump, Sonic the Hedgehog, Variable jump height
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. s1disasm/apex-by-hold
About: Sonic the Hedgehog Variable jump height
Value
{
"tap": {
"apex": 39,
"airtime": 39
},
"full": {
"apex": 100,
"airtime": 62
}
}_incObj/01 Sonic.asm#L8 — take-off speedson_jumpspeed: equ $680 ; Sonic's jump speeds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1273-L1288 — release capmove.w #-$400,d1 ; set max jump heightIn 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 −$3C8 after gravity (−$400 + $38, computed). VerifiedIn 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. Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub ObjectFall & SpeedToPos.asm#L16-L20 — motionmove.w obVelY(a0),d0 ; load vertical speed
addi.w #gravity,obVelY(a0) ; increase vertical speed (apply gravity)
…
add.l d0,d3 ; add speed to Y-axis positionIn 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. VerifiedChecked by claude, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; A held for the press frame only, and for 70 frames: apexes 39 and 100 px at the feet, landings on frames 39 and 62. jump-heights.mjs's simulation of the code gives the sameChecked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the take-off speed and the position add are quoted; tapped and held are defined.Probe: probes/jump-physics/sonic-mame.mjsHeights are whole drawn pixels at the feet (Y plus the height radius); airtime is frames from the press, counted as frame 1, until the feet are back at take-off height. On flat ground Sonic_Floor's landing falls on the frame the simulation predicts.
Cited by: Sonic the Hedgehog, Variable jump height
In the running game, on flat ground, Sonic's top running speed is $600 (6 px/frame): holding the d-pad his ground speed stops there, and in the air the d-pad caps his X speed there too. s1disasm/top-speed
About: Sonic the Hedgehog Running
Value: 1536 1/256 px/frame
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L5son_maxspeed: equ $600 ; Sonic's max speeds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L45move.w #son_maxspeed,(v_sonspeedmax).w ; set Sonic's top speeds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L940 — Sonic_JumpDirection, the air capmove.w (v_sonspeedmax).w,d6 ; get Sonic's current top speedSonic Physics Guide: Running · Constantstop_speed 6Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; every ground and airborne frame with the d-pad held, recomputed with a cap of $600, matches, including runs that reach the cap on the ground and in the air. Read the equate, Sonic_Main, Sonic_Move, and Sonic_JumpDirection at the pinned commitChecked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-28.Probe: probes/jump-physics/sonic-mame.mjsWater halves it (Sonic_Water, L258) and speed shoes raise it; neither is modeled here.
Cited by: Running, Sonic the Hedgehog, Sonic the Hedgehog 2
In the running game, on flat ground, holding the d-pad the way Sonic runs, or from a standstill, adds his acceleration, $C, to his ground speed each frame, up to the top speed. s1disasm/ground-accel
About: Sonic the Hedgehog Running
Value: 12 1/256 px/frame²
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L6son_acceleration: equ $C ; Sonic's accelerations1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L706-L723Sonic_MoveRight:
move.w obInertia(a0),d0 ; get Sonic's current ground speed
bmi.s .changedirection ; has Sonic changed direction? if yes, branch
…
add.w d5,d0 ; add acceleration to current ground speed
cmp.w d6,d0 ; is new speed above max speed?
blt.s .nocap ; if not, branch
move.w d6,d0 ; cap Sonic's ground speedSonic Physics Guide: Running · Constantsacceleration_speed 0.046875 (12 subpixels)Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; every ground frame of the scripts with the d-pad held his way, or from 0, adds exactly $C, both ways, up to $600. Read Sonic_Move, Sonic_MoveLeft, and Sonic_MoveRight at the pinned commitChecked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-28.Probe: probes/jump-physics/sonic-mame.mjsSonic_MoveLeft mirrors it (L636-L661). A ground speed of exactly 0 counts as either direction.
Cited by: Running
In the running game, on flat ground, holding forward above the top speed pulls Sonic's speed down to it in one frame, on the ground and in the air, because the ground move-right routine and the air steering cap after adding without first checking whether he is already faster. s1disasm/forward-cap
About: Sonic the Hedgehog Running
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L716-L719add.w d5,d0 ; add acceleration to current ground speed
cmp.w d6,d0 ; is new speed above max speed?
blt.s .nocap ; if not, branch
move.w d6,d0 ; cap Sonic's ground speeds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L963-L966add.w d5,d0 ; increase rightward movement speed
cmp.w d6,d0 ; is new speed exceeding maximum?
blt.s Sonic_JumpMove ; if not, branch
move.w d6,d0 ; cap rightward X-speed to maximumSonic Physics Guide: Running · Top SpeedThus it is possible to curtail your forward momentum by pressing in the very direction of your motion.Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; with ground speed, or X speed in a jump, written as $700 (−$700), one frame of Right (Left) left $600 (−$600). Read Sonic_MoveRight and Sonic_JumpDirection at the pinned commitChecked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-28.Probe: probes/jump-physics/sonic-mame.mjsThe air steering caps the same way. On flat ground nothing but a spring pushes him past the top speed, so the cap matters on slopes and after springs.
Cited by: Sonic the Hedgehog, Sonic the Hedgehog 2
In the running game, on flat ground, out of water and without speed shoes, with neither Left nor Right held, Sonic's ground speed loses the acceleration, $C, each frame toward zero, stopping at exactly 0. Water halves the acceleration and speed shoes double it, and the friction with it. s1disasm/ground-friction
About: Sonic the Hedgehog Running
Value: 12 1/256 px/frame²
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L499-L524Sonic_CheckDpadLetGo:
…
andi.b #btnL+btnR,d0 ; is left or right held?
bne.s Sonic_AngleSpeed ; if yes, branch (don't decrease speed)
…
sub.w d5,d0 ; reduce current rightward speed by acceleration
bcc.s .stillright ; if result is still to the right, branch
move.w #0,d0 ; reset speed to zero on sign changes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L6son_acceleration: equ $C ; Sonic's accelerations1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L45-L46move.w #son_acceleration,(v_sonspeedacc).w ; set Sonic's accelerations1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L381-L383 — the friction subtracts this registerSonic_Move:
…
move.w (v_sonspeedacc).w,d5 ; get Sonic's current accelerations1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L252-L259 — entering waterbset #status_underwater_bit,obStatus(a0) ; set underwater flag
…
move.w #son_acceleration/2,(v_sonspeedacc).w ; change Sonic's acceleration (half or regular)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/26, 2E Monitors and Power-Ups.asm#L285-L293 — speed shoesPow_ChkShoes:
…
move.w #son_acceleration*2,(v_sonspeedacc).w ; double Sonic's accelerationSonic Physics Guide: Running · Constantsfriction_speed 0.046875 (12 subpixels)Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; every ground frame with neither held loses exactly $C toward 0, and ground speeds of 5 and −5 written in by the probe went to 0 in one frame. Read Sonic_CheckDpadLetGo at the pinned commitChecked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Overstated; now out of water and without speed shoes, with the water halving and the shoes quoted.Probe: probes/jump-physics/sonic-mame.mjsd5 holds v_sonspeedacc, so friction equals the acceleration. Up and Down change nothing here: they only pick the look-up and duck animations when the ground speed is 0 (L465-L483).
In the running game, on flat ground, holding the d-pad against Sonic's motion subtracts his deceleration, $80, a frame, and a step that would cross zero sets the speed to $80 the other way: from $40 written in by the probe, Left gives −$80, and from −$40, Right gives $80. s1disasm/ground-decel
About: Sonic the Hedgehog Running
Value: 128 1/256 px/frame²
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L7son_deceleration: equ $80 ; Sonic's decelerations1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L665-L668.changeddirection:
sub.w d4,d0 ; apply deceleration to current speed
bcc.s .stilldecel ; if still decelerating, branch
move.w #-$80,d0 ; set minimum speed on sign changes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L729-L732.changedirection:
add.w d4,d0 ; apply deceleration to current speed
bcc.s .stilldecel ; if still decelerating, branch
move.w #$80,d0 ; set minimum speed on sign changeSonic Physics Guide: Running · DecelerationAt any time an addition or subtraction of deceleration_speed results in Ground Speed changing sign, Ground Speed is set to 0.5 (128 subpixels) in the opposite direction.Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; every ground frame braking against the motion (the reversals from top speed) takes exactly $80, and ground speeds $40 and −$40 written in by the probe went to −$80 and $80 in one frame. Read both .changeddirection branches at the pinned commitChecked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-28.Probe: probes/jump-physics/sonic-mame.mjsThe branches test the 68000 carry, not the sign. Moving right, sub.w borrows only below $80, so a speed of exactly $80 stops at 0. Moving left, add.w carries for any speed from −$80 up, so −$80 becomes +$80. The guide's pseudocode turns a result of exactly 0 into −0.5 either way, which the right-moving branch doesn't do (turn-zero).
Cited by: Running
In the running game, on flat ground, reversing from top speed, Sonic running right reaches exactly 0 on the 12th frame and −$C on the 13th, but running left he jumps from −$80 to +$80 on the 12th. s1disasm/turn-zero
About: Sonic the Hedgehog Running
Unit: frame, then 1/256 px/frame on that frame and the next
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L665-L668move.w #-$80,d0 ; set minimum speed on sign changes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L729-L732move.w #$80,d0 ; set minimum speed on sign changeChecked by claude, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; 130 frames of Right, then Left (and the mirror): ground speeds $80, 0, −$C on frames 11 to 13 from the right, −$80, $80, $8C from the left. sonic-movement.mjs's word-level simulation gives the sameRevised after a check by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-28.Probe: probes/jump-physics/sonic-mame.mjsAn asymmetry of the carry tests in ground-decel. From the right the next frame starts from 0 and accelerates by $C; from the left the 13th frame accelerates from $80.
Cited by: Running
In the running game, on flat ground, out of water and without speed shoes, turning around from top speed takes 140 frames to reach top speed the other way when Sonic runs right, and 130 when he runs left. s1disasm/turn-frames
About: Sonic the Hedgehog Running
Value: right 140 · left 130 (frames)
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L636-L672 — Sonic_MoveLeft.changeddirection:
sub.w d4,d0 ; apply deceleration to current speed
bcc.s .stilldecel ; if still decelerating, branch
move.w #-$80,d0 ; set minimum speed on sign changes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L706-L736 — Sonic_MoveRight.alreadyright:
add.w d5,d0 ; add acceleration to current ground speed
cmp.w d6,d0 ; is new speed above max speed?
blt.s .nocap ; if not, branch
move.w d6,d0 ; cap Sonic's ground speed
…
.changedirection:
add.w d4,d0 ; apply deceleration to current speed
bcc.s .stilldecel ; if still decelerating, branch
move.w #$80,d0 ; set minimum speed on sign changeIn the running game, on flat ground, Sonic's top running speed is $600 (6 px/frame): holding the d-pad his ground speed stops there, and in the air the d-pad caps his X speed there too. VerifiedIn the running game, on flat ground, holding the d-pad the way Sonic runs, or from a standstill, adds his acceleration, $C, to his ground speed each frame, up to the top speed. VerifiedIn the running game, on flat ground, holding the d-pad against Sonic's motion subtracts his deceleration, $80, a frame, and a step that would cross zero sets the speed to $80 the other way: from $40 written in by the probe, Left gives −$80, and from −$40, Right gives $80. VerifiedIn the running game, on flat ground, reversing from top speed, Sonic running right reaches exactly 0 on the 12th frame and −$C on the 13th, but running left he jumps from −$80 to +$80 on the 12th. VerifiedChecked by claude, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; the frame Left (or Right) is first held counts as 1: −$600 on frame 140 from the right, $600 on frame 130 from the left; that is 12 + 128 and 12 + 118 frames ($80 + 118 × $C reaches $600)Revised after a check by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the rightward reversal is quoted, the speeds cited, and the condition added.Probe: probes/jump-physics/sonic-mame.mjsCited by: Running, Sonic the Hedgehog
In the running game, on flat ground, out of water and without speed shoes, Sonic reaches top speed from a standstill in 128 frames, and from top speed he coasts to a stop in 128 frames with the d-pad released ($600 / $C = 128, computed). s1disasm/ground-frames
About: Sonic the Hedgehog Running
Value: accel 128 · friction 128 (frames)
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L5-L6son_maxspeed: equ $600 ; Sonic's max speed
son_acceleration: equ $C ; Sonic's accelerationIn the running game, on flat ground, Sonic's top running speed is $600 (6 px/frame): holding the d-pad his ground speed stops there, and in the air the d-pad caps his X speed there too. VerifiedIn the running game, on flat ground, holding the d-pad the way Sonic runs, or from a standstill, adds his acceleration, $C, to his ground speed each frame, up to the top speed. Verified — the acceleration added each frameIn the running game, on flat ground, out of water and without speed shoes, with neither Left nor Right held, Sonic's ground speed loses the acceleration, $C, each frame toward zero, stopping at exactly 0. Water halves the acceleration and speed shoes double it, and the friction with it. Verified — the friction taken each frameChecked by claude, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; holding Right from a standstill, ground speed $600 on frame 128; released, 0 on frame 128. $600 / $C = 128 exactlyRevised after a check by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the speeds are cited, the condition added and the 128 frames marked computed.Probe: probes/jump-physics/sonic-mame.mjsCited by: Running, Sonic the Hedgehog
In the running game, on flat ground, a reversal skids (stopping animation, and facing his motion) when the slowed speed is at least $400 moving right but only $301 moving left, because the angle read overwrites the speed's low byte. s1disasm/skid-threshold
About: Sonic the Hedgehog Running
Value: right 1152 · left 897 (1/256 px/frame, the speed before the reversal frame)
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L677-L694; d0 should not be used here, as it results in obInertia being
; partially overwritten! This causes Sonic's skidding animation
; to activate at differing speeds when he's moving left or right.
…
move.b obAngle(a0),d0 ; get Sonic's current angle (and partially overwrite d0...)
…
cmpi.w #$400,d0 ; has Sonic changed direction while being really fast?
blt.s .nostopping ; if not, don't play skidding animation/sound
move.b #id_Stop,obAnim(a0) ; use "stopping" animation
bclr #status_xflip_bit,obStatus(a0) ; clear X-flip flag (Sonic is now facing right)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L748-L752cmpi.w #-$400,d0 ; has Sonic changed direction while being really fast?
bgt.s .nostopping ; if not, don't play skidding animation/sound
…
bset #status_xflip_bit,obStatus(a0) ; set X-flip flag (Sonic is now facing left)Checked by claude, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; ground speed set to every value from $80 to $600 each way, facing away, and the reverse held one frame: every speed from $480 up skids moving right and from $381 moving left, none below, and the stopping animation ($0D) shows on exactly those frames. Read both skid checks at the pinned commit: on flat ground the angle byte is 0, so the test sees the slowed speed with its low byte clearedRevised after a check by a second AI model, 2026-10-25.Checked by a second AI model, 2026-11-04.Probe: probes/jump-physics/sonic-mame.mjsThe skid changes no speed. The deceleration is $80 either way.
Cited by: Sonic the Hedgehog
In the running game, on flat ground, the d-pad turns Sonic only when his ground speed is 0 or already that way, so reversing from top speed out of water and without speed shoes, he keeps facing his motion until the 13th frame, the one after his speed reaches 0 from the right or crosses it from the left. s1disasm/facing
About: Sonic the Hedgehog Running
Value: right 13 · left 13 (frame of the reversal, counting the first frame the other way is held)
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L636-L643Sonic_MoveLeft:
move.w obInertia(a0),d0 ; get Sonic's current ground speed
beq.s .still ; is Sonic standing still? if yes, branch
bpl.s .changeddirection ; has Sonic changed direction? if yes, branch
…
bset #status_xflip_bit,obStatus(a0) ; set X-flip flag (Sonic is facing left)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L706-L709Sonic_MoveRight:
move.w obInertia(a0),d0 ; get Sonic's current ground speed
bmi.s .changedirection ; has Sonic changed direction? if yes, branch
bclr #status_xflip_bit,obStatus(a0) ; clear X-flip flag (Sonic is facing right)In the running game, on flat ground, reversing from top speed, Sonic running right reaches exactly 0 on the 12th frame and −$C on the 13th, but running left he jumps from −$80 to +$80 on the 12th. Verified — the speeds on frames 12 and 13s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L948-L950 — in the air the d-pad sets facing at oncebtst #bitL,(v_jpadhold2).w ; is left being held?
beq.s .notleft ; if not, branch
bset #status_xflip_bit,obStatus(a0) ; set X-flip flag (Sonic is facing left)Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; every ground frame of the scripts and pokes matches that rule, and reversing from $600 he faces the new way from the 13th frame of the turn either way. Read Sonic_MoveLeft, Sonic_MoveRight, Sonic_RollLeft, Sonic_RollRight, and Sonic_JumpDirection at the pinned commitChecked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the facing flip for a leftward runner turning right is quoted and the condition added.Probe: probes/jump-physics/sonic-mame.mjsSo after a reversal crosses zero he faces his new direction one frame later. Rolling turns him the same way (L883-L917). In the air he faces whichever of Left or Right is held, Right last.
In the running game, on flat ground, Down without Left or Right curls Sonic into a roll when his ground speed, after this frame's friction, is at least $80 either way: out of water and without speed shoes the friction is $C, so from $8C written in by the probe he rolls, from $8B he doesn't. s1disasm/roll-start
About: Sonic the Hedgehog Running
Value: 128 1/256 px/frame
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1150-L1161move.w obInertia(a0),d0 ; get Sonic's current ground speed
…
cmpi.w #$80,d0 ; is Sonic moving at $80 speed or faster?
blo.s .noroll ; if not, branch
move.b (v_jpadhold2).w,d0 ; get held buttons
andi.b #btnL+btnR,d0 ; is left/right being held?
bne.s .noroll ; if yes, prevent rolling (some kind of fat-fingering convenience feature?)
btst #bitDn,(v_jpadhold2).w ; is down being held?
bne.s Sonic_ChkRoll ; if yes, branchs1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1176-L1187bset #status_rolling_bit,obStatus(a0) ; set rolling flag
move.b #sonic_roll_height,obHeight(a0) ; set Sonic's hitbox height to rolling size
…
addq.w #sonic_height-sonic_roll_height,obY(a0) ; adjust Y-position to align Sonic to the floors1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L320-L321bsr.w Sonic_Move ; handle Sonic's left/right movement
bsr.w Sonic_Roll ; check if we need to rollIn the running game, on flat ground, out of water and without speed shoes, with neither Left nor Right held, Sonic's ground speed loses the acceleration, $C, each frame toward zero, stopping at exactly 0. Water halves the acceleration and speed shoes double it, and the friction with it. Verified — the `$C` friction, which runs in the move routine before the roll checkSonic Physics Guide: Rolling · CriteriaIn Sonic 1, 2, and 3, the Player can't begin to roll unless absolute Ground Speed is greater than or equal to 0.5 (128 subpixels)Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; Down held for one frame from every ground speed $80 to $9F each way, written in by the probe: he rolled from $8C (−$8C) up and not below, and from $200 with Right or Left also held he didn't roll. Read Sonic_MdNormal and Sonic_Roll at the pinned commitChecked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; ground-friction is cited for the friction before the test.Probe: probes/jump-physics/sonic-mame.mjsThe roll keeps the speed of the frame it starts on, which has already lost $C to friction because Left and Right are up. Below $80, Down only ducks, and only at a standstill.
Cited by: Rolling, Sonic the Hedgehog
In the running game, on flat ground, a roll never speeds up: friction takes $6 a frame whatever is held, holding against the roll takes another $20, and a ground speed past $1000 written in by the probe gives an X speed of exactly ±$1000 (16 px/frame). s1disasm/roll-speed
About: Sonic the Hedgehog Running
Value: friction 6 · decel 32 · cap 4096 (1/256 px/frame² (cap in 1/256 px/frame))
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L767-L773Sonic_RollSpeed:
move.w (v_sonspeedmax).w,d6 ; get Sonic's current max speed...
asl.w #1,d6 ; ...doubled while rolling
move.w (v_sonspeedacc).w,d5 ; get Sonic's current acceleration...
asr.w #1,d5 ; ...halved while rolling
move.w (v_sonspeeddec).w,d4 ; get Sonic's current deceleration...
asr.w #2,d4 ; ...divided by 4 while rollingOur readingtop speed × 2768–769acceleration ÷ 2770–771deceleration ÷ 4772–773s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L791-L797.notright:
move.w obInertia(a0),d0 ; get Sonic's current ground speed
beq.s Sonic_RollSlowdownDone ; is he standing still? if yes, branch
bmi.s .rollingleft ; is he moving to the left? if yes, branch
sub.w d5,d0 ; slightly decrease Sonic's current roll speed
bcc.s .stillrollingright ; if still rolling, branch
move.w #0,d0 ; reset speed to zero on sign changeOur readingground speed 0: done (not quoted)792–793moving left: to .rollingleft (not quoted)794speed − half the acceleration795no borrow, 0 or more: to .stillrollingright (not quoted)796below 0: 0797s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L912-L917Sonic_RollRight:
move.w obInertia(a0),d0 ; get Sonic's current ground speed
bmi.s .changedirection ; has Sonic changed direction? if yes, branch
bclr #status_xflip_bit,obStatus(a0) ; clear X-flip flag (Sonic is facing right)
move.b #id_Roll,obAnim(a0) ; use "rolling" animation
rts ; returnOur readingmoving left: to .changedirection (not quoted)913–914else: face right, roll animation, return915–917s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L863-L873cmpi.w #$1000,d1 ; is new X-velocity bigger than maximum screen shift speed? (rightward)
…
move.w d1,obVelX(a0) ; set new X-velocityOur readingX speed above $1000: $1000 (not quoted)863–865below −$1000: −$1000 (not quoted)868–870X velocity ← it873Sonic Physics Guide: Rolling · Constantsroll_friction_speed 0.0234375 (6 subpixels) roll_deceleration_speed 0.125 (32 subpixels)Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; every rolling frame of the scripts, with nothing held, forward held, or braking, loses $6 a frame, $26 braking, and ground speeds of ±$1100 written in gave X speeds of ±$1000. Read Sonic_RollSpeed, Sonic_RollLeft, Sonic_RollRight, and Sonic_AngledRollSpeed at the pinned commitChecked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-10-28.Probe: probes/jump-physics/sonic-mame.mjsThe doubled top speed in d6 is never read; the only limit is the ±$1000 clamp on X speed (16 px/frame). A roll whose speed reaches 0 ends at once: Sonic_RollSlowdownDone restores the standing size and moves him up 5 px, so his feet stay put (L817-L825).
Cited by: Rolling, Sonic the Hedgehog
In the running game, on flat ground, out of water and without speed shoes, with the slow ground speed written in by the probe, holding against a roll turns it around only below $20 moving right but up to $20 moving left, then friction leaves $7A; other slow speeds stop and stand Sonic up. In a roll the deceleration is a quarter of the $80, $20, and the friction half of the $C acceleration, $6, so a turn's $80 drops to $7A (computed). s1disasm/roll-reverse
About: Sonic the Hedgehog Running
Value
[ [ -122, true ], [ 0, false ], [ 0, false ], [ 122, true ], [ 0, false ] ]
_incObj/01 Sonic.asm#L896-L899.changeddirection:
sub.w d4,d0 ; apply deceleration to current speed
bcc.s .stilldecel ; if still decelerating, branch
move.w #-$80,d0 ; set minimum speed on sign changes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L921-L924.changedirection:
add.w d4,d0 ; apply deceleration to current speed
bcc.s .stilldecel ; if still decelerating, branch
move.w #$80,d0 ; set minimum speed on sign changes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L767-L773Sonic_RollSpeed:
…
move.w (v_sonspeedacc).w,d5 ; get Sonic's current acceleration...
asr.w #1,d5 ; ...halved while rolling
move.w (v_sonspeeddec).w,d4 ; get Sonic's current deceleration...
asr.w #2,d4 ; ...divided by 4 while rollings1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L791-L825 — friction after the d-pad, every frame; at 0 he stands up.notright:
move.w obInertia(a0),d0 ; get Sonic's current ground speed
beq.s Sonic_RollSlowdownDone ; is he standing still? if yes, branch
bmi.s .rollingleft ; is he moving to the left? if yes, branch
sub.w d5,d0 ; slightly decrease Sonic's current roll speed
bcc.s .stillrollingright ; if still rolling, branch
move.w #0,d0 ; reset speed to zero on sign change
…
.rollingleft:
add.w d5,d0 ; slightly decrease Sonic's current roll speed
bcc.s .stillrollingleft ; if still rolling, branch
move.w #0,d0 ; reset speed to zero on sign change
…In the running game, on flat ground, out of water and without speed shoes, with neither Left nor Right held, Sonic's ground speed loses the acceleration, $C, each frame toward zero, stopping at exactly 0. Water halves the acceleration and speed shoes double it, and the friction with it. Verified — the `$C` acceleration, out of water without shoesIn the running game, on flat ground, holding the d-pad against Sonic's motion subtracts his deceleration, $80, a frame, and a step that would cross zero sets the speed to $80 the other way: from $40 written in by the probe, Left gives −$80, and from −$40, Right gives $80. Verified — the `$80` decelerationSonic Physics Guide: Rolling · Decelerationif absolute Ground Speed is less than that value … Ground Speed is set to 0.5 (128 subpixels) in the opposite direction.Checked by claude, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; Sonic curled at $84, his ground speed was set to each starting value, and the reverse held one frame: −$7A rolling, 0 standing, 0 standing, $7A rolling, 0 standing. sonic-movement.mjs's simulation of Sonic_RollSpeed gives the sameRevised after a check by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the roll deceleration and friction setup and the stand-up at 0 are quoted.Probe: probes/jump-physics/sonic-mame.mjsDisputed: The guide puts the turn-around below `$26` (deceleration plus friction) and the result at `$80`. In the code the deceleration step alone decides it, by its carry, before friction runs, and friction then takes `$6` off the `$80`.
In the running game, out of water and without speed shoes, a roll started at top speed on flat ground stops on its 255th frame whether forward is held or not, and Sonic stands up on that frame. The starting frame's walking friction leaves $600 − $C = $5F4, which the roll's $6 friction takes in 254 more frames (computed). s1disasm/roll-frames
About: Sonic the Hedgehog Running
Value: free 255 · forward 255 · stands true (frames, counting the frame Down starts the roll)
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L767-L825 — roll friction and standing upSonic_RollSpeed:
…
move.w (v_sonspeedacc).w,d5 ; get Sonic's current acceleration...
asr.w #1,d5 ; ...halved while rolling
…
sub.w d5,d0 ; slightly decrease Sonic's current roll speed
…
tst.w obInertia(a0) ; is Sonic standing still?
bne.s Sonic_AngledRollSpeed ; if not, branch
bclr #status_rolling_bit,obStatus(a0) ; clear rolling flagIn the running game, on flat ground, Sonic's top running speed is $600 (6 px/frame): holding the d-pad his ground speed stops there, and in the air the d-pad caps his X speed there too. VerifiedIn the running game, on flat ground, out of water and without speed shoes, with neither Left nor Right held, Sonic's ground speed loses the acceleration, $C, each frame toward zero, stopping at exactly 0. Water halves the acceleration and speed shoes double it, and the friction with it. VerifiedIn the running game, on flat ground, Down without Left or Right curls Sonic into a roll when his ground speed, after this frame's friction, is at least $80 either way: out of water and without speed shoes the friction is $C, so from $8C written in by the probe he rolls, from $8B he doesn't. Verified — the starting frame's walking frictionIn the running game, on flat ground, a roll never speeds up: friction takes $6 a frame whatever is held, holding against the roll takes another $20, and a ground speed past $1000 written in by the probe gives an X speed of exactly ±$1000 (16 px/frame). Verified — forward held adds nothing in a rollChecked by claude, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; from top speed, Down for one frame, then nothing or Right: ground speed 0 and standing on the 255th frame either way. The starting frame loses $C to walking friction, leaving $5F4, which is 254 × $6Checked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the roll friction's half acceleration is quoted and the speeds cited.Probe: probes/jump-physics/sonic-mame.mjsCited by: Sonic the Hedgehog
In the running game, on flat ground, the jump adds nothing to Sonic's X speed, and because the press frame skips the ground-move routine, he leaves the ground with the previous frame's speed, whatever the d-pad holds on that frame. s1disasm/takeoff-x
About: Sonic the Hedgehog Jump
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1224-L1230subi.b #$40,d0 ; rotate it perpendicularly for jump trajectory
jsr (CalcSine).l ; find the direction Sonic should jump
muls.w d2,d1 ; apply jump force to the cosine angle
asr.l #8,d1 ; shift it to upper word
add.w d1,obVelX(a0) ; apply to X speeds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub CalcSine.asm#L53 — Sine_Data entry $C0 is −$100; its cosine, entry $100 (the table's $40 past it), is 0dc.w -$100,-$FF,-$FF,-$FF,-$FE,-$FE,-$FD,-$FC ; =s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L317-L320Sonic_MdNormal: ; While Sonic is on the ground and not rolling
bsr.w Sonic_Jump ; check if we need to jump
…
bsr.w Sonic_Move ; handle Sonic's left/right movementSonic Physics Guide: Jumping · Jump VelocityThis means their speeds on the ground are preservedChecked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; on every press frame the X speed equals the previous frame's, including presses 20 frames into a run, at $F0, with Right or with Left held. Read Sonic_Jump, Sonic_MdNormal, and Sine_Data at the pinned commitChecked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-28.Probe: probes/jump-physics/sonic-mame.mjsSonic_AngleSpeed copied the ground speed into X speed on the previous frame, so that copy is the take-off speed. The d-pad on the press frame changes nothing. A, B, and C all jump (btnABC, _Constants.asm L214).
In the running game, on flat ground, after a jump from a roll the d-pad does nothing in the air, neither steering Sonic nor turning him, and air drag still runs. s1disasm/roll-jump-lock
About: Sonic the Hedgehog Air control
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1248-L1249btst #status_rolling_bit,obStatus(a0) ; is Sonic already in a ball state?
bne.s .rolljump ; if so, branchs1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1262-L1263bset #status_rolljumping_bit,obStatus(a0) ; set Roll-Jump flags1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L944-L945btst #status_rolljumping_bit,obStatus(a0) ; is Roll-Jump flag set?
bne.s Sonic_RollJumpLock ; if yes, prevent midair direction changes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L974-L986 — the lock skips only the steering and falls through to the dragSonic_RollJumpLock:
cmpi.w #$60,(v_lookshift).w ; is screen in its default position?
beq.s Sonic_AirDrag ; if yes, branch
…
Sonic_AirDrag:In the running game, while Sonic rises no faster than 4 px/frame (Y speed −$400 to −1 before that frame's gravity), each frame subtracts his X speed shifted right 5 bits, about 1/32: an X speed of $400 written in by the probe was dragged at Y speeds −$400 and −1, and not at −$401 or 0. VerifiedSonic Physics Guide: Rolling · Rolling JumpIn Sonic 1, 2, 3, and Knuckles, you can't control the Player's trajectory through the air with the buttons if you jump while rolling.Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; a roll jump with Left held for 60 frames: every airborne frame matches the model with no steering and drag on, and his facing never changed. Read Sonic_Jump, Sonic_JumpDirection, and Sonic_ResetOnFloor at the pinned commitChecked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the fall-through into the drag is quoted and air-drag cited.Probe: probes/jump-physics/sonic-mame.mjsFacing doesn't change either. Landing clears the flag (Sonic_ResetOnFloor, L1824).
Cited by: Air control, Sonic the Hedgehog
In the running game, on flat ground (with the disassembly's bug fixes off, as in the original game), a jump from a roll gives Sonic his standing height radius, 5 px more than the ball's, without moving him, so he lands 5 px early and uncurls with his feet 5 px above the floor. s1disasm/roll-jump-size
About: Sonic the Hedgehog Jump
Value: 5 px
Verifieddisputeds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1241-L1249if (FixBugs=0)&(UnusedOptimization=0)
; This sets Sonic's hitbox to standing size when roll-jumping.
; A leftover from the victory animation in prototypes.
move.b #sonic_height,obHeight(a0) ; set height to standing size
move.b #sonic_width,obWidth(a0) ; set width to standing size
endif
…
bne.s .rolljump ; if so, branchs1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1830-L1838btst #status_rolling_bit,obStatus(a0) ; check if Sonic is in a ball state
…
subq.w #sonic_height-sonic_roll_height,obY(a0) ; raise Sonic up 5 pixels so he's not inside the grounds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic AnglePos.asm#L86-L91tst.w d1
beq.s .on_floor ; branch if Sonic is 0px from floor
bpl.s .above_floor ; branch if Sonic is above floorSonic Physics Guide: Jumping · Bugs when Jumpingthey just rise 5 pixels above the floor instantly upon landing.Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; on the roll jump's press frame his height radius went from 14 to 19 with Y unchanged, and on the landing frame he stood uncurled with his feet 5 px above the floor. Read Sonic_Jump, Sonic_FloorDown, Sonic_ResetOnFloor, and Sonic_AnglePos at the pinned commitChecked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-28.Checked by a second AI model, 2026-11-18.Probe: probes/jump-physics/sonic-mame.mjsDisputed: The guide goes on: "then being moved up 5 pixels then falling back down slowly via gravity". In Sonic 1's code the landing clears the in-air flag, so the next frame runs the grounded mode, and `Sonic_AnglePos` moves him down the 5 px at once (it aligns any gap up to 14 px, L98-L106). The probe reproduces that.
The roll keeps the 14 px height radius on the ground, and the jump doesn't move Y, so in the air his center is where the ball's was but his sensor reaches 19 px down.
In the running game (with the disassembly's bug fixes off, as in the original game), on flat ground, a roll jump's landing frame leaves Sonic's feet 5 px above the floor, and the next frame puts them back on it. s1disasm/roll-jump-landing
About: Sonic the Hedgehog Jump
Value: vx true · feet 5, 0 (px above the floor on the landing frame and the next (vx: Left held in the air changed nothing))
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1241-L1263 — Sonic_Jump's standing size and roll-jump flagif (FixBugs=0)&(UnusedOptimization=0)
…
move.b #sonic_height,obHeight(a0) ; set height to standing size
…
btst #status_rolling_bit,obStatus(a0) ; is Sonic already in a ball state?
bne.s .rolljump ; if so, branchIn the running game, on flat ground (with the disassembly's bug fixes off, as in the original game), a jump from a roll gives Sonic his standing height radius, 5 px more than the ball's, without moving him, so he lands 5 px early and uncurls with his feet 5 px above the floor. Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1558-L1561 — the landing puts the standing-size sensor on the floor.landed:
add.w d1,obY(a0) ; fix Sonic to floor
…
bsr.w Sonic_ResetOnFloor ; reset various flags and states back to standing states1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1813-L1845 — Sonic_ResetOnFloorbclr #status_in_air_bit,obStatus(a0) ; clear in-air flag
…
btst #status_rolling_bit,obStatus(a0) ; check if Sonic is in a ball state
beq.s .notball ; if not, skip
bclr #status_rolling_bit,obStatus(a0) ; clear ball flag
move.b #sonic_height,obHeight(a0) ; set Sonic's hitbox height to standing
…
subq.w #sonic_height-sonic_roll_height,obY(a0) ; raise Sonic up 5 pixels so he's not inside the grounds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L317-L324 — the next frame runs the grounded modeSonic_MdNormal: ; While Sonic is on the ground and not rolling
…
bsr.w Sonic_AnglePos ; update Sonic's current angle as he walks along the floors1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic AnglePos.asm#L99-L105 — a gap of up to 14 px closes at once.above_floor:
cmpi.w #$E,d1
bgt.s .in_air ; branch if Sonic is > 14px above floor
…
add.w d1,obY(a0) ; align to floorChecked by claude, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; 100 frames of Right, Down, then a jump with Left held: X speed never grew in the air, and the feet stood 5 px above the floor on the landing frame and 0 on the nextChecked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the bug-fix condition, the landing snap, the 5 px raise and the next frame's floor align are quoted.Probe: probes/jump-physics/sonic-mame.mjsIn the running game, out of water and without speed shoes, in the air the d-pad adds $18, twice the ground acceleration $C, to Sonic's X speed each frame either way, with no separate deceleration, up to the top speed; after a jump from a roll it does nothing. s1disasm/air-accel
About: Sonic the Hedgehog Air control
Value: 24 1/256 px/frame²
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L939-L970Sonic_JumpDirection:
move.w (v_sonspeedmax).w,d6 ; get Sonic's current top speed
move.w (v_sonspeedacc).w,d5 ; get Sonic's current acceleration...
asl.w #1,d5 ; ...doubled
…
sub.w d5,d0 ; increase leftward movement speed
…
add.w d5,d0 ; increase rightward movement speed
…
move.w d0,obVelX(a0) ; update Sonic's horizontal speedIn the running game, on flat ground, out of water and without speed shoes, with neither Left nor Right held, Sonic's ground speed loses the acceleration, $C, each frame toward zero, stopping at exactly 0. Water halves the acceleration and speed shoes double it, and the friction with it. Verified — the acceleration is `$C` out of water without shoesIn the running game, on flat ground, Sonic's top running speed is $600 (6 px/frame): holding the d-pad his ground speed stops there, and in the air the d-pad caps his X speed there too. VerifiedIn the running game, on flat ground, after a jump from a roll the d-pad does nothing in the air, neither steering Sonic nor turning him, and air drag still runs. VerifiedSonic Physics Guide: Air State · Air Accelerationthere is no distinction for deceleration in the air, eitherChecked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; every airborne frame with Left or Right held (standing jumps steered each way, running jumps steered forward and back) matches $18 a frame before drag, capped at $600. Read Sonic_JumpDirection at the pinned commitChecked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Overstated; now out of water and without speed shoes, and after a jump from a roll it does nothing.Probe: probes/jump-physics/sonic-mame.mjsLeft is applied and capped first, then Right, so holding both ends facing right and changes nothing else, except near the left cap, where from −$5F0 Left caps at −$600 and Right leaves −$5E8. Releasing the d-pad keeps the X speed; the air has no friction, only air-drag.
Cited by: Air control, Sonic the Hedgehog, Sonic the Hedgehog 2
In the running game, while Sonic rises no faster than 4 px/frame (Y speed −$400 to −1 before that frame's gravity), each frame subtracts his X speed shifted right 5 bits, about 1/32: an X speed of $400 written in by the probe was dragged at Y speeds −$400 and −1, and not at −$401 or 0. s1disasm/air-drag
About: Sonic the Hedgehog Air control
Value: shift 5 · vy from -1024 · vy to -1 (bits; Y speed in 1/256 px/frame)
Verifieddisputeds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L986-L1013Sonic_AirDrag:
cmpi.w #-$400,obVelY(a0) ; is Sonic moving faster than -$400 upwards?
blo.s .return ; if yes, branch (skip air drag)
…
asr.w #5,d1 ; divide that copy by $20
beq.s .return ; if result is zero, branch
bmi.s .jumpingleftward ; if speed is negative, branch
sub.w d1,d0 ; slightly reduce speed (air drag)Sonic Physics Guide: Air State · Air DragY Speed must be negative and Y Speed must be more than -4Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; every airborne frame of every script matches the drag rule, and an X speed of $400 written with Y speeds −$401, −$400, −1, and 0 was dragged to $3E0 at −$400 and −1 only. Read Sonic_AirDrag, and Sonic_MdJump2's order (JumpHeight, JumpDirection, ObjectFall), at the pinned commitChecked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-11-04.Probe: probes/jump-physics/sonic-mame.mjsDisputed: The guide's window excludes −4; `blo` is an unsigned compare, so −`$400` itself is dragged. That matters on a release frame, where the release cap has just set −`$400` (`Sonic_JumpHeight` runs first). `asr` rounds toward minus infinity, so a leftward speed loses a subpixel more than the same speed rightward whenever it isn't a multiple of 32, and rightward speeds under `$20` aren't dragged at all.
The test reads Y speed before this frame's gravity. Falling, and rising faster than 4 px/frame, are both outside the window, and a roll jump is dragged too.
Cited by: Air control, Sonic the Hedgehog, Sonic the Hedgehog 2
In the running game, on flat ground out of water, a held jump from top speed with the d-pad released is dragged on 18 frames and lands at $369 (3.41 px/frame) to the right but −$35E to the left. The drag runs while the Y speed is −$400 to −1 before gravity, which a take-off of −$680 gaining $38 a frame passes through in 18 updates (computed). s1disasm/air-drag-jump
About: Sonic the Hedgehog Air control
Value: frames 18 · right 873 · left -862 · at cap 1488 (frames; 1/256 px/frame (atCap: X speed after one release frame from $600))
VerifiedIn the running game, while Sonic rises no faster than 4 px/frame (Y speed −$400 to −1 before that frame's gravity), each frame subtracts his X speed shifted right 5 bits, about 1/32: an X speed of $400 written in by the probe was dragged at Y speeds −$400 and −1, and not at −$401 or 0. Verified — Sonic_AirDrags1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L8son_jumpspeed: equ $680 ; Sonic's jump speeds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub ObjectFall & SpeedToPos.asm#L5gravity: equ $38 ; gravity constant used by many objectsIn 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. Verified — gravity on every airborne updateIn the running game, on flat ground, Sonic's top running speed is $600 (6 px/frame): holding the d-pad his ground speed stops there, and in the air the d-pad caps his X speed there too. VerifiedChecked by claude, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; a jump from $600 with A held and the d-pad released: X speed changed on 18 airborne frames and was $369 on the landing frame ($35E mirrored); one release frame at $600 left $5D0. Y speeds −$680 + k × $38 for k = 12…29 fall in the drag window, 18 framesRevised after a check by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the drag entry with no quote is replaced by a cite of air-drag, and the jump speed is quoted.Probe: probes/jump-physics/sonic-mame.mjsCited by: Air control
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. s1disasm/landing
About: Sonic the Hedgehog Jump
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1594-L1596.flatsurface:
move.w #0,obVelY(a0) ; completely clear Sonic's vertical speed when landing on a flat surface
move.w obVelX(a0),obInertia(a0) ; convert in-air horizontal speed to ground speed when landings1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1798-L1799 — Sonic_FloorRight, taken when the fall is mostly sideways; Sonic_FloorLeft is the same (L1683-L1684)move.w obVelX(a0),obInertia(a0) ; convert in-air horizontal speed to ground speed when landings1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L359-L371Sonic_MdJump2: ; While Sonic is in the air and rolling (usually, but not limited to, jumping)
…
bsr.w Sonic_JumpDirection ; handle midair direction adjustments while jumping
…
jsr (ObjectFall).l ; apply gravity and update Sonic's position based on his current velocities
…
bsr.w Sonic_Floor ; handle collision with level while airborneIn the running game, out of water and without speed shoes, in the air the d-pad adds $18, twice the ground acceleration $C, to Sonic's X speed each frame either way, with no separate deceleration, up to the top speed; after a jump from a roll it does nothing. Verified — the steeringIn the running game, while Sonic rises no faster than 4 px/frame (Y speed −$400 to −1 before that frame's gravity), each frame subtracts his X speed shifted right 5 bits, about 1/32: an X speed of $400 written in by the probe was dragged at Y speeds −$400 and −1, and not at −$401 or 0. Verified — the drag, which the steering routine runs intos1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1830-L1834 — Sonic_ResetOnFloor, which every landing path callsbtst #status_rolling_bit,obStatus(a0) ; check if Sonic is in a ball state
beq.s .notball ; if not, skip
bclr #status_rolling_bit,obStatus(a0) ; clear ball flag
move.b #sonic_height,obHeight(a0) ; set Sonic's hitbox height to standing
move.b #sonic_width,obWidth(a0) ; set Sonic's hitbox width to standingChecked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; on every landing frame of the scripts (jumps, steered jumps, a roll jump, a fast fall) the ground speed equals the X speed the frame's steering and drag gave, the Y speed is 0, and he is uncurled at standing height. Read Sonic_Floor's three landing paths and Sonic_ResetOnFloor at the pinned commitChecked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the steering call and the uncurling are quoted.Probe: probes/jump-physics/sonic-mame.mjsSonic_FloorDown lands when the fall is mostly downward, Sonic_FloorLeft/Right when it is mostly sideways and Y speed isn't negative; on flat ground all three do the same. The snap (add.w d1,obY, L1559) moves whole pixels and keeps Y's subpixel. Ground rules start on the next frame.
A frame-by-frame model of Sonic's normal, rolling, and airborne mode routines on flat ground matches Sonic the Hedgehog itself, run in MAME on a floor built of Green Hill Act 1's blocks, on every frame of the movement lab's flat-ground presets and stress scripts and of 100 random input scripts. s1disasm/movement-rule
About: Sonic the Hedgehog Running
Value
{
"ground": {
"accel": 12,
"friction": 12,
"decel": 128,
"top": 1536,
"flip": 128
},
"roll": {
"start": 128,
"friction": 6,
"decel": 32,
"flip": 128,
"cap": 4096
},
"air": {
"accel": 24,
"top": 1536,
"dragShift": 5,
"dragFrom": -1024
},
"jump": {
"speed": -1664,
"releaseCap": -1024,
"gravity": 56,
"rollShift": 5
}
}_incObj/01 Sonic.asm#L317-L371 — the four modes and their orderbsr.w Sonic_Jump ; check if we need to jump
…
bsr.w Sonic_Move ; handle Sonic's left/right movement
bsr.w Sonic_Roll ; check if we need to rolls1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L381-L536 — Sonic_Move, friction, Sonic_AngleSpeeds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L636-L929 — Sonic_MoveLeft/Right, Sonic_RollSpeed, Sonic_RollLeft/Rights1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L939-L1013 — Sonic_JumpDirection, Sonic_AirDrags1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1146-L1288 — Sonic_Roll, Sonic_Jump, Sonic_JumpHeightA different reading: Dropping the return address returns from Sonic_MdNormal itself, skipping the rest of the grounded routine, SpeedToPos included. The in-air routines run from the next frame. (s1disasm/jump-frame-no-move)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1484-L1617 — Sonic_Floor, Sonic_FloorDowns1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1813-L1845 — Sonic_ResetOnFloors1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · sonic.asm#L1117-L1122 — ReadJoypads, a press per buttonmove.b (a0),d1 ; get buttons pressed the previous frame
eor.b d0,d1 ; XOR with buttons pressed this frame
move.b d0,(a0)+ ; write HELD buttons
and.b d0,d1 ; find buttons pressed this frame
move.b d1,(a0)+ ; write PRESSED buttonsSonic Physics Guide: Running · NotesIn the original games, holding and at the same time will run both direction's code in one stepChecked by claude, 2026-10-26 — read the four mode routines and every subroutine they call for flat ground, and ReadJoypads, at the pinned commit. The probe runs Sonic The Hedgehog (USA, Europe) in MAME 0.289 through the movement lab's ROM check (probes/lab/conformance.mjs): Green Hill Act 1 with its objects cleared every frame, Sonic placed standing on a 4096 px floor of the act's full flat block, input written into the joypad bytes each game frame, and the model run on the same input. On 2026-10-26 it compared 132 scripts (32 presets and stress scripts, 100 random ones of 300 frames), 33,183 frames, on X and Y in 16.16, X, Y, and ground speed, airborne, curled, and facing, and all matched. The first run differed on 71 random scripts, all one way: the model took a jump press only when no jump button had been held, and the game reads a press per button, so B going down while A is held jumps; the model now does too. The model also matches sonic-movement.mjs's word-level simulation of the routines (sonic.model.test.ts, in the gate), which agreed with the step below on all 360,000 frames of 400 random scripts on 2026-10-21Checked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-26.Checked by a second AI model, 2026-10-28.Probe: probes/lab/sonic-conformance.mjsOne frame, out of water, g the ground speed and vx, vy the X and Y speeds in 1/256 px/frame, positions 16.16 (a speed moves the position by speed × 256, and the drawn pixel is the floor). Down is +y in the game. A, B, or C going down this frame is a jump, even with another of them held. Standing (not rolling): a jump press sets vy = −$680, curls Sonic (height radius 19 → 14, Y + 5), and ends the frame with no move and vx unchanged. Otherwise Left runs first, then Right. Left with g ≤ 0: face left, g −= $C, floor at −$600; Left with g > 0: g −= $80, or −$80 if g < $80; skid (face right) if the result ≥ $400. Right with g ≥ 0: face right, g += $C, cap at $600; Right with g < 0: g += $80, or +$80 if g ≥ −$80; skid (face left) if the result ≤ −$301. Neither: g moves $C toward 0, stopping at 0. Then vx = g, vy = 0; then if Down is held, Left and Right aren't, and |g| ≥ $80, he curls into a roll (Y + 5); then X += vx. Rolling: a jump press sets vy = −$680 and the roll-jump lock, keeps the standing height radius 19 (the bug), and ends the frame. Otherwise Left with g ≤ 0 faces left; Left with g > 0: g −= $20, or −$80 if g < $20. Right with g ≥ 0 faces right; Right with g < 0: g += $20, or +$80 if g ≥ −$20. Then g moves 6 toward 0; at 0 he stands (Y − 5). vx = g clamped to ±$1000; X += vx. Air: if jumping and vy < −$400 with no A, B, or C held, vy = −$400. Unless roll-jumping: Left faces left and vx −= $18, floor −$600; then Right faces right and vx += $18, cap $600. If −$400 ≤ vy < 0: vx −= vx >> 5 (arithmetic shift). X += vx, Y += vy, then vy += $38. If vy ≥ 0 and the floor sensor (Y + height radius) is below the floor, he lands: Y moves up by whole pixels to the floor, g = vx, vy = 0, the jump and roll-jump flags clear, and a curled Sonic uncurls (radius 19, Y − 5). The next standing frame ends by realigning him to the floor, which only matters after a roll jump (roll-jump-size). Slopes, walls, water, springs, and the camera are outside the model.
Cited by: Sonic the Hedgehog
Standing, Sonic's floor and ceiling sensors sit 19 px above and below his center and 9 px to each side, a 19 × 39 px box; curled up, 14 and 7, 15 × 29 px. s1disasm/collision-box
About: Sonic the Hedgehog Hitbox
Value
{
"w": 19,
"h": 39,
"rollW": 15,
"rollH": 29,
"radius": {
"w": 9,
"h": 19,
"rollW": 7,
"rollH": 14,
"push": 10
}
}_Constants.asm#L311-L318sonic_width: equ 18/2 ; Sonic's width
sonic_height: equ 38/2 ; Sonic's height
sonic_roll_width: equ 14/2 ; Sonic's width (rolling)
sonic_roll_height: equ 28/2 ; Sonic's height (rolling)
…
sonic_quick_size: equ 20/2 ; Sonic's size (quick terrain find)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic Collision.asm#L113-L123Sonic_FindFloor:
move.w obY(a0),d2
move.w obX(a0),d3
moveq #0,d0
move.b obHeight(a0),d0
ext.w d0
add.w d0,d2 ; d2 = y pos. of Sonic's bottom edge
move.b obWidth(a0),d0
ext.w d0
add.w d0,d3 ; d3 = x pos. of Sonic's right edgeSonic Physics Guide: Characters · SonicWhen standing, Sonic's Width Radius is 9 and his Height Radius is 19 … resulting in 19 pixels wide and 39 pixels tall.Checked by claude, 2026-10-21 — read the size equates, Sonic_FindFloor and Sonic_FindCeiling at the pinned commitChecked by a second AI model, 2026-10-27.The sensors sit at center ± radius, so a box counts the center pixel too: 2 × 9 + 1 wide, 2 × 19 + 1 tall. The disassembly's comments call the doubled radius (18, 38) the size. Walls are tested 10 px to each side (sonic_quick_size, the guide's push radius). The box enemies and rings hit is separate (ReactToItem), not read here.
Cited by: Hitbox
A hit throws Sonic up at -$400 and away from the object at $200 (-$200 and $100 underwater), and the hurt routine's gravity is $30, 8 less than the usual $38. s1disasm/hurt-knockback
About: Sonic the Hedgehog Knockback
Value: vy -1024 · vx 512 · gravity 48 · water vy -512 · water vx 256 (1/256 px/frame)
Codes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/Sonic ReactToItem.asm#L394-L405move.w #-$400,obVelY(a0) ; bounce Sonic vertically move.w #-$200,obVelX(a0) ; bounce Sonic horizontally … neg.w obVelX(a0) ; if Sonic is right of the object, reverses1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1868-L1869addi.w #gravity-8,obVelY(a0) ; apply gravity (this is 8 less than the normal gravity of $38)Checked by claude, 2026-10-21 — read HurtSonic and Sonic_Hurt at the pinned commitChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-11-04.The d-pad does nothing until he lands; Sonic_Hurt runs no steering.
Cited by: Sonic the Hedgehog
A hit sets the flash timer to 120 frames and landing sets it to 120 again; it counts down only in the control routine, so Sonic blinks and can't be hurt for 120 frames after he lands. s1disasm/hurt-invulnerable
About: Sonic the Hedgehog Invincibility frames
Value: 120 frames
Codes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/Sonic ReactToItem.asm#L410move.w #2*60,flashtime(a0) ; set temporary invulnerability time to 2 secondss1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1916-L1925move.w #2*60,flashtime(a0) ; set flash time to 2 seconds of invulnerability framess1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L142-L147subq.w #1,flashtime(a0) ; decrease invulnerability frames lsr.w #3,d0 ; don't render Sonic's sprite everys1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic ReactToItem.asm#L356-L357tst.w flashtime(a0) ; is Sonic flashing? bne.s .noDamage ; if yes, don't take damageChecked by claude, 2026-10-21 — read HurtSonic, Sonic_HurtStop, and Sonic_Display at the pinned commitChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.Cited by: Sonic the Hedgehog
Hit without a shield, Sonic drops his rings, at most 32 of them as bouncing rings, and the count goes to 0; if no object slot is free for the bouncing rings, he is knocked back and keeps them all. With no rings he dies, unless the debug cheat is on, when he is knocked back instead. s1disasm/hurt-rings
About: Sonic the Hedgehog Rings as health
Value: scatter max 32
Codes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/Sonic ReactToItem.asm#L376-L383tst.b (v_shield).w ; does Sonic have a shield? … tst.w (v_rings).w ; does Sonic have any rings? beq.w .hitWithoutRings ; if not, branch to kill Sonic jsr (FindFreeObj).l ; find a free object slot bne.s .bounceSonicAway ; if object RAM is full, branch _move.b #id_RingLoss,obID(a1) ; load bouncing multi rings objects1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic ReactToItem.asm#L437-L459 — the no-ring path runs on into KillSonic.hitWithoutRings:
tst.w (f_debugmode).w ; is debug mode cheat on?
bne.w .bounceSonicAway ; if yes, survive dying from no rings
…
KillSonic:
…
move.b #6,obRoutine(a0) ; set Sonic to "Sonic_Death" routines1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/25, 37 Rings.asm#L237-L241moveq #32,d0 ; spawn at most 32 ringss1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/25, 37 Rings.asm#L298move.w #0,(v_rings).w ; reset number of rings to zeroChecked by claude, 2026-10-21 — read HurtSonic and RLoss_Count at the pinned commit; on 2026-11-04 re-read HurtSonic's object-slot and debug branches and KillSonicChecked by a second AI model, 2026-10-21.Revised after a check by a second AI model, 2026-11-04: Missing quotes and conditions; a full object list keeps his rings and the debug cheat knocks him back instead of killing him, both quoted with the death routine.Cited by: Rings as health, Sonic the Hedgehog
Sonic 1's shield takes one hit in place of the rings; the hurt routine skips the ring drop, clears the shield, and knocks Sonic back as usual. s1disasm/shield
About: Sonic the Hedgehog Shields
Codes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/Sonic ReactToItem.asm#L376-L389tst.b (v_shield).w ; does Sonic have a shield? bne.s .bounceSonicAway ; if yes, branch … move.b #0,(v_shield).w ; remove a potential shieldChecked by claude, 2026-10-21 — read HurtSonic at the pinned commitChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.Cited by: Rings as health, Shields, Sonic the Hedgehog
Against objects Sonic is a 16 px wide box whose half-height is his height radius minus 3: 32 px tall standing, 22 px curled in a roll or a jump from standing or running, 20 px on the ducking frame. With the disassembly's bug fixes off, as in the original game, a jump from a roll keeps the standing height radius, so that ball is 32 px tall. The level sees separate sensors (collision-box). s1disasm/hitbox
About: Sonic the Hedgehog Hitbox
Value: w 16 · h 32 · roll H 22 · duck H 20 (px)
Codes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/Sonic ReactToItem.asm#L15-L41subq.w #sonic_react_width,d2 ; d2 = X-position of Sonic's left edge … subq.b #3,d5 ; shrink by 3px … moveq #sonic_duck_height,d5 ; use alternate hitbox extent … move.w #sonic_react_width*2,d4 ; d4 = Sonic's hitbox widths1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _Constants.asm#L316-L317sonic_react_width: equ 16/2 ; Sonic's width (object collision) sonic_duck_height: equ 20/2s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _Constants.asm#L312-L314sonic_height: equ 38/2 ; Sonic's height
…
sonic_roll_height: equ 28/2 ; Sonic's height (rolling)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1241-L1250 — Sonic_Jumpif (FixBugs=0)&(UnusedOptimization=0)
…
move.b #sonic_height,obHeight(a0) ; set height to standing size
…
btst #status_rolling_bit,obStatus(a0) ; is Sonic already in a ball state?
bne.s .rolljump ; if so, branch
move.b #sonic_roll_height,obHeight(a0) ; set height to rolling sizes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1176-L1178 — starting a rollmove.b #sonic_roll_height,obHeight(a0) ; set Sonic's hitbox height to rolling sizeChecked by claude, 2026-10-21 — read ReactToItem and the constants at the pinned commit; on 2026-11-04 re-read the height radius Sonic_Jump and Sonic_ChkRoll setChecked by a second AI model, 2026-10-21.Revised after a check by a second AI model, 2026-11-04: Wrong: a jump from a roll keeps the 32 px standing height; the height radii and the jump's height lines are quoted.Cited by: Hitbox
Sonic 1 has no spin dash; standing on the ground, the normal-mode routine checks only for a jump, the slope, the d-pad, and a roll. s1disasm/no-spindash
About: Sonic the Hedgehog Spin dash
Codes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L316-L325bsr.w Sonic_Jump ; check if we need to jump bsr.w Sonic_SlopeResistWalk ; handle resistance from running up slopes bsr.w Sonic_Move ; handle Sonic's left/right movement bsr.w Sonic_Roll ; check if we need to rolls2disasm: Sonic the Hedgehog 2 (16-bit) disassembly (sonicretro/s2disasm) · s2.asm#L36514-L36515bsr.w Sonic_CheckSpindash ; check for spindashChecked by claude, 2026-10-21 — read Sonic_MdNormal at the pinned commit and searched Sonic's object code for a spin dash routine (none)Checked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.Cited by: Sonic the Hedgehog, Sonic the Hedgehog 2, Spin dash
In the running game, on a 45° ramp built from Green Hill's $E0 ramp block, every ground frame's ground speed matched the flat-ground rules after a slope term of the sine of his angle times $20 while he ran, $50 while he rolled downhill and a quarter of that uphill; standing still on the ramp for 60 frames, he didn't move. s1disasm/slope-factors
About: Sonic the Hedgehog Slope physics
Value: walk 32 · roll down 80 · roll up shift 2 (1/256 px/frame² at sine 1)
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1329-L1339jsr (CalcSine).l ; get sine and cosine values for angle muls.w #$20,d0 ; multiply by resist force while walking asr.l #8,d0 ; shift down a byte tst.w obInertia(a0) ; check Sonic's ground speed beq.s .return ; if he's standing still, branchs1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1369-L1376muls.w #$50,d0 ; multiply by resist force while rolling (2.5x larger than walking) … asr.l #2,d0 ; reduce resist force while ascending a slopeChecked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-terrain.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, Green Hill Act 1 with its objects cleared and input written to the joypad bytes each game frame, its row 3 rebuilt from the act's own blocks, chosen by their heights and angles in the pinned collide/ files; on a 45° ramp of block 342 (angle $E0) with block 393 under it, between the flat floor and a plateau of block 1, seven runs (standing, walking up and down, rolling up and down, two running jumps) matched a frame model of the flat rules plus the slope term from this claim's factors and the pinned Sine_Data on every ground frame, with frames of each kind (walking up and down, rolling up and down, standing on the ramp); read Sonic_SlopeResistWalk and Sonic_SlopeResistRoll at the pinned commitChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-22.Checked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-11-04.Probe: probes/jump-physics/sonic-terrain.mjsBoth skip angles $60–$9F, near upside down (angle + $60 ≥ $C0, unsigned); at angle 0 the sine is 0, so they add nothing. Below $280 on a wall or ceiling Sonic_SlopeRepel drops him and locks the d-pad for 30 frames (L1412-L1427). On the ramp the sine of $E0 is −$B5, so the term is −23 walking either way, −57 rolling down, and −15 rolling up (−57 shifted right 2): the probe saw ground speed change by −11 a frame running up with Right held (+12 − 23), −35 coasting up (−12 − 23) and −11 coasting down, −21 rolling up (−15 − 6) and −51 rolling down (−57 + 6). Each term is added before Sonic_Move or Sonic_RollSpeed, so their friction and the d-pad act on the result. Standing still (ground speed 0) the walking term is skipped.
Cited by: Rolling, Slope physics, Sonic the Hedgehog
Sonic 1's level collision is 16 × 16 px blocks; a floor sensor reads the solid height of its pixel column in a block, a wall sensor the solid width of its pixel row, and each search looks in the sensor's block and at most one more. s1disasm/collision-blocks
About: Sonic the Hedgehog Hitbox
Codes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/sub FindNearestTile & FindFloor & FindWall.asm#L111-L125FindFloor:
bsr.s FindNearestTile ; a1 = address within 256x256 mappings of 16x16 block being stood on
…
add.w a3,d2
bsr.w FindFloor2 ; try block below the nearest
sub.w a3,d2
addi.w #$10,d1 ; return distance to floors1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub FindNearestTile & FindFloor & FindWall.asm#L150-L153andi.w #$F,d1 ; read only low nybble of X-position (i.e. X-position within 16x16 block)
add.w d0,d1 ; (id * $10) + X-position. = place in heightmap data
lea (CollArray1).l,a2
move.b (a2,d1.w),d0 ; get actual height value from heightmaps1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub FindNearestTile & FindFloor & FindWall.asm#L180-L185.maxfloor:
sub.w a3,d2
bsr.w FindFloor2 ; try block above the nearest
add.w a3,d2
subi.w #$10,d1 ; return distance to floors1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub FindNearestTile & FindFloor & FindWall.asm#L336-L337 — FindWall, reading the rotated array by the sensor's rowlea (CollArray2).l,a2
move.b (a2,d1.w),d0 ; get actual height value from heightmapChecked by claude, 2026-10-22 — read FindFloor, FindFloor2, FindWall and FindWall2 at the pinned commit, and the full block's heights in collide/Collision Array (Normal).binChecked by a second AI model, 2026-10-22.Checked by a second AI model, 2026-11-04.The lab's stages put every column edge and top on one 16 px grid, so each block is blank or full, like the game's block 255 (height 16 in all 16 columns). A distance is the solid edge's row − 1 − the sensor's row (or the same along a row for walls): 0 touching, negative inside. Searching down from a sensor in a blank block, FindFloor tries the block below; if that is blank too, it reports the bottom of that block, 16 to 31 px away. From inside a full block it measures to that block's top, or to the top of the block above if that is full too, and no further. A ceiling search is FindFloor upside down (flip mask $1000, a3 = −$10), a leftward wall search FindWall mirrored ($800). The lab's x grid starts at the stage's gridX.
In the running game, on a 45° ramp built from Green Hill's $E0 ramp block that meets its flat $FF blocks, each ground frame's angle was the nearer floor sensor's block angle, or, when that byte has bit 0 set, his last angle snapped to the nearest quarter turn: $E0 became 0 stepping onto the flat blocks, and angles $1F, $20, $E0, $E1 written on flat ground became 0, $40, 0, 0 a frame later. Placed in the air by RAM writes, landing on the flat blocks with $F0 written gave angle 0; landing on the ramp gave $E0. s1disasm/flat-angle
About: Sonic the Hedgehog Slope physics
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/Sonic AnglePos.asm#L190-L211Sonic_Angle:
move.b (v_anglebuffer2).w,d2 ; use left side angle
cmp.w d0,d1
ble.s .left_nearer ; branch if floor is nearer on left side
move.b (v_anglebuffer).w,d2 ; use right side angle
move.w d0,d1 ; use distance of right side
…
btst #0,d2
bne.s .snap_angle ; branch if bit 0 of angle is set
move.b d2,obAngle(a0) ; update angle
…
.snap_angle:
…s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic Collision.asm#L166-L168 — Sonic_FindSmaller, which gives a landing its anglebtst #0,d3 ; is bit 0 of angle set?
beq.s .no_angle_snap ; if not, branch
move.b d2,d3 ; clear d3 (this is copied to ost_angle)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic Collision.asm#L151 — Sonic_FindFloor's d2, the angle a flagged landing takesmove.b #0,d2s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1558-L1560 — the landing copies the angle into Sonic's.landed:
add.w d1,obY(a0) ; fix Sonic to floor
move.b d3,obAngle(a0) ; update Sonic's angle for the landed-on floors1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub FindNearestTile & FindFloor & FindWall.asm#L133-L134 — each sensor's block angle comes from the angle maplea (AngleMap).l,a2
move.b (a2,d0.w),(a4) ; get collision angle valueChecked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-terrain.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, Green Hill Act 1 with its objects cleared and input written to the joypad bytes each game frame, its row 3 rebuilt from the act's own blocks, chosen by their heights and angles in the pinned collide/ files; on the ramp runs of slope-factors, each ground frame's angle matched the block angle of the nearer floor sensor (from the blocks' heights and Angle Map.bin), snapped from his last angle when its bit 0 is set, including the frames he left the ramp for block 1; angles written on block 1 and two landings poked in the air gave the values stated; read Sonic_Angle and Sonic_FindSmaller at the pinned commitRevised after a check by a second AI model, 2026-10-22.Revised after a check by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the nearer-sensor test, the angle store and the landing's angle copy are quoted.Probe: probes/jump-physics/sonic-terrain.mjsThe angle $20 written on flat ground snaps to $40, a wall's quarter, and that frame's Sonic_SlopeRepel then drops him into the air, as it does on a wall below $280. In collide/Angle Map.bin at the pinned commit the full block (255) and the blocks with flat edges (78, 79, 99, 119, 143, 158) all have $FF. At angle 0 CalcSine gives sine 0, so Sonic_SlopeResistWalk and Sonic_SlopeResistRoll add 0, Sonic_SlopeRepel returns, and Sonic_AngleSpeed turns ground speed into X speed alone. The snap keeps a grounded angle's quarter, which on flat ground is 0; Sonic_FindFloor hands Sonic_FindSmaller a d2 of 0, so a landing on a flagged block sets the angle to 0 outright. The probe stops with an error if the angle ever leaves 0 on a stage.
On a flat floor, after each ground move, the floor-angle routine reads two floor sensors, at his center's X ± his width radius and his center's Y + his height radius (9 and 19 px standing, 7 and 14 curled); the nearer floor counts, and within 14 px either way he snaps to it. s1disasm/floor-sensors
About: Sonic the Hedgehog Hitbox
Codes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/Sonic AnglePos.asm#L45-L51 — angles from `$20` to `$DF` go to the wall and ceiling routines insteadandi.b #$C0,d0 ; read only bits 6-7 of angle
cmpi.b #$40,d0
beq.w Sonic_WalkVertL ; branch if on left verticals1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _Constants.asm#L311-L314sonic_width: equ 18/2 ; Sonic's width
sonic_height: equ 38/2 ; Sonic's height
sonic_roll_width: equ 14/2 ; Sonic's width (rolling)
sonic_roll_height: equ 28/2 ; Sonic's height (rolling)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic AnglePos.asm#L53-L61move.w obY(a0),d2
move.w obX(a0),d3
…
add.w d0,d2 ; d2 = y pos of bottom edge of Sonic
…
add.w d0,d3 ; d3 = x pos of right edge of Sonics1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic AnglePos.asm#L74-L78add.w d0,d2 ; d2 = y pos of bottom edge of Sonic
…
neg.w d0
add.w d0,d3 ; d3 = x pos of left edge of Sonics1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic AnglePos.asm#L84-L105move.w (sp)+,d0 ; d0 = distance to floor right side
bsr.w Sonic_Angle ; update angle
tst.w d1
beq.s .on_floor ; branch if Sonic is 0px from floor
bpl.s .above_floor ; branch if Sonic is above floor
cmpi.w #-$E,d1
blt.s Sonic_BelowFloor ; branch if Sonic is > 14px below floor
add.w d1,obY(a0) ; align to floor
…
cmpi.w #$E,d1
bgt.s .in_air ; branch if Sonic is > 14px above floor
…
…s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic AnglePos.asm#L192-L195cmp.w d0,d1
ble.s .left_nearer ; branch if floor is nearer on left side
move.b (v_anglebuffer).w,d2 ; use right side angle
move.w d0,d1 ; use distance of right sides1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L320-L324bsr.w Sonic_Move ; handle Sonic's left/right movement … jsr (SpeedToPos).l ; update Sonic's position based on his current velocities bsr.w Sonic_AnglePos ; update Sonic's current angle as he walks along the floorChecked by claude, 2026-10-22 — read Sonic_AnglePos, Sonic_Angle and Sonic_MdNormal at the pinned commitRevised after a check by a second AI model, 2026-10-22.Checked by a second AI model, 2026-10-28.The sensors sit at the box's bottom corners (collision-box), and a distance of 0 is standing on the floor (collision-blocks). More than 14 px inside the ground nothing happens (Sonic_BelowFloor returns); more than 14 px above it, he leaves the ground (walk-off). A snap moves whole pixels and keeps Y's subpixel. On the lab's stages, where every top is a whole block, the snap realigns him after a roll jump's landing (roll-jump-size), and a step down of one block, 16 px, is past the 14 px.
In the running game, walking and rolling off steps down built from Green Hill's 9, 10, and 11 px blocks, Sonic stayed on the ground over a 14 px step, his feet dropping 14 px on the frame his trailing floor sensor passed its edge; over a 15 px step he was in the air on that frame, with a Y speed of 0, no jump flag, and still curled if rolling, and the next frame's gravity made his Y speed $38. s1disasm/walk-off
About: Sonic the Hedgehog Coyote time
Value: 14 px
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/Sonic AnglePos.asm#L99-L113.above_floor:
cmpi.w #$E,d1
bgt.s .in_air ; branch if Sonic is > 14px above floor
…
.in_air:
tst.b sticktoconvex(a0)
bne.s .on_disc ; branch if Sonic is on a SBZ disc
bset #status_in_air_bit,obStatus(a0)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L74-L76andi.w #status_in_air|status_rolling,d0 ; limit to "is in air" and "rolling" flags
move.w Sonic_Modes(pc,d0.w),d1 ; use the those as routine counter for the correct mode
jsr Sonic_Modes(pc,d1.w) ; jump to that modes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L114-L116dc.w Sonic_MdJump-Sonic_Modes ; 2 - while in the air and not rolling
dc.w Sonic_MdRoll-Sonic_Modes ; 4 - while on the ground and rolling
dc.w Sonic_MdJump2-Sonic_Modes ; 6 - while in the air and rollings1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L534-L536 — Sonic_AngleSpeed; the sine at angle 0 is 0 (flat-angle)muls.w obInertia(a0),d0 ; multiply sine value by current ground speed
asr.l #8,d0 ; shift result up a byte
move.w d0,obVelY(a0) ; set new Y-velocitys1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1274-L1275tst.b jumping(a0) ; is Sonic airborne specifically from a jump?
beq.s .capyvel ; if not, just cap Y speed normallys1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1237 — the jump routine, the only code in Sonic's object that sets itmove.b #1,jumping(a0) ; set jump flags1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1842 — Sonic_ResetOnFloor, on landingmove.b #0,jumping(a0) ; clear jump flags1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L330-L334Sonic_MdJump: ; While Sonic is in the air but not rolling
…
jsr (ObjectFall).l ; apply gravity and update Sonic's position based on his current velocitiesIn 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. VerifiedChecked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-terrain.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, Green Hill Act 1 with its objects cleared and input written to the joypad bytes each game frame, its row 3 rebuilt from the act's own blocks, chosen by their heights and angles in the pinned collide/ files; a 14 px step (block 12's top on row 967 down to block 14's on 981) and a 15 px one (block 69's on 966 down to 981), each walked off with Right held from 48 px before it and rolled off from 160 px: over the step of this claim's 14 px or less he stayed on the ground and over the larger one he was in the air on that frame and not the one before; read Sonic_AnglePos, Sonic_Control's mode dispatch, Sonic_Modes, Sonic_AngleSpeed, Sonic_MdJump and Sonic_MdJump2 at the pinned commitChecked by a second AI model, 2026-10-22.Checked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the jump flag's only setter and its clear on landing, and the gravity call, are quoted.Probe: probes/jump-physics/sonic-terrain.mjsWhen both floor sensors are more than 14 px above the floor after a ground move, Sonic_AnglePos sets the in-air flag; from the next frame Sonic runs Sonic_MdJump, or Sonic_MdJump2 if he was rolling, from that frame's X speed and a Y speed of 0, without the jump flag. Within 14 px the same routine moves him down onto the lower floor. The nearer of the two sensors counts (floor-sensors), so he stays on the ground until the trailing one is past the edge. Over a pit, or over a floor one block (16 px) lower, the trailing sensor reads 16 px. The flag is set at the end of the frame, so that frame already shows him in the air, and its next press finds an air mode that never calls Sonic_Jump (no-coyote-time). Sonic_MdJump and Sonic_MdJump2 call the same routines; the rolling flag only keeps him curled, with the 14 px height radius, until he lands. Without the jump flag Sonic_JumpHeight has no release cap, and without the roll-jump flag the d-pad steers. His ground speed stays as it was until landing replaces it (landing).
Cited by: Sonic the Hedgehog 2
In the running game, at the end of the probe's flat runway, Sonic first counts as airborne on the frame whose move takes his trailing floor sensor past the ledge. Holding Right from a standstill 48 px before it, that is frame 49, his center 9 px past it; rolling toward it from 160 px, frame 95, his center 8 px past. A press on frame 49 still jumps, and one on any of the next 5 frames doesn't. s1disasm/walk-off-frame
About: Sonic the Hedgehog Coyote time
Value: stand 49 · roll 95 · trailing true · on frame true · late true (frames (roll: 60 frames of Right, Down, then coasting toward a ledge 160 px from the start); onFrame: a press on the walk-off frame itself jumps)
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/Sonic AnglePos.asm#L84-L116 — Sonic_AnglePos's thresholdscmpi.w #$E,d1
bgt.s .in_air ; branch if Sonic is > 14px above floor
…
bset #status_in_air_bit,obStatus(a0)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L317-L372 — the four modes; only the ground modes call Sonic_JumpSonic_MdNormal: ; While Sonic is on the ground and not rolling
bsr.w Sonic_Jump ; check if we need to jumps1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L330-L343 — no jump check in the airSonic_MdJump: ; While Sonic is in the air but not rolling
bsr.w Sonic_JumpHeight ; handle Sonic's jump height based on whether the jump button is still held
bsr.w Sonic_JumpDirection ; handle midair direction adjustments while jumping
bsr.w Sonic_LevelBound ; make sure Sonic stays within level bounds and handle bottomless pits
jsr (ObjectFall).l ; apply gravity and update Sonic's position based on his current velocities
…
bsr.w Sonic_JumpAngle ; steadily return Sonic's angle while jumping to 0
bsr.w Sonic_Floor ; handle collision with level while airborne
rts ; returns1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L359-L372Sonic_MdJump2: ; While Sonic is in the air and rolling (usually, but not limited to, jumping)
bsr.w Sonic_JumpHeight ; handle Sonic's jump height based on whether the jump button is still held
bsr.w Sonic_JumpDirection ; handle midair direction adjustments while jumping
bsr.w Sonic_LevelBound ; make sure Sonic stays within level bounds and handle bottomless pits
jsr (ObjectFall).l ; apply gravity and update Sonic's position based on his current velocities
…
bsr.w Sonic_JumpAngle ; steadily return Sonic's angle while jumping to 0
bsr.w Sonic_Floor ; handle collision with level while airborne
rts ; returnIn 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. Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic AnglePos.asm#L59-L78 — the floor sensors sit a width radius to either side of his centermove.b obWidth(a0),d0
ext.w d0
add.w d0,d3 ; d3 = x pos of right edge of Sonic
…
move.b obWidth(a0),d0
ext.w d0
neg.w d0
add.w d0,d3 ; d3 = x pos of left edge of Sonics1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _Constants.asm#L311-L313sonic_width: equ 18/2 ; Sonic's width
…
sonic_roll_width: equ 14/2 ; Sonic's width (rolling)Checked by claude, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame, its floor ending at x 2048; walking from 48 px before it, airborne on frame 49 with his center 9 px past it (width radius 9); rolling from 160 px (60 frames of Right, Down, coasting), on frame 95, center 8 px past (radius 7). A jump pressed on frame 49 left the ground; one pressed on frames 50 to 54 didn'tChecked by a second AI model, 2026-10-22.Revised after a check by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; both in-air modes' calls (no jump check) and the sensor offsets are quoted.Probe: probes/jump-physics/sonic-mame.mjsA press on the walk-off frame itself still jumps, because Sonic_MdNormal checks for a jump before it moves him. On the walk-off frame his X speed equals his ground speed (588 walking), his Y speed is 0, and the next frame's gravity makes it $38. The trailing sensor sits a width radius behind his center, 9 px standing and 7 rolling, so it passes the ledge once the center is that far past; rolling at speed, the move that takes it past leaves the center at 8.
Cited by: Coyote time
In the running game, on flat ground Sonic's wall sensor sat 10 px ahead of where the frame's X speed would put his center and 8 px below it: standing on Green Hill's 14 px blocks (feet on row 961), its 10 px block ahead (top row 950) stopped him and its 9 px block (top row 951) didn't, and curled on its 9 px blocks (feet on row 966), a full block (top row 960) stopped him and a 14 px one (top row 962) didn't. In the air, after the move, his side sensors sat 10 px to either side of his center. s1disasm/wall-sensors
About: Sonic the Hedgehog Hitbox
Value: 8 px below his center, on flat ground
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/Sonic Collision.asm#L13-L23Sonic_CalcRoomAhead:
move.l obX(a0),d3
move.l obY(a0),d2
move.w obVelX(a0),d1
…
add.l d1,d3 ; d3 = predicted x pos. at next frame
…
add.l d1,d2 ; d2 = predicted y pos. at next frames1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic Collision.asm#L57-L59andi.b #$38,d1
bne.s .find_wall_lr
addq.w #8,d2s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _Constants.asm#L318sonic_quick_size: equ 20/2 ; Sonic's size (quick terrain find)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic Collision.asm#L298-L299Sonic_FindWallRight_Quick:
addi.w #sonic_quick_size,d3s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic Collision.asm#L553-L555 — the eori flips the X within its block for the leftward searchSonic_FindWallLeft_Quick:
subi.w #sonic_quick_size,d3
eori.w #$F,d3s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic Collision.asm#L293-L295 — the air checks start from his current position, at his center's heightSonic_FindWallRight_Quick_UsePos:
move.w obY(a0),d2
move.w obX(a0),d3s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic Collision.asm#L548-L550Sonic_FindWallLeft_Quick_UsePos:
move.w obY(a0),d2
move.w obX(a0),d3s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L330-L342 — the move comes before the air checksSonic_MdJump: ; While Sonic is in the air but not rolling
…
jsr (ObjectFall).l ; apply gravity and update Sonic's position based on his current velocities
…
bsr.w Sonic_Floor ; handle collision with level while airbornes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L359-L371Sonic_MdJump2: ; While Sonic is in the air and rolling (usually, but not limited to, jumping)
…
jsr (ObjectFall).l ; apply gravity and update Sonic's position based on his current velocities
…
bsr.w Sonic_Floor ; handle collision with level while airborneIn the running game, with Sonic's position, speeds, and size written into RAM in the air beside walls of Green Hill's full blocks and one frame played, a wall at a side sensor pushed Sonic out by whole pixels, his center 11 px from its face, and set his X speed to 0; moving mostly down or up he was pushed by a wall on either side, moving mostly left or right only by one on that side, and that push ended the frame's checks: with his feet 3 px into the floor he stayed in the air beside the wall and landed away from it. Verified — the air checks call the searches aboves1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L554-L565 — Sonic_WallSpeedAdjust, the end of Sonic_Move and Sonic_RollSpeedmove.b #$40,d1 ; get angle rotation for wall collision detection
tst.w obInertia(a0) ; is Sonic standing still?
beq.s .return ; if yes, branch
…
bsr.w Sonic_CalcRoomAhead ; calculate distance to the wall in front of Sonic (if any)Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-terrain.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, Green Hill Act 1 with its objects cleared and input written to the joypad bytes each game frame, its row 3 rebuilt from the act's own blocks, chosen by their heights and angles in the pinned collide/ files; every ground frame of four runs into single blocks of 10, 9, 16, and 14 px (blocks 69, 12, 1, 243) on floors of 14 and 9 px blocks matched a frame model with the sensor this claim's 8 px below his center and collision-box's 10 px ahead, stopping at the 10 and 16 px blocks and climbing the others; the air pokes of air-wall stopped his center 11 px from each wall's face; read Sonic_WallSpeedAdjust, Sonic_CalcRoomAhead and the quick wall searches at the pinned commitRevised after a check by a second AI model, 2026-10-22.Checked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the air searches and the mode order are quoted, and a dropped line restored.Probe: probes/jump-physics/sonic-terrain.mjsThe standing case pins the row: 942 + 8 = 950 is the 10 px block's top row and above the 9 px block's. The curled case fits 952 + 8 = 960 and rules out 962. The 8 px drop applies when the wall's angle has no bits in $38, as on flat ground. On the ground only the side he moves toward is checked, from this frame's X speed before the move. Standing, 8 px below his center is 11 px above his feet; curled, 6 px; so a column one block (16 px) higher is a wall either way. The FixBugs build moves the point up 5 px while rolling (L60-L65). In the air, Sonic_Floor's direction decides which sides are checked (air-quadrant, air-wall).
In the running game, walking and rolling into walls of Green Hill's full blocks on flat ground, in 44 runs at speeds up to $A00 (10 of them coasting from $A00 written into his ground speed), a wall at the sensor ahead cut Sonic's X speed by the sensor's depth in whole pixels, 1 to 10 px, so that frame's move stopped the sensor 1 px short of the wall, his center 11 px from its face, and it set his ground speed to 0. s1disasm/ground-wall
About: Sonic the Hedgehog Hitbox
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L567-L579tst.w d1 ; has Sonic touched a wall?
bpl.s .return ; if not, branch
asl.w #8,d1 ; convert diff to wall into 8.8 fixed point for adjusting velocity
addi.b #$20,d0 ; rotate angle by 45 degrees clockwise
andi.b #$C0,d0 ; snap angle to nearest multiple of 90 degrees
beq.s .hitdown ; if Sonic is facing down, branch
…
.hitright: ; d0 is $C0, Sonic is facing right
add.w d1,obVelX(a0) ; adjust X-velocity to prevent Sonic from walking into the walls1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L591-L593else
bset #status_pushing_bit,obStatus(a0) ; set pushing flag
move.w #0,obInertia(a0) ; clear ground speeds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L605-L606.hitleft: ; d0 is $40, Sonic is facing left
sub.w d1,obVelX(a0) ; adjust X-velocity to prevent Sonic from walking into the walls1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L875 — the end of Sonic_RollSpeed, so a roll runs the same checkbra.w Sonic_WallSpeedAdjust ; adjust speed variations depending on current angle, or stop at wallChecked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-terrain.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, Green Hill Act 1 with its objects cleared and input written to the joypad bytes each game frame, its row 3 rebuilt from the act's own blocks, chosen by their heights and angles in the pinned collide/ files; walls of block 1 (angle $FF) with faces at x 1024 and 511 on a floor of it, Sonic walking into each from 16 distances, coasting into the right one from 10 with $A00 written into his ground speed, and rolling into each: every ground frame matched the flat rules with the cut, and on each run's first cut his X speed, X move, and center pixel were as stated; read Sonic_WallSpeedAdjust and its callers, Sonic_Move and Sonic_RollSpeed (L875), at the pinned commitRevised after a check by a second AI model, 2026-10-22.Revised after a check by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quote; the roll routine's wall check is quoted.Probe: probes/jump-physics/sonic-terrain.mjsOn flat ground the angle ahead is $C0 moving right and $40 moving left, the two cases that cut X speed; on slopes and in loops the same check can adjust Y speed instead. The FixBugs build sets the pushing flag only when he faces the wall (L580-L590). His center stops 11 px from the wall's face, so the last pixel column of his box (collision-box) is 2 px short of it. Held against the wall, his ground speed grows by the acceleration each frame until the predicted position reaches the wall's pixel and the cut zeroes it again, so his X creeps by subpixels. Sonic_Roll runs after the check, so he can't curl into a wall; a roll into one leaves him curled at ground speed 0 for a frame, and the next frame stands him up.
In the running game, Sonic in the air counted as moving mostly down or up by his speeds after gravity: falling rightward or rising leftward once his Y speed was at least 250/256 of his X speed, and falling leftward or rising rightward only once his X speed was under 250/256 of his Y speed. Placed beside a wall of Green Hill's full blocks on the side away from his X motion, which only the down and up checks reach, he was pushed at those Y speeds and not at 1 less, all four ways. s1disasm/air-quadrant
About: Sonic the Hedgehog Hitbox
Value: 250 /256, the ratio of the smaller speed to the larger at which Angle_Data reaches `$20`
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1485-L1504move.w obVelX(a0),d1 ; get current horizontal speed
move.w obVelY(a0),d2 ; get current vertical speed
jsr (CalcAngle).l ; calculate arctan based on Sonic's current fall direction
…
cmpi.b #$40,d0 ; is main movement direction to the left?
beq.w Sonic_FloorLeft ; if yes, branch
cmpi.b #$80,d0 ; is main movement direction upward?
beq.w Sonic_FloorUp ; if yes, branch
cmpi.b #$C0,d0 ; is main movement direction to the right?
beq.w Sonic_FloorRight ; if yes, branchs1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1493-L1495subi.b #$20,d0 ; rotate 45 degrees counterclockwise
move.b d0,(v_unused4).w ; (unused) store -45 degrees angle
andi.b #$C0,d0 ; snap to nearest multiple of 90 degreess1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub CalcAngle.asm#L31-L46cmp.w d3,d4 ; find out which one has a larger distance
bhs.w .yIsBigger ; if Y has a larger distance, branch
…
lsl.l #8,d4 ; multiply Y by 100 (creating fraction space)
divu.w d3,d4 ; divide by X distance
…
moveq #$40,d0 ; prepare 90 degree angles1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub CalcAngle.asm#L92-L93 — Angle_Data's last 17 entries, 240–256dc.b $1F,$1F,$1F,$1F,$1F,$1F,$1F,$1F,$1F,$1F,$20,$20,$20,$20,$20,$20 dc.b $20s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L330-L342 — gravity is added before the direction check reads the speedsSonic_MdJump: ; While Sonic is in the air but not rolling
…
jsr (ObjectFall).l ; apply gravity and update Sonic's position based on his current velocities
…
bsr.w Sonic_Floor ; handle collision with level while airbornes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L359-L371Sonic_MdJump2: ; While Sonic is in the air and rolling (usually, but not limited to, jumping)
…
jsr (ObjectFall).l ; apply gravity and update Sonic's position based on his current velocities
…
bsr.w Sonic_Floor ; handle collision with level while airborneChecked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-terrain.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, Green Hill Act 1 with its objects cleared and input written to the joypad bytes each game frame, its row 3 rebuilt from the act's own blocks, chosen by their heights and angles in the pinned collide/ files; eight one-frame RAM pokes of Sonic's position and speeds in the air beside walls of block 1, with Y speeds after gravity of 1000 and 999 falling right at X speed 1024, 1025 and 1024 falling left at −1000, −1049 and −1048 rising right at 1024, and −977 and −976 rising left at −1000, each pushed by the far wall exactly at the first of each pair; read Sonic_Floor, CalcAngle and Angle_Data at the pinned commitChecked by a second AI model, 2026-10-22.Revised after a check by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the mode order, gravity before the direction check, is quoted.Probe: probes/jump-physics/sonic-terrain.mjsCorrected 2026-10-25: the statement said he counts as moving mostly down once his Y speed is about 250/256 of his X speed, which holds falling rightward only; falling leftward he needs a Y speed about 256/250 of his X speed, as the probe measured and CalcAngle's mirroring gives. Each frame Sonic_Floor checks one direction, CalcAngle's angle less $20 snapped to a quarter turn. Y is positive down. Within a quarter, the angle is $20 once the smaller speed is 250/256 of the larger, and below it otherwise. At exactly $20 the four cases split: falling rightward checks down, falling leftward left, rising rightward right, rising leftward up. With both speeds 0 he counts as falling (CA_NullAngle, $40). Running off a ledge, his first frames in the air check only the side he moves toward, until his Y speed catches up with his X speed.
In the running game, with Sonic's position, speeds, and size written into RAM in the air beside walls of Green Hill's full blocks and one frame played, a wall at a side sensor pushed Sonic out by whole pixels, his center 11 px from its face, and set his X speed to 0; moving mostly down or up he was pushed by a wall on either side, moving mostly left or right only by one on that side, and that push ended the frame's checks: with his feet 3 px into the floor he stayed in the air beside the wall and landed away from it. s1disasm/air-wall
About: Sonic the Hedgehog Hitbox
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1511-L1524Sonic_FloorDown:
bsr.w Sonic_FindWallLeft_Quick_UsePos ; check Sonic's distance to nearest left wall
tst.w d1 ; is Sonic grazing a wall to the left while falling?
bpl.s .noleftgraze ; if not, branch
sub.w d1,obX(a0) ; align Sonic with the wall
move.w #0,obVelX(a0) ; clear horizontal speed
…
bsr.w Sonic_FindWallRight_Quick_UsePos ; check Sonic's distance to nearest right wall
…
add.w d1,obX(a0) ; align Sonic with the walls1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1625-L1632Sonic_FloorLeft:
bsr.w Sonic_FindWallLeft_Quick_UsePos ; check Sonic's distance to nearest left wall
…
sub.w d1,obX(a0) ; align Sonic to the wall
move.w #0,obVelX(a0) ; clear horizontal speed
move.w obVelY(a0),obInertia(a0) ; convert in-air vertical speed to ground speed when landing
rts ; returns1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1747-L1753bsr.w Sonic_FindWallRight_Quick_UsePos ; check Sonic's distance to nearest right wall
…
add.w d1,obX(a0) ; align Sonic to the wall
move.w #0,obVelX(a0) ; clear horizontal speed
move.w obVelY(a0),obInertia(a0) ; convert in-air vertical speed to ground speed when landing
rts ; returnChecked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-terrain.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, Green Hill Act 1 with its objects cleared and input written to the joypad bytes each game frame, its row 3 rebuilt from the act's own blocks, chosen by their heights and angles in the pinned collide/ files; Sonic written into the air (RAM pokes) 4 px into a wall of block 1 after the frame's move, moving mostly down, up, left, and right, with the wall on either side, and the eight air-quadrant pokes: x, X speed, and airborne after one frame matched a push to 11 px from the face (subpixel kept) exactly when the direction's check covers that side; moving sideways into the wall his ground speed took his Y speed; read Sonic_FloorDown, Sonic_FloorLeft, Sonic_FloorUp and Sonic_FloorRight at the pinned commitChecked by a second AI model, 2026-10-22.Revised after a check by a second AI model, 2026-10-25.Checked by a second AI model, 2026-11-04.Probe: probes/jump-physics/sonic-terrain.mjsThe side sensors are at his center's height, 10 px out (wall-sensors), so the push leaves his center 11 px from the wall's face, and a column whose top is below his center doesn't stop him sideways: his floor sensors meet it instead (landing-depth). After a sideways wall he can't land that frame; the ground speed copied from his Y speed is replaced when he lands (landing).
In the running game, written into the air above Green Hill's blocks, Sonic falling mostly down landed when a floor sensor was inside the ground unless both were deeper than his Y speed in whole pixels plus 8, and moved up by the deeper one's depth: at Y speed $100 he landed 9 px deep and not 10, at $500 13 and not 14, and with one sensor over a pit, or on a block 5 px lower, 12 px deep. Moving mostly sideways and not rising, he landed 19 px deep, and not 20, where his center's row is in the floor; rising, he didn't land. s1disasm/landing-depth
About: Sonic the Hedgehog Jump
Value: 8 px
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1528-L1559bsr.w Sonic_FindFloor ; find distance between Sonic and floor
…
tst.w d1 ; has Sonic touched the floor again?
…
move.b obVelY(a0),d2 ; get Sonic's fall speed at the time of impact (upper byte only, pixel delta)
addq.b #8,d2 ; increase it by one tile
neg.b d2 ; mirror it
cmp.b d2,d1 ; is result bigger than distance to floor?
bge.s .landed ; if yes, branch
cmp.b d2,d0 ; is result bigger than distance to floor? (sloped variant)
blt.s .return ; if not, branch
…
…s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1652-L1679 — Sonic_FloorLeft; the depth check between is inside `if FixBugs`tst.w obVelY(a0) ; is Sonic going up? bmi.s .return ; if yes, branch bsr.w Sonic_FindFloor ; find Sonic's distance to floor tst.w d1 ; has Sonic touched the floor? bpl.s .return ; if not, branch … add.w d1,obY(a0) ; align Sonic with floors1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1773-L1794 — Sonic_FloorRight, the sametst.w obVelY(a0) ; is Sonic going up?
bmi.s .return ; if yes, branch
bsr.w Sonic_FindFloor ; find Sonic's distance to floor
tst.w d1 ; has Sonic touched the floor?
bpl.s .return ; if not, branch
if FixBugs
…
endif
add.w d1,obY(a0) ; align Sonic with floorIn the running game, with Sonic's position, speeds, and size written into RAM in the air beside walls of Green Hill's full blocks and one frame played, a wall at a side sensor pushed Sonic out by whole pixels, his center 11 px from its face, and set his X speed to 0; moving mostly down or up he was pushed by a wall on either side, moving mostly left or right only by one on that side, and that push ended the frame's checks: with his feet 3 px into the floor he stayed in the air beside the wall and landed away from it. Verified — the side sensor's wall ends the frame's checks before the floor'sIn the running game, on flat ground Sonic's wall sensor sat 10 px ahead of where the frame's X speed would put his center and 8 px below it: standing on Green Hill's 14 px blocks (feet on row 961), its 10 px block ahead (top row 950) stopped him and its 9 px block (top row 951) didn't, and curled on its 9 px blocks (feet on row 966), a full block (top row 960) stopped him and a 14 px one (top row 962) didn't. In the air, after the move, his side sensors sat 10 px to either side of his center. Verified — the side sensors sit at his center's heightChecked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-terrain.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, Green Hill Act 1 with its objects cleared and input written to the joypad bytes each game frame, its row 3 rebuilt from the act's own blocks, chosen by their heights and angles in the pinned collide/ files; twelve one-frame pokes in the air over a floor of block 1, its edge over a pit, and its edge beside block 14 (11 px), with Y speeds after gravity of $100 and $500 and depths after the move at and past the limit, and moving sideways at $800 either way: landed and feet after the frame matched this claim's 8 px rule, with the sideways floor check behind the side sensors at his center's row; read Sonic_FloorDown, Sonic_FloorLeft and Sonic_FloorRight with FixBugs = 0 at the pinned commitChecked by a second AI model, 2026-10-22.Checked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the rising test and the sideways-right path are quoted.Probe: probes/jump-physics/sonic-terrain.mjsCorrected 2026-10-25: the statement said any depth lands him moving sideways; 20 px deep his center's row is in the floor, the side sensor there meets it as a wall, and the wall ends the frame's checks before the floor's (air-wall). d1 is the nearer floor of the two sensors (the more negative distance), d0 the other one's (Sonic_FindSmaller); the bytes compare signed, so a sensor over a pit, with a positive distance, always lets him land. The FixBugs build adds the check to the sideways cases and skips it on fully solid floors (L1537-L1547). Ground rules start on the next frame (landing).
In the running game, under Green Hill's full blocks, in one standing jump and in one-frame cases whose position and speeds the probe wrote into RAM, Sonic's head sensors met a ceiling only while he moved mostly up or mostly sideways: inside one, he moved down by the depth, his head sensors to the row below it. Moving mostly up, his Y speed became 0 under a flat block, and under its full $A0 block he landed on the ceiling, taking its angle and a ground speed from his Y speed. Moving sideways, his Y speed became 0 if he was rising and stayed if he was falling, and with his feet in the floor he didn't land that frame. Moving mostly down with his head in a block, he wasn't moved. s1disasm/air-ceiling
About: Sonic the Hedgehog Hitbox
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1714-L1722 — Sonic_FloorUp, after both quick wall checks (L1697-L1711)bsr.w Sonic_FindCeiling ; find Sonic's distance to the ceiling
tst.w d1 ; is Sonic touching the ceiling?
bpl.s .return ; if not, branch
sub.w d1,obY(a0) ; align Sonic with the ceiling
…
andi.b #$40,d0 ; are we bumping against an angled ceiling?
bne.s .angledceiling ; if yes, branch
move.w #0,obVelY(a0) ; clear vertical speed when bumping against a flat ceilings1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1727-L1733.angledceiling:
move.b d3,obAngle(a0) ; update Sonic's angle for the landed-on floor
bsr.w Sonic_ResetOnFloor ; reset various flags and states back to standing state
move.w obVelY(a0),obInertia(a0) ; convert in-air vertical speed to ground speed when landing
tst.b d3 ; is slope (when viewed left-to-right in game) ascending?
bpl.s .return ; if not, branch
neg.w obInertia(a0) ; negate converted ground speed for ascending slopess1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1637-L1643 — Sonic_FloorLeft after its wall check; Sonic_FloorRight has the same at L1758-L1764, and both return after itbsr.w Sonic_FindCeiling ; check if Sonic's distance to the ceiling
tst.w d1 ; is Sonic touching the ceiling?
bpl.s .noceiling ; if not, branch
sub.w d1,obY(a0) ; align Sonic with the ceiling
tst.w obVelY(a0) ; is vertical speed positive? (going down)
bpl.s .noyspeedreset ; if yes, branch
move.w #0,obVelY(a0) ; if going up, reset it to zeros1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic Collision.asm#L400-L401 — the end of Sonic_FindCeiling; a ceiling angle with bit 0 set becomes `$80` (flat-angle)move.b #$80,d2
bra.w Sonic_FindSmaller ; make d1 the smaller distances1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1511-L1534 — moving mostly down, the walls and the floor are searched, and no ceilingSonic_FloorDown:
bsr.w Sonic_FindWallLeft_Quick_UsePos ; check Sonic's distance to nearest left wall
…
bsr.w Sonic_FindWallRight_Quick_UsePos ; check Sonic's distance to nearest right wall
…
bsr.w Sonic_FindFloor ; find distance between Sonic and floor
…
tst.w d1 ; has Sonic touched the floor again?
if FixBugs=0
bpl.s .return ; if not, branchChecked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-terrain.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, Green Hill Act 1 with its objects cleared and input written to the joypad bytes each game frame, its row 3 rebuilt from the act's own blocks, chosen by their heights and angles in the pinned collide/ files; a standing jump under a row of block 1 48 px above the floor, and one-frame pokes in the air (RAM writes of position and speeds): moving up into block 1 and into block 395 (angle $A0), moving mostly right and mostly left while rising into block 1, and mostly right and mostly left while falling into it with the feet in the floor (and the rightward falling poke with no ceiling, which landed), and moving mostly down with the head inside block 1; the head row, Y speed, airborne, angle, and ground speed after the frame were as stated; read Sonic_FloorUp, Sonic_FloorLeft, Sonic_FloorRight, Sonic_FindCeiling and Sonic_FindSmaller at the pinned commitChecked by a second AI model, 2026-10-22.Revised after a check by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the ground-speed copy and the downward routine's lack of a ceiling search are quoted.Probe: probes/jump-physics/sonic-terrain.mjsY is positive down, so sub.w d1,obY with a negative distance moves him down, by whole pixels, keeping the fraction. The head sensors are his center's X ± his width radius, his height radius above his center (jump-headroom); d1 is the deeper of the two (Sonic_FindSmaller). Moving mostly down there is no ceiling check at all (air-quadrant), and moving sideways a wall on that side ends the frame first (air-wall). The steep case takes the ceiling's angle and turns his Y speed into ground speed, which is how he runs onto a ceiling that curves into a wall. The lab's blocks are flat: their angle byte $FF has bit 0 set, so Sonic_FindSmaller hands back $80, $80 + $20 has no $40 bit, and every bump is a flat one; the game's $A0 block keeps its angle, and $A0 + $20 has the $40 bit, a steep ceiling. The probe's word-level simulation of these routines agrees with the lab's model on stages with blocks (stage-rule).
In the running game, walking and rolling under rows of Green Hill's full blocks 16 and 32 px above the floor, Sonic stayed on the ground with his feet on row 959 and part of himself inside the blocks, and every frame's ground speed matched the flat-ground model. s1disasm/ground-no-ceiling
About: Sonic the Hedgehog Hitbox
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L317-L325Sonic_MdNormal: ; While Sonic is on the ground and not rolling
bsr.w Sonic_Jump ; check if we need to jump
…
bsr.w Sonic_Move ; handle Sonic's left/right movement
bsr.w Sonic_Roll ; check if we need to roll
…
bsr.w Sonic_AnglePos ; update Sonic's current angle as he walks along the floors1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L347-L354Sonic_MdRoll: ; While Sonic is on the ground and rolling
bsr.w Sonic_Jump ; check if we need to jump
…
bsr.w Sonic_RollSpeed ; update speed as Sonic rolls
…
bsr.w Sonic_AnglePos ; update Sonic's current angle as he walks along the floors1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic Collision.asm#L94 — Sonic_CalcHeadroom, from Sonic_Jump (jump-headroom)beq.w Sonic_FindCeiling ; ceiling is directly aboves1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1637 — Sonic_FloorLeft, in the air; Sonic_FloorUp at L1714 and Sonic_FloorRight at L1758 are the other two air calls (air-ceiling)bsr.w Sonic_FindCeiling ; check if Sonic's distance to the ceilings1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic Collision.asm#L57-L59 — Sonic_CalcRoomAhead's wall sensor, 8 px below his center on flat ground (wall-sensors)andi.b #$38,d1
bne.s .find_wall_lr
addq.w #8,d2s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _Constants.asm#L312-L314sonic_height: equ 38/2 ; Sonic's height
…
sonic_roll_height: equ 28/2 ; Sonic's height (rolling)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1031-L1038 — a grounded ceiling check that nothing callsSonic_SquashUnused:
…
bsr.w Sonic_FindCeiling ; find Sonic's distance to the ceiling
tst.w d1 ; is he below it?
bpl.s .return ; if yes, branch (this should always happen unless he clipped through)Checked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-terrain.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, Green Hill Act 1 with its objects cleared and input written to the joypad bytes each game frame, its row 3 rebuilt from the act's own blocks, chosen by their heights and angles in the pinned collide/ files; walking under a row of block 1 16 px up (rows 928-943) and one 32 px up (912-927), and rolling under the first: every frame on the ground at feet 959, ground speed and rolling as the flat model, and his box overlapped the blocks on 22 frames walking and 51 rolling under the first, 13 under the second; searched the pinned disassembly for calls to Sonic_FindCeiling and Sonic_SquashUnused (Sonic_FindCeiling from Sonic_CalcHeadroom L94, Sonic_FloorLeft, Sonic_FloorUp, Sonic_FloorRight L1637, L1714, L1758, and Sonic_SquashUnused L1036; Sonic_SquashUnused from nowhere), and read Sonic_MdNormal, Sonic_MdRoll, Sonic_CalcRoomAhead and the size equatesRevised after a check by a second AI model, 2026-10-22.Checked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-11-04.Probe: probes/jump-physics/sonic-terrain.mjsOn the ground the only ceiling check that runs is the jump's headroom check; Sonic_SquashUnused, which would stop him under a ceiling, is never called. The ground modes' collision is the jump's headroom check, the wall sensor ahead (wall-sensors), 19 − 8 = 11 px above his feet standing and 14 − 8 = 6 px curled, and the two floor sensors (floor-sensors). The other ceiling search, Sonic_FindCeiling_Quick, runs from Sonic_CalcRoomAhead only when the rotated angle points up (L56), which it doesn't on flat ground. Sonic_SquashUnused, which would stop him dead when his head is inside a ceiling on the ground, has no caller. Sonic 1's levels don't put a ceiling that low over a floor; the probe built one: under a block 32 px up his top 7 px are inside it, and a block from 16 to 32 px up sits wholly inside him, below his head sensors. Leaving the ground under one, the air checks find it (air-ceiling, air-wall).
Standing on flat ground, not on an object, with ground speed 0 after the left and right steps (before friction) and the floor under his center 12 px or more below his feet, Sonic turns to face right if last frame's right floor sensor met no block, or else left if the left one met none, and plays his balancing animation. s1disasm/balance
About: Sonic the Hedgehog Hitbox
Value: 12 px
Codes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L402-L412move.b obAngle(a0),d0 ; get Sonic's current angle
addi.b #$20,d0 ; rotate it 45 degrees clockwise
andi.b #$C0,d0 ; snap to nearest multiple of 90 degrees
bne.w Sonic_ResetScr ; is Sonic on a slope? if yes, branch
tst.w obInertia(a0) ; is Sonic standing still?
bne.w Sonic_ResetScr ; if not, branch
…
btst #status_on_object_bit,obStatus(a0) ; is Sonic standing on a platform object?
beq.s .chkbalance ; if not, branchOur readingangle not near flat: Sonic_ResetScr402–405inertia not 0: Sonic_ResetScr407–408clear pushing, standing animation (not quoted)409–410not on an object: .chkbalance411–412s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L437-L457.chkbalance:
jsr (ObjFloorDist).l ; get distance of Sonic to nearest floor
cmpi.w #12,d1 ; is he within 12px to floor?
blt.s Sonic_LookUp ; if yes, don't do balance animation (would look awkward)
cmpi.b #3,angleright(a0) ; is Sonic at the right edge of the floor?
…
bclr #status_xflip_bit,obStatus(a0) ; clear X-flip flag (make Sonic face right)
…
cmpi.b #3,angleleft(a0) ; is Sonic at the left edge of the floor?
…
bset #status_xflip_bit,obStatus(a0) ; set X-flip flag (make Sonic face left)Our readingfloor less than 12 px below: Sonic_LookUp, no balance438–440right sensor's angle not 3: .chkleftedge (not quoted)441–442.rightbalance: face right446 then balance (not quoted)447.chkleftedge: left sensor's angle not 3: Sonic_LookUp (not quoted)452–453.leftbalance: face left457s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic AnglePos.asm#L17-L19moveq #3,d0
move.b d0,(v_anglebuffer).w
move.b d0,(v_anglebuffer2).wOur readingboth angle buffers ← 317–19s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L83-L84move.b (v_anglebuffer).w,angleright(a0) ; update front collision hot spot
move.b (v_anglebuffer2).w,angleleft(a0) ; update rear collision hot spotOur readingangleright ← angle buffer, angleleft ← buffer 283–84Checked by claude, 2026-10-22 — read Sonic_Move's balance check, ObjFloorDist, Sonic_AnglePos and Sonic_Control at the pinned commitRevised after a check by a second AI model, 2026-10-22.Checked by a second AI model, 2026-10-28.Sonic_AnglePos sets both angle buffers to 3 before its search, and FindFloor overwrites one with a block's angle as soon as it meets a non-blank block (collision-blocks), so 3 means that sensor found no block in its own block or the one below. Sonic_Control copies the buffers after the frame's mode. A jump leaves $80 in both (Sonic_CalcHeadroom), and the air checks write $FF where they meet blocks, so the first standing frame after a landing reads what the landing frame left. ObjFloorDist measures down from his center's X at his feet's row. The check sits in Sonic_Move after the left and right steps and before friction (Sonic_CheckDpadLetGo), so a frame whose friction stops him doesn't balance yet, and a braking step that lands exactly on 0 does.
Cited by: Sonic the Hedgehog 2
In the running game, a jump press went through only when Sonic's head sensors had 6 or more clear pixel rows above them, under Green Hill's full blocks and its 4 px slab on floors of its 9 to 16 px blocks: gaps of 6, 7, and 9 rows jumped, and 5, 3, and less didn't, standing and curled. A block 48 px above his floor left him 9 standing; one 32 px up refused him standing (his head 7 px inside it) and curled (3 px above his head). A refused press ran the rest of the ground frame. s1disasm/jump-headroom
About: Sonic the Hedgehog Jump
Value: 6 px
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1211-L1216move.b obAngle(a0),d0 ; get Sonic's current angle
addi.b #$80,d0 ; rotate 180 degrees for ceiling collision check
bsr.w Sonic_CalcHeadroom ; calculate pixels above Sonic's head
cmpi.w #6,d1 ; are there less than 6px between Sonic and the ceiling?
blt.w .return ; if yes, prevent jumpings1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic Collision.asm#L359-L366Sonic_FindCeiling:
move.w obY(a0),d2
move.w obX(a0),d3
…
sub.w d0,d2 ; d2 = y pos. of Sonic's top edge
eori.w #$F,d2s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _Constants.asm#L311-L314 — the radii; the head sensors are sonic_height (19) or sonic_roll_height (14) above his centersonic_width: equ 18/2 ; Sonic's width
sonic_height: equ 38/2 ; Sonic's height
sonic_roll_width: equ 14/2 ; Sonic's width (rolling)
sonic_roll_height: equ 28/2 ; Sonic's height (rolling)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub FindNearestTile & FindFloor & FindWall.asm#L120-L124 — FindFloor from a blank block; for a ceiling `a3` is −`$10`, so the next block is the one above.isblank:
add.w a3,d2
bsr.w FindFloor2 ; try block below the nearest
sub.w a3,d2
addi.w #$10,d1 ; return distance to floors1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub FindNearestTile & FindFloor & FindWall.asm#L180-L184 — from inside a full block, the distance to the edge of the block behind it, less 16.maxfloor:
sub.w a3,d2
bsr.w FindFloor2 ; try block above the nearest
add.w a3,d2
subi.w #$10,d1 ; return distance to floors1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub FindNearestTile & FindFloor & FindWall.asm#L205-L209 — FindFloor2 on a blank block, 15 less the row's low nybble, which the `eori.w.isblank2:
move.w #$F,d1
move.w d2,d0
andi.w #$F,d0
sub.w d0,d1s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub FindNearestTile & FindFloor & FindWall.asm#L152-L178 — a partial block such as the slab, measured from its heightmap columnlea (CollArray1).l,a2
move.b (a2,d1.w),d0 ; get actual height value from heightmap
…
tst.w d0
beq.s .isblank ; branch if height is 0
bmi.s .negfloor ; branch if height is negative
cmpi.b #$10,d0
beq.s .maxfloor ; branch if height is $10 (max)
move.w d2,d1 ; get Y-position of object
andi.w #$F,d1 ; read only low nybble for Y-position within 16x16 block
add.w d1,d0
move.w #$F,d1
…s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1256-L1258 — a refused press returns to the ground mode.return:
rts ; returns1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L317-L324 — the rest of the ground frame runs after the jump check; the rolling mode does the same (L347-L353)Sonic_MdNormal: ; While Sonic is on the ground and not rolling
bsr.w Sonic_Jump ; check if we need to jump
bsr.w Sonic_SlopeResistWalk ; handle resistance from running up slopes
bsr.w Sonic_Move ; handle Sonic's left/right movement
bsr.w Sonic_Roll ; check if we need to roll
bsr.w Sonic_LevelBound ; make sure Sonic stays within level bounds and handle bottomless pits
jsr (SpeedToPos).l ; update Sonic's position based on his current velocities
bsr.w Sonic_AnglePos ; update Sonic's current angle as he walks along the floorChecked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-terrain.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, Green Hill Act 1 with its objects cleared and input written to the joypad bytes each game frame, its row 3 rebuilt from the act's own blocks, chosen by their heights and angles in the pinned collide/ files; nine presses under rows of block 1 48, 32, and 16 px above floors of block 1, and under block 87 (a 4 px slab hanging from its top) over floors of blocks 12, 69, and 243 (9, 10, 14 px), standing and rolling: each jumped exactly when the gap from the head sensors' row to the ceiling's bottom row, from the blocks' heights, was this claim's 6 or more (gaps 9, 7, 6 jumped; 5, 5, 3, −7, −13 didn't, and with no ceiling within 48 px above his head sensors he jumped), and each refused press left him on the ground with Y speed 0 and the ground model's speed; read Sonic_Jump, Sonic_CalcHeadroom, Sonic_FindCeiling, the size equates, and FindFloor and FindFloor2 at the pinned commitChecked by a second AI model, 2026-10-22.Revised after a check by a second AI model, 2026-10-22.Revised after a check by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the heightmap lines and the refused press's return are quoted.Probe: probes/jump-physics/sonic-terrain.mjsThe head sensors sit at his center's X ± his width radius, his height radius above his center: standing, 38 px above his feet (2 × 19); curled, 28 px (2 × 14). The eori.w #$F flips the row within its block, so the blank-block result, 15 less the flipped row, is the sensor's row within the block: a distance counts the clear pixel rows between the sensor and the ceiling's bottom row, 0 touching, negative inside. With his feet on row 0, the head sensor on row 38 (standing) or 28 (curled) and a block's bottom row at b, the distance is b − 39 or b − 29: 9 for b = 48, −7 and 3 for b = 32. A blank sensor block over a blank block reads 16 to 31, enough to jump. A refused press falls through to the rest of the ground mode, so he runs or rolls on as if it hadn't come. The search looks in the sensor's block and the one above, so a block that ends below his head sensors isn't seen: standing under a block from 16 to 32 px up, which he walks into (ground-no-ceiling), he jumps, and curled, with his head sensors inside it, he can't. Corrected 2026-10-22: the statement said a refusal needed his head inside a column, which stopped being true when the lab's stages got floating blocks.
Sonic dies once his Y position is more than 224 px below the level's bottom boundary, except past X $2000 in Scrap Brain Zone act 2, where it ends the act and loads act 3. In Green Hill Act 1, run in MAME, every one of 18 falls into a pit killed him on the first frame after his center passed the boundary plus 224 px; the Scrap Brain exception is read in the code only. s1disasm/bottom-boundary
About: Sonic the Hedgehog Fall damage
Value: 224 px
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L1083-L1097.chkbottom:
move.w (v_limitbtm2).w,d0 ; load current target bottom level boundary
…
addi.w #224,d0 ; add screen height
cmp.w obY(a0),d0 ; has Sonic touched the bottom boundary?
blt.s .bottom ; if yes, branchs1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1110-L1113cmpi.w #id_SBZ_act2,(v_zone_act).w ; is level SBZ2?
bne.w KillSonic ; if not, kill Sonic
cmpi.w #$2000,(v_player+obX).w ; is Sonic far enough into the level?
blo.w KillSonic ; if not, kill Sonics1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1116-L1119 — past X `$2000` in act 2 the level restarts as act 3; Transition from SBZ2 to SBZ3
clr.b (v_lastlamp).w ; clear lamppost counter
move.w #1,(f_restart).w ; restart the level
move.w #id_LZ_act4,(v_zone_act).w ; set level to SBZ3 (LZ4)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic ReactToItem.asm#L454-L459KillSonic:
…
move.b #6,obRoutine(a0) ; set Sonic to "Sonic_Death" routineChecked by claude, 2026-10-26 — read Sonic_LevelBound at the pinned commit (`cmp.w obY(a0),d0` then `blt.s .bottom`: a death once obY exceeds the target bottom boundary, `v_limitbtm2`, plus 224). The probe runs Sonic The Hedgehog (USA, Europe) in MAME 0.289 on the stages of stage-rule, built in Green Hill Act 1 (bottom boundary `$300`); on 2026-10-26 18 of its cases ended in a fall into a pit, and each death came on the first frame after his center passed row 992 (`$300` + 224), the row the probe computes from the boundary it reads in RAM and this claim's 224Checked by a second AI model, 2026-10-22.Checked by a second AI model, 2026-10-26.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the act transition and the death routine are quoted.Probe: probes/lab/sonic-conformance.mjsSonic_LevelBound runs in every mode before the move, so the death comes the frame after his center passes the line. The same routine stops him at the level's left and right edges.
On stages built in Green Hill Act 1 from the act's full flat 16 × 16 block, the movement lab's Sonic model matches Sonic the Hedgehog itself, run in MAME, on every frame of 100 random stages with random input scripts, three in four with floating blocks, and of the lab's stage presets, until a fall into a pit kills him at the bottom boundary or he nears the end of the built floor. s1disasm/stage-rule
About: Sonic the Hedgehog Hitbox
Value: stages 100 · frames 300 (random stages; frames each)
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/sub FindNearestTile & FindFloor & FindWall.asm#L111-L457 — FindFloor, FindFloor2, FindWall, FindWall2movea.l (v_collindex).w,a2
move.b (a2,d0.w),d0 ; get collision heightmap ids1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic AnglePos.asm#L6-L211 — Sonic_AnglePos, Sonic_Angles1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/Sonic Collision.asm#L13-L563 — Sonic_CalcRoomAhead, Sonic_FindFloor, Sonic_FindCeiling, the quick wall searchess1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L381-L629 — Sonic_Move with the balance check and Sonic_WallSpeedAdjusts1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1484-L1845 — Sonic_Floor's four directions, Sonic_ResetOnFloors1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub CalcAngle.asm#L13-L93 — CalcAngle; the probe reads Angle_Data from the disassemblyChecked by claude, 2026-10-26 — read the routines above at the pinned commit. The probe runs Sonic The Hedgehog (USA, Europe) in MAME 0.289 through the movement lab's ROM check (probes/lab/conformance.mjs, sonic-stage.mjs): each stage built in Green Hill Act 1's foreground row 3 from the act's full flat block (rows 2 and 4 emptied), its objects cleared every frame, Sonic placed standing at the stage's start, input written into the joypad bytes each game frame, and the model run on the same stage and input. The random stages are sonic-movement.mjs's (randomStages, seed 7), the ones its simulation check uses. On 2026-10-26 it compared 116 cases, 100 random stages of 300 frames and 16 stage-preset panes, 28,655 frames, on X and Y in 16.16, X, Y, and ground speed, airborne, curled, and facing, and all matched. 18 ended when the bottom boundary killed him, each on the first frame after his center passed row 992 (Green Hill Act 1's `$300` + 224, bottom-boundary); 3 stopped where he came within 48 px of the built floor's ends, x 0 and 4096. The model also matches sonic-movement.mjs's word-level simulation of the routines on the same stages (sonic.model.test.ts, in the gate); on 2026-10-22 2,000 such stages (seed 99; 600,000 frames, 781 ceiling bumps) agreed on every frameRevised after a check by a second AI model, 2026-10-22.Revised after a check by a second AI model, 2026-10-22.Checked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-25.Checked by a second AI model, 2026-10-26.Checked by a second AI model, 2026-11-04.Probe: probes/lab/sonic-conformance.mjsThe stages have every edge on one 16 px grid at a random origin, tops from 64 px down to 64 px up, and pits; three in four have two to eight blocks, one or two rows tall, with undersides 16 to 112 px up. The game runs them in its layout's row 3 (y 768 to 1023), Sonic's starting floor at row 928, and kills him 84 px below his starting center (bottom-boundary), where the lab lets him fall. The ramps and partial blocks the model leaves out are measured in the game by probes/jump-physics/sonic-terrain.mjs. A fall of about 585 frames would overflow the game's word-sized Y speed, which the model doesn't wrap; the game kills him long before (bottom-boundary).
In the running game, with the camera's left edge written 1 px right of Sonic as he stands in Green Hill Act 1, the camera scrolls right 16 px a frame, away from him, for 510 frames, until the act's end locks the left boundary past him and the boundary moves him 16 px inside it; with the edge on his own x, it moves 144 px left in one frame (the distance 0 less 144, computed). s1disasm/camera-wrap
About: Sonic the Hedgehog Scrolling
Value: at edge -144 · step 16 · frames 510 · locked true (px of camera move in one frame (atEdge, step); frames)
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_inc/ScrollHoriz & ScrollVertical.asm#L35-L51move.w (v_player+obX).w,d0 ; get Sonic's current X-position
sub.w (v_screenposx).w,d0 ; d0 = Sonic's distance from left edge of screen
subi.w #(320/2)-16,d0 ; is distance less than 144px?
…
else
bcs.s SH_MoveCameraLeft ; if yes, branch (unsigned)
endif
subi.w #16,d0 ; is distance more than 160px?
…
else
bcc.s SH_MoveCameraRight ; if yes, branch (unsigned)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _inc/ScrollHoriz & ScrollVertical.asm#L59-L62SH_MoveCameraRight:
cmpi.w #16,d0 ; is Sonic within 16px of middle area?
blo.s .moveRight ; if yes, branch
move.w #16,d0 ; set to 16 if greaters1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _inc/ScrollHoriz & ScrollVertical.asm#L83-L85 — the left move's 16 px cap is in the FixBugs build onlySH_MoveCameraLeft:
if FixBugs
; Fix leftside movement not being capped (unlike rightside movement),s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _inc/ScrollHoriz & ScrollVertical.asm#L93-L94 — with the distance 0, the camera moves by −144.moveLeft:
add.w (v_screenposx).w,d0 ; add current camera position to Sonic's X-offsets1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · sonic.asm#L3204-L3214 — SignpostArtLoadmove.w (v_screenposx).w,d0 ; get current X-camera position
move.w (v_limitright2).w,d1 ; get right level boundary
subi.w #$100,d1 ; check for $100 pixels before the right boundary
…
move.w d1,(v_limitleft2).w ; lock left level boundary to current screen positions1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1066-L1069 — Sonic_LevelBoundmove.w (v_limitleft2).w,d0 ; load level's left boundary
addi.w #16,d0 ; add 16px of leeway
cmp.w d1,d0 ; has Sonic touched the left level boundary?
bhi.s .sides ; if yes, branchs1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L1124-L1125 — he is put at the boundary plus 16.sides:
move.w d0,obX(a0) ; prevent Sonic from leaving the side boundaryChecked by claude-agent, 2026-10-25 — ran probes/jump-physics/sonic-mame.mjs: Sonic The Hedgehog (USA, Europe) in MAME 0.289, on a flat floor written into Green Hill Act 1 with its objects cleared, input written to the joypad bytes each game frame; Sonic standing at x 1000 and nothing held: the camera's x written as 1000 went to 856 in one frame and stayed; written as 1001 it moved right 16 px on every frame for 510 frames, to 9161, while Sonic stayed at 1000; then the left boundary was 9151, the right boundary 9407 less $100, and Sonic stood at 9167, 16 px inside it. Read MoveScreenHoriz, SignpostArtLoad, and Sonic_LevelBound at the pinned commitRevised after a check by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the 144 px subtraction, the camera add and the boundary set are quoted.Probe: probes/jump-physics/sonic-mame.mjsMoveScreenHoriz takes the camera's x from Sonic's and tests the difference unsigned, so with Sonic left of the camera the negative distance reads as more than 160 px, and the camera moves right by its 16 px cap, again each frame while he stays behind it. With the edge on his x the distance is 0, under 144, and the move left is uncapped in this build. s1disasm's FixBugs build makes both tests signed under the comment "Fix horizontal wrap bug". The probe reaches the state only by writing the camera's position; whether normal play can put Sonic left of the camera isn't shown here. The 510 frames are this setup's: from x 1001 to the right boundary less $100 in Green Hill Act 1, where SignpostArtLoad locks the left boundary.
The title screen's cheats start with a d-pad code, read from each frame's new presses: Up, Down, Left, Right on every console in REV00 (Sonic The Hedgehog (USA, Europe)) and on non-Japanese consoles in REV01, while a Japanese console in REV01 takes Up, Down, Down, Down, Left, Right. The code is complete on the first frame after its last direction with no new d-pad press, and a wrong direction starts it over; s1disasm's bug-fix build, unlike the original, counts a wrong press that matches the code's first direction as that first press. s1disasm/title-cheat-sequence
Value: Up, Down, Left, Right
Codes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·sonic.asm#L2353-L2361LevSelCode_J:
if Revision=0
dc.b btnUp,btnDn,btnL,btnR,0,$FF
else
dc.b btnUp,btnDn,btnDn,btnDn,btnL,btnR,0,$FF
endif
even
LevSelCode_US: dc.b btnUp,btnDn,btnL,btnR,0,$FFs1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · sonic.asm#L2096-L2118Tit_ChkRegion:
tst.b (v_megadrive).w ; check if the machine is US or Japanese
bpl.s Tit_RegionJap ; if Japanese, branch
lea (LevSelCode_US).l,a0 ; load US code
bra.s Tit_EnterCheat ; skip over
Tit_RegionJap:
lea (LevSelCode_J).l,a0 ; load J code
Tit_EnterCheat:
move.w (v_title_dcount).w,d0 ; get number of successful D-Pad cheat inputs
adda.w d0,a0 ; add to loaded code to find current cheat input requirement
move.b (v_jpadpress1).w,d0 ; get buttons pressed this frame
andi.b #btnDir,d0 ; read only D-Pad buttons (UDLR)
…Our readinga Japanese console: the J code (by the comment)2097–2098else: the US code2099–2100Japanese: the J code2103the entry at the count of right presses2106–2107the d-pad bits pressed this frame2108–2109not the entry: reset (not quoted)2110–2111count + 12112not the closing 0: on to the count (not quoted)2113–2114the closing 0: FixBugs build: count ← 02117 then on to the cheat's effect (not quoted)2118s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · sonic.asm#L2142-L2158Tit_ResetCheat:
tst.b d0 ; has D-Pad been pressed?
beq.s Tit_CountC ; if not, don't reset D-Pad counter
cmpi.w #9,(v_title_dcount).w ; has cheat reached index 9? (impossible condition)
beq.s Tit_CountC ; if yes, don't reset D-Pad counter
move.w #0,(v_title_dcount).w ; reset cheat index counter
if FixBugs
; Entering an incorrect cheat input normally resets the entire sequence.
; If the incorrect input matches the first cheat button, it should be treated
; as the first successful input to make repeated attempts less awkward.
lea (LevSelCode_J).l,a0 ; reload J code
tst.b (v_megadrive).w ; check if the machine is US or Japanese
…Our readingno d-pad press: keep the count2143–2144count 9, which can't happen: keep it (by the comment)2145–2146else: count ← 02147FixBugs build: the region's code again2152–2155 the press is its first entry: take it at once2156–2157Checked by claude-agent, 2026-10-26 — read Tit_ChkRegion, Tit_EnterCheat, Tit_ResetCheat, and LevSelCode_J and LevSelCode_US at the pinned commit; v_megadrive's bit 7 is the console's overseas bit (set at CheckSumOk from console_version), so bpl branches on a Japanese consoleChecked by a second AI model, 2026-10-26.Revised after a check by a second AI model, 2026-10-28.Checked by a second AI model, 2026-10-28.Each table ends in a 0 entry, which matches a frame with no new d-pad press, and then $FF. Its comments call these the level select codes; the cheat they turn on depends on C (credits-cheat-code).
Cited by: Sonic the Hedgehog
When the title screen's d-pad code completes on a Japanese console, the cheat it turns on depends on how many times C has been pressed since the title screen began: the count halved, keeping its low two bits, picks level select (0 or 1 presses), slow motion (2 or 3), debug mode (4 or 5), or the hidden-credits flag (6 or 7; the pattern repeats every 8 presses). On any other console 2 to 7 presses (again repeating every 8 presses) turn on slow motion and debug mode instead, and 0 or 1 level select, so the hidden-credits flag can't be set there from the title screen. s1disasm/credits-cheat-code
Value: 6, 7 (C presses (mod 8))
Codes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·sonic.asm#L2064-L2065move.w #0,(v_title_dcount).w ; clear D-Pad counter for title screen cheats
move.w #0,(v_title_ccount).w ; clear C counter for title screen cheatsOur readingD-pad and C counters ← 02064–2065s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · sonic.asm#L2125-L2138lea (f_levselcheat).w,a0 ; get base cheat index
move.w (v_title_ccount).w,d1 ; get number of tiles C was pressed
lsr.w #1,d1 ; half pressed amount
andi.w #3,d1 ; only four cheats are possible
beq.s Tit_PlayRing ; if C was not pressed, only activate level select
tst.b (v_megadrive).w ; check if the machine is US or Japanese
bpl.s Tit_PlayRing ; if Japanese, branch
moveq #1,d1 ; on non-Japanese console, force index to slow motion cheat
move.b d1,1(a0,d1.w) ; enable debug mode first (and slow motion in the next line)
Tit_PlayRing:
move.b #1,(a0,d1.w) ; activate cheat depending on C-press count
move.b #sfx_Ring,d0 ; set ring sound when code is entered
…Our readinga0 ← the level-select flag, the first cheat2125index ← C count ÷ 2, & 32126–21280: to Tit_PlayRing2129Japanese console: to Tit_PlayRing (by the comment)2130–2131else: index ← 1; the flag at index + 1 ← 12132–2133Tit_PlayRing: the cheat flag at index ← 12135–2136ring sound2137–2138s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · sonic.asm#L2160-L2164Tit_CountC:
move.b (v_jpadpress1).w,d0 ; get currently pressed buttons
andi.b #btnC,d0 ; is C button pressed?
beq.s Tit_ChkStartOrDemo ; if not, branch
addq.w #1,(v_title_ccount).w ; increment C counterOur readingpressed buttons & C2161–2162 none: to Tit_ChkStartOrDemo2163 else: C count + 12164s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _Variables.asm#L459-L462f_levselcheat: ds.b 1 ; level select cheat flag
f_slomocheat: ds.b 1 ; slow motion & frame advance cheat flag
f_debugcheat: ds.b 1 ; debug mode cheat flag
f_creditscheat: ds.b 1 ; hidden Japanese credits & 9E/9F sound test shortcuts cheat flagChecked by claude-agent, 2026-10-26 — read the title screen's counter setup, Tit_ActivateCheat, Tit_PlayRing, Tit_CountC, and the cheat flags' order in _Variables.asm at the pinned commit; the lines have no Revision or FixBugs conditionalsRevised after a check by a second AI model, 2026-10-26.Checked by a second AI model, 2026-10-28.Checked by a second AI model, 2026-11-04.Checked by a second AI model, 2026-11-18.The flags sit in that order from f_levselcheat, so index 3 is f_creditscheat. On a non-Japanese console the index is forced to 1 and move.b d1,1(a0,d1.w) writes the debug flag before the slow-motion one. The comment above Tit_ActivateCheat, s1disasm's annotators' reading, says the same. With CheatsEnabled = 1, an s1disasm build option the original doesn't have, every flag is on from power-on (sonic.asm#L424-L430). The C counter is cleared each time the title screen starts and counts on every frame of its loop, so presses after the code completes count toward the next code.
Cited by: Sonic the Hedgehog
With the hidden-credits flag set, holding exactly A, B, C, and Down ($72; any other button added fails) as the screen before the title loads hides its SONIC TEAM PRESENTS text and puts white ($EEE) and cyan ($880) in the first two colors of the third palette line of the palette the screen fades in to. The text is an object that makes this test once, when it first runs, which the title screen's setup does once before the screen fades in; if the test fails, it shows the text. The ending's credits load the same object, which there shows the current credits page and skips the test. s1disasm/credits-cheat-hold
Value: buttons $72 · white EEE · cyan 880
Codes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/8A Credits and Sonic Team Presents.asm#L16-L42Cred_Main: ; Routine 0
addq.b #2,obRoutine(a0) ; advance to Cred_Display
…
move.w (v_creditsnum).w,d0 ; load credits page index number (doesn't reset between game mode changes)
move.b d0,obFrame(a0) ; display appropriate sprite
…
cmpi.b #id_Title,(v_gamemode).w ; is the mode #4 (title screen)?
bne.s Cred_Display ; if not, branch
move.w #ArtTile_Sonic_Team_Font,obGfx(a0) ; alternate art tile offset for title screen
move.b #$A,obFrame(a0) ; display "SONIC TEAM PRESENTS" frame
tst.b (f_creditscheat).w ; is hidden Japanese credits cheat on?
beq.s Cred_Display ; if not, branch
…s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · sonic.asm#L3839-L3867 — the ending's credits screenGM_Credits:
…
move.b #id_CreditsText,(v_credits).w ; load credits text objectOn the SONIC TEAM PRESENTS screen the backdrop is color 0 of the third palette line, and the fade-in buffer is cleared to black before Sonic's palette is loaded into its first line, so without the cheat the backdrop fades in black. The cheat's white goes into that backdrop color, and its cyan into color 1 of the third line. In the original game (bug fixes off) the hidden names are on the first line and don't use that cyan; in s1disasm's bug-fix build they are on the third line, where their color 1 is the cheat's cyan. Code — the buffer the screen fades in tos1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · sonic.asm#L1945-L1948move.b #id_CreditsText,(v_sonicteam).w ; load "SONIC TEAM PRESENTS" object
jsr (ExecuteObjects).l ; execute objects to load STP object
jsr (BuildSprites).l ; build sprites for the STP object
bsr.w PaletteFadeIn ; fade-in STP screens1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _Constants.asm#L188cWhite: equ $EEE ; color whiteChecked by claude-agent, 2026-10-26 — read Cred_Main and the title screen's setup at the pinned commit; Cred_Main advances obRoutine to Cred_Display on its first run, so the test runs once per object; no Revision or FixBugs conditionalsChecked by a second AI model, 2026-10-26.Revised after a check by a second AI model, 2026-11-04: Unclear and unquoted; the object id and buffer name are gone, and the credits pages and display are quoted.Probe: probes/sonic-the-hedgehog/hidden-credits.mjsCited by: Sonic the Hedgehog
In MAME 0.289 from power-on, Sonic The Hedgehog (USA, Europe) on a Japanese console (MAME's Genesis, with a read tap that clears the overseas bit, bit 7, of the version register at $A10001), with C pressed six times on the title screen and then Up, Down, Left, Right, turned on the hidden-credits flag and no other cheat; on MAME's Genesis (USA), the same input turned on slow motion and debug mode. s1disasm/credits-cheat-run
Value: japan f_creditscheat · usa f_slomocheat, f_debugcheat
Verifieds1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·sonic.asm#L2354-L2355if Revision=0
dc.b btnUp,btnDn,btnL,btnR,0,$FFs1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · sonic.asm#L2125-L2136lea (f_levselcheat).w,a0 ; get base cheat index
move.w (v_title_ccount).w,d1 ; get number of tiles C was pressed
lsr.w #1,d1 ; half pressed amount
andi.w #3,d1 ; only four cheats are possible
beq.s Tit_PlayRing ; if C was not pressed, only activate level select
tst.b (v_megadrive).w ; check if the machine is US or Japanese
bpl.s Tit_PlayRing ; if Japanese, branch
moveq #1,d1 ; on non-Japanese console, force index to slow motion cheat
move.b d1,1(a0,d1.w) ; enable debug mode first (and slow motion in the next line)
Tit_PlayRing:
move.b #1,(a0,d1.w) ; activate cheat depending on C-press counts1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _Variables.asm#L459-L462 — the four flags in order from the basef_levselcheat: ds.b 1 ; level select cheat flag
f_slomocheat: ds.b 1 ; slow motion & frame advance cheat flag
f_debugcheat: ds.b 1 ; debug mode cheat flag
f_creditscheat: ds.b 1 ; hidden Japanese credits & 9E/9F sound test shortcuts cheat flags1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · sonic.asm#L2160-L2164Tit_CountC:
move.b (v_jpadpress1).w,d0 ; get currently pressed buttons
andi.b #btnC,d0 ; is C button pressed?
beq.s Tit_ChkStartOrDemo ; if not, branch
addq.w #1,(v_title_ccount).w ; increment C counterChecked by claude-agent, 2026-10-26 — ran probes/sonic-the-hedgehog/hidden-credits.mjs: MAME 0.289's Genesis driver, the pad pressed through MAME's inputs, one frame per press with a frame released between; the Japanese console is the Genesis with a read tap clearing bit 7 of the version register ($A10001), and v_megadrive read $00 against $80 without it. A scratch run on MAME's Mega Drive (Japan) driver with no tap gave the same values. The four cheat flags at $FFFFE0 read 0,0,0,1 on the Japanese console and 0,1,1,0 on the Genesis (USA)Revised after a check by a second AI model, 2026-10-26.Revised after a check by a second AI model, 2026-11-04: Missing quotes; the cheat-flag order and the C counting are quoted.Probe: probes/sonic-the-hedgehog/hidden-credits.mjsThe run tested 6 presses of C only; credits-cheat-code reads the other counts from the code. A scratch run on MAME's Mega Drive (Japan) driver (megadrij), with no tap, gave the same values for this claim and the two screen claims.
Cited by: Sonic the Hedgehog
The end-of-act signpost counts Sonic as passing on the first frame his x position is at or right of the signpost's and less than 32 px past it; it then plays its sound, stops the act's timer, and locks the screen's left edge. s1disasm/signpost-touch
Value: reach 32
Codes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/0D Signpost.asm#L43-L55move.w (v_player+obX).w,d0 ; get Sonic's X-position
sub.w obX(a0),d0 ; subtract signpost's X-position
blo.s .notouch ; if Sonic is to the left of signpost, branch
cmpi.w #32,d0 ; is Sonic within 32 pixels of the signpost?
bhs.s .notouch ; if not, branch
…
move.w #sfx_Signpost,d0 ; set signpost sound
jsr (QueueSound1).l ; play play it
clr.b (f_timecount).w ; stop time counter
move.w (v_limitright2).w,(v_limitleft2).w ; lock screen positionChecked by claude, 2026-10-26 — read Sign_Touch (L43-L55) at the pinned commit: an unsigned compare of Sonic's x less the signpost's against 32, then the sound, the timer flag, the left limit set to the right one, and the advance to Sign_SpinRevised after a check by a second AI model, 2026-10-27.Each loop in Green Hill and Star Light is one 256 × 256 px chunk of level with two versions, and a loop flag on Sonic picks which one is solid under him. The zone's table names the loop chunks, Green Hill's $B5 and Star Light's $AA and $B4, their high bit marking them special in the layout; for a special chunk, with Sonic's loop flag set, the block lookup that the wall and floor searches call reads the chunk after it instead. s1disasm/loop-chunks
About: Sonic the Hedgehog Loop
Codes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_inc/LevelSizeLoad & BgScrollSpeed.asm#L224-L228LoopChunkNums: ; loop loop tunnel tunnel
dc.b $B5, $7F, $1F, $20 ; Green Hill
dc.b $7F, $7F, $7F, $7F ; Labyrinth
dc.b $7F, $7F, $7F, $7F ; Marble
dc.b $AA, $B4, $7F, $7F ; Star Lights1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub FindNearestTile & FindFloor & FindWall.asm#L67-L74.specialtile:
andi.w #$7F,d1
btst #sprite_looping_bit,obRender(a0) ; is object "behind a loop"?
beq.s .treatasnormal ; if not, branch
addq.w #1,d1
cmpi.w #$29,d1 ; is 256x256 chunk number $28?
bne.s .treatasnormal ; if not, branch
move.w #$51,d1 ; replace with $51s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub FindNearestTile & FindFloor & FindWall.asm#L24-L26move.b (a1,d0.w),d1 ; get 256x256 chunk number
beq.s .blanktile ; branch if 0 (blank chunk)
bmi.s .specialtile ; branch if > $7Fs1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/sub FindNearestTile & FindFloor & FindWall.asm#L295-L296FindWall:
bsr.w FindNearestTile ; a1 = address within 256x256 mappings of 16x16 block being stood onSonic Physics Guide: Solid Terrain · Chunk SwappingIn Sonic 1, loop chunks are simply built different. When the Player enters the loop chunk from the left, only the right side of it is solid. As the Player goes around the loop, the entire chunk will swap for another half way and sets the left side solid instead.Checked by claude, 2026-11-18 — read LoopChunkNums, LevSz_InitBackgroundAndLoops, which copies the zone's row to v_256loop1, and FindNearestTile's .specialtile branch at the pinned commitRevised after a check by a second AI model, 2026-11-18.The table's last two columns are Green Hill's roll tunnels ($1F, $20), which force a roll (Sonic_Loops). One special chunk breaks the rule: for $28, which is none of the three loop chunks ($35, $2A, $34 without the high bit), the alternate is $51, not $29. FindFloor calls FindNearestTile too (L197). Sonic is the only object that sets the flag (Sonic_Loops' header comment). No revision conditional touches these lines.
Cited by: Loop, Sonic the Hedgehog, Sonic the Hedgehog 2
Sonic's loop flag switches at the loop's top: on a loop chunk it clears in the chunk's first 44 px and sets from 224 px on; between them, a clear flag sets once his angle is $01 to $80 ($80 upside down), and a set flag clears once his angle passes $80. On Star Light's second loop chunk, $B4, it clears while he is in the air. Off a loop chunk it clears, except on Green Hill's two roll-tunnel chunks, which force a roll and leave it as it is. Only Green Hill and Star Light run the check. s1disasm/loop-flag
About: Sonic the Hedgehog Loop
Codes1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) ·_incObj/01 Sonic.asm#L2058-L2062Sonic_Loops:
cmpi.b #id_SLZ,(v_zone).w ; is level SLZ?
beq.s .levelhasloops ; if yes, check for loop chunks
tst.b (v_zone).w ; is level GHZ?
bne.w .return ; if not, return (level has no loops, so no need to check for them)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L2075-L2085cmp.b (v_256roll1).w,d1 ; is Sonic on a "roll tunnel" tile? (type A, entrance from the left)
beq.w Sonic_ChkRoll ; if yes, force Sonic into a rolling state
cmp.b (v_256roll2).w,d1 ; is Sonic on a "roll tunnel" tile? (type B, exit to the right)
beq.w Sonic_ChkRoll ; if yes, force Sonic into a rolling state
cmp.b (v_256loop1).w,d1 ; is Sonic on a loop tile? (type A, entering from/exiting to the left)
beq.s .chkifleft ; if yes, branch
cmp.b (v_256loop2).w,d1 ; is Sonic on a loop tile? (type B, entering from/exiting to the right)
beq.s .chkifinair ; if yes, branch
bclr #sprite_looping_bit,obRender(a0) ; clear loop flag (return Sonic to high plane)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L2090-L2094.chkifinair:
btst #status_in_air_bit,obStatus(a0) ; is Sonic in the air?
beq.s .chkifleft ; if not, branch
bclr #sprite_looping_bit,obRender(a0) ; clear loop flag (return Sonic to high plane)s1disasm: Sonic the Hedgehog (16-bit) disassembly (sonicretro/s1disasm) · _incObj/01 Sonic.asm#L2099-L2135.chkifleft:
move.w obX(a0),d2 ; get Sonic's current X position
cmpi.b #44,d2 ; is Sonic past the first couple pixels of the loop? (byte check)
bhs.s .chkifright ; if yes, branch
bclr #sprite_looping_bit,obRender(a0) ; clear loop flag (return Sonic to high plane)
rts ; return
; ===========================================================================
; loc_13988:
.chkifright:
cmpi.b #224,d2 ; is Sonic past the last couple pixels of the loop? (byte check)
blo.s .chkangle1 ; if not, branch
bset #sprite_looping_bit,obRender(a0) ; set loop flag (send Sonic to low plane)
…Checked by claude, 2026-11-18 — read Sonic_Loops and its call at the end of Sonic_Control (L101) at the pinned commitRevised after a check by a second AI model, 2026-11-18.Running right up a slope, Sonic's angle is $80 to $FF (Sonic_SlopeResistWalk, L1339: "walking up a right slope" adds a negative push), so a run into a loop from the left keeps the flag clear up the near side and sets it at the top, where the chunk's far side becomes solid. The X tests read only the low byte of his X position, his place within the 256 px chunk. The call runs every frame he is under control, on the ground or in the air.
Cited by: Loop, Sonic the Hedgehog