@henols/c64-re-tools 2.2.0 → 2.3.0-rc.1

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.
Files changed (40) hide show
  1. package/README.md +4 -3
  2. package/package.json +1 -1
  3. package/skills/c64-assembler/SKILL.md +4 -3
  4. package/skills/c64-assembler/scripts/assembler.ts +1 -1
  5. package/skills/c64-basic/SKILL.md +3 -3
  6. package/skills/c64-development/SKILL.md +9 -9
  7. package/skills/c64-disk/SKILL.md +2 -2
  8. package/skills/c64-docs/SKILL.md +2 -2
  9. package/skills/c64-knowledge/SKILL.md +1 -1
  10. package/skills/c64-memory-map/SKILL.md +2 -2
  11. package/skills/c64-packer/SKILL.md +109 -0
  12. package/skills/c64-packer/scripts/packer.ts +113 -0
  13. package/skills/c64-provenance/SKILL.md +3 -3
  14. package/skills/c64-reverse-engineering/SKILL.md +3 -3
  15. package/skills/c64-static-analysis/SKILL.md +3 -3
  16. package/skills/c64-testing/SKILL.md +4 -4
  17. package/skills/c64-unpacker/SKILL.md +5 -5
  18. package/skills/emulator/SKILL.md +137 -0
  19. package/src/cli/main.ts +1 -1
  20. package/{skills/c64-assembler/scripts/lib → src}/compare.ts +3 -3
  21. package/src/host/main.ts +3 -1
  22. package/src/host/server.ts +7 -7
  23. package/src/host/vice/session.ts +4 -1
  24. package/src/mcp/main.ts +3 -3
  25. package/src/mcp/output.ts +4 -4
  26. package/src/mcp/server.ts +7 -2
  27. package/src/mcp/tools/debug.ts +6 -3
  28. package/src/mcp/tools/execution.ts +1 -0
  29. package/src/mcp/tools/input.ts +1 -0
  30. package/src/mcp/tools/machine.ts +1 -1
  31. package/src/mcp/tools/media.ts +4 -2
  32. package/src/native/c64run.ts +34 -4
  33. package/src/native/discover.ts +8 -0
  34. package/src/native/exomizer.ts +90 -0
  35. package/src/native/local.ts +2 -2
  36. package/src/native/processes.ts +20 -3
  37. package/src/native/status.ts +3 -2
  38. package/tools/install-container.sh +2 -1
  39. package/tools/install-exomizer.sh +70 -0
  40. package/skills/c64-emulator/SKILL.md +0 -160
@@ -1,6 +1,6 @@
1
1
  import { spawn, spawnSync, type ChildProcess, type StdioOptions } from "node:child_process";
2
2
  import type { Writable } from "node:stream";
