Sonic Source Code Notes

From Hidden Palace
Jump to navigation Jump to search

Notes on the surviving Mega Drive source code for Sonic the Hedgehog, including development tools, unused code, data structures and original comments.

These notes were derived from a partial Sonic 1 source code archive. We don't have access to the original source code so please don't ask. We received an AI-generated summary of the archive, and the notes below are derived from that.

Source code notes

Removed gameplay

  • Disabled code survives as lines prefixed with *, blocks enclosed by comment @ … @, and text after the assembler’s end directive.

Player mechanics

Automatic curling near the jump apex

  • In the shipped game, pressing jump turns Sonic into a ball straight away (Sonic_Jump). The original once worked differently. play00jump called a routine named rollatackchk (* bsr.w rollatackchk, PLAYER.ASM:252), now inside a comment block at PLAYER.ASM:1025-1043:
PLAYER.ASM:1025
  • ジャンプ時の回転アタックチェック: “rolling-attack check during a jump”.
  • Sonic took off upright, and curled into the spin attack only near the apex, once his rising speed had decayed past -$400. Two other changes support this interpretation. The old animation table after end has a ;stand jump animation (frames 08,10,10,10,10). And jumping out of a roll used to un-curl him: the commented-out block at PLAYER.ASM:853-861 cleared cd_ball, set the roll-jump flag, restored standing size and set animation 0.
Unsigned jump-speed test
rollatackchk:
	cmpi.w	#$fc00,yspeed(a0)
	bcs.b	?end                    ; unsigned: skip if yspeed < $FC00
	btst.b	#cd_ball,cddat(a0)
	bne.b	?end
	bset.b	#cd_ball,cddat(a0)
	move.b	#14,sprvs(a0)           ; ball height
	move.b	#07,sprhs(a0)		;05
	move.b	#2,mstno(a0)            ; rolling animation
	addq.w	#19-14,yposi(a0)
*	move.w	#$a1,d0                 ; roll sound, commented out
*	jsr	soundset
?end:
	rts
  • bcs after cmpi.w #$fc00 is an unsigned test. Upward speeds are negative, so -$680 is $F980, below $FC00: skip. Falling speeds are small positive numbers, also below $FC00: skip. The only window that passes is $FC00–$FFFF, i.e. rising between −$400 and 0. Every jump passes through it on the way up, so Sonic curls just before the top of the arc and never on the way down.
  • With the shipped jump speed, that window opens 12 frames after take-off, 64 pixels up, about two-thirds of the way to the top. The old table’s ;stand jump shows frame 08 for nine frames and then holds frame 10: two of the walk frames. The reconstruction below combines these behaviours:
Two Sonics jump side by side. The left one rises upright, legs apart, and curls into a ball as he passes a dashed line two-thirds of the way up. The right one is a ball from take-off
Two Sonics jump side by side. The left one rises upright, legs apart, and curls into a ball as he passes a dashed line two-thirds of the way up. The right one is a ball from take-off
  • Illustration notes: Earlier and shipped jump behaviour. Left: upright on the old table's ;stand jump (PLAYER.ASM:2422-2424) until the rising speed passes −$400 (the dashed line) and rollatackchk curls him up. Right: the shipped jump, a ball from take-off. Both are stepped frame by frame with the live physics: pljump $680, gravity $38 a frame (speedset), button held. The ball is animation 2, the one rollatackchk sets, at its zero-speed rate of 5 frames per sprite frame. ;stand jump comes from the older table and rollatackchk numbers its animation for the later one, so pairing them is (inference). Frames: Map_Sonic and its DPLCs over Art_Sonic.

