c64bridge 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/prompts/steer.prompt.md +55 -0
- package/AGENTS.md +9 -7
- package/README.md +139 -95
- package/data/embeddings_asm.json +1 -1
- package/data/embeddings_basic.json +1 -1
- package/data/embeddings_hardware.json +1 -1
- package/data/embeddings_mixed.json +1 -1
- package/data/embeddings_other.json +1 -1
- package/data/graphics/petscii-style-guide.md +4 -4
- package/data/graphics/sprite-charset-best-practices.md +9 -9
- package/data/vice/vice-binary-monitor-spec.md +921 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/device.js +86 -10
- package/dist/mcp-server.js +1 -1
- package/dist/prompts/registry.js +27 -25
- package/dist/rag/knowledgeIndex.js +112 -79
- package/dist/rag/resourceUris.js +93 -0
- package/dist/tools/audio.js +11 -11
- package/dist/tools/debug.js +1 -1
- package/dist/tools/developer.js +13 -13
- package/dist/tools/graphics.js +10 -10
- package/dist/tools/machineControl.js +5 -5
- package/dist/tools/memory.js +19 -11
- package/dist/tools/meta/index.js +1 -1
- package/dist/tools/printer.js +11 -12
- package/dist/tools/programRunners.js +16 -16
- package/dist/tools/rag.js +9 -9
- package/dist/tools/registry/config.js +1 -1
- package/dist/tools/registry/disk.js +1 -1
- package/dist/tools/registry/drive.js +1 -1
- package/dist/tools/registry/extract.js +1 -1
- package/dist/tools/registry/graphics.js +1 -1
- package/dist/tools/registry/memory.js +1 -1
- package/dist/tools/registry/platform.js +1 -1
- package/dist/tools/registry/printer.js +1 -1
- package/dist/tools/registry/program.js +1 -1
- package/dist/tools/registry/rag.js +1 -1
- package/dist/tools/registry/sound.js +1 -1
- package/dist/tools/registry/stream.js +1 -1
- package/dist/tools/registry/system.js +1 -1
- package/dist/tools/storage.js +15 -15
- package/dist/tools/streaming.js +3 -3
- package/dist/tools/types.js +41 -4
- package/dist/tools/vice.js +2 -5
- package/dist/vice/process.js +79 -2
- package/dist/vice/readiness.js +35 -0
- package/dist/vice/smokeOptions.js +44 -0
- package/dist/viceRunner.js +2 -0
- package/doc/developer.md +10 -2
- package/doc/plans/prompts/README.md +7 -7
- package/mcp/prompts.json +42 -59
- package/mcp/protocol-examples.json +2 -2
- package/mcp/resources.json +179 -166
- package/mcp/schemas/c64_config.schema.json +109 -326
- package/mcp/schemas/c64_debug.schema.json +158 -337
- package/mcp/schemas/c64_disk.schema.json +180 -262
- package/mcp/schemas/c64_drive.schema.json +31 -111
- package/mcp/schemas/c64_extract.schema.json +193 -291
- package/mcp/schemas/c64_graphics.schema.json +208 -308
- package/mcp/schemas/c64_memory.schema.json +94 -144
- package/mcp/schemas/c64_printer.schema.json +151 -205
- package/mcp/schemas/c64_program.schema.json +229 -367
- package/mcp/schemas/c64_rag.schema.json +25 -59
- package/mcp/schemas/c64_select_backend.schema.json +19 -26
- package/mcp/schemas/c64_sound.schema.json +346 -622
- package/mcp/schemas/c64_stream.schema.json +25 -54
- package/mcp/schemas/c64_system.schema.json +79 -212
- package/mcp/schemas/c64_vice.schema.json +24 -55
- package/mcp/server.json +1 -1
- package/mcp/tools.json +1935 -3443
- package/mcp.json +10 -9
- package/package.json +20 -15
- package/scripts/fetch-external-sources.mjs +1 -2
- package/scripts/prepare-release.mjs +59 -2
- package/scripts/run-coverage.mjs +26 -1
- package/scripts/run-tests.mjs +2 -2
- package/scripts/run-tests.ts +273 -52
- package/scripts/update-readme.ts +54 -2
- package/server.json +94 -0
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
# VICE Binary Monitor Specification
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
This document is a concise implementation reference for C64 Bridge maintainers and LLM agents that need to understand how the VICE backend maps to the VICE binary monitor protocol.
|
|
6
|
+
|
|
7
|
+
For normal MCP use, agents should call the existing C64 Bridge tools instead of constructing VICE packets directly.
|
|
8
|
+
|
|
9
|
+
Recommended C64 Bridge entry points:
|
|
10
|
+
|
|
11
|
+
| Need | C64 Bridge tool | Typical operation |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Select the VICE backend | `c64_select_backend` | `select` |
|
|
14
|
+
| Read or write memory | `c64_memory` | `read`, `write`, `read_screen`, `wait_for_text` |
|
|
15
|
+
| Debug registers and checkpoints | `c64_debug` | `get_registers`, `set_registers`, `create_checkpoint`, `list_checkpoints`, `step`, `step_return` |
|
|
16
|
+
| Capture emulator display | `c64_graphics` | `capture_frame` |
|
|
17
|
+
| Reset or resume execution | `c64_system` | `reset`, `resume` |
|
|
18
|
+
| Read or write VICE resources | `c64_vice` | `resource_get`, `resource_set` |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Core Protocol Rules
|
|
23
|
+
|
|
24
|
+
- The VICE binary monitor uses a dedicated connection configured with `-binarymonitor` and `-binarymonitoraddress`.
|
|
25
|
+
- Every packet starts with `STX = 0x02`.
|
|
26
|
+
- There is no packet terminator.
|
|
27
|
+
- Packet boundaries are determined by the length field in the frame header.
|
|
28
|
+
- Current API version: `0x02`.
|
|
29
|
+
- All multibyte integers are little-endian.
|
|
30
|
+
- Boolean fields use `0x00 = false`, `>= 0x01 = true`.
|
|
31
|
+
- Direct responses echo the command `request_id`.
|
|
32
|
+
- Responses with `request_id = 0xffffffff` are asynchronous events.
|
|
33
|
+
- Commands may cause asynchronous monitor-entry events before the direct command response.
|
|
34
|
+
- Register IDs and bank IDs are machine-dependent. Do not hard-code them.
|
|
35
|
+
- Use `REGISTERS_AVAILABLE` and `BANKS_AVAILABLE` to resolve IDs.
|
|
36
|
+
- Many array items include an item-size field. Use it to skip future extensions.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Notation
|
|
41
|
+
|
|
42
|
+
| Notation | Meaning |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `u8` | 1 byte unsigned |
|
|
45
|
+
| `u16` | 2 byte unsigned, little-endian |
|
|
46
|
+
| `u32` | 4 byte unsigned, little-endian |
|
|
47
|
+
| `u64` | 8 byte unsigned, little-endian |
|
|
48
|
+
| `bytes[N]` | exactly `N` bytes |
|
|
49
|
+
| `str[N]` | `N` bytes, not null-terminated unless stated otherwise |
|
|
50
|
+
| `FIELD?` | optional field |
|
|
51
|
+
| `ITEM[N]` | `N` repeated items |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Common Values
|
|
56
|
+
|
|
57
|
+
### Memspace
|
|
58
|
+
|
|
59
|
+
| Value | Meaning |
|
|
60
|
+
|---:|---|
|
|
61
|
+
| `0x00` | Main machine memory |
|
|
62
|
+
| `0x01` | Drive 8 |
|
|
63
|
+
| `0x02` | Drive 9 |
|
|
64
|
+
| `0x03` | Drive 10 |
|
|
65
|
+
| `0x04` | Drive 11 |
|
|
66
|
+
|
|
67
|
+
### Generic Errors
|
|
68
|
+
|
|
69
|
+
| Code | Meaning |
|
|
70
|
+
|---:|---|
|
|
71
|
+
| `0x00` | OK |
|
|
72
|
+
| `0x01` | Object does not exist |
|
|
73
|
+
| `0x02` | Invalid memspace |
|
|
74
|
+
| `0x80` | Incorrect command length |
|
|
75
|
+
| `0x81` | Invalid parameter value |
|
|
76
|
+
| `0x82` | Unsupported API version |
|
|
77
|
+
| `0x83` | Unknown command type |
|
|
78
|
+
| `0x8f` | General failure after basic validation |
|
|
79
|
+
|
|
80
|
+
Always check the response error code before decoding the body.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Command Frame
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
Offset Size Field
|
|
88
|
+
0 1 STX = 0x02
|
|
89
|
+
1 1 API version = 0x02
|
|
90
|
+
2 4 Command body length as u32
|
|
91
|
+
6 4 Request ID as u32
|
|
92
|
+
10 1 Command type as u8
|
|
93
|
+
11 N Command body
|
|
94
|
+
````
|
|
95
|
+
|
|
96
|
+
```text
|
|
97
|
+
command_body_length = total_command_packet_length - 11
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The command length excludes the whole command header.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Response Frame
|
|
105
|
+
|
|
106
|
+
```text
|
|
107
|
+
Offset Size Field
|
|
108
|
+
0 1 STX = 0x02
|
|
109
|
+
1 1 API version = 0x02
|
|
110
|
+
2 4 Response body length as u32
|
|
111
|
+
6 1 Response type as u8
|
|
112
|
+
7 1 Error code as u8
|
|
113
|
+
8 4 Request ID as u32
|
|
114
|
+
12 N Response body
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
response_body_length = total_response_packet_length - 12
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
For asynchronous events:
|
|
122
|
+
|
|
123
|
+
```text
|
|
124
|
+
request_id = 0xffffffff
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Forward-Compatible Arrays
|
|
130
|
+
|
|
131
|
+
Common array pattern:
|
|
132
|
+
|
|
133
|
+
```text
|
|
134
|
+
COUNT | ITEM[COUNT]
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Common item pattern:
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
IS:u8 | ITEM_BODY[IS]
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
`IS` is the item body size and excludes the `IS` byte itself. Use `IS` to skip unknown future fields.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
# Commands
|
|
148
|
+
|
|
149
|
+
## `0x01` - Memory Get
|
|
150
|
+
|
|
151
|
+
Reads memory from inclusive range `[SA..EA]`.
|
|
152
|
+
|
|
153
|
+
```text
|
|
154
|
+
cmd: FX:u8 | SA:u16 | EA:u16 | MS:u8 | BI:u16
|
|
155
|
+
rsp: 0x01 | ML:u16 | MM:bytes[ML]
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
| Field | Meaning |
|
|
159
|
+
| ----- | ------------------------ |
|
|
160
|
+
| `FX` | Read causes side effects |
|
|
161
|
+
| `SA` | Start address |
|
|
162
|
+
| `EA` | End address, inclusive |
|
|
163
|
+
| `MS` | Memspace |
|
|
164
|
+
| `BI` | Bank ID |
|
|
165
|
+
| `ML` | Memory length |
|
|
166
|
+
| `MM` | Memory bytes |
|
|
167
|
+
|
|
168
|
+
For `$0000..$ffff`, `ML` may be `0`, meaning 65536 bytes.
|
|
169
|
+
|
|
170
|
+
C64 Bridge mapping:
|
|
171
|
+
|
|
172
|
+
| MCP tool | Operation |
|
|
173
|
+
| ------------ | --------------- |
|
|
174
|
+
| `c64_memory` | `read` |
|
|
175
|
+
| `c64_memory` | `read_screen` |
|
|
176
|
+
| `c64_memory` | `wait_for_text` |
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## `0x02` - Memory Set
|
|
181
|
+
|
|
182
|
+
Writes memory to inclusive range `[SA..EA]`.
|
|
183
|
+
|
|
184
|
+
```text
|
|
185
|
+
cmd: FX:u8 | SA:u16 | EA:u16 | MS:u8 | BI:u16 | MM:bytes[EA-SA+1]
|
|
186
|
+
rsp: 0x02 | empty
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
C64 Bridge mapping:
|
|
190
|
+
|
|
191
|
+
| MCP tool | Operation |
|
|
192
|
+
| ------------ | --------- |
|
|
193
|
+
| `c64_memory` | `write` |
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## `0x11` - Checkpoint Get
|
|
198
|
+
|
|
199
|
+
Gets a breakpoint, watchpoint, or tracepoint by checkpoint number.
|
|
200
|
+
|
|
201
|
+
```text
|
|
202
|
+
cmd: CN:u32
|
|
203
|
+
rsp: 0x11 | CHECKPOINT_INFO
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
C64 Bridge mapping:
|
|
207
|
+
|
|
208
|
+
| MCP tool | Operation |
|
|
209
|
+
| ----------- | ---------------- |
|
|
210
|
+
| `c64_debug` | `get_checkpoint` |
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## `0x12` - Checkpoint Set
|
|
215
|
+
|
|
216
|
+
Creates a breakpoint, watchpoint, or tracepoint.
|
|
217
|
+
|
|
218
|
+
```text
|
|
219
|
+
cmd: SA:u16 | EA:u16 | ST:u8 | EN:u8 | OP:u8 | TM:u8 | MS?:u8
|
|
220
|
+
rsp: 0x11 | CHECKPOINT_INFO
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
| Field | Meaning |
|
|
224
|
+
| ----- | --------------------------------- |
|
|
225
|
+
| `ST` | Stop when hit |
|
|
226
|
+
| `EN` | Enabled |
|
|
227
|
+
| `OP` | Operation bitmask |
|
|
228
|
+
| `TM` | Temporary, delete after first hit |
|
|
229
|
+
| `MS` | Optional memspace |
|
|
230
|
+
|
|
231
|
+
`OP`: `0x01 = load`, `0x02 = store`, `0x04 = exec`.
|
|
232
|
+
|
|
233
|
+
Use `0x22 CONDITION_SET` after creation to add a condition.
|
|
234
|
+
|
|
235
|
+
C64 Bridge mapping:
|
|
236
|
+
|
|
237
|
+
| MCP tool | Operation |
|
|
238
|
+
| ----------- | ------------------- |
|
|
239
|
+
| `c64_debug` | `create_checkpoint` |
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## `0x13` - Checkpoint Delete
|
|
244
|
+
|
|
245
|
+
```text
|
|
246
|
+
cmd: CN:u32
|
|
247
|
+
rsp: 0x13 | empty
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
C64 Bridge mapping:
|
|
251
|
+
|
|
252
|
+
| MCP tool | Operation |
|
|
253
|
+
| ----------- | ------------------- |
|
|
254
|
+
| `c64_debug` | `delete_checkpoint` |
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## `0x14` - Checkpoint List
|
|
259
|
+
|
|
260
|
+
```text
|
|
261
|
+
cmd: empty
|
|
262
|
+
rsp: zero or more 0x11 CHECKPOINT_INFO, then 0x14 | CC:u32
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
`CC` is total checkpoint count.
|
|
266
|
+
|
|
267
|
+
C64 Bridge mapping:
|
|
268
|
+
|
|
269
|
+
| MCP tool | Operation |
|
|
270
|
+
| ----------- | ------------------ |
|
|
271
|
+
| `c64_debug` | `list_checkpoints` |
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## `0x15` - Checkpoint Toggle
|
|
276
|
+
|
|
277
|
+
```text
|
|
278
|
+
cmd: CN:u32 | EN:u8
|
|
279
|
+
rsp: 0x15 | empty
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
C64 Bridge mapping:
|
|
283
|
+
|
|
284
|
+
| MCP tool | Operation |
|
|
285
|
+
| ----------- | ------------------- |
|
|
286
|
+
| `c64_debug` | `toggle_checkpoint` |
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## `0x22` - Condition Set
|
|
291
|
+
|
|
292
|
+
Sets a text-monitor condition expression on an existing checkpoint.
|
|
293
|
+
|
|
294
|
+
```text
|
|
295
|
+
cmd: CN:u32 | EL:u8 | ES:str[EL]
|
|
296
|
+
rsp: 0x22 | empty
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
`ES` is not null-terminated. Conditions cannot currently be retrieved.
|
|
300
|
+
|
|
301
|
+
C64 Bridge mapping:
|
|
302
|
+
|
|
303
|
+
| MCP tool | Operation |
|
|
304
|
+
| ----------- | --------------- |
|
|
305
|
+
| `c64_debug` | `set_condition` |
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## `0x31` - Registers Get
|
|
310
|
+
|
|
311
|
+
```text
|
|
312
|
+
cmd: MS:u8
|
|
313
|
+
rsp: 0x31 | REGISTER_INFO
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
C64 Bridge mapping:
|
|
317
|
+
|
|
318
|
+
| MCP tool | Operation |
|
|
319
|
+
| ----------- | --------------- |
|
|
320
|
+
| `c64_debug` | `get_registers` |
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## `0x32` - Registers Set
|
|
325
|
+
|
|
326
|
+
```text
|
|
327
|
+
cmd: MS:u8 | RC:u16 | ITEM[RC]
|
|
328
|
+
item: IS:u8 | RI:u8 | RV:u16
|
|
329
|
+
rsp: 0x31 | REGISTER_INFO
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Register IDs are machine-dependent. Query `0x83 REGISTERS_AVAILABLE`.
|
|
333
|
+
|
|
334
|
+
C64 Bridge mapping:
|
|
335
|
+
|
|
336
|
+
| MCP tool | Operation |
|
|
337
|
+
| ----------- | --------------- |
|
|
338
|
+
| `c64_debug` | `set_registers` |
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## `0x41` - Dump
|
|
343
|
+
|
|
344
|
+
Saves emulator state to a snapshot file.
|
|
345
|
+
|
|
346
|
+
```text
|
|
347
|
+
cmd: SR:u8 | SD:u8 | FL:u8 | FN:str[FL]
|
|
348
|
+
rsp: 0x41 | empty
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
`SR = save ROMs`, `SD = save disks`.
|
|
352
|
+
|
|
353
|
+
No primary public C64 Bridge MCP mapping is listed in the README API reference.
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## `0x42` - Undump
|
|
358
|
+
|
|
359
|
+
Loads emulator state from a snapshot file.
|
|
360
|
+
|
|
361
|
+
```text
|
|
362
|
+
cmd: FL:u8 | FN:str[FL]
|
|
363
|
+
rsp: 0x42 | PC:u16
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
No primary public C64 Bridge MCP mapping is listed in the README API reference.
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## `0x51` - Resource Get
|
|
371
|
+
|
|
372
|
+
```text
|
|
373
|
+
cmd: NL:u8 | RN:str[NL]
|
|
374
|
+
rsp: 0x51 | RT:u8 | VL:u8 | RV:bytes[VL]
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
`RT`: `0x00 = string`, `0x01 = integer`.
|
|
378
|
+
|
|
379
|
+
C64 Bridge mapping:
|
|
380
|
+
|
|
381
|
+
| MCP tool | Operation |
|
|
382
|
+
| ---------- | -------------- |
|
|
383
|
+
| `c64_vice` | `resource_get` |
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## `0x52` - Resource Set
|
|
388
|
+
|
|
389
|
+
```text
|
|
390
|
+
cmd: RT:u8 | NL:u8 | RN:str[NL] | VL:u8 | RV:bytes[VL]
|
|
391
|
+
rsp: 0x52 | empty
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
`RT`: `0x00 = string`, `0x01 = integer`.
|
|
395
|
+
|
|
396
|
+
C64 Bridge mapping:
|
|
397
|
+
|
|
398
|
+
| MCP tool | Operation |
|
|
399
|
+
| ---------- | -------------- |
|
|
400
|
+
| `c64_vice` | `resource_set` |
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## `0x71` - Advance Instructions
|
|
405
|
+
|
|
406
|
+
Steps over a number of instructions.
|
|
407
|
+
|
|
408
|
+
```text
|
|
409
|
+
cmd: SO:u8 | IC:u16
|
|
410
|
+
rsp: 0x71 | empty
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
`SO` means step over subroutines.
|
|
414
|
+
|
|
415
|
+
C64 Bridge mapping:
|
|
416
|
+
|
|
417
|
+
| MCP tool | Operation |
|
|
418
|
+
| ----------- | --------- |
|
|
419
|
+
| `c64_debug` | `step` |
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## `0x72` - Keyboard Feed
|
|
424
|
+
|
|
425
|
+
Adds PETSCII text to the keyboard buffer.
|
|
426
|
+
|
|
427
|
+
```text
|
|
428
|
+
cmd: TL:u8 | TC:bytes[TL]
|
|
429
|
+
rsp: 0x72 | empty
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
No primary public C64 Bridge MCP mapping is listed in the README API reference.
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
## `0x73` - Execute Until Return
|
|
437
|
+
|
|
438
|
+
Continues execution until just after the next `RTS` or `RTI`.
|
|
439
|
+
|
|
440
|
+
```text
|
|
441
|
+
cmd: empty
|
|
442
|
+
rsp: 0x73 | empty
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
Equivalent to the text monitor `return` command.
|
|
446
|
+
|
|
447
|
+
C64 Bridge mapping:
|
|
448
|
+
|
|
449
|
+
| MCP tool | Operation |
|
|
450
|
+
| ----------- | ------------- |
|
|
451
|
+
| `c64_debug` | `step_return` |
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
## `0x81` - Ping
|
|
456
|
+
|
|
457
|
+
```text
|
|
458
|
+
cmd: empty
|
|
459
|
+
rsp: 0x81 | empty
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
Used internally for VICE connectivity checks.
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## `0x82` - Banks Available
|
|
467
|
+
|
|
468
|
+
Lists machine-specific bank IDs and names.
|
|
469
|
+
|
|
470
|
+
```text
|
|
471
|
+
cmd: empty
|
|
472
|
+
rsp: 0x82 | BC:u16 | ITEM[BC]
|
|
473
|
+
item: IS:u8 | BI:u16 | NL:u8 | BN:str[NL]
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
Usually internal to the VICE backend. Required for robust banked memory support.
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
## `0x83` - Registers Available
|
|
481
|
+
|
|
482
|
+
Lists machine-specific register IDs and names.
|
|
483
|
+
|
|
484
|
+
```text
|
|
485
|
+
cmd: MS:u8
|
|
486
|
+
rsp: 0x83 | RC:u16 | ITEM[RC]
|
|
487
|
+
item: IS:u8 | RI:u8 | RS:u8 | NL:u8 | RN:str[NL]
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
`RS` is register size in bits.
|
|
491
|
+
|
|
492
|
+
C64 Bridge mapping:
|
|
493
|
+
|
|
494
|
+
| MCP tool | Operation |
|
|
495
|
+
| ----------- | ---------------- |
|
|
496
|
+
| `c64_debug` | `list_registers` |
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
## `0x84` - Display Get
|
|
501
|
+
|
|
502
|
+
Gets the current display buffer.
|
|
503
|
+
|
|
504
|
+
```text
|
|
505
|
+
cmd: VC:u8 | FM:u8
|
|
506
|
+
rsp: 0x84 | FL:u32 | DW:u16 | DH:u16 | XO:u16 | YO:u16 | IW:u16 | IH:u16 | BP:u8 | BL:u32 | BD:bytes[BL]
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
| Field | Meaning |
|
|
510
|
+
| --------- | -------------------------------------------------------- |
|
|
511
|
+
| `VC` | C128 only: true = VIC-II, false = VDC. Ignored otherwise |
|
|
512
|
+
| `FM` | Format. `0x00 = indexed 8-bit` |
|
|
513
|
+
| `DW`,`DH` | Uncropped display size |
|
|
514
|
+
| `XO`,`YO` | Inner display offset |
|
|
515
|
+
| `IW`,`IH` | Inner display size |
|
|
516
|
+
| `BP` | Bits per pixel |
|
|
517
|
+
| `BD` | Display buffer |
|
|
518
|
+
|
|
519
|
+
C64 Bridge mapping:
|
|
520
|
+
|
|
521
|
+
| MCP tool | Operation |
|
|
522
|
+
| -------------- | --------------- |
|
|
523
|
+
| `c64_graphics` | `capture_frame` |
|
|
524
|
+
|
|
525
|
+
---
|
|
526
|
+
|
|
527
|
+
## `0x85` - VICE Info
|
|
528
|
+
|
|
529
|
+
Gets VICE version information.
|
|
530
|
+
|
|
531
|
+
```text
|
|
532
|
+
cmd: empty
|
|
533
|
+
rsp: 0x85 | ML:u8 | MV:bytes[ML] | SL:u8 | SV:bytes[SL]
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
Example `MV = 03 05 00 00` means VICE `3.5.0.0`.
|
|
537
|
+
|
|
538
|
+
Used internally for diagnostics and backend capability checks.
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
## `0x86` - CPU History
|
|
543
|
+
|
|
544
|
+
Gets executed instruction history.
|
|
545
|
+
|
|
546
|
+
```text
|
|
547
|
+
cmd: MS:u8 | HC:u32
|
|
548
|
+
rsp: 0x86 | HC:u32 | HISTORY_ITEM[HC]
|
|
549
|
+
|
|
550
|
+
history_item:
|
|
551
|
+
IS:u8 | RC:u16 | REGISTER_ITEM[RC] | CL:u64 | IL:u8 | IB:bytes[IL]
|
|
552
|
+
|
|
553
|
+
register_item:
|
|
554
|
+
RS:u8 | REGISTER_INFO_BODY:bytes[RS]
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
`REGISTER_INFO_BODY` usually means:
|
|
558
|
+
|
|
559
|
+
```text
|
|
560
|
+
RI:u8 | RV:u16
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
`CL` is CPU clock. `IB` is instruction bytes.
|
|
564
|
+
|
|
565
|
+
No primary public C64 Bridge MCP mapping is listed in the README API reference.
|
|
566
|
+
|
|
567
|
+
---
|
|
568
|
+
|
|
569
|
+
## `0x91` - Palette Get
|
|
570
|
+
|
|
571
|
+
Gets current palette colors.
|
|
572
|
+
|
|
573
|
+
```text
|
|
574
|
+
cmd: VC:u8
|
|
575
|
+
rsp: 0x91 | PC:u16 | ITEM[PC]
|
|
576
|
+
item: IS:u8 | RR:u8 | GG:u8 | BB:u8
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
`VC` has the same C128 VIC-II/VDC meaning as `DISPLAY_GET`.
|
|
580
|
+
|
|
581
|
+
Usually internal to display capture and normalization.
|
|
582
|
+
|
|
583
|
+
---
|
|
584
|
+
|
|
585
|
+
## `0xa2` - Joyport Set
|
|
586
|
+
|
|
587
|
+
```text
|
|
588
|
+
cmd: PN:u16 | PV:u16
|
|
589
|
+
rsp: 0xa2 | empty
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
No primary public C64 Bridge MCP mapping is listed in the README API reference.
|
|
593
|
+
|
|
594
|
+
---
|
|
595
|
+
|
|
596
|
+
## `0xb2` - Userport Set
|
|
597
|
+
|
|
598
|
+
```text
|
|
599
|
+
cmd: UV:u16
|
|
600
|
+
rsp: 0xb2 | empty
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
No primary public C64 Bridge MCP mapping is listed in the README API reference.
|
|
604
|
+
|
|
605
|
+
---
|
|
606
|
+
|
|
607
|
+
## `0xaa` - Exit
|
|
608
|
+
|
|
609
|
+
Exits the monitor and resumes emulation until the next breakpoint.
|
|
610
|
+
|
|
611
|
+
```text
|
|
612
|
+
cmd: empty
|
|
613
|
+
rsp: 0xaa | empty
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
May be followed by a `0x63 RESUMED` event.
|
|
617
|
+
|
|
618
|
+
C64 Bridge mapping:
|
|
619
|
+
|
|
620
|
+
| MCP tool | Operation |
|
|
621
|
+
| ------------ | --------- |
|
|
622
|
+
| `c64_system` | `resume` |
|
|
623
|
+
|
|
624
|
+
---
|
|
625
|
+
|
|
626
|
+
## `0xbb` - Quit
|
|
627
|
+
|
|
628
|
+
Quits VICE.
|
|
629
|
+
|
|
630
|
+
```text
|
|
631
|
+
cmd: empty
|
|
632
|
+
rsp: 0xbb | empty
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
Used internally for managed VICE lifecycle, not normally exposed as a user-facing MCP operation.
|
|
636
|
+
|
|
637
|
+
---
|
|
638
|
+
|
|
639
|
+
## `0xcc` - Reset
|
|
640
|
+
|
|
641
|
+
Resets system or drive.
|
|
642
|
+
|
|
643
|
+
```text
|
|
644
|
+
cmd: RS:u8
|
|
645
|
+
rsp: 0xcc | empty
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
`RS`: `0x00 = reset system`, `0x01 = power-cycle system`, `0x08..0x0b = reset drives 8..11`.
|
|
649
|
+
|
|
650
|
+
C64 Bridge mapping:
|
|
651
|
+
|
|
652
|
+
| MCP tool | Operation |
|
|
653
|
+
| ------------ | --------- |
|
|
654
|
+
| `c64_system` | `reset` |
|
|
655
|
+
| `c64_system` | `reboot` |
|
|
656
|
+
| `c64_drive` | `reset` |
|
|
657
|
+
|
|
658
|
+
---
|
|
659
|
+
|
|
660
|
+
## `0xdd` - Autostart / Autoload
|
|
661
|
+
|
|
662
|
+
Loads a program, then returns to monitor.
|
|
663
|
+
|
|
664
|
+
```text
|
|
665
|
+
cmd: RL:u8 | FI:u16 | FL:u8 | FN:str[FL]
|
|
666
|
+
rsp: 0xdd | empty
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
`RL` means run after loading. `FI` is file index inside disk image, use `0x0000` for default.
|
|
670
|
+
|
|
671
|
+
C64 Bridge mapping:
|
|
672
|
+
|
|
673
|
+
| MCP tool | Operation |
|
|
674
|
+
| ------------- | ------------------ |
|
|
675
|
+
| `c64_program` | `run_prg` |
|
|
676
|
+
| `c64_program` | `upload_run_basic` |
|
|
677
|
+
| `c64_program` | `upload_run_asm` |
|
|
678
|
+
|
|
679
|
+
---
|
|
680
|
+
|
|
681
|
+
# Shared and Event Responses
|
|
682
|
+
|
|
683
|
+
## `0x00` - Invalid / Error
|
|
684
|
+
|
|
685
|
+
```text
|
|
686
|
+
body: usually empty
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
Inspect the response header error code.
|
|
690
|
+
|
|
691
|
+
---
|
|
692
|
+
|
|
693
|
+
## `0x11` - Checkpoint Info
|
|
694
|
+
|
|
695
|
+
```text
|
|
696
|
+
CN:u32 | CH:u8 | SA:u16 | EA:u16 | ST:u8 | EN:u8 | OP:u8 | TM:u8 | HC:u32 | IC:u32 | CE:u8 | MS:u8
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
| Field | Meaning |
|
|
700
|
+
| --------- | -------------------------------------- |
|
|
701
|
+
| `CN` | Checkpoint number |
|
|
702
|
+
| `CH` | Currently hit |
|
|
703
|
+
| `SA`,`EA` | Inclusive address range |
|
|
704
|
+
| `ST` | Stop when hit |
|
|
705
|
+
| `EN` | Enabled |
|
|
706
|
+
| `OP` | `0x01 load`, `0x02 store`, `0x04 exec` |
|
|
707
|
+
| `TM` | Temporary |
|
|
708
|
+
| `HC` | Hit count |
|
|
709
|
+
| `IC` | Ignore count |
|
|
710
|
+
| `CE` | Has condition |
|
|
711
|
+
| `MS` | Memspace |
|
|
712
|
+
|
|
713
|
+
---
|
|
714
|
+
|
|
715
|
+
## `0x31` - Register Info
|
|
716
|
+
|
|
717
|
+
```text
|
|
718
|
+
RC:u16 | ITEM[RC]
|
|
719
|
+
item: IS:u8 | RI:u8 | RV:u16
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
Query `0x83 REGISTERS_AVAILABLE` before interpreting `RI`.
|
|
723
|
+
|
|
724
|
+
---
|
|
725
|
+
|
|
726
|
+
## `0x61` - JAM Event
|
|
727
|
+
|
|
728
|
+
```text
|
|
729
|
+
PC:u16
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
Usually emitted with `request_id = 0xffffffff`.
|
|
733
|
+
|
|
734
|
+
---
|
|
735
|
+
|
|
736
|
+
## `0x62` - Stopped Event
|
|
737
|
+
|
|
738
|
+
```text
|
|
739
|
+
PC:u16
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
Usually emitted with `request_id = 0xffffffff`.
|
|
743
|
+
|
|
744
|
+
---
|
|
745
|
+
|
|
746
|
+
## `0x63` - Resumed Event
|
|
747
|
+
|
|
748
|
+
```text
|
|
749
|
+
PC:u16
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
Usually emitted with `request_id = 0xffffffff`.
|
|
753
|
+
|
|
754
|
+
---
|
|
755
|
+
|
|
756
|
+
# Command Summary
|
|
757
|
+
|
|
758
|
+
| Command | Hex | Direct Response | C64 Bridge surface |
|
|
759
|
+
| -------------------- | -----: | -----------------------: | ----------------------------------------------------------------------------------- |
|
|
760
|
+
| Memory Get | `0x01` | `0x01` | `c64_memory.read`, `c64_memory.read_screen`, `c64_memory.wait_for_text` |
|
|
761
|
+
| Memory Set | `0x02` | `0x02` | `c64_memory.write` |
|
|
762
|
+
| Checkpoint Get | `0x11` | `0x11` | `c64_debug.get_checkpoint` |
|
|
763
|
+
| Checkpoint Set | `0x12` | `0x11` | `c64_debug.create_checkpoint` |
|
|
764
|
+
| Checkpoint Delete | `0x13` | `0x13` | `c64_debug.delete_checkpoint` |
|
|
765
|
+
| Checkpoint List | `0x14` | many `0x11`, then `0x14` | `c64_debug.list_checkpoints` |
|
|
766
|
+
| Checkpoint Toggle | `0x15` | `0x15` | `c64_debug.toggle_checkpoint` |
|
|
767
|
+
| Condition Set | `0x22` | `0x22` | `c64_debug.set_condition` |
|
|
768
|
+
| Registers Get | `0x31` | `0x31` | `c64_debug.get_registers` |
|
|
769
|
+
| Registers Set | `0x32` | `0x31` | `c64_debug.set_registers` |
|
|
770
|
+
| Dump | `0x41` | `0x41` | internal or unmapped |
|
|
771
|
+
| Undump | `0x42` | `0x42` | internal or unmapped |
|
|
772
|
+
| Resource Get | `0x51` | `0x51` | `c64_vice.resource_get` |
|
|
773
|
+
| Resource Set | `0x52` | `0x52` | `c64_vice.resource_set` |
|
|
774
|
+
| Advance Instructions | `0x71` | `0x71` | `c64_debug.step` |
|
|
775
|
+
| Keyboard Feed | `0x72` | `0x72` | internal or unmapped |
|
|
776
|
+
| Execute Until Return | `0x73` | `0x73` | `c64_debug.step_return` |
|
|
777
|
+
| Ping | `0x81` | `0x81` | internal |
|
|
778
|
+
| Banks Available | `0x82` | `0x82` | internal |
|
|
779
|
+
| Registers Available | `0x83` | `0x83` | `c64_debug.list_registers` |
|
|
780
|
+
| Display Get | `0x84` | `0x84` | `c64_graphics.capture_frame` |
|
|
781
|
+
| VICE Info | `0x85` | `0x85` | internal diagnostics |
|
|
782
|
+
| CPU History | `0x86` | `0x86` | internal or unmapped |
|
|
783
|
+
| Palette Get | `0x91` | `0x91` | internal display support |
|
|
784
|
+
| Joyport Set | `0xa2` | `0xa2` | internal or unmapped |
|
|
785
|
+
| Userport Set | `0xb2` | `0xb2` | internal or unmapped |
|
|
786
|
+
| Exit | `0xaa` | `0xaa` | `c64_system.resume` |
|
|
787
|
+
| Quit | `0xbb` | `0xbb` | managed VICE lifecycle |
|
|
788
|
+
| Reset | `0xcc` | `0xcc` | `c64_system.reset`, `c64_system.reboot`, `c64_drive.reset` |
|
|
789
|
+
| Autostart / Autoload | `0xdd` | `0xdd` | `c64_program.run_prg`, `c64_program.upload_run_basic`, `c64_program.upload_run_asm` |
|
|
790
|
+
|
|
791
|
+
---
|
|
792
|
+
|
|
793
|
+
# C64 Bridge Implementation Guidance
|
|
794
|
+
|
|
795
|
+
## Public MCP API First
|
|
796
|
+
|
|
797
|
+
LLM agents should prefer the public C64 Bridge MCP tools over raw VICE protocol details.
|
|
798
|
+
|
|
799
|
+
Examples:
|
|
800
|
+
|
|
801
|
+
| User intent | Prefer |
|
|
802
|
+
| ------------------------------- | ----------------------------------------- |
|
|
803
|
+
| Read memory at `$0801` | `c64_memory` with `op = read` |
|
|
804
|
+
| Write bytes to RAM | `c64_memory` with `op = write` |
|
|
805
|
+
| Show the current text screen | `c64_memory` with `op = read_screen` |
|
|
806
|
+
| Capture the current video frame | `c64_graphics` with `op = capture_frame` |
|
|
807
|
+
| Set a breakpoint | `c64_debug` with `op = create_checkpoint` |
|
|
808
|
+
| List breakpoints | `c64_debug` with `op = list_checkpoints` |
|
|
809
|
+
| List registers | `c64_debug` with `op = list_registers` |
|
|
810
|
+
| Read PC and A | `c64_debug` with `op = get_registers` |
|
|
811
|
+
| Step one instruction | `c64_debug` with `op = step` |
|
|
812
|
+
| Step until return | `c64_debug` with `op = step_return` |
|
|
813
|
+
| Continue execution | `c64_system` with `op = resume` |
|
|
814
|
+
| Reset VICE | `c64_system` with `op = reset` |
|
|
815
|
+
| Change a VICE setting | `c64_vice` with `op = resource_set` |
|
|
816
|
+
|
|
817
|
+
## Backend Selection
|
|
818
|
+
|
|
819
|
+
If both C64 Ultimate and VICE are configured, use `c64_select_backend` before making VICE-specific requests.
|
|
820
|
+
|
|
821
|
+
```json
|
|
822
|
+
{
|
|
823
|
+
"tool": "c64_select_backend",
|
|
824
|
+
"op": "select",
|
|
825
|
+
"backend": "vice"
|
|
826
|
+
}
|
|
827
|
+
```
|
|
828
|
+
|
|
829
|
+
Use backend switching instead of assuming the active backend is already VICE.
|
|
830
|
+
|
|
831
|
+
## Internal VICE Backend Rules
|
|
832
|
+
|
|
833
|
+
The C64 Bridge VICE backend should:
|
|
834
|
+
|
|
835
|
+
- keep binary monitor request IDs internal;
|
|
836
|
+
- correlate direct replies by request ID;
|
|
837
|
+
- treat the protocol as asynchronous;
|
|
838
|
+
- buffer or route asynchronous events separately from command responses;
|
|
839
|
+
- decode binary data internally;
|
|
840
|
+
- return LLM-readable JSON from MCP tools;
|
|
841
|
+
- return memory and display payloads as hex strings or files, not raw byte arrays;
|
|
842
|
+
- cache register metadata from `REGISTERS_AVAILABLE`;
|
|
843
|
+
- cache bank metadata from `BANKS_AVAILABLE`;
|
|
844
|
+
- refresh cached metadata if the VICE machine type changes.
|
|
845
|
+
|
|
846
|
+
## Suggested VICE Initialization
|
|
847
|
+
|
|
848
|
+
After connecting to the VICE binary monitor:
|
|
849
|
+
|
|
850
|
+
1. Send `PING`.
|
|
851
|
+
2. Send `VICE_INFO`.
|
|
852
|
+
3. Send `BANKS_AVAILABLE`.
|
|
853
|
+
4. Send `REGISTERS_AVAILABLE` for main memspace.
|
|
854
|
+
5. Cache register and bank mappings.
|
|
855
|
+
6. Drain or classify any asynchronous monitor events.
|
|
856
|
+
|
|
857
|
+
## Suggested MCP Result Shapes
|
|
858
|
+
|
|
859
|
+
### `c64_memory.read`
|
|
860
|
+
|
|
861
|
+
```json
|
|
862
|
+
{
|
|
863
|
+
"address": 2048,
|
|
864
|
+
"endAddress": 2063,
|
|
865
|
+
"length": 16,
|
|
866
|
+
"memspace": "main",
|
|
867
|
+
"bankId": 0,
|
|
868
|
+
"hex": "0102030405060708090a0b0c0d0e0f10"
|
|
869
|
+
}
|
|
870
|
+
```
|
|
871
|
+
|
|
872
|
+
### `c64_debug.get_registers`
|
|
873
|
+
|
|
874
|
+
```json
|
|
875
|
+
{
|
|
876
|
+
"memspace": "main",
|
|
877
|
+
"registers": [
|
|
878
|
+
{
|
|
879
|
+
"id": 3,
|
|
880
|
+
"name": "PC",
|
|
881
|
+
"value": 58575,
|
|
882
|
+
"hex": "e4cf"
|
|
883
|
+
}
|
|
884
|
+
]
|
|
885
|
+
}
|
|
886
|
+
```
|
|
887
|
+
|
|
888
|
+
### `c64_debug.create_checkpoint`
|
|
889
|
+
|
|
890
|
+
```json
|
|
891
|
+
{
|
|
892
|
+
"checkpointNumber": 2,
|
|
893
|
+
"hit": false,
|
|
894
|
+
"startAddress": 64738,
|
|
895
|
+
"endAddress": 64739,
|
|
896
|
+
"stopWhenHit": true,
|
|
897
|
+
"enabled": true,
|
|
898
|
+
"operation": ["exec"],
|
|
899
|
+
"temporary": true,
|
|
900
|
+
"hitCount": 0,
|
|
901
|
+
"ignoreCount": 0,
|
|
902
|
+
"hasCondition": false,
|
|
903
|
+
"memspace": "main"
|
|
904
|
+
}
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
---
|
|
908
|
+
|
|
909
|
+
# Attribution
|
|
910
|
+
|
|
911
|
+
This reference is derived from the VICE binary monitor documentation.
|
|
912
|
+
|
|
913
|
+
VICE is licensed under GPL v2 or later. Copyright belongs to the VICE authors as listed here:
|
|
914
|
+
|
|
915
|
+
[https://vice-emu.sourceforge.io/index.html#copyright](https://vice-emu.sourceforge.io/index.html#copyright)
|
|
916
|
+
|
|
917
|
+
The authoritative source of truth for the VICE binary monitor protocol is the VICE manual:
|
|
918
|
+
|
|
919
|
+
[https://vice-emu.sourceforge.io/vice_13.html](https://vice-emu.sourceforge.io/vice_13.html)
|
|
920
|
+
|
|
921
|
+
When this document conflicts with the upstream VICE manual, the upstream manual wins.
|