No description
  • Rust 91.8%
  • Assembly 6.5%
  • Python 1%
  • CSS 0.7%
Find a file
Jimmy Berglund a0c6b9a655
Core: PRNG returns the top 16 bits and mixes the seed
SYS_RAND took bits 16-31 of its 64-bit LCG state, so only the low 32
bits mattered (period 2^32) and the low output bits, which `random`
reduces with MOD, had periods as short as 2^17. It now returns
state >> 48.

SYS_SRAND passes the seed through splitmix64's finalizer, so nearby
seeds such as frame counts no longer give evenly spaced first values.
mix(0) = 0, so the power-on sequence is unchanged. SPEC documents the
algorithm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 13:49:11 +01:00
.cargo Add the video chip, emulator window and parallax demo 2026-11-14 16:38:02 +01:00
assembler Canvas library and drawing examples; drop the Cove comparison 2026-11-14 21:29:04 +01:00
core Core: PRNG returns the top 16 bits and mixes the seed 2026-11-21 13:49:11 +01:00
docs Core: PRNG returns the top 16 bits and mixes the seed 2026-11-21 13:49:11 +01:00
emulator Scripts: labels and .equ constants as values 2026-11-20 14:29:39 +01:00
examples Canvas library and drawing examples; drop the Cove comparison 2026-11-14 21:29:04 +01:00
lib Canvas library and drawing examples; drop the Cove comparison 2026-11-14 21:29:04 +01:00
tools scove-manual: PDF outline of every heading 2026-11-15 15:36:30 +01:00
.gitignore Fork Cove core and assembler as starting point 2026-11-14 15:53:09 +01:00
Cargo.lock scove-manual: page numbers in the table of contents 2026-11-14 21:10:02 +01:00
Cargo.toml Add .scove.png cartridges, save RAM persistence and asset tools 2026-11-14 18:04:57 +01:00
README.md Scripts: poke, ranges for peek/expect, CPU stats, isolated saves, label offsets 2026-11-20 14:24:14 +01:00

Super Cove

Super Cove logo

A 16-bit fantasy console in the SNES class, written in Rust. The successor to Cove: same spirit (real assembly, a machine you can understand completely), much bigger machine.

  • CPU: Cove's instruction set, extended: carry chains, signed / high / 8.8 fixed-point multiply, signed divide, rotates, auto-index loads and stores, DJNZ, signed and unsigned branches, far calls. 2.5 MHz.
  • Memory: 4 MB of banked ROM, 148 KB of RAM, 32 KB of battery-backed save RAM.
  • Video: 256×224, 256 colours from 24-bit RGB. Four scrolling tile layers or a Mode 7–style affine layer, 128 scalable sprites, windows, colour math, mosaic.
  • Raster effects in four tiers, from "never think about scanlines" to cycle-exact: frame-committed registers, per-line tables, HDMA, and line interrupts with a stable raster.
  • Audio: 8 channels of synth waves or samples, ADSR, pan, echo.
  • DMA with a vblank queue.

The manual teaches the machine, from a first program to raster effects, and is the reference (PDF for printing). The design behind it is in docs/SPEC.md.

Quick start

cargo build --release
cargo run --release -p assembler -- examples/hello.asm -o hello.bin -s hello.sym
cargo run --release -p emulator -- hello.bin

examples/hello.asm is the starting point: a complete program on the SDK in about 60 lines. Then try examples/parallax.asm (arrow keys move, Z runs, X shows the X-ray spotlight), examples/mode7.asm (drive with the arrows), examples/shapes.asm (lines, rectangles and circles) and examples/music.asm.

Keyboard as controller 1: arrows = D-pad, Z / X / A / S = south / east / west / north, Q / W = L1 / R1, Enter = Start, Right Shift = Select. Gamepads work too. Close the window to quit.

Tools

Command What it does
assembler game.asm -o game.bin -s game.sym Assemble. .include, .incbin, macros, local labels (.loop), .bank / .ram sections, bank(label), FARCALL.
scove game.bin Run in a window (also game.scove.png).
scove game.bin --debug Run with the debugger: F12 or Pause, a breakpoint or BRK stops into a REPL in the terminal.
scove game.bin --frames 120 --png shot.png [--wav sound.wav] [--hold right,south] Run headless, save the picture (and sound), optionally holding pad buttons.
scove game.bin --script test.scv [--sav start.sav] Run a test script headless: pad 1 and 2, keyboard and mouse input on given frames, memory pokes, peeks and checks, screenshots, CPU use. Never touches the game's save. Exit code 1 if a check fails.
png2tiles art.png -o assets/art [--bpp 4|8] [--cell 16x16] [--map] PNG → tiles, palette and map for .incbin.
scove-pack game.bin -o game.scove.png --title "My Game" [--label art.png] Make a cartridge: a PNG that is also the game, with its save data inside.
scove-manual docs/MANUAL.md -o docs/MANUAL.pdf Print the manual to an A4 PDF (needs Chromium or Chrome; -o x.html for HTML).

Run the binaries with cargo run --release -p <crate> --bin <name> -- … (assembler, emulator → scove, tools → png2tiles / scove-pack / scove-manual), or put target/release on your PATH.

Debugger

With --debug, symbols load from the .sym next to the ROM. In the REPL, h lists everything; the main commands:

c            continue              s [n]   step          n        step over a call
f [n]        run frames            l LINE  run to a line r        registers
b LABEL      breakpoint            bl / bd list / delete d [ADDR] disassemble
m ADDR [LEN] memory                bt      backtrace     set REG VALUE
video        live video state      oam     sprites       log [all] who wrote which
                                                                   register on which line
shot / tiles / pal / layer FILE.png        pictures of the screen, VRAM, palette, a layer
overlay FILE.png   the frame in the beam area, with where each register write landed

Layout

Crate
core The machine: CPU, bus and banking, master clock, video, audio, DMA, cartridge format, disassembler. No I/O.
assembler The assembler.
emulator scove: SDL window, audio, input, save files, debugger.
tools png2tiles, scove-pack, scove-manual; logo.py draws the logo.
lib The SDK: sdk.asm (one include: names, text, font, drawing, macros and routines), hw.asm (register names only), text.asm, font.asm, canvas.asm.

cargo test runs about 400 unit and end-to-end tests, including the examples.