@henols/c64-re-tools 0.2.1 → 0.2.3
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/README.md +1 -1
- package/THIRD-PARTY-NOTICES.md +26 -0
- package/bin/cli.mjs +18 -7
- package/package.json +6 -4
- package/skills/acme-build/SKILL.md +83 -33
- package/skills/acme-build/scripts/acme.mjs +159 -64
- package/skills/acme-build/template.a +1 -1
- package/skills/c64-disk-access/SKILL.md +156 -0
- package/skills/c64-disk-access/scripts/c1541.mjs +569 -0
- package/skills/c64-memory-mapping/SKILL.md +419 -23
- package/skills/c64-memory-mapping/scripts/driver.mjs +1 -1
- package/skills/c64-petcat/SKILL.md +87 -0
- package/skills/c64-petcat/scripts/petcat.mjs +221 -0
- package/skills/c64-program-recon/SKILL.md +497 -92
- package/skills/c64-program-recon/references/control-flow.md +12 -15
- package/skills/c64-program-recon/references/graphics.md +1 -1
- package/skills/c64-program-recon/references/observation-hazards.md +18 -16
- package/skills/c64-program-recon/references/reconstruction.md +11 -6
- package/skills/c64-program-recon/references/sound-and-input.md +6 -8
- package/skills/c64-program-recon/references/tool-selection.md +37 -18
- package/skills/c64-program-recon/scripts/packer-finding.mjs +709 -0
- package/skills/c64-program-recon/templates/memory-map.template.md +27 -13
- package/skills/c64-provenance-diff/SKILL.md +43 -8
- package/skills/c64-provenance-diff/scripts/diff-images.mjs +9 -6
- package/skills/c64-provenance-diff/scripts/recovery-schema.mjs +20 -8
- package/skills/c64-ram-capture/RELEASES.json.example +17 -0
- package/skills/c64-ram-capture/SKILL.md +147 -46
- package/skills/c64-ram-capture/scripts/compare.mjs +2 -2
- package/skills/c64-ram-capture/scripts/derive-transients.mjs +575 -0
- package/skills/c64-ram-capture/scripts/dump-artifacts.mjs +3 -3
- package/skills/c64-ram-capture/scripts/mcp-module.mjs +174 -0
- package/skills/c64-ram-capture/scripts/project-paths.mjs +1 -1
- package/skills/c64-ram-capture/scripts/releases.mjs +1 -1
- package/skills/c64-ram-capture/scripts/vsf-slice.mjs +147 -0
- package/skills/c64-ram-capture/scripts/watch-loads.mjs +19 -13
- package/skills/c64-ram-capture/templates/capture-record.template.md +44 -4
- package/skills/c64-ram-capture/transients/README.md +136 -0
- package/skills/routine-queue-walker/SKILL.md +365 -0
- package/skills/routine-queue-walker/scripts/completeness-report.mjs +463 -0
- package/skills/vice-wedge-triage/SKILL.md +104 -97
- package/skills/c64-provenance-diff/scripts/diff-images.test.mjs +0 -665
- package/skills/c64-ram-capture/scripts/d64-parse.mjs +0 -243
- package/skills/c64-ram-capture/scripts/d64-parse.test.mjs +0 -243
- package/skills/c64-ram-capture/scripts/dump-artifacts.test.mjs +0 -133
- package/skills/c64-ram-capture/scripts/test-corpus.mjs +0 -75
- package/skills/c64-ram-capture/scripts/watch-loads.test.mjs +0 -339
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: c64-disk-access
|
|
3
|
+
description: Read a Commodore .d64 disk image's directory, block allocation map, a named file's sector chain, or a named file's raw bytes, using VICE's own c1541 disk tool as the reference implementation, and audit its directory for fabricated or corrupted entries. Use when asked to list what a disk image contains, check a disk's free blocks or block allocation map, trace which sectors a named file occupies on disk, extract a named file's raw bytes from a .d64, or check whether a disk's directory entries are genuine (a cracker-fabricated filename, a corrupted first track/sector, or a cyclic directory chain).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Reading C64 disk images with c1541
|
|
7
|
+
|
|
8
|
+
Read-only. Six capabilities, one script, one binary (`c1541`) reached only
|
|
9
|
+
through the host-tool execution seam:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
S=src/skills/c64-disk-access/scripts/c1541.mjs # from the repo root
|
|
13
|
+
|
|
14
|
+
node $S bam --image path/to/image.d64 # block allocation map
|
|
15
|
+
node $S dir --image path/to/image.d64 # what's on the disk
|
|
16
|
+
node $S entry --image path/to/image.d64 --name FILENAME # one directory entry's raw fields
|
|
17
|
+
node $S chain --image path/to/image.d64 --name FILENAME # a named file's sector chain
|
|
18
|
+
node $S read --image path/to/image.d64 --name FILENAME # extract a named file's bytes
|
|
19
|
+
node $S audit --image path/to/image.d64 # find fabricated/corrupted directory entries
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The script wraps `c1541` and nothing else — **read-only**. `bam`/`dir`/`audit`
|
|
23
|
+
need only `--image`; `entry`/`chain`/`read` also need `--name`, a CBM
|
|
24
|
+
filename or glob pattern (never a path). No `-format`, `-write`, `-bwrite`
|
|
25
|
+
or `-delete` verb is reachable from here, deliberately: this skill only
|
|
26
|
+
ever reads a disk image, never mutates one.
|
|
27
|
+
|
|
28
|
+
Options: `--image PATH` `--name CBM-NAME` `--out-dir DIR` `--json`.
|
|
29
|
+
|
|
30
|
+
`--out-dir` defaults to the image's own directory, exactly like
|
|
31
|
+
`acme-build`'s own `--out-dir` default. Both `--image` and `--out-dir` are
|
|
32
|
+
resolved **workspace-relative** to the smallest ancestor directory
|
|
33
|
+
containing both, before the request ever reaches the seam — the same
|
|
34
|
+
resolution `acme-build`'s `source`/`--out-dir` already go through. `--name`
|
|
35
|
+
is passed straight through, never resolved as a path; a value beginning
|
|
36
|
+
with `-` is refused by the seam before any child process is spawned (it
|
|
37
|
+
would otherwise be read as a flag by `c1541`'s own CLI).
|
|
38
|
+
|
|
39
|
+
## Directory listing
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
node $S dir --image game.d64 --json
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Prints the seam's response verbatim as one line of JSON:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{"ok":true,"tool":"c1541.dir","exitStatus":0,"results":[{"path":"/abs/path/game.dir.txt","sha256":"...","byteLength":123}],"stderrTail":""}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`results[0].path` names the listing file the seam wrote — `c1541`'s own
|
|
52
|
+
`-dir` output, captured and digested.
|
|
53
|
+
|
|
54
|
+
## Block allocation map
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
node $S bam --image game.d64 --json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Same response shape as `dir`; `results[0].path` names a file carrying one
|
|
61
|
+
per-sector allocation row per track (a run of `*`/`.` characters, `*` for
|
|
62
|
+
an allocated sector).
|
|
63
|
+
|
|
64
|
+
## One directory entry's raw fields
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
node $S entry --image game.d64 --name FILENAME --json
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`results[0].path` names a file carrying the entry's raw 32-byte directory
|
|
71
|
+
record (as a hex dump) followed by its `T/S: <t>/<s>, <n> blocks` summary
|
|
72
|
+
line. This script ALSO parses that line back and adds `firstTrack`/
|
|
73
|
+
`firstSector` as numeric fields on the JSON response, purely for display —
|
|
74
|
+
the file itself is still the authoritative source.
|
|
75
|
+
|
|
76
|
+
## A named file's sector chain
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
node $S chain --image game.d64 --name FILENAME --json
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`results[0].path` names a file listing every `(track,sector)` hop the file
|
|
83
|
+
occupies, in order. A single-sector file's chain shows one hop with no
|
|
84
|
+
second tuple on the arrow's right side; a multi-sector file's chain repeats
|
|
85
|
+
the tuple at every hop.
|
|
86
|
+
|
|
87
|
+
## Extracting a named file's bytes
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
node $S read --image game.d64 --name FILENAME --out-dir /scratch --json
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Writes the file's raw bytes (unlike the other four capabilities, this one
|
|
94
|
+
is NOT a captured-stdout listing — `c1541` writes the output file itself).
|
|
95
|
+
`results[0]` carries that file's `path`/`sha256`/`byteLength`.
|
|
96
|
+
|
|
97
|
+
## Auditing for fabricated or corrupted entries
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
node $S audit --image game.d64 --json
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Composes `dir` (names and block counts), `bam` (the per-sector allocation
|
|
104
|
+
map), and one `entry` call per name (each file's own claimed first track/
|
|
105
|
+
sector, and its directory sector's "next directory" pointer) into a ported,
|
|
106
|
+
read-only detector — no `-format`/`-write`/mutating verb, and no seventh
|
|
107
|
+
`host_tool` id; this is three existing capabilities composed client-side.
|
|
108
|
+
|
|
109
|
+
A directory entry is flagged `suspicious`, with **named reasons, never a
|
|
110
|
+
bare boolean**, on any of:
|
|
111
|
+
|
|
112
|
+
1. its block count is `0`;
|
|
113
|
+
2. its first track/sector lies outside the image's own geometry (there is
|
|
114
|
+
no such track, or no such sector on that track);
|
|
115
|
+
3. its first **sector** — not merely its whole track — is reported free by
|
|
116
|
+
the allocation map, meaning the file cannot really start there. This is
|
|
117
|
+
sharper than checking only whether the whole track is free, because the
|
|
118
|
+
per-sector map is available.
|
|
119
|
+
|
|
120
|
+
A cyclic or self-referential directory chain (two entries claiming the same
|
|
121
|
+
first track/sector, or a "next directory" pointer that refers back to a
|
|
122
|
+
sector already seen — including the directory's own starting sector) stops
|
|
123
|
+
being treated as new information and is reported as a top-level
|
|
124
|
+
`chain_error` naming the repeated pointer, rather than looping. Every
|
|
125
|
+
remaining entry is still audited afterward — a chain error on one entry
|
|
126
|
+
never hides another entry's own independent flag.
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{"entries":[{"name":"basicstub","blocks":1,"first_track":17,"first_sector":0,"suspicious":false,"suspicious_reasons":[]}],"chain_error":null}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**A flag is a signal to investigate, not a verdict.** A directory entry a
|
|
133
|
+
cracker fabricated for a file never actually written, a genuinely corrupted
|
|
134
|
+
image, and (rarely) an unusual-but-legitimate disk layout can all produce a
|
|
135
|
+
flag; this command reports what it finds, named, and leaves the
|
|
136
|
+
interpretation to whoever is looking at the disk.
|
|
137
|
+
|
|
138
|
+
## Failure shape
|
|
139
|
+
|
|
140
|
+
A nonexistent image, a nonexistent named entry, or any other call `c1541`
|
|
141
|
+
cannot service is reported as `{"ok":false,"message":"..."}` with a
|
|
142
|
+
non-zero exit code — **never** a success envelope over an empty or partial
|
|
143
|
+
result. `c1541` itself exits `0` even on a genuine failure (it prints its
|
|
144
|
+
own `Error - ...` lines to stdout instead); the seam's own classifier, not
|
|
145
|
+
the exit code, is what decides success here.
|
|
146
|
+
|
|
147
|
+
## What this skill does NOT do
|
|
148
|
+
|
|
149
|
+
- **No mutating verb.** `-format`/`-write`/`-bwrite`/`-delete` are never
|
|
150
|
+
reachable from this script, on the wire, or anywhere in this skill's tree
|
|
151
|
+
— only the six read-only capabilities above are exposed.
|
|
152
|
+
- **No direct binary spawn.** `c1541` runs host-side; this script only ever
|
|
153
|
+
constructs a typed request and reads the produced files back off the
|
|
154
|
+
shared workspace tree — the host-tool execution seam is the only route.
|
|
155
|
+
- **No emulator dependency.** This skill names no VICE emulator tool at
|
|
156
|
+
all — it works entirely on files, never on a running machine, by construction.
|