Mode 7 Mandelbrot
FractalsA 64×56 fixed-point Mandelbrot, computed live on the 65816 and revealed through
Mode 7 — written in C and compiled to a real .sfc ROM with the
llvm-mos-based 65816 toolchain. Every
pixel round-trips through a 24-bit far pointer into high WRAM ($7E2000),
the broadest single codegen exercise the publish gate runs.
Self-running — the fractal reveals coarse-to-fine, then spins and zooms.
Click the screen, then play. (Tab away and it pauses.)
What it is
The escape-time computation runs entirely on the 65816; the finished 64×56 grid lives
in a high-WRAM buffer reached only through far (24-bit) pointers — a feature that
requires +mos-a16, the 16-bit-accumulator target this compiler adds. A 4×
affine matrix magnifies the grid to fill the screen, then animates a spin/zoom.
#321 — the canonical codegen tester
| Item | What it exercises |
|---|---|
| far pointers (#320/#321) | The 65816 computes the fractal and FAR-STORES every pixel into a high-WRAM escape buffer at $7E2000 (sta [dp]) — a 24-bit far pointer, only legal under +mos-a16 — then FAR-LOADS it back (lda [dp]) both to upload each line to Mode 7 character VRAM and to CRC the finished image. This is the broadest single codegen exercise the toolchain’s publish gate runs. |
| 64×56, N=15 | The escape-time grid is 64×56 pixels, 15 iterations max (15 = interior = black). A 4× affine matrix magnifies it to exactly fill the 256×224 Mode 7 screen, then spins and zooms it. |
| revealed during vblank | Each coarse refresh is one Mode 7 tile-row (8 image rows = a contiguous 512-byte character region) — a 512-byte WRAM→VRAM DMA fits comfortably inside one vblank, so the picture fills in and later sharpens with no force-blank flash. |
| result: correct | corpus_result (the finished-image CRC) matches the host reference tools/mandel-render 64 56 15 exactly — host == +mos-a16 on MAME and bsnes-jg, -verify-machineinstrs clean. |
Written in C with the llvm-mos 65816 toolchain and verified against bsnes-jg and MAME.
Hit Verify fidelity to reproduce the build gate's WRAM assert
(image CRC 0x204F) live in this tab.
host == +mos-a16 on MAME and bsnes-jg, -verify clean.