Spirograph

Motion & Curves

The curve a pen traces through a hole in a small gear rolling inside a ring — a hypotrochoid — drawn live on the Super Nintendo and driven with the joypad. Written in C and compiled to a real .sfc ROM with the llvm-mos-based 65816 toolchain (16-bit accumulator, +mos-a16). Each point is a sin/cos lookup plus two fixed-point multiplies; the figure blooms stroke-by-stroke into a bitmap canvas in WRAM. Cycle through four curve families — hypotrochoid, epitrochoid, rose and Lissajous.

loading core…

/ ring · / wheel · Q/W pen · X/A family · Shift preset · Enter reset

Click the screen, then play. The rose draws itself in over a second or two; change a dial and it re-blooms — tab away and it pauses.

Controls

KeysAction
↑ / ↓Ring radius R + / −
← / →Wheel radius r − / +
Q / WPen offset d − / +
X / ANext / previous curve family
ShiftCycle gear preset
EnterReset

The four curve families

Cycle them with X (next) / A (previous) — each re-blooms the canvas. The on-screen HUD shows the live R (ring), W (wheel), D (pen) and the petal count.

FamilyWhat it is
HYPOTROCHOIDpen inside the wheel as it rolls inside the ring — the classic rosette
EPITROCHOIDwheel rolls outside the ring — a ring of interlocking loops
ROSErhodonea ρ = cos(kθ) — a k-petalled flower
LISSAJOUSx = sin(aθ+δ), y = sin(bθ) — the crossing-wave figure

Tips

Written in C with an LLVM/65816 SNES toolchain and verified pixel-for-pixel against two emulators (MAME + bsnes-jg). The player above is that exact cycle-accurate core — hit Verify fidelity to reproduce the build gate's WRAM assert (curve-math hash 0x32D4) live in this tab. No far pointers, so the same program is checked five ways: host == default == +mos-a16 == +mos-xy16.