Skip to content

Debugging

The VSCode debugger extension uses the Debug Adapter Protocol (DAP) over TCP to debug 6502 programs running in the Avalonia Desktop emulator.

For internals of the debug adapter library, see Highbyte.DotNet6502.DebugAdapter.

VSCode extension

Install the extension and learn how to use it from its documentation:

  • README.md — installation, quick start, features, launch configuration reference
  • DEBUGGING.md — conditional breakpoints, logpoints, hit counts, stepping, memory inspection, register editing, the C64's VIC-II raster position and run until, and more
  • REMOTE_DEBUGGING.md — cross-machine debugging with path mappings and remote source fallback

Manual smoke test

Useful when verifying that the debug adapter starts up correctly without VSCode involved.

  1. Start the Avalonia Desktop app with debug port:
./Highbyte.DotNet6502.App.Avalonia.Desktop --enableExternalDebug --debug-port 6502 --debug-wait --console-log
  1. Connect with a TCP client (e.g. nc):
nc 127.0.0.1 6502

If you started the emulator with --debug-bind-address 0.0.0.0, connecting to 127.0.0.1 from the same machine still works.

  1. Send a DAP initialize request:
Content-Length: 122

{"seq":1,"type":"request","command":"initialize","arguments":{"adapterID":"dotnet6502","pathFormat":"path"}}
  1. Verify a response is received.