@henols/c64-re-tools 2.6.0 → 2.7.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/package.json +1 -1
- package/skills/c64-assembler/SKILL.md +4 -4
- package/skills/c64-basic/SKILL.md +1 -1
- package/skills/c64-development/SKILL.md +5 -5
- package/skills/c64-disk/SKILL.md +13 -13
- package/skills/c64-docs/SKILL.md +22 -9
- package/skills/c64-docs/references/page-types.md +11 -11
- package/skills/c64-docs/references/style.md +21 -0
- package/skills/c64-docs/scripts/docs.ts +64 -17
- package/skills/c64-docs/scripts/lib/links.ts +1 -1
- package/skills/c64-knowledge/SKILL.md +7 -7
- package/skills/c64-knowledge/scripts/knowledge.ts +1 -1
- package/skills/c64-memory-map/SKILL.md +1 -1
- package/skills/c64-packer/SKILL.md +1 -1
- package/skills/c64-provenance/SKILL.md +5 -4
- package/skills/c64-provenance/scripts/lib/compare.ts +1 -1
- package/skills/c64-reverse-engineering/SKILL.md +20 -11
- package/skills/c64-source/SKILL.md +8 -8
- package/skills/c64-source/scripts/lib/export.ts +7 -6
- package/skills/c64-source/scripts/lib/source.ts +3 -3
- package/skills/c64-source/scripts/source.ts +17 -17
- package/skills/c64-static-analysis/SKILL.md +1 -1
- package/skills/c64-testing/SKILL.md +25 -24
- package/skills/c64-testing/references/recording-format.md +7 -7
- package/skills/c64-testing/references/scenario-format.md +5 -5
- package/skills/c64-testing/scripts/lib/recording.ts +38 -38
- package/skills/c64-testing/scripts/lib/replay.ts +26 -26
- package/skills/c64-testing/scripts/lib/scenario.ts +28 -28
- package/skills/c64-testing/scripts/testing.ts +14 -14
- package/skills/c64-unpacker/SKILL.md +12 -12
- package/src/knowledge/separate.ts +2 -2
- package/src/knowledge/write.ts +1 -1
- package/src/project.ts +1 -1
- package/src/script.ts +1 -1
- package/tools/c64run.c +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The c64-testing script. test runs a scenario on the
|
|
1
|
+
// The c64-testing script. test runs a scenario on the reference and the
|
|
2
2
|
// rebuild in one emulator; run runs steps on one side and writes what they
|
|
3
3
|
// ask for; record and replay play a session in the replay core (c64run) and
|
|
4
4
|
// compare the rebuild with it; diff shows what changed between two states;
|
|
@@ -30,9 +30,9 @@ const DEFAULT_HTTP_PORT = 6465;
|
|
|
30
30
|
|
|
31
31
|
/** Behavior that only a person can judge. */
|
|
32
32
|
const ALWAYS = [
|
|
33
|
-
"The controls respond as fast as in the
|
|
33
|
+
"The controls respond as fast as in the reference.",
|
|
34
34
|
"The animation is smooth and has no glitches.",
|
|
35
|
-
"The music and the sound effects sound the same as in the
|
|
35
|
+
"The music and the sound effects sound the same as in the reference.",
|
|
36
36
|
"The game flow and the level changes work from start to end.",
|
|
37
37
|
"Nothing unexpected happens outside the tested scenarios.",
|
|
38
38
|
];
|
|
@@ -140,7 +140,7 @@ function checklist(call: Call): { text: string } {
|
|
|
140
140
|
for (const path of call.subjects) {
|
|
141
141
|
const scenario: Scenario = readScenario(path);
|
|
142
142
|
lines.push(`## ${scenario.name}`, "");
|
|
143
|
-
for (const step of scenario.steps) if ("observe" in step) lines.push(`- [ ] At "${step.observe}", the rebuild looks and behaves as the
|
|
143
|
+
for (const step of scenario.steps) if ("observe" in step) lines.push(`- [ ] At "${step.observe}", the rebuild looks and behaves as the reference.`);
|
|
144
144
|
lines.push("");
|
|
145
145
|
}
|
|
146
146
|
lines.push("## Application", "");
|
|
@@ -154,7 +154,7 @@ const STATE_ITEM = "a name or a $ address, with :size for more than one byte, fo
|
|
|
154
154
|
const COMMANDS: CommandSpec[] = [
|
|
155
155
|
{
|
|
156
156
|
name: "test",
|
|
157
|
-
summary: "Runs a scenario on the
|
|
157
|
+
summary: "Runs a scenario on the reference and then on the rebuild in one emulator. result is PASS, FAIL with the differences, or INCONCLUSIVE with the reason.",
|
|
158
158
|
subjects: [{ name: "<scenario.json>", help: "a scenario file, relative to the project folder. See references/scenario-format.md" }],
|
|
159
159
|
options: {
|
|
160
160
|
out: { ...OPTIONS.out, output: "folder", value: "<dir>", help: "with a FAIL, write both screens, the difference image and memory.json into this folder: each differing memory item with all its bytes, and each byte that differs" },
|
|
@@ -177,7 +177,7 @@ const COMMANDS: CommandSpec[] = [
|
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
179
|
name: "record",
|
|
180
|
-
summary: "Plays the steps of a record file on the
|
|
180
|
+
summary: "Plays the steps of a record file on the reference, and writes the session as a recording folder: recording.json, reads.txt and coverage.bin. result is FAIL when the session did not complete.",
|
|
181
181
|
subjects: [{ name: "<record.json>", help: "a record file, relative to the project folder. See references/recording-format.md" }],
|
|
182
182
|
options: {
|
|
183
183
|
out: { ...OPTIONS.out, output: "folder", value: "<dir>", required: true, help: "the recording folder, for example tests/recordings/<name>" },
|
|
@@ -189,25 +189,25 @@ const COMMANDS: CommandSpec[] = [
|
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
191
|
name: "replay",
|
|
192
|
-
summary: "Replays a recording on the
|
|
192
|
+
summary: "Replays a recording on the reference, which must end with the recorded state, and with --rebuild on the rebuild, which must have the state of the reference at each checkpoint. result is PASS, FAIL or INCONCLUSIVE.",
|
|
193
193
|
subjects: [{ name: "<recording>", help: "a folder that record wrote, relative to the project folder" }],
|
|
194
194
|
options: {
|
|
195
195
|
checkpoint: { kind: "text", value: "<routine>", help: "the name or $ address of a routine: each entry is a checkpoint. Without it, the comparison of the record file" },
|
|
196
196
|
state: { kind: "text", value: "<item>", multiple: true, help: `the state to compare at each checkpoint: ${STATE_ITEM}` },
|
|
197
|
-
pin: { kind: "text", value: "<item>", multiple: true, help: `random state in RAM, in the form of --state: at each checkpoint the rebuild gets the
|
|
198
|
-
rebuild: { kind: "path", value: "<prg>", help: "the rebuild to compare with the
|
|
197
|
+
pin: { kind: "text", value: "<item>", multiple: true, help: `random state in RAM, in the form of --state: at each checkpoint the rebuild gets the reference's values there` },
|
|
198
|
+
rebuild: { kind: "path", value: "<prg>", help: "the rebuild to compare with the reference" },
|
|
199
199
|
symbols: { ...OPTIONS.symbols, help: "the names of the rebuild: the symbol file of its build (default: the symbols of the recording)" },
|
|
200
200
|
out: { ...OPTIONS.out, output: "folder", value: "<dir>", help: "with a FAIL, write the RAM of both sides at the first different checkpoint into this folder" },
|
|
201
201
|
},
|
|
202
|
-
notes: "A recording without names takes the names of the knowledge for the
|
|
202
|
+
notes: "A recording without names takes the names of the knowledge for the reference. A $ address is an address of the reference: on the rebuild it moves with the name before it.",
|
|
203
203
|
run: async (call) => {
|
|
204
204
|
const [checkpoint, rebuild, symbols, out] = [call.string("checkpoint"), call.string("rebuild"), call.string("symbols"), call.string("out")];
|
|
205
205
|
const result = await replay({ folder: call.subject(0), state: call.strings("state"), pin: call.strings("pin"), ...(checkpoint === undefined ? {} : { checkpoint }), ...(rebuild === undefined ? {} : { rebuild }), ...(symbols === undefined ? {} : { symbols }), ...(out === undefined ? {} : { out }) });
|
|
206
206
|
if (result.result === "INCONCLUSIVE") return reply(result, { hint: INCONCLUSIVE_HINT });
|
|
207
207
|
if (result.result !== "FAIL") return result;
|
|
208
|
-
const [
|
|
209
|
-
if (
|
|
210
|
-
return reply(result, { hint: "files holds the RAM of each side at the first different checkpoint. Run nextAction to compare them. Then examine the first different state item in the emulator.", nextAction: call.next("diff",
|
|
208
|
+
const [reference, rebuilt] = result.files ?? [];
|
|
209
|
+
if (reference !== undefined && rebuilt !== undefined) {
|
|
210
|
+
return reply(result, { hint: "files holds the RAM of each side at the first different checkpoint. Run nextAction to compare them. Then examine the first different state item in the emulator.", nextAction: call.next("diff", reference.out, rebuilt.out) });
|
|
211
211
|
}
|
|
212
212
|
if (result.firstDifference === undefined) return reply(result, { hint: "reason tells how many checkpoints the rebuild came to. Examine the rebuild in the emulator after its last checkpoint." });
|
|
213
213
|
return reply(result, { hint: `A difference in a random value with the same input often shows a missing --pin.${out === undefined ? " Give --out to get the RAM of each side at the first different checkpoint." : ""}` });
|
|
@@ -243,7 +243,7 @@ const COMMANDS: CommandSpec[] = [
|
|
|
243
243
|
|
|
244
244
|
await runScript({
|
|
245
245
|
name: "testing",
|
|
246
|
-
summary: "Tests a rebuild against the
|
|
246
|
+
summary: "Tests a rebuild against the reference: scenarios in an emulator, runs, recorded play sessions, state differences, and a checklist for a human tester.",
|
|
247
247
|
names: knowledgeNames,
|
|
248
248
|
commands: COMMANDS,
|
|
249
249
|
});
|
|
@@ -13,7 +13,7 @@ node <skill>/scripts/unpacker.ts <command>
|
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
`<skill>` is the base directory of this skill. Run the script with `node`. You can run it from any directory.
|
|
16
|
-
Each command in this skill, for example `inspect
|
|
16
|
+
Each command in this skill, for example `inspect releases/game.prg`, goes in the place of `<command>`.
|
|
17
17
|
Each command prints one JSON envelope on stdout. See the section "JSON output".
|
|
18
18
|
To get the command list, run the script with no arguments.
|
|
19
19
|
|
|
@@ -23,16 +23,16 @@ To get the command list, run the script with no arguments.
|
|
|
23
23
|
|
|
24
24
|
| Goal | Command |
|
|
25
25
|
|---|---|
|
|
26
|
-
| Find evidence of packing in the file, without a run | `inspect
|
|
27
|
-
| Find the code that the program wrote and then executed | `trace
|
|
28
|
-
| Run a program that is not a BASIC program at `$0801` | `trace
|
|
29
|
-
| Give input to an intro or a menu before the evidence starts | `trace
|
|
30
|
-
| Find each stage and the entry of the unpacked program | `stages
|
|
31
|
-
| Capture the unpacked program at its entry | `capture
|
|
32
|
-
| Capture again without the bytes of a cracktro | `capture
|
|
33
|
-
| Capture only one known range of the program | `capture
|
|
34
|
-
| Capture each part of a multi-load program | `loads
|
|
35
|
-
| Capture each part and the RAM of the disk drive | `loads
|
|
26
|
+
| Find evidence of packing in the file, without a run | `inspect releases/game.prg` |
|
|
27
|
+
| Find the code that the program wrote and then executed | `trace releases/game.prg` |
|
|
28
|
+
| Run a program that is not a BASIC program at `$0801` | `trace releases/game.prg --entry '$c000'` |
|
|
29
|
+
| Give input to an intro or a menu before the evidence starts | `trace releases/game.prg --steps .c64-re-tools/local/input.json` |
|
|
30
|
+
| Find each stage and the entry of the unpacked program | `stages releases/game.prg` |
|
|
31
|
+
| Capture the unpacked program at its entry | `capture releases/game.prg --until '$c000' --out .c64-re-tools/local/capture` |
|
|
32
|
+
| Capture again without the bytes of a cracktro | `capture releases/game.prg --until '$c000' --out .c64-re-tools/local/capture --exclude '$a000-$a9ff'` |
|
|
33
|
+
| Capture only one known range of the program | `capture releases/game.prg --until '$c000' --out .c64-re-tools/local/capture --range '$c000-$cfff'` |
|
|
34
|
+
| Capture each part of a multi-load program | `loads releases/game.d64 --steps .c64-re-tools/local/parts.json --out .c64-re-tools/local/parts` |
|
|
35
|
+
| Capture each part and the RAM of the disk drive | `loads releases/game.d64 --steps .c64-re-tools/local/parts.json --out .c64-re-tools/local/parts --drive` |
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
@@ -75,7 +75,7 @@ The script refuses a step in an old form. The message gives the step to write.
|
|
|
75
75
|
- Give each path relative to the project folder. The project folder is the nearest folder at or above the working directory that holds `.c64-re-tools/`.
|
|
76
76
|
- If the working directory is not in a project, give `--project <folder>` to each command. If the working directory has projects below it, the script refuses and lists them.
|
|
77
77
|
- In a group folder, each version of a program is a project. The script refuses the group folder and each folder in it that is not a project. Give `--project` with a project of the group, for example `--project v1`.
|
|
78
|
-
- A path that a command only reads can go into another project of the group, for example `../v1/
|
|
78
|
+
- A path that a command only reads can go into another project of the group, for example `../v1/releases/game.prg`. The command writes only in its own project.
|
|
79
79
|
- An address is `$` and 1 to 4 hex digits, for example `'$c000'` or `'$fb'`, or a name. A name is a symbol, else an analyzer name that only one analyzer gives. Put an address in single quotes in a shell.
|
|
80
80
|
- A range is `<start>-<end>`, for example `'$c000-$cfff'`. In a JSON file, a range is `start` and `end`.
|
|
81
81
|
- Bytes in a JSON file are hex in a field `data`, for example `"data": "a900"`.
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// region of knowledge, whether call and jump references or the run on from
|
|
4
4
|
// its last instruction reach it from a root (the entry, and the NMI, RESET
|
|
5
5
|
// and IRQ vectors at $fffa-$ffff when the image holds them); and what the program reads
|
|
6
|
-
// or executes outside the image. Evidence only: nothing here decides
|
|
7
|
-
//
|
|
6
|
+
// or executes outside the image. Evidence only: nothing here decides which
|
|
7
|
+
// bytes the publisher shipped.
|
|
8
8
|
|
|
9
9
|
import { type AddressRange, COVERAGE, executedRamCode, instructionLength } from "../c64.ts";
|
|
10
10
|
|
package/src/knowledge/write.ts
CHANGED
|
@@ -1039,7 +1039,7 @@ type ReleaseRequest = InSpace & { label: string; base?: boolean; comment?: strin
|
|
|
1039
1039
|
function checkRelease(request: ReleaseRequest): void {
|
|
1040
1040
|
checkSpace(request);
|
|
1041
1041
|
if (typeof request.label !== "string" || !RELEASE_LABEL.test(request.label)) {
|
|
1042
|
-
throw new Refusal("invalid-input", "A release label is an upper-case letter, then 1 to 31 upper-case letters, digits or underscores, for example
|
|
1042
|
+
throw new Refusal("invalid-input", "A release label is an upper-case letter, then 1 to 31 upper-case letters, digits or underscores, for example FIRESTAR or V2.");
|
|
1043
1043
|
}
|
|
1044
1044
|
for (const [address, bytes] of request.rows ?? []) {
|
|
1045
1045
|
if (!Number.isInteger(address) || address < 0 || address > 0xffff || !/^(?:[0-9a-f]{2})+$/.test(bytes) || bytes.length > MEMORY_ROW * 2 || address + bytes.length / 2 > 0x10000) {
|
package/src/project.ts
CHANGED
|
@@ -443,7 +443,7 @@ export function readGroup(root: string): ProjectGroup | undefined {
|
|
|
443
443
|
* Resolves a path that a command only reads, relative to the project folder,
|
|
444
444
|
* as resolveProjectPath does. In a group the path can also lead into the group
|
|
445
445
|
* folder, so a version reads the files of the other versions, for example
|
|
446
|
-
* ../v1/
|
|
446
|
+
* ../v1/releases/game.prg. A write stays in the project.
|
|
447
447
|
*/
|
|
448
448
|
export function resolveReadPath(path: string, root = projectRoot()): string {
|
|
449
449
|
const group = readGroup(root);
|
package/src/script.ts
CHANGED
|
@@ -342,7 +342,7 @@ export function listed<T, U = T>(items: readonly T[], max: number, show: (item:
|
|
|
342
342
|
|
|
343
343
|
/** The conventions in the help of every script. */
|
|
344
344
|
export const CONVENTIONS = `Addresses are $ and 1 to 4 hex digits, for example '$c000' or '$fb', or a name: a symbol, else an analyzer name that only one analyzer gives. A range is <start>-<end>, for example '$c000-$cfff'. Quote them in a shell.
|
|
345
|
-
Paths are relative to the project folder. Every script takes --project <folder>: the project folder, relative to the working directory. Without it, the script uses the nearest folder at or above the working directory that holds .c64-re-tools/. In a group folder, give --project with a project of the group. A path that a command only reads can go into another project of the group, for example ../v1/
|
|
345
|
+
Paths are relative to the project folder. Every script takes --project <folder>: the project folder, relative to the working directory. Without it, the script uses the nearest folder at or above the working directory that holds .c64-re-tools/. In a group folder, give --project with a project of the group. A path that a command only reads can go into another project of the group, for example ../v1/releases/game.prg.
|
|
346
346
|
Each command prints one JSON envelope: {ok: true, command, body, hint?, nextAction?} with exit status 0, or {ok: false, command?, code, error, hint?, nextAction?} with exit status 2.`;
|
|
347
347
|
|
|
348
348
|
function optionLabel(name: string, spec: OptionSpec): string {
|
package/tools/c64run.c
CHANGED
|
@@ -196,7 +196,7 @@ static int halted;
|
|
|
196
196
|
|
|
197
197
|
// Pins: at each sample, before it is taken, the next line of a pin file
|
|
198
198
|
// ("hex hex ...", one field for each range) goes into RAM. A replay pins the
|
|
199
|
-
// random state of a rebuild to the values of the
|
|
199
|
+
// random state of a rebuild to the values of the reference this way.
|
|
200
200
|
static FILE* pin_file;
|
|
201
201
|
static uint16_t pin_from[16], pin_size[16];
|
|
202
202
|
static int pin_ranges;
|