Skip to main content
Glama
C64 Debug MCP

C64 Debug MCP

by henols

C64 Debug MCP

npm version License: MIT

Debug Commodore 64 programs through conversation - AI-powered control of the VICE emulator for 6502 assembly and BASIC.

Features

  • 🎮 Full C64 Control: Pause, resume, step, and reset the emulator

  • 🔍 Memory Operations: Read, write, search, and compare memory

  • 🐛 Breakpoints: Set execution breakpoints and watchpoints

  • 📊 Register Access: Get and set CPU registers (A, X, Y, PC, SP, flags)

  • 📸 Display Capture: Capture screen state and text content

  • ⌨️ Input Control: Send keyboard and joystick input

  • 📝 Program Loading: Load PRG files and manage execution

  • 🔢 Flexible Formats: Use C64 notation ($D000, $FF, %11111111) or standard formats (0xD000, 255, 0b11111111)

Related MCP server: VICE C64 Emulator MCP Server

Address Formats

The MCP server accepts C64 addresses in multiple formats for natural interaction:

  • C64 style: $D000 (dollar sign prefix - classic 6502 assembler notation)

  • C style: 0xD000 (0x prefix - standard programming hex notation)

  • Decimal: 53248 (traditional decimal format)

Note: Bare hex without prefix (e.g., D000) is NOT supported to avoid ambiguity with 4-digit decimals.

Range Support

Tools that read memory or set breakpoints support both address+length and start+end formats:

Address + Length format (original):

memory_read(address="$D000", length=256)      // Read 256 bytes starting at $D000
breakpoint_set(kind="exec", address="$1000", length=1)  // Breakpoint at $1000

Start + End format (more intuitive for ranges):

memory_read(start="$D000", end="$D0FF")       // Read from $D000 to $D0FF inclusive
memory_read(start=198, end=199)                // Read addresses 198-199 (2 bytes)
breakpoint_set(kind="exec", start="$1000", end="$1000")  // Breakpoint at $1000

Both formats work with all address representations (decimal, $, 0x).

Common C64 Addresses:

  • $D000 - SID chip registers (sound)

  • $D020 - Border color register

  • $D021 - Background color register

  • $0400 - Default screen memory

  • $0800 - Common program start

  • $C000 - BASIC ROM start

Address Ranges

For operations that work with memory ranges (like memory_read and breakpoint_set), you can specify ranges in two ways:

Option 1: Address + Length

memory_read(address="$0400", length=256)  // Read 256 bytes from $0400
breakpoint_set(kind="exec", address="$1000", length=16)  // Break on $1000-$100F

Option 2: Start + End (inclusive)

memory_read(start="$0400", end="$04FF")  // Read from $0400 to $04FF (256 bytes)
breakpoint_set(kind="exec", start="$1000", end="$100F")  // Break on $1000-$100F

Both formats work identically and support all address formats (decimal, hex).

Byte Value Formats

The MCP server accepts byte values (0-255) in multiple formats for natural C64-style input:

  • C64 hex: $FF (dollar sign prefix - classic 6502 notation)

  • C hex: 0xFF (0x prefix - standard programming notation)

  • C64 binary: %11111111 (percent prefix - classic 6502 bit notation)

  • C binary: 0b11111111 (0b prefix - standard programming notation)

  • Decimal: 255 (traditional decimal format)

Note: Bare hex/binary without prefix (e.g., FF, 11111111) is NOT supported to avoid ambiguity.

Mixed formats in arrays:

[255, "$FF", "0xFF", "%11111111", "0b11111111"]

Common C64 Byte Values:

  • $00-$0F - Color values (0-15)

  • $20 - PETSCII space character

  • $41 - PETSCII 'A' character

  • %00011011 - VIC-II D011 control register (text mode, 25 rows, screen on)

  • %11111111 - All bits set (enable all sprites, etc.)

Use Cases:

// Set border to light blue
memory_write(address="$D020", data=["$0E"])

// Enable all 8 sprites
memory_write(address="$D015", data=["%11111111"])

// Write " AB" to screen (PETSCII)
memory_write(address="$0400", data=["$20", "$41", "$42"])

// Set VIC-II control register with bit pattern
memory_write(address="$D011", data=["%00011011"])

Requirements

Installation

claude mcp add c64-dev-tools -- npx -y c64-debug-mcp@latest

Or add manually to your MCP client config:

{
  "mcpServers": {
    "c64-dev-tools": {
      "command": "npx",
      "args": ["-y", "c64-debug-mcp@latest"]
    }
  }
}

Quick Start

  1. Add MCP server (see Installation above)

  2. Ask your AI assistant to interact with C64:

    • "What's in memory at $D000?"

    • "Set a breakpoint at $1000"

    • "Load and run my program.prg"

Important: The MCP server launches and controls VICE automatically. Your AI assistant owns the emulator process and can reset or restart it at any time. Don't use VICE manually or create valuable work in the emulator while debugging - any unsaved state may be lost when it resets the machine.

Example Workflows

Debugging a Program

You: Load examples/hello.prg and set a breakpoint at $1000

AI assistant will:
1. Load the program using program_load
2. Set a breakpoint at $1000 using breakpoint_set
3. Resume execution until breakpoint is hit
4. Show you the register state when stopped

Memory Analysis

You: What's the BASIC program in memory?

AI assistant will:
1. Read memory from $0801 (BASIC start)
2. Parse the BASIC tokens
3. Show you the program listing

Screen Capture

You: Show me what's on the screen

