diff --git a/AGENTS.md b/AGENTS.md index 5cf961d..ebf4462 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -3,7 +3,7 @@ > **Assembled by a collective of 150 expert Commodore 64 developers.** > This file is the primary reference for AI agents assisting with Commodore 64 application development. > Core C64 platform knowledge is sourced from canonical reference books (see Sources below). -> Supplemental modern emulator workflow guidance is included for **VICE 3.10** from `C:\Program Files\GTK3VICE-3.10-win64\doc\vice.txt`. +> Supplemental modern emulator workflow guidance is included for **VICE 3.10** from the manual installed as `C:\Program Files\GTK3VICE-3.10-win64\doc\vice.pdf` (copy kept at `reference/vice.pdf`). --- @@ -39,17 +39,34 @@ This repository contains structured skills and reference material for developing | `reference/cia-registers.md` | CIA 6526 register map | | `reference/disk-dos-commands.md` | 1541 DOS command reference | | `reference/vice-usage.md` | VICE 3.10 emulator, monitor, autostart, and automation reference | +| `reference/vice.pdf` | VICE 3.10 manual as shipped with the emulator | +| `reference/POWERc.d81` | Power C compiler, libraries, and headers (copy before writing to it) | +| `reference/Power_C_Instruction_Manual.pdf` | Power C Instruction Manual (Spinnaker, 1986) | ### Example Programs | File | Description | |------|-------------| | `examples/hello-world.asm` | Minimal 6510 assembly hello world | +| `examples/bitmap-demo.asm` | Hi-res 320×200 bitmap mode: draws a diagonal line, key returns to text mode | | `examples/sprite-demo.bas` | BASIC sprite programming demo | +| `examples/sprite-music-demo.bas` | Multicolor sprite moving to a SID bass line | | `examples/sound-demo.bas` | SID chip sound demo in BASIC | | `examples/disk-access.bas` | Sequential and relative file access | | `examples/irq-handler.asm` | Custom IRQ handler skeleton | | `examples/kernal-io.asm` | Using Kernal routines for I/O | +| `examples/moonlander.c` | Lunar Lander game in C (cc65), joystick control | +| `examples/moonlander.prg` | Built `moonlander.c` binary | +| `examples/moonlander-build.bat` | Build `moonlander.c` with `cl65`; `-run` also launches it | +| `examples/run.bat` | Rebuild if needed, then autostart `moonlander.prg` in VICE | +| `examples/linked-list-test.c` | `malloc`-backed linked list tests plus a heap capacity probe (cc65) | +| `examples/linked-list-test.prg` | Built `linked-list-test.c` binary | +| `examples/linked-list-test-build.bat` | Build `linked-list-test.c` with `cl65`; `-run` also launches it | +| `examples/powerc-hello.c` | Minimal Power C program; ASCII source converted to PETSCII for the disk | +| `examples/powerc-hello.d81` | Power C work disk with `hello.c` compiled, linked, and ready to run | +| `examples/powerc-work.d81` | Writable working copy of the Power C system disk | +| `examples/powerc-build.bat` | Run a Power C Shell command sequence on a work disk via `-keybuf` | +| `examples/powerc-ced.bat` | Boot the Power C system disk and enter the `ced` editor | | `examples/vice-autostart-c64os.bat` | Launch `c64os.prg` directly in `x64sc` | | `examples/vice-monitor-c64os.txt` | VICE monitor playback script for debugging `c64os.prg` | | `examples/vice-debug-c64os.bat` | Launch `c64os.prg` with VICE native monitor and debug-friendly options | @@ -194,7 +211,7 @@ This knowledge base was compiled from these canonical references: ### Supplemental Emulator Source -12. **VICE 3.10 Manual** — `C:\Program Files\GTK3VICE-3.10-win64\doc\vice.txt` +12. **VICE 3.10 Manual** — `C:\Program Files\GTK3VICE-3.10-win64\doc\vice.pdf` (copy: `reference/vice.pdf`) - Use for emulator operation, autostart behavior, monitor commands, snapshots, and automation interfaces --- diff --git a/examples/powerc-build.bat b/examples/powerc-build.bat index 2d52ee6..8a4d1bb 100644 --- a/examples/powerc-build.bat +++ b/examples/powerc-build.bat @@ -1,8 +1,10 @@ @echo off setlocal -REM Usage: powerc-build.bat "shell commands" (use \n for RETURN) +REM Usage: powerc-build.bat "shell commands" [disk.d81] (use \n for RETURN) set "VICE_EXE=C:\Program Files\GTK3VICE-3.10-win64\bin\x64sc.exe" set "D81=%~dp0powerc-work.d81" +REM Optional second argument selects another work disk image +if not "%~2"=="" set "D81=%~2" set "CMDS=%~1" if "%CMDS%"=="" set "CMDS=cc squares\n" "%VICE_EXE%" -8 "%D81%" -autostart "%D81%:shell" -autostart-warp -warp -keybuf "%CMDS%" diff --git a/examples/powerc-hello.c b/examples/powerc-hello.c new file mode 100644 index 0000000..4c0f709 --- /dev/null +++ b/examples/powerc-hello.c @@ -0,0 +1,42 @@ +/* powerc-hello.c - first program for Power C on the C64 + * + * Prints a small table and demonstrates 16-bit int wrap-around, + * so it exercises printf(), a counting loop and int arithmetic. + * + * Build on the Power C disk (examples/powerc-hello.d81 already holds + * the compiled result): + * + * cc hello.c + * link -s + * > hello.o + * > ^ (pull in stdlib.l + syslib.l) + * > (empty RETURN) + * output file name: hello + * + * This file is plain ASCII; Power C needs PETSCII source with CR line + * endings, so convert it before writing it to the image: + * + * c1541 powerc-hello.d81 -write hello.pet "hello.c,s" + * + * Then run it with -autostart "powerc-hello.d81:hello", or from BASIC: + * LOAD"HELLO",8 : RUN + */ + +#include + +main() +{ + int i, v; + + printf("power c on the c64\n"); + printf("==================\n\n"); + + for (i = 1; i <= 5; i++) { + v = i * i; + printf("%d squared is %d\n", i, v); + } + + v = 32767; + v = v + 1; + printf("\nint is 16-bit: 32767 + 1 = %d\n", v); +} diff --git a/examples/powerc-hello.d81 b/examples/powerc-hello.d81 new file mode 100644 index 0000000..5b210d9 Binary files /dev/null and b/examples/powerc-hello.d81 differ diff --git a/skills/graphics-vic2/SKILL.md b/skills/graphics-vic2/SKILL.md index 4192e21..4a5ef38 100644 --- a/skills/graphics-vic2/SKILL.md +++ b/skills/graphics-vic2/SKILL.md @@ -119,14 +119,14 @@ Bit 0 (unused) ``` Video matrix address = bits[7:4] × $0400 within the VIC-II bank -Character base = bits[3:1] × $0800 within the VIC-II bank +Character base = bits[3:1] × $0800 within the VIC-II bank (bit 0 is unused) | $D018 Value | Screen RAM | Character Set | |-------------|------------|---------------| -| $10 (default) | $0400 | $1000 (ROM chars via mirror) | -| $14 | $0400 | $1800 (ROM chars, inverted) | -| $18 | $0400 | $2000 (user char at $2000) | -| $15 | $0400 | $1400 (user chars at $1400 in Bank 0) | +| $15 (default) | $0400 | $1000 (character ROM via mirror) | +| $17 | $0400 | $1800 (upper half of character ROM, reversed chars) | +| $18 | $0400 | $2000 (user charset at $2000) | +| $10 | $0400 | $0000 (RAM, not the character ROM) | --- @@ -153,7 +153,7 @@ Character base = bits[3:1] × $0800 within the VIC-II bank - Each 8×8 cell has its own 2-color pair stored in screen RAM - Bitmap data location: bit 3 of $D018 × $2000 within VIC-II bank - $D018 = $18 → bitmap at $2000 (if screen at $0400) - - $D018 = $1A → bitmap at $4000 in Bank 0? No — bitmap bit is bit3 of high nybble + - $D018 = $08 → bitmap at $0000; in bitmap mode only bit 3 matters, so $1A and $3A also give $2000 - Screen RAM holds color pairs: high nybble = "0" pixel color, low nybble = "1" pixel color ### 5. Multicolor Bitmap Mode ($D011 bit 5 = 1, $D016 bit 4 = 1)