3
- import { mkdtempSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
3
+ import { existsSync, mkdtempSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { tmpdir } from "node:os";
5
5
  import { join } from "node:path";
6
6
  import { setTimeout as sleep } from "node:timers/promises";
@@ -14,6 +14,8 @@ export const STOP_GRACE_MS = 5_000;
14
14
  /** How long to wait for the group to vanish after SIGKILL before giving up. */
15
15
  const KILL_WAIT_MS = 2_000;
16
16
  const POLL_MS = 25;
17
+ /** How many times a killed watchdog is replaced. A watchdog that cannot run at all must not start new ones forever. */
18
+ const WATCHDOG_RESPAWNS = 5;
17
19
 
18
20
  export interface SpawnOptions {
19
21
  cwd?: string;
@@ -170,6 +172,7 @@ export class ProcessSupervisor {
170
172
  /** The registry file that the watchdog reads, once a watchdog runs. */
171
173
  #registry: string | undefined;
172
174
  #watchdogPid: number | undefined;
175
+ #watchdogRespawns = 0;
173
176
  /** The writing end of the watchdog's pipe. Kept open until this process ends: its end tells the watchdog that this process is gone. */
174
177
  #watchdogPipe: Writable | undefined;
175
178
 
@@ -270,10 +273,20 @@ export class ProcessSupervisor {
270
273
  const directory = mkdtempSync(join(tmpdir(), `c64-re-tools-${owner}-watchdog-`));
271
274
  this.#registry = join(directory, "registry.json");
272
275
  this.#writeRegistry();
276
+ this.#spawnWatchdog(this.#registry);
277
+ this.installExitGuard();
278
+ }
279
+
280
+ /**
281
+ * A watchdog that ends while its registry is still there did not end by
282
+ * itself (it removes the registry when it cleans up, as the exit guard does):
283
+ * something killed it. A new one takes over the same registry, a few times at most.
284
+ */
285
+ #spawnWatchdog(registry: string): void {
273
286
  // The watchdog runs in the temporary directory, never in the caller's directory: Windows refuses
274
287
  // to remove a directory that a running process uses. Its standard input is a pipe from this
275
288
  // process, which the system closes when this process ends.
276
- const watchdog = spawn(process.execPath, [...process.execArgv, WATCHDOG, String(process.pid), this.#registry], { cwd: tmpdir(), detached: true, stdio: ["pipe", "ignore", "ignore"], windowsHide: true });
289
+ const watchdog = spawn(process.execPath, [...process.execArgv, WATCHDOG, String(process.pid), registry], { cwd: tmpdir(), detached: true, stdio: ["pipe", "ignore", "ignore"], windowsHide: true });
277
290
  watchdog.unref();
278
291
  // The pipe does not keep this process running, and an error on it does not end this process.
279
292
  const pipe = watchdog.stdin as (Writable & { unref?: () => void }) | null;
@@ -281,7 +294,11 @@ export class ProcessSupervisor {
281
294
  pipe?.unref?.();
282
295
  this.#watchdogPipe = pipe ?? undefined;
283
296
  this.#watchdogPid = watchdog.pid;
284
- this.installExitGuard();
297
+ watchdog.once("exit", () => {
298
+ if (!existsSync(registry) || this.#watchdogRespawns >= WATCHDOG_RESPAWNS) return;
299
+ this.#watchdogRespawns++;
300
+ this.#spawnWatchdog(registry);
301
+ });
285
302
  }
286
303
 
287
304
  #writeRegistry(): void {
@@ -1,14 +1,14 @@
1
1
  // Tool status: finds each native tool the way its operations do and runs it
2
2
  // once with a version option, so a user can see in advance which tools work.
3
3
  // The Host Runtime reports VICE and its tools (host.status); the CLI reports
4
- // the tools that skill scripts run themselves (ACME, DXA, Ghidra).
4
+ // the tools that skill scripts run themselves (ACME, DXA, Exomizer, Ghidra).
5
5
 
6
6
  import { tmpdir } from "node:os";
7
7
  import { stripVTControlCharacters } from "node:util";
8
8
 
9
9
  import { isRefusal } from "../errors.ts";
10
10
  import { type ToolStatus } from "../protocol/tools.ts";
11
- import { ACME, C64RUN, DXA, findTool, INSTALL_STEPS } from "./discover.ts";
11
+ import { ACME, C64RUN, DXA, EXOMIZER, findTool, INSTALL_STEPS } from "./discover.ts";
12
12
  import { findGhidra, ghidraVersion, NO_USABLE_JDK, noJdk } from "./ghidra/index.ts";
13
13
  import { runTool, type ToolContext } from "./run.ts";
14
14
  import { Workspace } from "./staging.ts";
@@ -129,6 +129,7 @@ export async function localToolStatus(context: ToolContext): Promise<ToolStatus[
129
129
  // dxa -V prints its version and exits with status 1. It names itself by argv[0], without the
130
130
  // directory only where that uses "/": on Windows the line starts with the full path.
131
131
  { name: "dxa", find: (env) => findTool(DXA, env), args: ["-V"], pattern: DXA_VERSION },
132
+ { name: "Exomizer", find: (env) => findTool(EXOMIZER, env), args: ["-v"], pattern: /^Exomizer v\d/ },
132
133
  ];
133
134
  return [...(await probeTools(probes, context)), await probeGhidra(context), await probeC64run(context)];
134
135
  }
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # The native tools of the skill scripts in a Debian or Ubuntu dev container,
3
- # as root: ACME, dxa, c64run with its C64 ROMs, and Ghidra. The dev container
3
+ # as root: ACME, dxa, Exomizer, c64run with its C64 ROMs, and Ghidra. The dev container
4
4
  # Feature runs the copy of this script that comes with the toolkit version it
5
5
  # installs, so the tools and the skills are always of the same version.
6
6
  # A tool is installed again only when its install files changed: a stamp in
@@ -55,6 +55,7 @@ tool() {
55
55
 
56
56
  packages acme unzip curl ca-certificates build-essential
57
57
  tool dxa install-dxa.sh
58
+ tool exomizer install-exomizer.sh
58
59
  tool c64run install-chips.sh c64run.c
59
60
  tool ghidra install-ghidra.sh
60
61
 
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -Eeuo pipefail
4
+
5
+ # ------------------------------------------------------------
6
+ # Exomizer installer. install-container.sh runs it as root, with
7
+ # build-essential and curl.
8
+ #
9
+ # Installs:
10
+ # /usr/local/bin/exomizer
11
+ #
12
+ # Exomizer version:
13
+ # 3.1.2 (tag 3.1.2, commit df77c879ce2a)
14
+ # ------------------------------------------------------------
15
+
16
+ EXOMIZER_VERSION="3.1.2"
17
+
18
+ # Bitbucket makes the archive of the tag on request, so its bytes can change.
19
+ # The check is on the source files that the build uses: the SHA-256 of the
20
+ # sorted list of "sha256 ./path" lines of src/.
21
+ EXOMIZER_URL="https://bitbucket.org/magli143/exomizer/get/${EXOMIZER_VERSION}.tar.gz"
22
+ EXOMIZER_SOURCE_SHA256="0824d19bdf5a2cc752d2c21e1e6314f7d5feb398bc2d42510aebc1a2e4f08c72"
23
+
24
+ BIN_DIR="/usr/local/bin"
25
+
26
+ BUILD_DIR=""
27
+
28
+ error()
29
+ {
30
+ printf '\nERROR: %s\n' "$*" >&2
31
+ exit 1
32
+ }
33
+
34
+ cleanup()
35
+ {
36
+ if [[ -n "${BUILD_DIR}" && -d "${BUILD_DIR}" ]]; then
37
+ rm -rf "${BUILD_DIR}"
38
+ fi
39
+ }
40
+
41
+ trap cleanup EXIT
42
+
43
+ [[ "$(id -u)" -eq 0 ]] || error "Run as root."
44
+
45
+ printf '\n==> Installing Exomizer %s to %s/exomizer\n' "${EXOMIZER_VERSION}" "${BIN_DIR}"
46
+
47
+ BUILD_DIR="$(mktemp -d -t exomizer-build-XXXXXXXX)"
48
+ cd "${BUILD_DIR}"
49
+
50
+ curl --fail --location --show-error --silent --retry 3 --output exomizer.tar.gz "${EXOMIZER_URL}"
51
+ tar -xzf exomizer.tar.gz
52
+
53
+ # The archive holds one folder, named after the repository and the commit.
54
+ SOURCE_DIR="$(find "${BUILD_DIR}" -mindepth 2 -maxdepth 2 -type d -name src -print -quit)"
55
+ [[ -n "${SOURCE_DIR}" ]] || error "The archive has no src folder."
56
+ cd "${SOURCE_DIR}"
57
+
58
+ ACTUAL_SHA256="$(find . -type f | LC_ALL=C sort | xargs sha256sum | sha256sum | cut -d' ' -f1)"
59
+ if [[ "${ACTUAL_SHA256}" != "${EXOMIZER_SOURCE_SHA256}" ]]; then
60
+ error "The source files of Exomizer ${EXOMIZER_VERSION} have the SHA-256 ${ACTUAL_SHA256}, not ${EXOMIZER_SOURCE_SHA256}. Refusing to compile them."
61
+ fi
62
+
63
+ make CC=gcc exomizer
64
+
65
+ [[ "$(./exomizer -v 2>&1 || true)" == *"Exomizer v${EXOMIZER_VERSION} "* ]] || error "The compiled exomizer does not run or is not version ${EXOMIZER_VERSION}."
66
+
67
+ install -d -m 0755 "${BIN_DIR}"
68
+ install -m 0755 exomizer "${BIN_DIR}/exomizer"
69
+
70
+ printf '\nExomizer %s is installed: %s/exomizer\n' "${EXOMIZER_VERSION}" "${BIN_DIR}"
@@ -1,160 +0,0 @@
1
- ---
2
- name: c64-emulator
3
- description: Use this skill to operate and debug the live C64 emulator through the c64-re-tools MCP tools, whose names start with c64_. It loads programs and disks, controls and steps the CPU, and sets breakpoints and watchpoints. It reads and writes memory and registers, types keys, moves a joystick, advances frames and captures the screen. Do not use it for static analysis, project knowledge, assembly or disk inspection.
4
- ---
5
-
6
- # c64-emulator
7
-
8
- ## Purpose
9
-
10
- Operate and debug the one live C64 that belongs to this MCP session. Get runtime evidence and runtime state from it.
11
-
12
- This skill does not analyse code statically. It does not write project knowledge. It does not assemble source code.
13
-
14
- ## Inputs
15
-
16
- - The machine action or the runtime question.
17
- - The target address, state or condition, when the question needs one.
18
- - The project path of the program or disk to load, when the question needs one.
19
-
20
- An address is `$` and 1 to 4 hex digits, for example `$c000` or `$fb`. A tool takes no names. Get the address of a name with `knowledge.ts at <name>` of the c64-knowledge skill.
21
-
22
- ## Tools / execution path
23
-
24
- Use only the MCP tools. Each MCP session has its own C64. Nothing else can change that C64.
25
-
26
- | Need | Tool |
27
- |---|---|
28
- | Run state, video standard, warp mode, window, version of the MCP server | `c64_status` |
29
- | Reset, power cycle | `c64_reset` |
30
- | Fast emulation | `c64_warp` |
31
- | Show the C64 to the user in a window, hide it again | `c64_window` |
32
- | Stop, start, step, step over, step out, exact frames | `c64_execution` |
33
- | Run until an address, a memory value or a raster position | `c64_run_until` |
34
- | Run to a place and read the machine there in one call | `c64_run_until` with `observe` and `history` |
35
- | Each write, read or routine entry over many frames, with the instruction and the raster line | `c64_trace` |
36
- | Stop on an instruction address | `c64_breakpoint` |
37
- | Stop on a memory read or write from `start` to `end` | `c64_watchpoint` |
38
- | Memory | `c64_memory_read`, `c64_memory_write`, `c64_memory_search`, `c64_memory_compare` |
39
- | CPU registers | `c64_registers` (action `read` or `write`) |
40
- | Code as it is in memory now | `c64_disassemble` |
41
- | Executed instructions, call chain | `c64_cpu_history`, `c64_backtrace` |
42
- | Which instruction reads or writes an address | `c64_trace` with a `read` or `write` point |
43
- | Where the CPU spends cycles, which memory it uses | `c64_profile`, `c64_memmap` |
44
- | Cycle count between two points | `c64_timing` |
45
- | Video chip, sprites, CIAs, sound chip | `c64_vicii`, `c64_sprite`, `c64_cia`, `c64_sid` |
46
- | Screen image, screen compare, remove a baseline | `c64_screen` |
47
- | Several of these from one moment | `c64_observe` |
48
- | Keys, joystick | `c64_keyboard`, `c64_joystick` |
49
- | Program and disk media | `c64_autostart`, `c64_program_load`, `c64_disk_attach` |
50
- | Machine state to go back to, also in a later session, remove a snapshot | `c64_snapshot` (with `out` and `file`) |
51
-
52
- Each memory and register tool has a `space`. Use `c64` for the computer. Use `drive8` for the CPU of the 1541 disk drive. The memory `view` is `cpu` or `ram`. With `cpu`, you see what the CPU sees now, with ROM and I/O where the memory configuration puts them. With `ram`, you see the RAM under them.
53
-
54
- For a large result, give `out` with a path in the project. `c64_memory_read`, `c64_disassemble`, `c64_cpu_history` and `c64_screen` then write the result to that file. The answer gives only the file, the number of bytes and a SHA-256. Use it for a memory dump of more than a few hundred bytes, a long listing, or a screen that the user wants to keep. `c64_memmap` action `read` and `c64_snapshot` action `save` also take `out`. Write a file that is only for your work in `.c64-re-tools/local/` of the project. Git ignores that folder.
55
-
56
- `c64_memmap` keeps RAM, ROM and I/O apart. Use action `summary` to see which code ran. Use action `read` with `out` to keep a coverage run as a file, for example `.c64-re-tools/local/attract.bin`. Then add it to the knowledge with `coverage` of the c64-knowledge skill. Clear the map before each run that you want to keep apart.
57
-
58
- - Only the first byte of an instruction gets execute. Thus `read` without `out` gives a new range at each instruction of code. For code, use `summary`, or `read` with `out`.
59
- - A read on a byte right after executed code, or at a return address, can be a dummy read of the 6502. The CPU reads such a byte but does not use it.
60
- - VICE has a known flaw: it uses only one bit of `$01` to find RAM or ROM. At `$A000-$BFFF` it gives `rom` when bit 0 is set, also when bit 1 is clear and the CPU used the RAM there. Many games set `$01` to `$35`. Then code that runs at `$A000-$BFFF` shows as ROM. `emulatorFlaw` in the result tells when this can occur. Every access at `$D000-$DFFF` shows as I/O.
61
-
62
- `c64_profile` gives the routines that used the most cycles since the session started, the last `clear` or the last `c64_window`. Use action `clear` before the part of the program that you want to measure. The profiler gives the cycles to the routine that a JSR called last. Code that the CPU enters with JMP or a branch counts for that routine. After `c64_window` or a snapshot restore, the profiler of VICE keeps the routines that ran before the restore. Then `c64_profile` can give the cycles of the program to such a routine, for example `$fd50`. Do not trust the routine addresses of `c64_profile` after a restore.
63
-
64
- ### Project folder
65
-
66
- Paths (`path`, `file` and `out`) are relative to the project folder. A project folder holds `.c64-re-tools/`. The tools use the nearest project folder at or above the folder where the agent started. If that folder is not in a project and has projects below it, a tool with a path refuses and lists them. Then give `project` with the project folder, for example `"project": "game"`. Give the same folder as the `--project` of the skill scripts. A tool without a path does not need `project`.
67
-
68
- ## Workflow
69
-
70
- 1. Read the project knowledge for the addresses in the question. Use the c64-knowledge skill.
71
- 2. Get the machine state with `c64_status`.
72
- 3. Load the subject if it is not loaded. Use `c64_autostart` to start it as a user does. Use `c64_program_load` to put a PRG in memory with no start.
73
- 4. Set the stop condition. Use a breakpoint, a watchpoint or a `c64_run_until` target. Add a typed condition when the stop must occur only in one state. The `list` result shows the condition of each breakpoint and each watchpoint.
74
- 5. Run, step or give input. Prefer `c64_run_until` and `advance-frames` to waits. They stop at the same emulated time on every run. To wait for a breakpoint or a watchpoint, use `advance-frames` with a large count. `stopReason` and `pointId` in the result tell what stopped the CPU. `c64_status` also gives them.
75
- 6. Read only the state that answers the question. To read several things from one moment, use `c64_observe`.
76
- 7. Interpret the evidence. Keep the observed facts apart from your conclusions.
77
-
78
- Write operations need a stopped CPU. Stop the CPU with `c64_execution` action `pause` first.
79
-
80
- `c64_reset` with `run` false stops the CPU at the first instruction of the reset routine. The result gives that address in `pc`. A reset and `c64_autostart` set `c64_timing` to zero.
81
-
82
- A cartridge from `c64_autostart` stays in the C64 through every reset, as on a real C64. `c64_status` gives `cartridge: true` while the C64 has it, and `cartridge: false` when it does not. `c64_autostart` of a file that is not a cartridge removes the cartridge first. `c64_autostart` also sets both joysticks to the center first. `joysticksCentred` gives the ports that it changed.
83
-
84
- `c64_autostart` returns while the load continues. The emulator turns warp on until it types RUN. A key in that time stops the autostart, so `c64_keyboard` refuses it. Run frames with `advance-frames` until `c64_status` gives `warp: false`. Then type.
85
-
86
- Step, next and until-return work only in space `c64`. The emulator cannot stop the disk drive CPU after one instruction. To find when the drive executes an address, use `c64_run_until` with an address target in space `drive8`, or a breakpoint in space `drive8`. The drive can execute a few more instructions before it stops. The computer completes its current instruction. The `pc` in the result is the drive address where it stopped. `space` in the result is `drive8`. A breakpoint or a watchpoint in space `drive8` that stops `advance-frames` gives the same `pc` and `space`. `c64_status` also gives them. A memory target or a memory condition tests only space `c64`.
87
-
88
- `c64_keyboard` puts keys in the keyboard queue of the KERNAL. A program that reads the keyboard matrix directly does not see them. Many games do this. No MCP tool presses a key of the keyboard matrix. For such a program:
89
-
90
- - VICE 3.10 and older have a known flaw: bits 5-7 of `$DC00` and `$DC01` are always 0. Then `emulatorFlaw` in the result of `c64_keyboard` and `c64_joystick` gives the flaw. With this flaw, a wait for any key that reads all keyboard columns at one time ends without a key. A wait for one specific key, or a compare of the full byte of a joystick port, never ends. Tell the user about the flaw. The next VICE release and the VICE nightly builds do not have it. Joystick port 1 uses the same lines as the keyboard.
91
- - For one specific key, for example F1 or RUN/STOP, use one of these two ways:
92
- - Open the window and ask the user to press the key.
93
- - Record a session with a `press` step. Use `testing.ts record` of the c64-testing skill.
94
- - Do not change the program to make it accept a key.
95
-
96
- Before a risky experiment, save the state with `c64_snapshot`. Restore it to try again from the same point.
97
-
98
- The emulator has no window. When the user must type, play or look at the C64, do these steps:
99
-
100
- 1. Open the window with `c64_window` action `open`.
101
- 2. Tell the user that the window is open and what to do in it.
102
- 3. Wait until the user tells you that they finished.
103
- 4. Close the window with `c64_window` action `close`.
104
-
105
- The machine, the disk in drive 8, the breakpoints, the watchpoints, the joysticks, warp mode and `c64_timing` stay the same. The CPU stays running or stopped. The result field `notCarried` names the data that the move clears. A second `open` or `close` changes nothing.
106
-
107
- A read does not change the run state. A running machine continues to run after a read.
108
-
109
- ## Knowledge
110
-
111
- Read:
112
- - the current knowledge for each address and range that the question touches.
113
-
114
- Automatic write:
115
- - none.
116
-
117
- Write after interpretation:
118
- - a symbol, a region or a comment that the runtime evidence justifies. Record it with the c64-knowledge skill.
119
-
120
- Do not store:
121
- - breakpoints or watchpoints
122
- - memory reads
123
- - temporary machine state
124
- - a screen capture, unless the user asks for it as an artifact
125
-
126
- ## Result
127
-
128
- The result is the runtime state or evidence that the question asks for.
129
-
130
- If you cannot get the machine into the necessary state, say which state you could not get. Say what you tried.
131
-
132
- ## Failure and conflicts
133
-
134
- An error is `{"error": {"code": "...", "message": "..."}}`. The message tells what is wrong and what to do.
135
-
136
- - `machine-state-lost` and the message says that the VICE window closed: the window closed before `c64_window` action `close`. The emulator has no window again. The machine state is the same as at the time when the window opened. The breakpoints and the watchpoints stay. Do not use results from the window time. Read the machine state again, then continue.
137
- - `machine-unavailable` and the message says that the VICE window closed: the session starts the emulator again. Wait a few seconds. Then do the operation again.
138
- - `machine-state-lost` with a different message: the connection to the host runtime was lost, and the machine state is gone. Do not continue with results from before. The next call starts a new machine when the host runtime runs. Load the program again, and set the breakpoints and the watchpoints again. If the next call gives `machine-unavailable` with a message that the host runtime does not run, obey the rule for that message.
139
- - `machine-unavailable` and the message names a pause or a dialog in the emulator window: this occurs only while the window is open. Do not send more operations. Tell the user to resume the emulator (Pause, Alt+P) or to close the dialog in the VICE window. Then do the operation again. The machine state does not change.
140
- - `machine-unavailable` and the message says that the emulator does not take commands now, with no window open: wait a few seconds. Then do the operation again one time. If you get the same error again, stop the task. Tell the user to restart the c64-re-tools MCP server, and wait for the user.
141
- - `media-error`: the file is not of the type that its extension names. Give a file of that type.
142
- - `machine-running`: stop the CPU first, then try again.
143
- - `installation-incomplete`, or `machine-unavailable` with a message that the host runtime does not run: stop the task. Give the message to the user and wait for the user. The message gives the remedy. Do not make a replacement for the tool or the host runtime, for example your own disk parser, disassembler or emulator script. Do not try to repair the installation.
144
- - `c64_run_until` with `stopReason` `timeout`: the target did not occur in the frame limit. This is evidence too. Report it.
145
- - `stopReason` `jam`: the CPU executed a JAM opcode and stopped. Report the address. The CPU stays stopped, as on a real C64. Each run gives `jam` again. Step, next, until-return and resume refuse with `operation-failed`. Only `c64_reset`, a snapshot restore or `c64_autostart` starts the CPU again.
146
- - After a JAM, VICE records no CPU history until the next reset. If the CPU ran again after a snapshot restore, `c64_cpu_history` refuses with `operation-failed`. `c64_run_until` then gives `historyMissing` in place of `history`. Use `c64_reset`, or use `c64_trace`.
147
- - `invalid-input`: the message names the field and the rule. Change the call to obey the rule.
148
- - `not-found`: a file, a snapshot, a baseline or a point that the call names does not exist.
149
- - `unsupported-in-space`: the action works only in space `c64`.
150
- - `limit-exceeded`: the call goes past a limit of the session, for example the number of snapshots. The message names the limit.
151
- - `operation-failed`: the emulator did not do the operation. The message tells why.
152
-
153
- If the runtime evidence does not agree with the current knowledge, do not change the knowledge. Report the conflict and hand it to c64-knowledge.
154
-
155
- ## Handoffs
156
-
157
- - Static explanation of code → c64-static-analysis
158
- - Durable conclusion or a knowledge conflict → c64-knowledge
159
- - Comparison or assertion between runs → c64-testing
160
- - Meaning of a C64 address or register → c64-memory-map