AI assistant will:
1. Capture the display using capture_display
2. Save a PNG image
3. Describe what's visible

License

MIT - see LICENSE file

Made with ❤️ for C64 developers and AI-assisted retro coding

"The C64 never gets old, it just gets smarter" 🎮

Available Tools

18 tools
breakpoint_clearB

Deletes a breakpoint by numeric id.

Inputs: breakpointId (required). Returns: data, meta

breakpoint_setB

Creates an execution breakpoint or read/write watchpoint. Specify start_address and either data_length or end_address. Address can be decimal (53248) or hex string with prefix ($D000, 0xD000).

Inputs: kind (required), label, enabled, condition, +4 more. Returns: data, meta

capture_displayA

Captures the current screen to a PNG file and returns the saved image path.

Inputs: useVic. Returns: data, meta

executeA

Controls execution with pause, resume, step, step_over, step_out, or reset. Pause and resume are idempotent (safe to call multiple times).

Inputs: action (required), count, resetMode, waitUntilRunningStable. Returns: data, meta

get_display_stateA

Returns screen RAM, color RAM, the current graphics mode, screen memory addresses, and the current border and background colors.

Inputs: no named parameters. Returns: data, meta

get_display_textA

Returns the current text screen as readable text when the C64 is in a text mode.

Inputs: no named parameters. Returns: data, meta

get_monitor_stateA

Returns whether the C64 is running or stopped, along with the current stop reason and program counter when available.

Inputs: no named parameters. Returns: data, meta

get_registersA

Returns the current C64 register snapshot. Requires emulator to be stopped - call execute(action="pause") first if running.

Inputs: no named parameters. Returns: data, meta

get_session_stateA

Returns emulator session state including transport/process status, auto-resume state, and the most recent hit checkpoint.

Inputs: no named parameters. Returns: data, meta

joystick_inputA

Sends joystick input to C64 joystick port 1 or 2. Automatically resumes if stopped and restores pause state after.

Inputs: port (required), action (required), control (required), durationMs. Returns: data, meta

keyboard_inputA

Sends one to four keys or PETSCII tokens to the C64. Automatically resumes if stopped and restores pause state after. Use for key presses, releases, and taps.

Inputs: keys (required), action (required), durationMs. Returns: data, meta

list_breakpointsB

Lists current breakpoints and watchpoints.

Inputs: includeDisabled. Returns: data, meta

memory_readA

Reads a memory chunk. Specify start_address and either data_length or end_address. Address can be decimal (53248) or hex string with prefix ($D000, 0xD000). Returns byte values as decimal numbers.

Inputs: data_length, end_address, start_address. Returns: data, meta

memory_writeA

Writes raw byte values into C64 memory. Address and byte values support decimal, hex ($FF, 0xFF), and binary (%11111111, 0b11111111) formats. Requires emulator to be stopped.

Inputs: data (required), address. Returns: data, meta

program_loadC

Loads a C64 program and optionally starts it.

Inputs: filePath (required), autoStart, fileIndex. Returns: data, meta

set_registersA

Sets one or more C64 registers by field name. Requires emulator to be stopped - call execute(action="pause") first if running.

Inputs: registers (required). Returns: data, meta

wait_for_stateA

Waits for the emulator to reach a target execution state and optionally remain there for a stability window.

Inputs: executionState (required), stableMs, timeoutMs. Returns: data, meta

write_textA

Types text into the C64. Automatically resumes if stopped and restores pause state after. Supports escaped characters and PETSCII brace tokens like {RETURN}, {CLR}, {HOME}, {PI}, and color names. Limit 64 bytes per request.

Inputs: text (required). Returns: data, meta

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 18 tools

    Disambiguation4/5

    Tools are mostly distinct and pair naturally (get/set_registers, memory_read/write, breakpoint_set/list/clear). Main ambiguities are get_monitor_state vs get_session_state and write_text vs keyoard_input, but descriptions give enough differentiation.

    Naming Consistency3/5

    Most tools use readable snake_case, but the pattern is mixed: many are verb_noun (get_registers, set_registers, list_breakpoints) while several are noun_verb (memory_read, memory_write, breakpoint_set, breakpoint_clear, program_load) and two are noun phrases (keyboard_input, joystick_input). The names are still understandable, but not consistently predictable.

    Tool Count4/5

    18 tools is above the typical 3-15 sweet spot, but each tool addresses a distinct debugger concern: execution, memory, registers, breakpoints, display, and input. No significant redundancy exists, so the count feels slightly heavy but justified for a full C64 debugger.

    Completeness4/5

    The set covers the core debugging lifecycle: load, run, step, pause, reset, breakpoints, watchpoints, memory/register inspection, display capture, and input. Advanced debugger features like conditional breakpoints or symbol support are absent, but there are no critical dead ends for normal C64 debugging.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to control Commodore 64 Ultimate hardware via REST API, supporting program execution, memory operations, disk management, audio playback, and device configuration through natural language commands.
      22
      MIT
    • F
      license
      B
      quality
      D
      maintenance
      Enables control and interaction with Commodore 64 Ultimate Computer devices through their REST API, allowing users to play SID/MOD files, load and run programs, manage disk images, configure settings, and control the C64 machine through natural language.
      49
      22
      -
    • A
      license
      B
      quality
      C
      maintenance
      Enables AI agents to code and debug Commodore PET software using the VICE emulator, with CLI and MCP tools for session control, screen reading, memory manipulation, and testing.
      44
      1
      MIT