Ball-bounce code and animations

  • The biggest cut physics in the player is a comment \ block, PLAYER.ASM:1277-1488, with an older draft after end (:2183-2214). It resolved air collisions by reflecting the velocity vector: take the surface angle (atan), the speed’s magnitude (sqr), and recompose. The ball version, jumpcolchk2 (labelled *ball), halves the normal component (asr.l #1,d0, :1415), giving a bounce with a restitution of ½. An even earlier stage was a perfectly elastic mirror bounce.
  • The symbol file confirms that the block was not assembled. jumpcolsub ($13E74) is followed directly by play00damage ($13EC6), and jumpcolchk2 doesn’t appear in AC.EVT at all.
  • The animation names suggest that its frames remain in the shipped table. The shipped table still has four entries, plchg09–plchg12, labelled 回転バウンド (“rolling bounce”) at 0°, 45°, 90° and 135° (PLAYER.ASM:2032-2047). The disassembly calls them SonAni_Warp1–Warp4. PLAY.TST, the animation spec of October 1990, lists the same “spin bounce” pattern with one frame per angle, IDs 9–12.
Animation-name correspondence
  • The bounce block itself sets no animation, so the link between it and IDs 9–12 is their name and nothing more. The only code in the tree that sets one of them is the head-bump check below, which picks ID 11.
Angle Image Description
0° Rolling bounce at 0 degrees Rolling bounce at 0 degrees
45° Rolling bounce at 45 degrees Rolling bounce at 45 degrees
90° Rolling bounce at 90 degrees Rolling bounce at 90 degrees
135° Rolling bounce at 135 degrees Rolling bounce at 135 degrees
  • Illustration notes: The "rolling bounce" frames (the disassembly's SonAni_Warp1-4): a ball squashed against a surface at four angles, which is what a bounce off a slope needs. Sonic's mappings and DPLCs live in the data image, which isn't in the tree, so these are drawn from the disassembly's Map_Sonic and SonicDynPLC over Art_Sonic.

Uncurling with Down

  • A comment block in ballset (Sonic_ChkRoll, PLAYER.ASM:776-789) let Sonic un-roll by pressing down: it probed the ceiling (dircol2 with the angle flipped by $80), and if there were at least 6 pixels of headroom it cleared the ball flag and restored his standing size. The shipped routine is a plain rts.

Head collision: hedcolchk

  • The disassembly has an uncalled routine it names Sonic_SquashUnused. Its real name is hedcolchk, and its header (PLAYER.ASM:692) says what it was for:
PLAYER.ASM:692
  • プレイヤーの頭がつっかえるかどうかのチェック: “check whether the player’s head is blocked”.
  • It was called from play00walk until the call was commented out (* bsr.w hedcolchk, PLAYER.ASM:233). On a hit it stops Sonic dead and sets animation 11, which in the shipped table is the 90° “rolling bounce” (plchg11 ;ball baund). The old animation table after end has a ;hed col stop pose, but as ID 16 (:2430), not 11. The routine itself is still assembled, which is why the disassembly found it.

Act-clear jump

  • PLAYER.ASM:864-877 once checked object slot actwk17, which holds stclear_act, the act-clear card (GAME.ASM:1437, GOLE.ASM:128). Jumping while that card was up played animation 19, ;zone clear (the disassembly’s SonAni_Leap2), instead of curling into a ball.
  • The test is commented out, but the line in front of it isn’t: move.b #19,sprvs(a0) sets the standing hitbox height before every jump. That’s the line the disassembly annotates “a leftover from the victory animation in prototypes” (_incObj/01 Sonic.asm:974).

Earlier death sequence and debug revival

  • The death sequence was longer once (PLAYER.ASM:1608-1612, :1654-1668, and post-end :2463-2507). Sonic hopped, fell, and hopped again when he dropped back to the height he died at, saved in a field called yposi_m (offset $38). Then the game waited for a button: A went back to the title screen, and B or C revived him with two seconds of invulnerability.
  • The second hop had its own animation. The post-end play00die sets animation 25, labelled 死にパターン (“death pattern”) in the live table: frames 78–82, then frame 0, which draws nothing. Those are the five frames the disassembly calls Shrink1–Shrink5. In this version, Sonic shrank away in mid-air instead of falling off the screen. The old table’s ;die runs the death pose and all five as one animation (:2434-2436).
Two dying Sonics side by side. The left one hops, falls back to a dashed line, hops again and shrinks to nothing. The right one hops once and falls off the bottom
Two dying Sonics side by side. The left one hops, falls back to a dashed line, hops again and shrinks to nothing. The right one hops once and falls off the bottom
  • Illustration notes: Earlier and shipped death sequences. Left: the post-end play00die and play00erase (PLAYER.ASM:2463-2507), stepped frame by frame. He hops at −$700 in the death pose (animation 24, frame 77), falls back to yposi_m (the dashed line), then hops again at −$800 and shrinks away in 20 frames (animation 25, 4 frames per sprite frame). Right: the shipped death, one hop and off the bottom. Frames: Map_Sonic and its DPLCs over Art_Sonic, each looked up by number as the game does. The disassembly's two tables label frame 77 differently (MS_Death, SonPLC_Burnt).
Unused death-sequence writes
*	move.b	swdata+1,d0
*	andi.b	#$70,d0			; abc button check
*	beq.b	?end
*	andi.b	#$40,d0			; a button check
*	bne.b	?jump2
*	move.b	#00,mstno(a0)
*	subq.b	#word*2,r_no0(a0)
*	move.w	yposi_m(a0),yposi(a0)    ; back to where he died
*	move.w	#2*60,nocolitimer(a0)    ; 2 s of invulnerability
  • The revive is gone, but its inputs still run. KillSonic still writes obY to objoff_38 (COLI.ASM:295, move.w yposi(a0),$38(a0) ;yposi_m), and Sonic_Death still sets a Y speed of -$38 that play00erase (Sonic_ResetLevel) never applies. The disassembly reproduces both without comment.

Loop handling through layout changes

  • The shipped loop-handling code uses render flag af_loop and per-zone loopmapno variables to select between two chunks. An older loopchk, disabled in a comment block at PLAYER.ASM:1752–1814, rewrites the level layout in RAM: it swaps chunk IDs 71 and 79 in mapwka as Sonic passes. Trailing comments retain an earlier pair, $29/$51. The old code applies to stages 0 and 1; the shipped mechanism applies to stages 0 and 3 (GHZ and SLZ). FCOL.ASM retains another version using the fixed pair $35/$36.

Animations by slope

  • After PLAYER.ASM’s first end is an entire older animation engine (:2216-2437): separate walk and run animations for every 45° of slope, a “slow” walk, a skid that loops four times and then returns to standing, a spdpattbl speed-to-animation table, and acceleration lookup tables plspdtbl and plspdtblb that ramp speed up to $400 and $800 (:2444-2460). PLAY.TST (October 1990) describes exactly this design, with a frame set per slope quadrant.

Unused drowning-countdown sprite

  • The drowning-countdown master object (PLAYSUB.ASM:329-338) once displayed its own sprite on Sonic whenever pl_air was below 30. Air starts at 30 and drops once a second underwater, so that meant from his first second underwater until he took a breath. It never displays in the retail game, but its mappings, plawapat (frame S01), are still assembled. That’s the piece in Map_Drown that the disassembly doesn’t flag. PLAYSUB.ASM:236-255 also keeps three generations of drown-death code, the earliest of which restarted the level directly.

Monitors and rings

Random monitor contents

  • The shipped monitor takes its contents from its subtype. An earlier version selected them from the timer (ITEM.ASM:53-60):
*	move.b	systemtimer+3,d0
*	andi.b	#7,d0
*	cmpi.b	#6,d0
*	bcs.b	?jump2
*	move.b	#5,d0
*?jump2:
*	addq.b	#1,d0
*	move.b	d0,mstno(a0)
  • Timer values 0–5 give types 1–6 and values 6 and 7 are clamped to 5, so type 6 comes up three times in eight and every other type once in eight. Type 6 is kane, money: the ring monitor. The ‘S’ and aqualung monitors were never in the pool.

Monitor names

  • ITEM.ASM:359-369 names every monitor type:
Type Original Meaning Shipped as
0 kara empty static
1 hazure dud, a “miss” the Eggman monitor
2 1up — extra life
3 speed up — speed shoes
4 baria barrier shield
5 muteki invincible invincibility
6 kane money 10 rings
7 super — ‘S’ (the stub is a nop, ITEM.ASM:292-293)
8 akuarangu aqualung the “goggles” monitor that does nothing
9 kowareru “breaks” broken monitor
Monitor Image Description
HAZURE HAZURE monitor: Eggman's face HAZURE monitor: Eggman's face
1UP 1UP monitor: Sonic's face 1UP monitor: Sonic's face
SPED SPED monitor: a shoe SPED monitor: a shoe
BARIA BARIA monitor: a shield bubble BARIA monitor: a shield bubble
MUTEKI MUTEKI monitor: stars MUTEKI monitor: stars
KANE KANE monitor: a ring KANE monitor: a ring
SUPER SUPER monitor: an S SUPER monitor: an S
MIZU MIZU monitor: goggles MIZU monitor: goggles
  • Illustration notes: Every monitor face, under its sprite-tool name. These are itempat frames 3–10, assembled and live in ITEM.ASM, with the names from their size lines (; HAZURE, ; SPED, ; MIZU…). The last one, the aqualung's, is called "water", and its icon is a pair of goggles. Art: itemcg (Nem_Monitors), palette line 0.
Blank Eggman-monitor frame
  • hazure is what you call a losing lottery ticket. Type 1 was designed as a dud, not as a trap.

Aqualung power-up

  • SONIC.DOC (November 1990) lists four power-ups to implement: invincibility, barrier, speed-up and aqualung. The code got as far as:
  • a flag, plpower_a ;1: player power akuarangu (EQU.LIB:792; commented out in PLAYER.ASM:127);
  • a monitor type, itemchg8 *akuarangu (ITEM.ASM:394), with a sprite frame labelled MIZU, “water” (:485);
  • a power-up routine that is a bare rts (ITEM.ASM:295).
  • The flag is the disassembly’s v_unused1 “(Goggles?)” at $FE2F. It’s cleared at level start (GAME.ASM:194, ENDING.ASM:97) and never set or tested. The guess was close: the monitor’s icon is the goggles, and the item was an aqualung.
  • The aqualung had its own art, and it’s still in REV00. After GAME.ASM’s end is a list of one-word stand-ins for art files (GAME.ASM:1505-1515), each named by its original label. Their externs are live (GAME.ASM:16-17). Each word is exactly what the real file would start with: a Nemesis header (bit 15 = XOR mode, low 15 bits = tile count). Lined up against the disassembly’s REV00-only “Unused” art, they match one for one:
Stand-in Header Disassembly file (REV00 only) Confirmed by
kemuricg (煙 “smoke”) $0010 Unused - Smoke.nem the only $0010 file in the block
kiraricg (キラリ “sparkle”) $0003 Unused - SYZ Sparkles.nem two $0003 files: told apart by the names
diefirecg (“die fire”) $0003 Unused - Fireball.nem the same
mogakicg (もがき “struggling”) $800F Unused - LZ Sonic.nem (Sonic holding his breath) DEVTBL.ASM:210, REV00 PLC, ;$0f
backtocg $003B Unused - SStage Flash.nem DEVTBL.ASM:364, REV00 PLC, ;$3b
akuacg $0024 Unused - Goggles.nem the only $0024 file left once mutekicg is the stars
  • The disassembly’s “unused goggles” art, Nem_Goggle, is akuacg: the aqualung’s own art, 36 tiles that REV00 carries and REV01 dropped. No mapping for it survives in either tree.
Nine red goggle shapes at different angles
Nine red goggle shapes at different angles
  • Illustration notes: akuacg, as nine 2×2 sprite pieces. Read the way the VDP reads sprite tiles (down each column, then across), the 36 tiles form nine whole shapes: goggles seen from different angles. This is consistent with an overlay that follows Sonic’s facing direction. The palette line is a guess. Line 0, Sonic's, gives red rims.
Art-data placeholder words
  • The stand-ins sit in a comment block after end, so they were never assembled in this tree. One reading: a build without the data image linked against one-word placeholders, so that every art symbol resolved. Each would also tell a loader the art’s real size. The header match doesn’t depend on that reading. Two other stand-ins, bariacg ($0020) and mutekicg ($0012), don’t match the shipped shield ($801B) and stars ($0024), so the list predates their final art.

An extra life at 50 rings

  • Both places that award a ring extra life carry a commented-out * cmpi.w #50,plring (RING.ASM:148-151, ITEM.ASM:274-277). The shipped game pays out at 100 and 200 only. The 1-up check flags live in plring_f2 (the disassembly’s v_lifecount), and bit 0, the 50-ring bit, is never used as a result.

Giant-ring respawn

  • The giant-ring flash object once waited 120 frames after contact and re-created the giant ring at the same position (RING.ASM:394, :400–412). The shipped flash deletes itself.
  • Before both, the prototype’s ring spawned backto: Sonic vanished and came back two seconds later.

Badniks

Splats, the rabbit

  • usa: in USA.ASM is a bare rts, and that’s the disassembly’s blank Obj4F. Directly underneath, in two comment @ blocks, is an entire badnik: code at USA.ASM:16-89 and mappings at :116-135. Usa (兎) is “rabbit”. This is the pogo-bouncing rabbit the community calls Splats.
  • Wake-up. It waits until Sonic is within $E0 pixels ($300 if its subtype is non-zero), turns to face him, and sets xspeed to ±$100.
  • Bounce. Under gravity (speedset), it hops with yspeed -$400 each time it lands, showing frame 1 while rising and frame 0 while falling. It bounces in place even before it wakes.
  • Walls. It turns round at walls, flipping its sprite.
  • Sinking. If the 16×16 block under it has an ID of $2D2 or above, it switches to usadie, stops bouncing and falls through the floor and off the screen.
  • The source places Splats at VRAM tile $0448, palette line 0, with two 24×40 frames, U01 and U02. The prototype uses Splats in Marble Zone.
Frame Image Description
U01 Splats, frame U01: a blue rabbit on a coiled spring Splats, frame U01: a blue rabbit on a coiled spring
U02 Splats, frame U02: the same rabbit with its spring compressed Splats, frame U02: the same rabbit with its spring compressed
  • Illustration notes: Splats, drawn from the original's own mappings. The frame layout is usapat, inside a comment @ block at USA.ASM:116-135. The pixels are the art still in the ROM, usacg (the disassembly's Nem_Splats, 29 tiles), in palette line 0. Neither retail revision ever puts these frames on screen. The prototype can, from Marble Zone's debug list.
Splats bouncing on its spring between two walls: twice in place, then across to the right wall, back to the left, and so on
Splats bouncing on its spring between two walls: twice in place, then across to the right wall, back to the left, and so on
  • Illustration notes: Splats movement reconstruction. usawait and usamove (USA.ASM:40-82), stepped frame by frame on flat ground between two walls. It bounces at −$400 under gravity $38, showing U02 while rising and U01 while falling. It hops twice in place, facing Sonic, then sets off at $100 (a pixel a frame) as if he had come within range. It turns at the walls, which kabecolchk tests every fourth frame.
Splats collision and zone placement
	move.w	(a1),d0          ; the block word under Splats
	andi.w	#$3ff,d0
	cmpi.w	#$2d2,d0
	bcs.b	?jump0           ; below $2D2: bounce
	addq.b	#word,r_no0(a0)  ; else: usadie
  • The same “read the block ID under the object” idiom appears for MZ lava in BOX.ASM:151-153 and FBLOCK.ASM:120-122 (#$16a). usadie has the same shape as Basaran’s dead batdie (BAT.ASM:140-145), the code the disassembly calls “unused crap”, except that batdie moves without gravity (speedset2 for speedset).
  • The art is still in the ROM. usacg is at $0389B8 (the disassembly’s Nem_Splats). Its Nemesis header says $801D = 29 tiles, exactly the tiles $00–$1C the dead mappings use. But no PLC loads it: it is only .externed (DEVTBL.ASM:21). The debug-list entry * dcblw usa_act,usapat,$0448,0,$00 ;5: is commented out at the end of the SBZ list (EDIT.ASM:347), and the SLZ and SBZ object PLCs both leave a bare *$448 hole right after the Bomb and Orbinaut art.
  • Three parts of the prototype place Splats in Marble Zone:
  • Marble Zone’s object PLC (list 8, $012364) loads usacg to VRAM tile $4E4.
  • The prototype’s Splats sets sproffset to $24E4 ($00D216): that tile, in palette line 1.
  • Marble Zone’s debug list ($01207A) has a Splats entry with the same tile, between the pushable block and Yadrin.
  • The same Marble Zone PLC also loads Yadrin, which shipped only in Spring Yard.
Possible relocation to Star Light or Scrap Brain
  • The tree is weeks later than the prototype, and by then Marble Zone no longer loads Splats. Its SLZ and SBZ object PLCs leave a VRAM hole at $448 beside the Bomb/Orbinaut set, and its SBZ debug list has a commented Splats line in slot 5, which the Caterkiller now holds. So Splats seems to have been moving to one of those zones when it was cut (inference).
  • Splats’s wall check, kabecolchk (“kabe” = wall), remains in the shipped game because Yadrin uses it. The disassembly’s Yad_ChkWall sits before Yadrin’s own code for exactly this reason: it lives in USA.ASM’s address range, left behind when the rabbit was cut.

Walking Ball Hog

  • After BUTA.ASM’s end (:394-462) is a Ball Hog that walked back and forth, at $40 per frame, dropping bombs while it paused. The shipped one stands and hops. Its timer field, buta_time, is still defined and unused.
  • The cannonball changed too. Its fuse was once a fixed eight seconds (* move.w #60*8,bbomb_time(a0), BUTA.ASM:101); now the subtype sets the seconds. And it used to explode into bakuha (爆破, “blast”, object $24), not the shared bomb explosion.
Unused explosion write and art
	move.b	#bakuha_act,actno(a0)    ; still assembled...
*	move.b	#$00,r_no0(a0)
*	bra.w	bakuha
	move.b	#yarare2_act,actno(a0)   ; ...and overwritten at once
  • BUTA.ASM:126 is assembled and immediately overwritten. bakuha’s art, bakuhacg, is the disassembly’s “Unused - Explosion.nem” (Nem_UnkExplode, $8024 = 36 tiles). The old Ball Hog PLC that loaded it (* dco bakuhacg ,$41c*$20, DEVTBL.ASM:505-507) sits after DEVTBL.ASM’s own end (:499), in the post-end text. Object $24 is still created by the Buzz Bomber missile’s unreachable cd_die branch (HACHI.ASM:171-174), which the disassembly marks “unused?”.

Earlier Caterkiller movement

  • After IMO.ASM’s end (:556-569) the Caterkiller bobbed on a sine wave: yposi = yposi_m + sin>>6. The same fragment writes the curve into RAM at $FFA000, which looks like a tuning dump read out through the ICE. The shipped Caterkiller is a segment chain following its head.

Enemies using player collision routines

  • Earlier enemies used the player’s floor routines. Commented code at KANI.ASM:35 and :43–45 makes Crabmeat land through jumpcolchk (Sonic_Floor). The walking Ball Hog also calls fcol (* bsr.w fcol, BUTA.ASM:437), as does the test enemy in ENEMY.ASM. The rolling boulder uses more of the player’s terrain physics.

Gadgets and level objects

GHZ rolling boulder

  • Obj19 is a blank rts in the disassembly, and its mappings are known only as the GHZ boss’s swinging ball. BALL.ASM keeps three successive versions of the original object: a rolling boulder for Green Hill.
Version Where Behaviour
A, simplest (oldest, by inference) post-end, :438-532 waits until Sonic has just passed it, then chases him at $400, following the floor with emycol_d and jumping off ledges. Its own 4-frame, 90-tile art. Collision commented out
B, physics post-end, :295-432 a 40×40 hazard (colino 1, ;1: ball) that runs Sonic’s own terrain code: jsr fcol (Sonic_AnglePos) to follow slopes, jsr jumpcolchk (Sonic_Floor) in the air, slope acceleration muls #$002a × sin(angle)
C, latest comment @, :18-219 adds a ballwait state in which the ball is a solid object (atariridesub = SolidObject). Sonic can stand on it and push it. It starts rolling when pushed, or once Sonic is to its right. Its hurt collision is commented out
  • Version C uses the shipped ballpat mappings (frames Q0+TERI “shine”, Q1–Q3). So the boulder was cut after its final art was drawn. The art and mappings were recycled for the swinging-ball platforms (BURANKO.ASM:119-123) and the GHZ boss’s wrecking ball, and Obj19 is still in the GHZ debug list (EDIT.ASM:227). SONIC.DOC’s ZONE 1 gimmick list starts with ボールの動き, “ball movement”.

Spike bridge

  • The spiked helix, Obj17, is called thashi in the original: toge-hashi, “spike bridge”. In GHZ it was once rideable, calling the bridge’s own rideonchk2 (THASHI.ASM:89-97, commented out; HASHI.ASM:104 exports the entry point just for it). An old thashiride routine survives in a comment block (:103-118), as does an older self-timed spike animation (:130-142).
  • Its first art survives too. The commented-out 8-frame mapping set thashipat (:176-234, frames TOGE_H1…H8) uses exactly 44 tiles, and togehcg at $2FD7A has a Nemesis header of $802C, 44 tiles. That art file is the disassembly’s “Unused - GHZ Log”. It depicts a spike-bridge segment: a log with a spike rotating around it.
Spike-bridge frame Image Description
H1 Spike bridge frame 1 Spike bridge frame 1
H2 Spike bridge frame 2 Spike bridge frame 2
H3 Spike bridge frame 3 Spike bridge frame 3
H4 Spike bridge frame 4 Spike bridge frame 4
H5 Spike bridge frame 5 Spike bridge frame 5
H6 Spike bridge frame 6 Spike bridge frame 6
H7 Spike bridge frame 7 Spike bridge frame 7
H8 Spike bridge frame 8 Spike bridge frame 8
Shipped helix frame Image Description
0 Shipped helix frame 1 Shipped helix frame 1
1 Shipped helix frame 2 Shipped helix frame 2
2 Shipped helix frame 3 Shipped helix frame 3
3 Shipped helix frame 4 Shipped helix frame 4
4 Shipped helix frame 5 Shipped helix frame 5
5 Shipped helix frame 6 Shipped helix frame 6
6 Shipped helix frame 7: empty Shipped helix frame 7: empty
7 Shipped helix frame 8 Shipped helix frame 8
  • Illustration notes: Spike bridge, the eight frames of the commented-out thashipat (THASHI.ASM:176-234) over the "Unused - GHZ Log" art. Shipped helix, thashipat2 over the 18-tile spiked-log art, in table order. Frame 6 is the empty one that shares its bytes with frame 7. Both sets use palette line 2 (sproffset $4398), shown with Green Hill's colours.
Two rows of ten logs. In each, a spike turns round the logs in sequence, so a wave runs along the row. The top row is a solid log bridge, the bottom row only the spikes
Two rows of ten logs. In each, a spike turns round the logs in sequence, so a wave runs along the row. The top row is a solid log bridge, the bottom row only the spikes
  • Illustration notes: Earlier and shipped spike-bridge animations. Ten logs, each showing frame (sys_patno + its place in the row) & 7 (thashipatchg, THASHI.ASM:119-128). sys_patno steps back one every 12 frames (GAME.ASM:910-914), so the spike runs along the bridge. Top: thashipat, the set the commented-out tst.b stageno picked in Green Hill. Bottom: the shipped thashipat2. The cut bridge's riding and sag aren't modelled.
Overlapping spike-bridge mapping entries
  • The disassembly describes the helix’s invisible frame as “a nasty hack … pointing at a random 00 byte”. The source shows a deliberate overlap, with one sprite piece split across two lines so that frame 6’s count byte is frame 7’s size byte:
thashisp7	equ	$
	dc.b	$01
	dc.b	$f0+4		*,$00,$00,$11,$f8+5
thashisp6	equ	$
	dc.b	$00,$00,$11,$f8+5

GHZ-only mappings

  • Three objects once picked their mappings with tst.b stageno: one set for GHZ (stage 0), one for everyone else. The test was removed and the “everyone else” set shipped.
Object GHZ set Fate
Platforms (SHIMA.ASM, Obj18) shimapat: 48-px UKISHIMA (浮島, floating island) and YUKA_A still assembled, unreferenced: the disassembly’s “Platforms (unused)”
Collapsing ledge (BREAK.ASM) breakpat in a comment block; the shipped set is the same layout, tiles shifted by −9
Spiked helix (THASHI.ASM) thashipat in a comment block
  • SHIMA.ASM also retains two diagonal-motion subtypes, shima_ul and shima_ur, survive in a comment block (:245-275), driving X and Y together from direc−$40. Neither is in the shipped subtype table (:117-131).

Earlier switch and door

  • The unused switch, Obj1D (SWITCH.ASM, the disassembly’s MagicSwitch), writes a single word, switchflag. Its partner door is after DOOR.ASM’s end (:269-321): it rises up to $20 pixels while switchflag is non-zero. Later switches use sixteen per-switch flag bytes instead. TURI.ASM:181 shows the transition, keeping * tst.w switchflag as the old line above the indexed byte test.
  • The old solid-wall routine in DOOR.ASM (atarichksub, the disassembly’s Obj44_SolidWall) also crush-killed Sonic: pushed more than 22 pixels inside a wall, or pinned vertically with zero Y speed, he went to playdieset (KillSonic). Those lines are commented out (DOOR.ASM:156-159, :195, :204-209).

Bridge-sag table generator

  • After HASHI.ASM’s end (:483-508) sits haship, a little program that computes the bridge’s bend table with sinset (the disassembly’s CalcSine), writes it to $FF0000/$FF0200, and then loops forever (?jump: nop / bra ?jump). It’s a run-once tool: run it on the ICE, read the table out of RAM. Its output matches the assembled hashitbl2, the disassembly’s Obj11_BendData2.

Earlier launcher behaviour

  • SHOOTER.ASM is the SBZ tube teleporter (Obj72), with earlier code that launched Sonic out of the tube. The commented-out ending of shootermove2 (:104-110) fires Sonic straight up (yspeed $800, or -$C00) and lets go. A commented timer ending (:166-170) pushes him left at -$200. After end (:304-392) are three earlier attempts at the speed routine, and all eight route tables keep their old start coordinates as * comments (:248-298).

Removed conveyor sound

  • In a comment block in BELTC.ASM (:148-159), every SBZ spin-conveyor platform played sound $BF every eight frames. The LZ conveyor platforms did the same (KASSYA.ASM:181-192). Both are silent in the shipped game, and in the final sound list $BF is sfx_Continue.
Conveyor sound ID
  • The repeated eight-frame trigger suggests that $BF may have been a machine hum before the sound IDs were reassigned. The roll sound shows the same renumbering.

Smaller object changes

Object Changes Where
Rotating junction (MAWARU) turned every 2 frames, now every 8: four times slower than first written MAWARU.ASM:133, move.b #08-1,pattim(a0) *#2-1
Vanishing platform (YUKAE) was a solid block (atariridesub, width ($20+22)/2) before it became a top-only platform post-end, YUKAE.ASM:155-160
Lamppost (SAVE) once counted lampposts up (* addq.b #1,plflag), now stores its subtype SAVE.ASM:151
Lamppost (SAVE) restores the ring count and 1-up flags, then clears both at once: an assembled dead store the disassembly keeps SAVE.ASM:177-179
Spikes (TOGE) once deleted on spawn (* bra.w frameout), and once used touch collision instead of being solid TOGE.ASM:19, :28-33
Lava Tag (YOGAN, Obj54) drew 4 corner markers in debug mode; the shipped mapping is empty YOGAN.ASM:376-391, :409-431

Bosses

Hittable prison-capsule centre

  • After MASIN.ASM’s end (:283-312) is masincenter, a hittable centre part for the prison capsule. Its height tracked its hit counter (colicnt − 8 added to its base Y, so it shifted a pixel per hit), and being hit played $AC, the boss-hit sound. On the eighth hit it unlocked the right edge of the screen (scralim_right = $1FBF) and set bossflag.
  • In the shipped code, masincenter is just an alias of masinbomb. But the init code still gives subtype 2 a collision type and eight hit points:
	cmpi.w	#2*4,d0			;userflagが2か??   is userflag 2??
	bne.b	?end
	move.b	#$6,colino(a0)		;userflagが2の場合。 when userflag is 2
	move.b	#8,colicnt(a0)
  • That’s MASIN.ASM:60-63, and it’s the collision setup the disassembly shows on Pri_Main without explanation, along with three identical Pri_Explosion index entries.
MASIN.ASM:68
  • The capsule’s own description: エネミー製造機, “enemy-making machine”.

Removed afterburner effect

  • Every Eggmobile boss, BOSS1 to BOSS5, carries the same seven commented-out lines at its re-ignition point (BOSS1.ASM:271-277 and the matching block in each of BOSS2–5):
;		jsr	actwkchk		;アフターバーナー   afterburner
  • They spawned a separate yarare2_act explosion at −34,+7 as an afterburner. It was replaced by flame frames on the ship itself, labelled ;追加のバックファイア, “additional backfire” (BOSS1.ASM:677-689, the disassembly’s .escapeflame). BOSS1.ASM:596-597 also shows that ship and pilot were once one sprite: the ship mapping still has Eggman’s two head pieces, commented out.

Labyrinth boss flame and face checks

  • Two code slips in BOSS2.ASM survive into the ROM.
Unreachable flame code and incorrect face-state check
  • The flame. In bossfire, the “show the moving flame” block sits behind a ?pass label that nothing branches to (BOSS2.ASM:429-432): So the LZ ship never shows its moving flame. The disassembly keeps the bytes, unlabelled, after BossLabyrinth_FlameMain.
	bra.s	?jump
?pass:
	tst.w	xspeed(a1)	;横に移動しないときは、  when not moving sideways,
	beq.b	?jump		;出さない。              don't show it.
	move.b	#08,mstno(a0)
  • The face. bossoyaji picks Eggman’s expression from the body’s state (r_no1(a1)), but tests bomb_flag(a0), the face object’s own field (BOSS2.ASM:385). Only the body sets that flag, so the charred-Eggman face (;黒こげエッグマン, :387) can never appear on this boss. The disassembly has it as tst.b objoff_3D(a0), unflagged.
  • BOSS3.ASM:256 has a smaller one: lsr.b #07,d1 ;get 00 or 01 computes a random bit for the MZ boss’s lava fireballs and throws it away, because the next line writes $00FF to userflag(a1).

Final Zone plasma position patterns

  • The FZ plasma launcher (B7ETC.ASM, the disassembly’s BossPlasma) once fired at fixed positions. A commented table, ?positbl, headed ;12 箇所 (“12 places”), lists four patterns A–D of four X positions each (B7ETC.ASM:509-514). It was replaced by a random spread, muls #-79,d1 (:491), with an even older lsl.w #6 / neg.w beside it (:492-493).
Unused plasma-table indexing
		add.w	index(a0),d0	;
		andi.w	#$1e,d0		;4飛び   steps of 4
;		lea	?positbl(pc),a2
		adda.w	d0,a2
		addq.w	#04,index(a0)
  • B7ETC.ASM:463-468. The lea that loaded the table is commented out, but the arithmetic that indexed it still runs, and a2 is never read again. The disassembly keeps these lines unexplained (86 FZ Plasma Ball Launcher.asm:73-76). The launcher’s contact damage, ; move.b #$80+11,colino(a0), was also cut (:416).
  • BOSS7.ASM:499 has one more small cut: * move.b #07,mstno+actwk00 ;上を見る, “look up”, which made Sonic look up at the end of the fight. It was replaced by a simulated Up press.

Object messages: “SP”, “SW”, “GO”

  • Boss objects communicate with their component objects by writing two ASCII characters into userflag:
Word Where Meaning
"SP" BOSS4.ASM:639, :668, :842 split: a SLZ spikeball should burst into four mini-balls
"SW" BOSS6.ASM:158 ;スイッチにスイッチ(??), “switch to the switch (??)”: Eggman has jumped onto the SBZ2 switch
"GO" BOSS6 ;落ちろ!!, “fall!!”: tells the floor to crumble
  • "SW" and "GO" assemble as expected, to $5357 and $474F.
Assembled value of “SP”
  • In the REV01 ROM, the "SP" write assembles to $0020 (317C 0020 0028 at $195CC; the tree’s own AC.S28 agrees). Nothing in the tree defines a symbol SP. It’s harmless, because the writer and the tester use the same expression and agree on the value.
Possible explanation for $0020
  • The likeliest explanation is that x68k parses SP (the stack-pointer register name) as something other than two characters inside a string constant. There’s no documentation in the tree to confirm it.

Removed object placements

  • The object-placement files keep a few entries commented out, absent from both retail revisions:
Zone Description Where
SBZ1 a Giant Ring after the goal ZONE6ACT.LIB:935-937
SBZ2 a Giant Ring and five hidden bonuses around the signpost (the signpost itself stays) ZONE6ACT.LIB:1829-1849
GHZ2 two platforms ZONE1ACT.LIB:1330-1347
LZ1 a spike ZONE2ACT.LIB:307

Monitor IDs with barrier subtypes

  • ZONE6ACT.LIB:1093-1371 has ten SBZ2 entries commented ;scoli (the invisible solid barrier) but coded item_act+sflag,$11..$17. Those subtypes are exactly scoli’s size codes, $11, $13, $15 and $17, and far beyond Ani_Monitor’s ten entries. They’re in the retail placement, too: objpos/sbz2.bin has 04f0 03d0 a6 15 and friends.
Untested
  • Barrier size codes typed onto a monitor ID look like a copy-and-edit slip. What these ten objects actually do in-game hasn’t been checked.

BUTA.ASM and bakuha

  • BUTA.ASM:1–15 defines and exports bakuha. Its header contains no Japanese:
	.public	buta,bbomb,bakuha,yarare,butapat,yarare2
	.extern	actionsub,frameout,speedset,speedset2,fcol,patchg,jumpcolchk
	.extern	actwkchk,emycol_d,soundset,random,frameoutchk
buta_time	equ	$30
buta_flag	equ	$32
bbomb_time	equ	$30
emytensuu	equ	$3e
  • bakuha is live code (:145-174), object $24 (bakuha_act), the disassembly’s MissileDissolve. The cannonball once turned into it (move.b #bakuha_act,actno(a0), now a dead store at :126), the Buzz Bomber missile still branches to it, and the old Ball Hog PLC after DEVTBL.ASM’s end loads its art bakuhacg at the tile bakuha still uses. Nothing in the source places the Ball Hog in Green Hill: buta_act appears only in ZONE6ACT.LIB.

SWITCH, SWITCH2 and FHOLE

  • switch_act equ 29 ($1D) is SWITCH.ASM, and switch2_act equ 50 ($32) is the shipped button. SWITCH.ASM sinks 2 pixels and writes 1 to the word switchflag. Its only reader is the old door after DOOR.ASM’s end, which rises $20 pixels while the flag is set. Nothing in the source names Green Hill; that part is inference from the art offsets and the date.
  • FHOLE.ASM isn’t part of the mechanism (it never reads switchflag), but it shares code and formatting with it. It was saved three minutes after SWITCH.ASM on 1990-11-30, and it shares SWITCH’s template line for line: the same .extern actionsub,actwkchk,rideonchk_h,ridechk,rideplayset2 (:8 in SWITCH.ASM, FHOLE.ASM and DOOR.ASM), and the post-end door opens with SWITCH’s yposi_m equ $30 / * globals on. So the door was probably written in the same session and pasted into DOOR.ASM later (inference).

Fourth power-up flag

  • plpower_a equ ramfe+$2f ;1: player power akuarangu (EQU.LIB:792): the aqualung. It’s cleared at level start (GAME.ASM:194, ENDING.ASM:97) and never set or tested. The “goggles” is the same item: monitor type 8 is *akuarangu (ITEM.ASM:368), and its icon frame is ; MIZU, “water”.

Unused goggle variables

  • The flag, the monitor slot and its icon, and a line in the to-do list (SONIC.DOC:9, アクアラングの処理, “aqualung handling”). There’s no effect code anywhere, live or commented: the monitor’s case is the shared rts (ITEM.ASM:295-296), and the air countdown in PLAYSUB.ASM never tests plpower_a. The Pow_ChkGoggles lines in the disassembly’s monitor file, with their “uncomment these lines” note, are the disassembly’s suggestion, not original code.

hedcolchk

  • Its header says what it was for (PLAYER.ASM:692): “check whether the player’s head is blocked”. It was called from the walk routine between limitchk and speedset2, until the call was commented out (:233). On ground within 45° of flat it probes the ceiling; on a hit it zeroes all three speeds and sets animation 11.
  • Animation 11 in the shipped table is ;ball baund at 90° (frame 53), which is why the disassembly’s version says “use warping animation”. In the old table after end, the head-bump pose ;hed col stop is ID 16, not 11, so the routine either was written for the new numbering or kept a stale ID (inference). And SONIC.DOC:11-12 lists “player hitting a narrow space” and “not returning to normal in a narrow space” as work to do. hedcolchk and the 6-pixel headroom checks in jumpchk fit that description (inference).

roll-jump lock

  • The nops replaced two commented lines, * move.w #0,xspeed(a0) and * asr.w xspeed(a0) (PLAYER.ASM:1254-1258): landing from a roll-jump once stopped Sonic, and at another time halved his speed.
  • Every use of the flag. cd_ballj equ 4, commented ball jump (EQU.LIB:127), is the only comment on it.
Lines Description
PLAYER.ASM:879 Set by jumpchk, only if Sonic is already rolling.
:638 jumpmove skips all left/right input while it’s set. Air drag still runs.
:1252 jumpcolsub tests it on landing (the nops).
:1262, AWA.ASM:110, BOBIN.ASM:49 Cleared on landing, by an air bubble and by a bumper.
:757-758, :853-861, :1030 Commented out: no rolling while set; an older jump that set it while un-curling Sonic.
  • jumpmove clamps to plmaxspdwk whenever a direction is held (:655-657), while a roll allows up to $1000 (:588-594). Without the lock, holding forward in a fast roll-jump would snap the speed back to $600. No comment gives the reason, though, and three details suggest that the lock was intended to commit Sonic to the roll-jump, with avoidance of the speed cap as an additional effect (inference). Ordinary jumps faster than $600 get no lock. The flag was first set on a jump that uncurled Sonic. And the old landing penalty is inconsistent with preserving roll momentum as the sole purpose.

Sonic’s unused frames

  • The animation table names them all (PLAYER.ASM:1982-2121):
Disassembly Original Frames Meaning
SonAni_Surf plchg20 ;sukebo 73 skateboard (スケボー)
SonAni_Burnt plchg22 ;fire damage 75 fire damage: the charred pose
SonAni_Warp1–4 plchg09–12 ;ball baund 51–54 “rolling bounce”, 0°/45°/90°/135°
(fr_BubStand) commented 74,-1 in GetAir 74 the old “breathing in” pose
  • PLAY.TST, the October 1990 spec, lists the fire damage as frame 75 followed by the death fall, 78–82. No code, live or commented, ever sets animation 20 or 22.
  • The breath-holding art (mogakicg, もがき “struggling”) had a display path that can be pieced together. Its PLC loaded it at VRAM $440 (commented out, DEVTBL.ASM:210); the air-countdown object uses plawapat with sproffset #$0440 (PLAYSUB.ASM:49-51); plawapat is one 32×24 piece just above the object’s origin (:421-427); and commented code at PLAYSUB.ASM:329-338 put that object on Sonic and showed it while pl_air was below 30. pl_air starts at 30 (GAME.ASM:94), counts down once a second underwater (PLAYSUB.ASM:212) and is reset to 30 on a breath (:361). So the overlay showed on Sonic’s upper body from his first second underwater until he got air (inference about the art’s exact use).

masincenter

  • The live labels (MASIN.ASM:112-113) are bare aliases that fall through to masinbomb, and the bodies sit after the file’s end (:283-320). masincenter was a hittable centre part: it rose a pixel per hit as colicnt counted down from 8, played $AC, and when the hits ran out (COLI.ASM:179-182 sets cd_die) it unlocked the right edge of the screen and set bossflag. masincenter2 played animation 1 while bossflag was clear. The live jump-table comments still read “the following three are identical” and “make the machine explode”.
  • The move is older than the prototype. Its capsule already points table entries 3, 4 and 5 at masinbomb, with no hittable centre.

BALL.ASM

  • A rolling boulder: Sonic could push it or stand on it, and it rolled down slopes. BALL.ASM keeps three versions of it, one commented out and two after end, while the live object is a bare rts. SONIC.DOC lists “ball movement” under zone 1 as unfinished work.
  • The prototype’s ball is Version C, the latest one, from the comment block at BALL.ASM:18-219, instruction for instruction. It has the same five routines, solidity through atariridesub, and the hurt collision already commented out. Its mappings are byte-identical to the final’s Map_GBall. So the prototype has no extra ball code: the tree has everything it runs, and two older versions besides.

Nop in LZSlide_Move

  • No comment survives. The original, mizucoli, keeps older slide-chunk tables commented out beneath it, and the nop is most likely a swapped-out rts that once kept the table’s first three chunks from steering Sonic (inference).

helix’s status byte

  • THASHI.ASM:36 writes move.b #cd_die,cddat(a0): the bit number 7 is used as a byte value. A bset would set bit 7 and prevent Sonic’s balance check from making him teeter on the formerly rideable, 16-pixel-wide helix. This suggests an instruction error; the source does not state the intent.

missile’s dissolve

  • Bit 7 is cd_die, and the dissolve is bakuha. The missile’s “hurts Sonic” collision type never reaches any code that sets cd_die, in the final or in the prototype. The branch is a leftover from a time when the missile could be shot down (inference).

Flashing button

  • No surviving placement enables the button’s flashing subtype bit 5. ZONEnACT.LIB uses subtypes $00–$0F, $80 and $85; debug lists use $00. The blink stops when pressed, suggesting a “press me” indicator. Its art would display correctly in SYZ and SBZ, but not LZ.

Old star trail

  • The earlier invincibility-star trail remains assembled but is skipped by a bra at PLAYSUB.ASM:476. Its length is two-thirds that of the replacement trail.

brick’s $5C0

  • The field is yposi_mm, a lowest Y. A commented-out clamp in the falling routine once stopped the brick at Y $5C0; the shipped brick stops on lava blocks instead.

Basaran’s dead code

  • In this disassembly it’s the block marked ; unused crap after .chkdistance. In the original it’s batdie, the bat’s old “fly off and delete” routine, dropped from its jump table.

junction’s timer

  • It’s mawaru_timer, set to one second and never read, with no comment. The original field names do correct one disassembly name: jun_frame is really the rotation direction.