Mode 7 racing — an F-Zero-style mini game (#4, part 1).
A drivable race circuit on the Mode 7 plane. The car stays fixed near the bottom of the screen and the WORLD rotates and scrolls under it — the classic SNES racing camera: per frame, mode7SetAngle(heading) + mode7SetScroll/SetCenter follow the car's fixed-point position. This is also the per-frame dogfooding of the C-migrated mode7 module (C1 audit).
- D-pad left/right: steer — A: accelerate — B: brake
- Grass slows the car down; the red wall ring stops it.
The track is generated at build time (gen_track.py -> gfx4snes -M 7); collision reads a 128x128 class map (road/grass/wall, one byte per tile) through a far pointer — 16 KB of data deliberately outside bank $00 (see the bank $00 budget rules).
ROM mode: LoROM (project default).
- SNES Concepts
- The F-Zero camera: SetCenter(car) makes the car the rotation pivot, SetScroll places it low on screen, SetAngle spins the world opposite to the car's heading
- Fixed-point driving physics from the math module: velocity = fixMul(speed, fixSin/fixCos(heading)) — same 0-255 angle unit as mode7SetAngle, so heading feeds both directly
- Mode 7 VRAM interleave loaded with dmaCopyVramMode7(); OBJ tiles coexist at name base 3 (word $6000)
- A procedural 16x16 car sprite (4bpp planes built in C)
- What to Observe
- Boot on the start line. Hold A: the checker line recedes and the track streams under the car; steer through the chicane. Cutting the grass visibly slows you; the border wall is solid.
- Modules Used
- console, dma, background, sprite, math, input
- See also
- gen_track.py — the reproducible track generator
-
lib/source/mode7.c — the C Mode 7 module this game exercises