This skill is primarily about debugging programs with VICE, not just launching them.
Use this skill when you need to:
.prg, .d64, .g64, .tap, or cartridge image in VICEIf the user asks to “debug the assembly,” “trace startup,” “find where banking breaks,” or “step through a PRG,” this is the first skill to load.
For C64 work, prefer:
x64sc — accurate C64 emulator with cycle-based and pixel-accurate VIC-II emulationThe VICE manual notes that:
x64 was the older fast emulatorx64sc is the accurate emulator and the default choice for serious debuggingUseful companion tools in the VICE package:
c1541 — disk image toolpetcat — BASIC tokenization/detokenization toolcartconv — cartridge image conversionvsid — SID playerThe VICE manual documents two equivalent ways to autostart:
x64sc mydisk.d64
x64sc -autostart myprog.prg
You can also select a named file inside an image:
x64sc "demo.d64:loader"
x64sc -autostart "demo.d64:loader"
Helpful options for agent workflows:
-autostart-warp
-autostart-handle-tde
-basicload
+basicload
Notes from the manual:
-autostart-warp temporarily enables warp mode during autostart-autostart-handle-tde lets VICE temporarily manage True Drive Emulation during autostart.prg/P00 files, VICE loads the file and then restores the previous autostart settingsVICE supports three monitor-related workflows that are useful for agents:
-nativemonitor
+nativemonitor
When enabled, the monitor runs in the spawning terminal instead of only inside the emulator UI.
-remotemonitor
-remotemonitoraddress ip4://127.0.0.1:6510
This enables the text-based remote monitor server.
-binarymonitor
-binarymonitoraddress ip4://127.0.0.1:6502
This enables the binary monitor protocol used by automation tools and external debuggers.
For agent-driven debugging, prefer launching VICE with:
x64sc -autostart c64os.prg -autostart-warp -nativemonitor -keepmonopen -refreshonbreak
Useful companion options from the manual:
-monlog
-monlogname vice-monitor.log
These make the monitor visible in the terminal, keep it open after continuing, refresh screen state on breaks, and optionally log monitor output.
These monitor commands are the most useful for day-to-day program debugging:
| Command | Meaning |
|---|---|
x / exit |
Leave the monitor and resume execution |
q / quit |
Exit VICE |
r / registers |
Show or modify registers |
reset [type] |
Reset the machine or drive |
goto <address> |
Set the program counter |
next [count] |
Step over instructions |
step [count] |
Step into instructions |
return |
Run until the next RTS or RTI |
until <address> |
Run until an address is reached, then break |
bt / backtrace |
Show the JSR call chain |
m <range> |
Show memory |
i <range> |
Show memory as PETSCII |
d <range> |
Disassemble |
io [address] |
Inspect I/O registers or a chip block |
break exec $addr |
Break on execution |
watch store $addr |
Break when an address is written |
trace exec $addr1 $addr2 |
Trace execution without stopping |
bank |
Show/select banks |
device c: / 8: |
Switch computer vs drive address space |
sidefx off |
Prevent monitor reads from causing hardware side effects |
keybuf "text\x0d" |
Feed characters into the keyboard buffer |
playback "file" |
Execute commands from a monitor script |
record "file" |
Record monitor commands for replay |
Examples:
break exec $0810
watch store $0001
d $0810 $0840
m $0000 $0002
bt
return
Conditional checkpoints are supported. The manual documents register-based conditions and raster-aware conditions such as RL and CY.
VICE supports several complementary debugging styles:
Use when you care about where execution reaches:
break exec $0810
until $0930
Use when you care about what wrote or read a memory location:
watch store $0001
watch load $dc0d
For C64 debugging, watchpoints are especially useful for:
$0001 — memory banking changes$0314/$0315 — IRQ vector changes$d020/$d021 — border/background color debugging$0400-$07e7 — screen RAM writes$d800-$dbe7 — color RAM writesUse when you need a non-stopping execution log:
trace exec $0810 $08ff
The VICE manual supports conditions using registers, arithmetic, boolean operators, raster line RL, cycle CY, and bank-qualified memory references.
Examples:
break exec $0810 if A == $00
break load 0 $ffff if @cpu:(pc - $1) == $37
The monitor can attach commands to checkpoints:
command 2 "m $0000 $0002"
ignore 2 1
disable 1
enable 1
This is useful when you want an automatic memory dump the first time a watchpoint hits.
Use these commands intentionally:
step for stepping into a subroutinenext for stepping over a subroutinereturn for stepping out of the current subroutineuntil <address> to run quickly to a known targetbacktrace to recover the call chain after a breakRecommended sequence for a new bug:
d the nearby coder to inspect registersstep or next depending on whether you need to enter subroutinesbacktrace if you need to know how execution reached the current pointThe monitor manual explicitly documents side-effectful reads.
For C64 work:
sidefx offdevice c: for the main machine and device 8: when debugging a true-emulated drive CPUbank if you need to inspect the CPU-visible versus I/O-visible memory viewio $d000, io $d400, io $dc00, or io $dd00 when you want chip-level register contextVICE can execute a command file from inside the monitor, and can also record command sequences:
playback "examples/vice-monitor-c64os.txt"
record "my-session.txt"
This is the easiest way for an agent to set up a repeatable debug session.
In this repository, prefer:
examples/vice-monitor-c64os.txt for startup and banking inspectionexamples/vice-monitor-c64os-debug.txt for a fuller debugging session with labels, checkpoints, and keyboard injection-nativemonitor -keepmonopen -refreshonbreakbreak exec $0810d $0801 $0840step through startup or next over known KERNAL callswatch store $0001command <n> "m $0000 $0002" to dump the port state when it hitsbank and io to inspect what memory view is activekeybuf "help\x0d" to push test input into the keyboard bufferi on the input buffer to inspect PETSCII textwatch store $0314 $0315watch store $0318 $0319bt and d when the watchpoint hitsio $dc00 and io $d000VICE snapshots save the complete emulator state, including memory configuration and optionally attached drives.
Use snapshots for:
Do not use snapshots for:
The VICE manual explicitly warns that snapshot compatibility is not reliable across versions.
For this repository:
build.batc64os.prg with x64sc -autostart c64os.prg -autostart-warp -nativemonitor -keepmonopen -refreshonbreakplayback "examples/vice-monitor-c64os-debug.txt" for an immediate debug setupwatch store $0001 to confirm banking writesstep, next, return, and backtrace to narrow the failing routinex64sc is the preferred accurate emulator; do not default to the older x64sidefx offstep, next, and return can waste a lot of time in KERNAL codedevice 8: vs device c: can make you debug the wrong CPU when true drive emulation is involvedPowered by TurnKey Linux.