loadProgram
Load and optionally run C64 program files (PRG, D64, T64) in the VICE emulator. Specify file index for disk images and control execution after loading.
Instructions
Load and optionally run a program file.
Supports PRG, D64, T64, and other C64 file formats. For disk images, can specify which file to run.
Options:
run: If true (default), starts execution after loading
fileIndex: For disk images, which file to load (0 = first)
Related tools: reset, status, setBreakpoint
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | Path to the program file (PRG, D64, T64, etc.) | |
| run | No | Run after loading (default: true) | |
| fileIndex | No | File index in disk image (default: 0) |
Implementation Reference
- src/index.ts:998-1034 (registration)MCP tool registration for 'loadProgram', including Zod input schema and inline async handler that calls ViceClient.autostart() with parameters and formats response/error.// Tool: loadProgram - Autostart a program server.registerTool( "loadProgram", { description: `Load and optionally run a program file. Supports PRG, D64, T64, and other C64 file formats. For disk images, can specify which file to run. Options: - run: If true (default), starts execution after loading - fileIndex: For disk images, which file to load (0 = first) Related tools: reset, status, setBreakpoint`, inputSchema: z.object({ filename: z.string().describe("Path to the program file (PRG, D64, T64, etc.)"), run: z.boolean().optional().describe("Run after loading (default: true)"), fileIndex: z.number().optional().describe("File index in disk image (default: 0)"), }), }, async (args) => { try { await client.autostart(args.filename, args.fileIndex ?? 0, args.run ?? true); return formatResponse({ success: true, filename: args.filename, run: args.run ?? true, message: `Loading ${args.filename}${args.run !== false ? " and running" : ""}`, hint: args.run !== false ? "Program is loading. Set breakpoints before it reaches your code of interest." : "Program loaded but not started. Use continue() to run.", }); } catch (error) { return formatError(error as ViceError); } } );
- src/protocol/client.ts:670-679 (handler)Core handler implementation in ViceClient: constructs binary monitor 'AutoStart' command packet (run flag, file index, filename) and sends via sendCommand() to VICE.async autostart(filename: string, fileIndex = 0, runAfterLoad = true): Promise<void> { const filenameBuffer = Buffer.from(filename, "utf8"); // Body: run(1) + index(2) + filename_length(1) + filename const body = Buffer.alloc(4 + filenameBuffer.length); body[0] = runAfterLoad ? 1 : 0; body.writeUInt16LE(fileIndex, 1); body[3] = filenameBuffer.length; filenameBuffer.copy(body, 4); await this.sendCommand(Command.AutoStart, body); }
- src/protocol/types.ts:49-50 (helper)Command constant definition for VICE binary monitor AutoStart command (0xdd). Used by ViceClient.autostart().AutoStart = 0xdd, }