Wireframe 3-D Solid

Physics & Simulation

A spinning polyhedron drawn live on the Super Nintendo — tetrahedron, cube, octahedron, icosahedron. Each frame builds a 3×3 rotation matrix (three Q8.8 matrix multiplies), projects every vertex through a perspective divide, and connects the edges with integer Bresenham lines into a 2bpp bitmap canvas. Written in C and compiled to a real .sfc ROM with the llvm-mos-based 65816 toolchain (+mos-a16 16-bit accumulator). Demo #16 of the compiler stress-test battery.

loading core…

/ spin Y · / spin X · Q/W dolly · X/A solid · S palette · Shift trail · Enter reset

Click the screen, then play. Switch solids with X/A; toggle trail mode with Shift.

Controls

KeysAction
↑ / ↓Speed Y-axis + / −
← / →Speed X-axis + / −
Q / WDolly distance − / +
A / XPrevious / next solid (tetra → cube → octa → icosa)
SCycle palette
ShiftToggle trail / crisp
EnterReset

The four solids

Cycle them with A (previous) / X (next). Each has its own vertex count and edge table — the icosahedron has 30 edges to draw per frame.

SolidWhat it is
TETRA4 faces, 4 vertices, 6 edges — the simplest solid
CUBE6 faces, 8 vertices, 12 edges — a plain box in 3-D
OCTA8 faces, 6 vertices, 12 edges — two square pyramids joined
ICOSA20 faces, 12 vertices, 30 edges — the most complex

Rendering modes

Shift toggles between two modes shown in the top-right HUD:

Tips

Written in C with an LLVM/65816 SNES toolchain. The 3-D math — matrix multiply + perspective divide — runs identically on the host oracle and all three compiler modes, verified against MAME and bsnes-jg. Hit Verify fidelity to reproduce the build gate's WRAM assert (3-D math hash 0xEF8E) live in this tab. No far pointers, so the same program is checked five ways: host == default == +mos-a16 == +mos-xy16.