saveSnapshot
Save the complete state of a Commodore 64 emulation session to a file for debugging, creating restore points, or sharing exact machine configurations.
Instructions
Save the complete machine state to a file.
Creates a VICE snapshot file containing:
All memory (RAM, I/O states)
CPU registers
VIC-II, SID, CIA states
Disk drive state (if attached)
Use to:
Save state before risky debugging
Create restore points
Share exact machine state
Related tools: loadSnapshot
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | Filename for the snapshot (e.g., 'debug-state.vsf') |
Implementation Reference
- src/index.ts:953-965 (handler)MCP tool handler for 'saveSnapshot'. Extracts filename argument and calls the ViceClient saveSnapshot method, formats success/error response.async (args) => { try { await client.saveSnapshot(args.filename); return formatResponse({ success: true, filename: args.filename, message: `Snapshot saved to ${args.filename}`, hint: "Use loadSnapshot() to restore this state later", }); } catch (error) { return formatError(error as ViceError); } }
- src/index.ts:949-951 (schema)Zod input schema defining the 'filename' string parameter for the saveSnapshot tool.inputSchema: z.object({ filename: z.string().describe("Filename for the snapshot (e.g., 'debug-state.vsf')"), }),
- src/index.ts:932-966 (registration)Registration of the 'saveSnapshot' tool with the MCP server using server.registerTool, including description, schema, and handler.server.registerTool( "saveSnapshot", { description: `Save the complete machine state to a file. Creates a VICE snapshot file containing: - All memory (RAM, I/O states) - CPU registers - VIC-II, SID, CIA states - Disk drive state (if attached) Use to: - Save state before risky debugging - Create restore points - Share exact machine state Related tools: loadSnapshot`, inputSchema: z.object({ filename: z.string().describe("Filename for the snapshot (e.g., 'debug-state.vsf')"), }), }, async (args) => { try { await client.saveSnapshot(args.filename); return formatResponse({ success: true, filename: args.filename, message: `Snapshot saved to ${args.filename}`, hint: "Use loadSnapshot() to restore this state later", }); } catch (error) { return formatError(error as ViceError); } } );
- src/protocol/client.ts:653-659 (helper)ViceClient method that implements the VICE binary monitor protocol to save a snapshot by sending the Dump command with filename.async saveSnapshot(filename: string): Promise<void> { const filenameBuffer = Buffer.from(filename, "utf8"); const body = Buffer.alloc(1 + filenameBuffer.length); body[0] = filenameBuffer.length; filenameBuffer.copy(body, 1); await this.sendCommand(Command.Dump, body); }