Critical bugs found by the parallel code review: 1. .attr tables were at $A000-$B388 — inside the BASIC ROM. The KERNAL LOAD routine doesn't toggle $01, so writes were silently dropped on real C64 hardware. Moved the screens region to $BC00-$D000 (5 KB always-RAM under the banked-out KERNAL and below the I/O area). 2. game_enter_draw() initialized draw_was_pressed[] to 0, so a player holding fire from WAIT into DRAW got an instant win with 0 reaction time. Now initialized from input_fire() so the current state is the baseline, not zero. 3. First-round WAIT was always 100 frames because audio_stop() wrote freq=0 to all 3 voices — $D41B stuck at 0 so the random was deterministic. audio_init() now sets voice 3's freq to 0xffff after audio_stop() so the oscillator is running from the first sample. 4. build.sh --kill pgrep regex was broken: 'x64sc?' matches 'x64s' or 'x64sc' but never 'x64', and the '+' is a regex quantifier not a literal. Fixed: x64(sc)? \\+confirmonexit. 5. -v and -p (or -V and -P) would both fire and launch two VICE processes. Added mutual-exclusion check. 6. c1541 exits 0 even on failure, so set -e couldn't catch a broken d64 build. Extracted build_d64() helper that verifies the PRG landed in the d64 via c1541 -list (in the interactive heredoc form, since the flag form doesn't work on this c1541 version). 7. Counter showed '000' for one frame before '001'. Init to 1 not 0 (GAME.md spec). Build script also now: - --kill removes stale vice.pid / vice.log - -p / -P kill any prior VICE before launching a new one - Has a clear error for -v + -p combination Also: KNOWN_ISSUES.md documents 3 deferred items (LZO-in-IRQ screen tearing, IRQ half of mmap_trampoline silently disabled, audio schedule 1 frame short per note in WIN/GAMEOVER) that require larger refactors to fix.
nyuller
A C64 programming project using Oscar64
as the cross-compiler. Oscar64 is checked in as a git submodule under
./oscar64/.
Layout
.
├── oscar64/ # Oscar64 cross-compiler (git submodule)
├── docs/c64/ # Low-level C64 reference (memory map, VIC, CIA, SID, …)
├── src/ # Your C code
│ ├── helloworld.c
│ └── build.sh # Compile + run helper
├── OSCAR64.md # Notes on the Oscar64 compiler internals
└── PROG_C64.md # Notes on programming the C64 hardware
First-time setup
# 1. Clone with submodules:
git clone --recurse-submodules <this-repo-url>
# Or, if you already cloned without --recurse-submodules:
git submodule update --init --recursive
Building
cd src
./build.sh # compile helloworld.c → src/build/helloworld.prg
./build.sh -e # run in oscar64's built-in emulator (headless, fast)
./build.sh -v # run in VICE x64 (interactive, needs a real display)
./build.sh -V # run in VICE x64sc (interactive, cycle-exact)
./build.sh -c # just compile
build.sh will build the oscar64 compiler automatically the first time
(it runs make -C make compiler inside ./oscar64/ if
./oscar64/bin/oscar64 doesn't exist yet).
Default test tool is the oscar64 built-in emulator (-e): it
runs headless, needs no ROMs, no display, and is fast. Every Verify
step in tasks.md uses this.
VICE 3.9 is installed at /usr/bin/ (x64, x64sc, x128,
xvic, xpet) and is available via -v / -V. It is a GUI
emulator and needs a real X11 / Wayland display to render — it
won't produce useful screenshots in this headless environment.
Use it from a real terminal session for interactive play-testing
and cycle-exact validation of raster IRQ and SID timing; don't
expect to script it.
Documentation
PROG_C64.md— how the C64 hardware actually works, from a low-level programming perspective. Start here if you want to understand what's going on under the hood.OSCAR64.md— how the Oscar64 compiler works internally, plus a C64- specific section on how to use it well (memory model, bank switching, raster IRQs, common mistakes).docs/c64/— downloaded reference material: the full Commodore 64 Programmer's Reference Guide text, Christian Bauer's canonical VIC-II paper, and per-chip reference notes.