# C64 DevSetup A workbench for writing Commodore 64 and C128 software, set up for AI coding agents and the people working with them. One command builds a program, runs it headlessly in VICE, and prints what the C64 screen shows, so changes are checked on the (emulated) machine rather than assumed. ``` > c64 new invaders -Template c created projects\invaders from templates\c > c64 test projects/invaders built projects\invaders\build\invaders.prg $0801-$0B27 (807 bytes) +----------------------------------------+ |invaders | |READY TO GO | +----------------------------------------+ PASS invaders [d7ff, 3.1s] artifacts: projects\invaders\build\test\invaders ``` ## Requirements - Windows with [PowerShell 7](https://github.com/PowerShell/PowerShell) (`pwsh`) - [cc65](https://cc65.github.io/) (`cl65`, `ca65`, `ld65`) - [VICE 3.x](https://vice-emu.sourceforge.io/) (`x64sc`, `x128`, `c1541`, `petcat`), e.g. `winget install VICE-Team.VICE.GTK3` `c64 doctor` finds the tools on `PATH`, in Program Files, or in WinGet's package folder, and says what is missing. Set `C64_TOOLS_PATH` (semicolon-separated folders) to point it somewhere else. ## Commands | Command | Does | |---------|------| | `c64 doctor` | Check the toolchain | | `c64 new [-Template c\|asm\|basic]` | Create `projects/` with a passing self-test | | `c64 build ` | Build `.prg`, plus `.lbl` (VICE labels), `.map`, and optionally `.d64` | | `c64 run [-Monitor] [-FromDisk] [-Disk x.d64]` | Autostart in VICE | | `c64 test <...> [-Expect TEXT] [-Until label] [-AfterJiffies n] [-Keys "x\n"] [-Disk x.d64]` | Headless run: prints the screen, PASS/FAIL, exit code 0/1 | | `c64 mon "r" "m .label"` | Query a program started with `run -Monitor` | | `pwsh tools/regress.ps1` | Regression suite for templates, projects, and examples | A project is a folder with `c64project.json` (see `templates/`). Any single `.c`, `.s`, `.asm`, or `.bas` file also works as a target. ## Layout ``` AGENTS.md / CLAUDE.md agent entry point (CLAUDE.md includes AGENTS.md) c64.cmd command wrapper -> tools/c64.ps1 tools/ C64Tools.psm1 (build, run, test, monitor), c64.ps1, regress.ps1 lib/ c64test.h / c64test.inc: report test results via $D7FF templates/ c, asm, basic project skeletons projects/ new programs .claude/skills/ topic skills: c64-workflow, 6510-assembly, memory-map, graphics-vic2, sound-sid, interrupts, kernal-routines, disk-io-1541, basic-programming, compiler-design, vice-emulator, powerc reference/ register, opcode, Kernal, memory, DOS, and VICE references; Power C disk and manual; powerc-re/ (Power C improvements) examples/ single-file examples in BASIC, ca65, and cc65 C; Power C disks skirmish-game/ tactical game in ca65 assembly samples/ kernal-os-skeleton (OS shell), cc65-mouse-driver-demo vim/ vi clone (Power C on the C64, cc65 on the C128) newLang/ Nova128: OO language and on-machine compiler for the C128 ``` ## How testing works `c64 test` starts `x64sc` (or `x128`) minimized in warp mode, injects the program, and waits for a trigger: - **`$D7FF` store** (default): the program writes its result: 0 = pass, otherwise a failure code. `lib/c64test.h` and `lib/c64test.inc` wrap it; BASIC uses `POKE 55295,0`. On real hardware the store does nothing. - **`-Until