@henols/c64-re-tools 2.6.0-rc.9 → 2.7.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.
- package/package.json +1 -1
- package/skills/c64-assembler/SKILL.md +7 -7
- package/skills/c64-assembler/scripts/assembler.ts +4 -3
- package/skills/c64-basic/SKILL.md +1 -1
- package/skills/c64-development/SKILL.md +7 -7
- package/skills/c64-disk/SKILL.md +13 -13
- package/skills/c64-docs/SKILL.md +25 -10
- 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 +78 -18
- package/skills/c64-docs/scripts/lib/links.ts +1 -1
- package/skills/c64-docs/scripts/lib/reference.ts +117 -31
- package/skills/c64-docs/scripts/lib/source-map.ts +14 -0
- package/skills/c64-knowledge/SKILL.md +15 -14
- package/skills/c64-knowledge/scripts/knowledge.ts +17 -10
- 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 +26 -11
- package/skills/c64-source/SKILL.md +18 -15
- package/skills/c64-source/scripts/lib/export.ts +20 -8
- package/skills/c64-source/scripts/lib/loader.ts +51 -28
- package/skills/c64-source/scripts/lib/source.ts +27 -20
- package/skills/c64-source/scripts/source.ts +68 -53
- package/skills/c64-static-analysis/SKILL.md +24 -22
- package/skills/c64-static-analysis/scripts/lib/findings.ts +11 -11
- package/skills/c64-static-analysis/scripts/lib/instructions.ts +4 -4
- package/skills/c64-static-analysis/scripts/lib/macros.ts +3 -1
- package/skills/c64-static-analysis/scripts/static-analysis.ts +36 -27
- package/skills/c64-testing/SKILL.md +32 -24
- package/skills/c64-testing/references/recording-format.md +15 -9
- package/skills/c64-testing/references/scenario-format.md +9 -7
- package/skills/c64-testing/scripts/lib/recording.ts +214 -49
- package/skills/c64-testing/scripts/lib/replay.ts +45 -19
- package/skills/c64-testing/scripts/lib/runs.ts +7 -2
- package/skills/c64-testing/scripts/lib/scenario.ts +31 -31
- package/skills/c64-testing/scripts/testing.ts +37 -16
- package/skills/c64-unpacker/SKILL.md +16 -14
- package/skills/c64-unpacker/scripts/lib/stages.ts +18 -3
- package/skills/c64-unpacker/scripts/unpacker.ts +38 -6
- package/src/build-name.ts +9 -4
- package/src/c64.ts +1 -1
- package/src/host/main.ts +2 -2
- package/src/host/server.ts +3 -1
- package/src/host/tools/index.ts +1 -1
- package/src/host/vice/process.ts +34 -17
- package/src/host/vice/session.ts +55 -27
- package/src/host-client/steps.ts +4 -1
- package/src/host-client/tools.ts +1 -1
- package/src/knowledge/evidence.ts +66 -0
- package/src/knowledge/history.ts +5 -5
- package/src/knowledge/import.ts +12 -5
- package/src/knowledge/program.ts +81 -33
- package/src/knowledge/read.ts +3 -3
- package/src/knowledge/schema.ts +7 -7
- package/src/knowledge/separate.ts +2 -2
- package/src/knowledge/start-screen.ts +2 -0
- package/src/knowledge/text.ts +28 -3
- package/src/knowledge/write.ts +7 -7
- package/src/mcp/tools/debug.ts +23 -21
- package/src/mcp/tools/memory.ts +12 -9
- package/src/native/c64run.ts +7 -4
- package/src/native/{ghidra → decompiler}/analyze.ts +17 -17
- package/src/native/{ghidra → decompiler}/language/c64rt_6510.slaspec +1 -1
- package/src/native/{ghidra → decompiler}/walk.ts +6 -6
- package/src/native/types.ts +25 -25
- package/src/opcodes.ts +1 -1
- package/src/project.ts +1 -1
- package/src/reference-pages.ts +64 -0
- package/src/script.ts +2 -2
- package/tools/c64run.c +151 -5
- /package/src/native/{ghidra → decompiler}/c64rt-wasm.ts +0 -0
- /package/src/native/{ghidra → decompiler}/language/c64rt_6510.cspec +0 -0
- /package/src/native/{ghidra → decompiler}/language/c64rt_6510.ldefs +0 -0
- /package/src/native/{ghidra → decompiler}/language/c64rt_6510.pspec +0 -0
- /package/src/native/{ghidra → decompiler}/language/c64rt_6510.sla +0 -0
- /package/src/native/{ghidra → decompiler}/pcode.ts +0 -0
- /package/src/native/{ghidra → decompiler}/wasm.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// The c64-static-analysis script: analyzes the program in the knowledge
|
|
2
|
-
// with DXA (fast first pass) or
|
|
2
|
+
// with DXA (fast first pass) or the decompiler (deeper), which it runs itself, seeded
|
|
3
3
|
// from current knowledge and the coverage of the knowledge, and imports the
|
|
4
4
|
// structural findings into .c64-re-tools/knowledge/.
|
|
5
5
|
|
|
@@ -9,19 +9,19 @@ import { WireFailure } from "#src/host-client/tools.ts";
|
|
|
9
9
|
import { writeReported } from "#src/host-client/transfer.ts";
|
|
10
10
|
import { knowledgeNames } from "#src/knowledge/names.ts";
|
|
11
11
|
import { analyze as analyzeWithDxa } from "#src/native/dxa.ts";
|
|
12
|
-
import { analyze as
|
|
12
|
+
import { analyze as analyzeWithDecompiler } from "#src/native/decompiler/analyze.ts";
|
|
13
13
|
import { localToolContext } from "#src/native/local.ts";
|
|
14
|
-
import {
|
|
14
|
+
import { DECOMPILER_LIMITS } from "#src/native/types.ts";
|
|
15
15
|
import { openForRead, withWrite } from "#src/knowledge/database.ts";
|
|
16
16
|
import { analyzedBytes, operandImages, programCoverage, requireProgram } from "#src/knowledge/program.ts";
|
|
17
17
|
import { applyBatch, type BatchOperation } from "#src/knowledge/write.ts";
|
|
18
|
-
import { importFindings, runProvenance, type ImportConflict, type ImportContext, type ImportResult, type NormalizedFindings } from "#src/knowledge/import.ts";
|
|
18
|
+
import { importFindings, lastToolVersion, runProvenance, type ImportConflict, type ImportContext, type ImportResult, type NormalizedFindings } from "#src/knowledge/import.ts";
|
|
19
19
|
import { currentRevision, listMacros, listMacroUses, listPatches, listReferences, listRegions, listSymbols } from "#src/knowledge/read.ts";
|
|
20
20
|
import { DEFAULT_SPACE, SEMANTIC_ORIGINS, type Analyzer } from "#src/knowledge/schema.ts";
|
|
21
21
|
import { platformNames, platformNamesFor, romUseOfProgram, type RomUse } from "#src/platform.ts";
|
|
22
22
|
import { listed, OPTIONS, reply, runScript, UsageError, type Call } from "#src/script.ts";
|
|
23
23
|
import { codeEntries, coverageConflicts, coverageEntries, coverageSeedKinds, executedStarts, imageReader, romOnlyRanges, type ImageByte } from "./lib/coverage.ts";
|
|
24
|
-
import { dxaFindings,
|
|
24
|
+
import { dxaFindings, decompilerFindings, seedsFromKnowledge } from "./lib/findings.ts";
|
|
25
25
|
import { findIdioms } from "./lib/idioms.ts";
|
|
26
26
|
import { instructionList } from "./lib/instructions.ts";
|
|
27
27
|
import { CATALOGUE, findMacroUses, type MacroCandidate } from "./lib/macros.ts";
|
|
@@ -36,8 +36,13 @@ const ALL_NAMES = "a larger --max-listed. The project knowledge has all of them
|
|
|
36
36
|
* analyzer data over executed code to classify, and macro candidates to write.
|
|
37
37
|
* The envelope adds the sentence for a cut list.
|
|
38
38
|
*/
|
|
39
|
-
function withHint(body: Record<string, unknown>, conflicts: number, coverageConflicts: number, macros: { candidates: number; applied: boolean; revision: string | null | undefined }) {
|
|
39
|
+
function withHint(body: Record<string, unknown>, conflicts: number, coverageConflicts: number, macros: { candidates: number; applied: boolean; revision: string | null | undefined }, version: { now: string | undefined; last: string | undefined; revision: string | null }, retiredReferences: number) {
|
|
40
40
|
const hints: string[] = [];
|
|
41
|
+
if (version.revision !== null && version.now !== undefined && version.last !== undefined && version.now !== version.last) {
|
|
42
|
+
hints.push(`The last analysis of this program used ${version.last}. Thus a change in revision ${version.revision} can come from the new analyzer version, and not from the program or the project knowledge.`);
|
|
43
|
+
}
|
|
44
|
+
// A leftover is data that no reference reads: a retired reference can make one.
|
|
45
|
+
if (retiredReferences > 0) hints.push("The analysis retired references. A data range that only a retired reference used can be a leftover now. Generate the source again, and examine the leftovers that changed.");
|
|
41
46
|
if (conflicts > 0) hints.push("The analysis and the project knowledge disagree at each place in conflicts. Find the correct answer in the emulator. Then correct the project knowledge.");
|
|
42
47
|
if (coverageConflicts > 0) hints.push("The coverage shows executed code in each range of coverageConflicts. Classify each range as code, or as dual-use when its bytes are also data, in the project knowledge.");
|
|
43
48
|
if (typeof macros.revision === "string") hints.push("The project knowledge has the macro candidates now. Generate the source again.");
|
|
@@ -175,15 +180,15 @@ async function analyze(call: Call): Promise<unknown> {
|
|
|
175
180
|
const decompile = call.addresses("decompile");
|
|
176
181
|
if (decompile.length > 32) throw new UsageError("--decompile takes at most 32 routines");
|
|
177
182
|
const max = call.count("max-listed")!;
|
|
178
|
-
const analyzer = call.string("analyzer") as "dxa" | "
|
|
183
|
+
const analyzer = call.string("analyzer") as "dxa" | "decompiler";
|
|
179
184
|
const listingPath = call.string("out-listing");
|
|
180
185
|
const instructionsPath = call.string("out-instructions");
|
|
181
186
|
const applyMacros = call.flag("apply-macros");
|
|
182
187
|
const skip = new Set(call.addresses("skip"));
|
|
183
188
|
if (skip.size > 0 && !applyMacros) throw new UsageError("--skip works only with --apply-macros: it names a macro candidate that the run does not write");
|
|
184
|
-
if (analyzer === "dxa" && decompile.length > 0) throw new UsageError("--decompile works only with --analyzer
|
|
185
|
-
if (analyzer === "
|
|
186
|
-
if (analyzer === "dxa" && instructionsPath !== undefined) throw new UsageError("--out-instructions works only with --analyzer
|
|
189
|
+
if (analyzer === "dxa" && decompile.length > 0) throw new UsageError("--decompile works only with --analyzer decompiler");
|
|
190
|
+
if (analyzer === "decompiler" && listingPath !== undefined) throw new UsageError("--out-listing works only with --analyzer dxa");
|
|
191
|
+
if (analyzer === "dxa" && instructionsPath !== undefined) throw new UsageError("--out-instructions works only with --analyzer decompiler");
|
|
187
192
|
const space = call.space;
|
|
188
193
|
const reader = openForRead();
|
|
189
194
|
const program = requireProgram(reader, space);
|
|
@@ -203,25 +208,27 @@ async function analyze(call: Call): Promise<unknown> {
|
|
|
203
208
|
const revision = currentRevision(reader);
|
|
204
209
|
const seeds = seedsFromKnowledge(reader, entries, space, executed.executed);
|
|
205
210
|
// Knowledge routines and --entry first, then code regions and JMP tables, then idioms, then coverage, up to the seed bound:
|
|
206
|
-
// at most
|
|
207
|
-
//
|
|
211
|
+
// at most DECOMPILER_LIMITS.entryPoints (1024) entry points for both analyzers, and for the decompiler at most
|
|
212
|
+
// DECOMPILER_LIMITS.codeStarts (8192) coverage flow starts that are code in a routine. coverageSeeds gives what was used.
|
|
208
213
|
const fromCoverage = coverage === undefined ? [] : coverageEntries(coverage, inProgram);
|
|
209
214
|
const known = [...seeds.entryPoints, ...codeEntries(reader, byteAt, space)];
|
|
210
|
-
//
|
|
215
|
+
// The decompiler takes the coverage as code starts without a function; DXA has one list.
|
|
211
216
|
const kinds = analyzer === "dxa" || coverage === undefined ? { routines: fromCoverage, codeStarts: [] } : coverageSeedKinds(coverage, inProgram);
|
|
212
217
|
const ordered = [...new Set([...known, ...idioms.entryPoints, ...kinds.routines])];
|
|
213
|
-
seeds.entryPoints = ordered.slice(0,
|
|
214
|
-
const codeStarts = kinds.codeStarts.filter((entry) => !seeds.entryPoints.includes(entry)).slice(0,
|
|
218
|
+
seeds.entryPoints = ordered.slice(0, DECOMPILER_LIMITS.entryPoints).sort((a, b) => a - b);
|
|
219
|
+
const codeStarts = kinds.codeStarts.filter((entry) => !seeds.entryPoints.includes(entry)).slice(0, DECOMPILER_LIMITS.codeStarts);
|
|
215
220
|
// Idiom tables and the RAM under ROM that the runs never used are data for this run too; semantic data ranges come first.
|
|
216
221
|
// A range with an entry point of the knowledge or --entry in it is left out: that code stays code.
|
|
217
222
|
const fromRom = coverage === undefined ? [] : romOnlyRanges(coverage, byteAt).filter((range) => !known.some((entry) => entry >= range.start && entry <= range.end));
|
|
218
223
|
const dataRanges = [...seeds.dataRanges];
|
|
219
224
|
for (const range of [...idioms.dataRanges, ...fromRom]) if (!dataRanges.some((seed) => range.start <= seed.end && range.end >= seed.start)) dataRanges.push(range);
|
|
220
|
-
seeds.dataRanges = dataRanges.slice(0,
|
|
225
|
+
seeds.dataRanges = dataRanges.slice(0, DECOMPILER_LIMITS.dataRanges);
|
|
221
226
|
const romUsed = fromRom.filter((range) => seeds.dataRanges.includes(range)).length;
|
|
222
227
|
const coverageUsed = fromCoverage.filter((entry) => seeds.entryPoints.includes(entry) || codeStarts.includes(entry)).length;
|
|
223
228
|
// Platform names are C64 names: drive code and banks get none.
|
|
224
229
|
const platform = space === DEFAULT_SPACE ? platformNames() : [];
|
|
230
|
+
/** The analyzer version of the last analysis of these bytes: a new version can change the findings by itself. */
|
|
231
|
+
const lastVersion = reader === undefined ? undefined : lastToolVersion(reader, analyzer, bytes);
|
|
225
232
|
reader?.close();
|
|
226
233
|
/** Imports the idioms as their own revision, after the analyzer's, and gives their part of the result. */
|
|
227
234
|
const idiomsResult = () => {
|
|
@@ -298,6 +305,7 @@ async function analyze(call: Call): Promise<unknown> {
|
|
|
298
305
|
const found = idiomsResult();
|
|
299
306
|
const body = {
|
|
300
307
|
analyzer: "dxa",
|
|
308
|
+
...(result.toolVersion === undefined ? {} : { analyzerVersion: result.toolVersion }),
|
|
301
309
|
...(space === DEFAULT_SPACE ? {} : { space }),
|
|
302
310
|
...found,
|
|
303
311
|
...coverageResult(),
|
|
@@ -307,13 +315,13 @@ async function analyze(call: Call): Promise<unknown> {
|
|
|
307
315
|
labels: listed(result.labels, max, (label) => ({ address: formatC64Address(label.address), name: label.name }), ALL_NAMES),
|
|
308
316
|
...(written === undefined ? {} : { listing: written }),
|
|
309
317
|
};
|
|
310
|
-
return withHint(body, imported.conflicts.length + found.idioms.conflicts.length, body.coverageConflicts?.length ?? 0, { candidates: found.idioms.candidates.macros.count, applied: applyMacros, revision: found.idioms.candidates.macros.revision });
|
|
318
|
+
return withHint(body, imported.conflicts.length + found.idioms.conflicts.length, body.coverageConflicts?.length ?? 0, { candidates: found.idioms.candidates.macros.count, applied: applyMacros, revision: found.idioms.candidates.macros.revision }, { now: result.toolVersion, last: lastVersion, revision: imported.revision }, imported.changes.references.retired);
|
|
311
319
|
}
|
|
312
320
|
|
|
313
|
-
const { result } = await
|
|
314
|
-
// Executed instruction starts that
|
|
321
|
+
const { result } = await analyzeWithDecompiler({ imageKind, ...seeds, codeStarts, decompile }, bytes, localToolContext());
|
|
322
|
+
// Executed instruction starts that the decompiler did not decode: the instruction list and the source miss them.
|
|
315
323
|
const decoded = new Set(result.instructions.map((instruction) => instruction.address));
|
|
316
|
-
const imported = record({ ...
|
|
324
|
+
const imported = record({ ...decompilerFindings(result), space, ...executed }, revision, "Decompiler analysis of the program", runProvenance(bytes, result.toolVersion));
|
|
317
325
|
const found = idiomsResult();
|
|
318
326
|
// A start inside a dual-use region is a known overlap, for example the second instruction of a BIT skip: one list cannot hold both.
|
|
319
327
|
// Read after the idioms, which write those regions.
|
|
@@ -327,7 +335,8 @@ async function analyze(call: Call): Promise<unknown> {
|
|
|
327
335
|
instructions = { count: list.length, ...writeReported(instructionsPath, `${JSON.stringify(list, null, 1)}\n`, { what: "--out-instructions" }) };
|
|
328
336
|
}
|
|
329
337
|
const body = {
|
|
330
|
-
analyzer: "
|
|
338
|
+
analyzer: "decompiler",
|
|
339
|
+
...(result.toolVersion === undefined ? {} : { analyzerVersion: result.toolVersion }),
|
|
331
340
|
...(space === DEFAULT_SPACE ? {} : { space }),
|
|
332
341
|
...(instructions === undefined ? {} : { instructions }),
|
|
333
342
|
...found,
|
|
@@ -341,29 +350,29 @@ async function analyze(call: Call): Promise<unknown> {
|
|
|
341
350
|
? {}
|
|
342
351
|
: { notDecompiled: result.notDecompiled!.map((item) => ({ entry: formatC64Address(item.entry), reason: item.reason })) }),
|
|
343
352
|
};
|
|
344
|
-
return withHint(body, imported.conflicts.length + found.idioms.conflicts.length, body.coverageConflicts?.length ?? 0, { candidates: found.idioms.candidates.macros.count, applied: applyMacros, revision: found.idioms.candidates.macros.revision });
|
|
353
|
+
return withHint(body, imported.conflicts.length + found.idioms.conflicts.length, body.coverageConflicts?.length ?? 0, { candidates: found.idioms.candidates.macros.count, applied: applyMacros, revision: found.idioms.candidates.macros.revision }, { now: result.toolVersion, last: lastVersion, revision: imported.revision }, imported.changes.references.retired);
|
|
345
354
|
}
|
|
346
355
|
|
|
347
356
|
await runScript({
|
|
348
357
|
name: "static-analysis",
|
|
349
|
-
summary: "Analyzes the program in the knowledge with DXA or
|
|
358
|
+
summary: "Analyzes the program in the knowledge with DXA or the decompiler, seeded from the knowledge and its coverage, and imports the structural findings into the knowledge.",
|
|
350
359
|
names: knowledgeNames,
|
|
351
360
|
commands: [
|
|
352
361
|
{
|
|
353
362
|
name: "analyze",
|
|
354
363
|
summary: "Runs the analyzer over the program in the knowledge and imports what it finds as one revision, then the 6502 idioms as a second one.",
|
|
355
364
|
options: {
|
|
356
|
-
analyzer: { kind: "choice", value: "<dxa|
|
|
365
|
+
analyzer: { kind: "choice", value: "<dxa|decompiler>", choices: ["dxa", "decompiler"], default: "decompiler", help: "dxa (a fast first pass) or decompiler (deeper, the default)" },
|
|
357
366
|
entry: { ...OPTIONS.entry, multiple: true, help: "an entry point of the program" },
|
|
358
|
-
decompile: { kind: "address", value: "<address>", multiple: true, help: "
|
|
367
|
+
decompile: { kind: "address", value: "<address>", multiple: true, help: "decompiler: a routine to decompile, at most 32" },
|
|
359
368
|
space: OPTIONS.space,
|
|
360
369
|
"max-listed": { ...OPTIONS["max-listed"], help: "list at most n labels, functions or candidates (default 50, 0 for none). The counts are always given, and the knowledge has all labels and functions" },
|
|
361
370
|
"out-listing": { kind: "path", output: "file", value: "<file>", help: "dxa: write the disassembly listing to this project file" },
|
|
362
|
-
"out-instructions": { kind: "path", output: "file", value: "<file>", help: "
|
|
371
|
+
"out-instructions": { kind: "path", output: "file", value: "<file>", help: "decompiler: write every instruction (address, bytes, mnemonic, mode, operand, target, executed) to this project file as JSON" },
|
|
363
372
|
"apply-macros": { kind: "flag", help: "write the macro candidates (the macros and their uses) to the project knowledge as one revision of the LLM" },
|
|
364
373
|
skip: { kind: "address", value: "<address>", multiple: true, help: "with --apply-macros: the start of a macro candidate that is not correct. The run does not write it" },
|
|
365
374
|
},
|
|
366
|
-
notes: "The program and the coverage come from the project knowledge: put them into the project knowledge first. The executed code of the coverage gives entry points. Routine symbols in the knowledge are entry points too.
|
|
375
|
+
notes: "The program and the coverage come from the project knowledge: put them into the project knowledge first. The executed code of the coverage gives entry points. Routine symbols in the knowledge are entry points too. The decompiler needs at least one entry point. DXA finds the SYS of a BASIC start by itself.",
|
|
367
376
|
run: analyze,
|
|
368
377
|
},
|
|
369
378
|
],
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: c64-testing
|
|
3
|
-
description: Tests if a rebuilt or changed C64 program behaves as the
|
|
3
|
+
description: Tests if a rebuilt or changed C64 program behaves as the reference, or if a program has the expected values. It runs a scenario on the reference and on the rebuild in an emulator. It compares memory, registers, chip state and the screen with explicit rules, and gives PASS, FAIL or INCONCLUSIVE. Use it when you must show that a rebuild or a correction keeps the behavior of the reference. Use it to do many steps on one program and keep the screens, coverage maps, traces and snapshots as files. Use it to test a new program or a correction with expected values. Use it to record a play session of the reference and replay it on the default build of the rebuild. Use it to find what changed between two machine states, and to make a checklist for a human playtest. It does not find the cause of a difference. It does not build the program.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# C64 testing
|
|
7
7
|
|
|
8
|
-
Use this script to test a rebuild or a changed C64 program against the
|
|
8
|
+
Use this script to test a rebuild or a changed C64 program against the reference, or against expected values.
|
|
9
9
|
Use only the commands of the script. Do not compare machine states or replay play sessions in another way.
|
|
10
10
|
|
|
11
11
|
```bash
|
|
@@ -23,13 +23,13 @@ To get the command list, run the script with no arguments.
|
|
|
23
23
|
|
|
24
24
|
| Goal | Command |
|
|
25
25
|
|---|---|
|
|
26
|
-
| Compare the rebuild with the
|
|
26
|
+
| Compare the rebuild with the reference in a scenario | `test tests/moves-left.json` |
|
|
27
27
|
| Keep the screens and all differing bytes of a FAIL | `test tests/moves-left.json --out .c64-re-tools/local/results/moves-left` |
|
|
28
28
|
| Do many steps on one program and keep the results as files | `run .c64-re-tools/local/runs/rooms/run.json --out .c64-re-tools/local/runs/rooms` |
|
|
29
29
|
| Test a new program or a correction with expected values | `run tests/title.json --out .c64-re-tools/local/runs/title` |
|
|
30
|
-
| Record a play session of a person on the
|
|
30
|
+
| Record a play session of a person on the reference | `record tests/record/start.json --out tests/recordings/play1 --play --joystick 1` |
|
|
31
31
|
| Record a session from steps only | `record tests/record/rooms.json --out tests/recordings/rooms` |
|
|
32
|
-
| Make sure that a recording replays on the
|
|
32
|
+
| Make sure that a recording replays on the reference | `replay tests/recordings/rooms` |
|
|
33
33
|
| Compare the rebuild with a recording | `replay tests/recordings/rooms --checkpoint main_loop --state room --state lives --pin random_ptr:2 --rebuild build/clean.prg --symbols build/symbols/clean.json --out .c64-re-tools/local/results/rooms` |
|
|
34
34
|
| Find what changed between two snapshot files | `diff .c64-re-tools/local/runs/rooms/before.vsf .c64-re-tools/local/runs/rooms/after.vsf` |
|
|
35
35
|
| Find what changed between two observations of runs | `diff .c64-re-tools/local/runs/rooms/results.json:room0 .c64-re-tools/local/runs/rooms/results.json:room3` |
|
|
@@ -38,8 +38,9 @@ To get the command list, run the script with no arguments.
|
|
|
38
38
|
|
|
39
39
|
## Programs, files and names
|
|
40
40
|
|
|
41
|
-
- The
|
|
42
|
-
- The
|
|
41
|
+
- The reference is the reference file: the program file or the capture that you examined. A test compares the rebuild with it. It can be a crack, a snapshot, a memory dump, a disk image or a commercial release. Here it must be a PRG file, for example the file of the base release. A PASS tells only about that file.
|
|
42
|
+
- The reference program and the rebuild are PRG files in the project. The script refuses a disk, tape or cartridge image. Extract the program file from the image first.
|
|
43
|
+
- The reference gets its names from the project knowledge. Give `"symbols": "knowledge"` for the reference.
|
|
43
44
|
- The rebuild gets its names from the symbol file of its build. Build the rebuild with a symbol file that has all symbols, also the constants that the source does not use.
|
|
44
45
|
- You write the scenario file, the run file and the record file. Their formats are in the files of the section "Reference".
|
|
45
46
|
- A file in `tests/` is a scenario or a run file with expected values. Give a scenario to `test` and a run file to `run`. `test` refuses a run file.
|
|
@@ -48,13 +49,14 @@ To get the command list, run the script with no arguments.
|
|
|
48
49
|
- `--state` and `--pin` take a name or a `$` address, with `:size` for more than one byte, for example `room:2`. Use the names that the project knowledge has at the time of the replay.
|
|
49
50
|
- The joystick port of `--joystick` is the port that the program reads. Port 2 is `$DC00`, and port 1 is `$DC01`. Find the port in the code or in the project knowledge. If you do not know the port, use 2.
|
|
50
51
|
- `diff` takes two states of one kind. A state is a snapshot file (`.vsf`), a memory file (`.bin`) of a run, or an observation of a run (`results.json:<name>`). A `save` step of a run writes a snapshot file. A snapshot save in the emulator also writes one.
|
|
52
|
+
- Each command starts its own emulator. Thus many commands can run at the same time. For example, other commands can run while a long `record` runs in the background.
|
|
51
53
|
|
|
52
54
|
### Paths and the project folder
|
|
53
55
|
|
|
54
56
|
- 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/`.
|
|
55
57
|
- 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.
|
|
56
58
|
- 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`.
|
|
57
|
-
- A path that a command only reads can go into another project of the group, for example `../v1/
|
|
59
|
+
- 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.
|
|
58
60
|
- 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.
|
|
59
61
|
- A range is `<start>-<end>`, for example `'$c000-$cfff'`. In a JSON file, a range is `start` and `end`.
|
|
60
62
|
- Bytes in a JSON file are hex in a field `data`, for example `"data": "a900"`.
|
|
@@ -82,8 +84,8 @@ Each flag applies only to the commands in the table. On another command, the scr
|
|
|
82
84
|
| `--http-port <n>` | `record` | With `--play`: the port of the page. The default is 6465. |
|
|
83
85
|
| `--checkpoint <routine>` | `replay` | The routine of the checkpoints. Each entry of the routine is a checkpoint. The default is the comparison of the record file. |
|
|
84
86
|
| `--state <item>` | `replay` | A memory item to compare at each checkpoint. Give it again for each item. |
|
|
85
|
-
| `--pin <item>` | `replay` | Random state in RAM. At each checkpoint, the rebuild gets the values of the
|
|
86
|
-
| `--rebuild <prg>` | `replay` | The rebuild to compare with the
|
|
87
|
+
| `--pin <item>` | `replay` | Random state in RAM. At each checkpoint, the rebuild gets the values of the reference there. Give it again for each item. |
|
|
88
|
+
| `--rebuild <prg>` | `replay` | The rebuild to compare with the reference. Without it, the script replays only on the reference. |
|
|
87
89
|
| `--symbols <file>` | `replay` | The symbol file of the rebuild. The default is the symbols of the recording. |
|
|
88
90
|
| `--out <dir>` | `replay` | With a FAIL, write the RAM of each side at the first different checkpoint into this folder. |
|
|
89
91
|
| `--gap <n>` | `diff` | Join changed ranges across at most n equal bytes. The default is 0. |
|
|
@@ -99,7 +101,7 @@ Each flag applies only to the commands in the table. On another command, the scr
|
|
|
99
101
|
|
|
100
102
|
### `test <scenario.json>`
|
|
101
103
|
|
|
102
|
-
The script runs the scenario on the
|
|
104
|
+
The script runs the scenario on the reference and then on the rebuild. Before each side, it does a hard reset. The CPU then stops at the reset vector.
|
|
103
105
|
Before the test starts, the script examines the scenario and each file that it names. The section "Checks" of `references/scenario-format.md` gives each refusal.
|
|
104
106
|
|
|
105
107
|
`body` holds:
|
|
@@ -107,8 +109,8 @@ Before the test starts, the script examines the scenario and each file that it n
|
|
|
107
109
|
- `result`: `PASS`, `FAIL` or `INCONCLUSIVE`.
|
|
108
110
|
- `checkpoints`: the names of the checkpoints.
|
|
109
111
|
- `differences`: with a FAIL, each difference with its `checkpoint` and the item in `what`.
|
|
110
|
-
- A memory item gives `bytes`. `bytes.count` is the number of differing bytes. `bytes.listed` gives the first bytes, each with `address`, `
|
|
111
|
-
- Another item gives the `
|
|
112
|
+
- A memory item gives `bytes`. `bytes.count` is the number of differing bytes. `bytes.listed` gives the first bytes, each with `address`, `reference` and `rebuild`.
|
|
113
|
+
- Another item gives the `reference` value and the `rebuild` value.
|
|
112
114
|
- `excluded`: each byte that an `exclude` left out of the comparison, with its `reason`.
|
|
113
115
|
- `files`: with `--out` and a FAIL, the files that the script wrote. These are both screens and the difference image for each screen difference. `memory.json` has all bytes of each memory item that differs, and each byte that differs.
|
|
114
116
|
- `reason`: with an INCONCLUSIVE, why the script could not compare.
|
|
@@ -129,7 +131,7 @@ Traps:
|
|
|
129
131
|
|
|
130
132
|
- A FAIL with only a `screen` difference: add `vicii` or `sprites` to the observation. Then you find the chip state that is different.
|
|
131
133
|
- A program that uses random numbers: set the random seed with a `write` step on both sides. If you cannot set it, observe only values that do not depend on the random numbers.
|
|
132
|
-
- The two sides start differently, for example the
|
|
134
|
+
- The two sides start differently, for example the reference after a cracked intro. Give a `side` to the steps that only one side needs. Then make the memory the same with a `normalize` step.
|
|
133
135
|
- `normalize` needs the entry state of a capture in the project knowledge. If the knowledge has no capture, the script refuses. Then capture the unpacked program at its entry point, and put the capture image into the project knowledge.
|
|
134
136
|
- The frame counts of the sides are different by one frame. The sides got to the same address at different raster positions. Do not synchronize on an interrupt handler. Synchronize on a value that the interrupt changes, with a `runUntil` step with a `memory` target. Or use an `address` target with a `raster` condition.
|
|
135
137
|
- A byte cannot be the same on both sides, for example a read-only collision register. Use `exclude` with the reason. Do not use `exclude` to hide a real difference.
|
|
@@ -173,11 +175,13 @@ Traps:
|
|
|
173
175
|
|
|
174
176
|
## Recordings
|
|
175
177
|
|
|
176
|
-
A recording keeps a session of the
|
|
178
|
+
A recording keeps a session of the reference program, for example a play through some rooms of a game. A replay gives the same input to a rebuild and compares the game state. A recording needs no names.
|
|
177
179
|
|
|
178
180
|
- Make the recordings early, before you change the program.
|
|
179
181
|
- Ask the user to play first. Tell the user which parts of the program the recordings must have, for example each room, a fight and a lost life.
|
|
180
182
|
- Record a session from steps only for a part that the sessions of the user do not have, or when the user cannot play.
|
|
183
|
+
- Replay each recording on the default build. Do not replay a release build or a build with a switch that is not at its default.
|
|
184
|
+
- When the generated source has a loader, the default build is `build/clean_loader.prg`. Give `--symbols build/symbols/clean_loader.json` with it. Else the default build is `build/clean.prg`, with `--symbols build/symbols/clean.json`.
|
|
181
185
|
- Commit the recording folder with the scenarios. Do not put a recording into the project knowledge. Do not put test results, screenshots or playtest results into it.
|
|
182
186
|
- A finding that a recording shows can go into the project knowledge. Give the `recording.json` of the recording as its test evidence.
|
|
183
187
|
- The C64 of a recording has no disk drive. For a program that loads more files from a disk, use a scenario with `test`.
|
|
@@ -193,7 +197,7 @@ Control each source of random numbers:
|
|
|
193
197
|
|
|
194
198
|
### `record <record.json>`
|
|
195
199
|
|
|
196
|
-
The script does the steps of the record file on the
|
|
200
|
+
The script does the steps of the record file on the reference program. Then it writes the recording folder into `--out`: `recording.json`, `reads.txt` and `coverage.bin`. The program must be a PRG file.
|
|
197
201
|
|
|
198
202
|
`body` holds:
|
|
199
203
|
|
|
@@ -204,10 +208,12 @@ The script does the steps of the record file on the original program. Then it wr
|
|
|
204
208
|
- `executed`: the number of instructions in the coverage map.
|
|
205
209
|
- `coverageFrom`: the `frame` and the `pc` where the coverage map starts. `null` when the coverage did not start.
|
|
206
210
|
- `reason`: with a FAIL, why the session did not complete.
|
|
211
|
+
- `evidence`: only when the project knowledge gives a file of `--out` as evidence, and this record changed the file. Each item has the `file`, its `state` and the `revisions` that give the file.
|
|
207
212
|
|
|
208
213
|
Do this for each result:
|
|
209
214
|
|
|
210
|
-
- `PASS`: `hint` tells you to commit the folder and to add its `coverage.bin` to the project knowledge as coverage. `nextAction` replays the recording on the
|
|
215
|
+
- `PASS`: for a folder in `tests/recordings/`, `hint` tells you to commit the folder and to add its `coverage.bin` to the project knowledge as coverage. Git ignores `.c64-re-tools/local/`, thus the project knowledge must not name a file in it. For a folder there, `hint` tells you to record again with `--out tests/recordings/<name>`. `nextAction` replays the recording on the reference. Run it to make sure that the recording replays.
|
|
216
|
+
- `PASS` with `evidence`: you recorded into the folder of an earlier recording. Put the new `coverage.bin` into the project knowledge as coverage. It replaces the map of the earlier recording. For another file in `evidence`, examine the facts of its revisions against the new recording.
|
|
211
217
|
- `FAIL` after a cancel on the page: `hint` tells you to ask the user what to do. Do not record a session from steps in place of the session of the user.
|
|
212
218
|
- Another `FAIL`: `reason` names the step that did not complete. Examples are a `runUntil` step that did not get to its target, and a `type` step with too many keys. Change the step, then run `record` again.
|
|
213
219
|
- `coverageFrom` is `null` and `executed` is 0: the coverage did not start, so the coverage map is empty. The recording can still replay.
|
|
@@ -229,30 +235,32 @@ Traps:
|
|
|
229
235
|
|
|
230
236
|
### `replay <recording>`
|
|
231
237
|
|
|
232
|
-
The script first replays the recording on the
|
|
238
|
+
The script first replays the recording on the reference. The reference must end the session with the recorded state. With `--rebuild`, the script then replays the recording on the rebuild and compares the state at each checkpoint. Without `--rebuild`, it replays only on the reference.
|
|
233
239
|
|
|
234
240
|
`--checkpoint` and `--state` go together. `--pin` needs both of them. `--symbols` needs `--rebuild`. Give at most 16 `--state` and `--pin` items. Without `--checkpoint`, the script uses the comparison of the record file.
|
|
235
|
-
A `$` address is an address of the
|
|
241
|
+
A `$` address is an address of the reference. On the rebuild, it moves with the name before it.
|
|
236
242
|
|
|
237
243
|
A rebuild can be a loader with a start screen that RUN starts. If the symbols of the rebuild have `loader_start_screen_wait` and `loader_start_screen_continue`, the script runs the rebuild to the wait. Then it sets the PC to `loader_start_screen_continue`. The cycles before the wait do not count.
|
|
238
244
|
|
|
245
|
+
A rebuild can be the loader program of a generated source. Give its symbols. Then the replay counts from the entry of the program, where the loader jumps to. The checkpoints of both sides start at that entry. At the entry, the rebuild gets the raster position, the CIA timers and the interrupt state of the reference. The loader cannot set them as the reference has them in the replay. A runUntil step to an address does not count the code of the loader, or the code that the reference runs before that entry. If another step of the recording runs before the entry, the result is INCONCLUSIVE. Then start the steps of the record file after the entry.
|
|
246
|
+
|
|
239
247
|
`body` holds `result`, `side`, `firstDifference`, `reason` and `files`. The section "Replay" of `references/recording-format.md` gives each field.
|
|
240
248
|
|
|
241
249
|
Do this for each result:
|
|
242
250
|
|
|
243
|
-
- `PASS`: each checkpoint of the rebuild has the state of the
|
|
251
|
+
- `PASS`: each checkpoint of the rebuild has the state of the reference. Without `--rebuild`, the recording replays on the reference.
|
|
244
252
|
- `FAIL` with `--out`: `files` has the RAM of each side at the first different checkpoint. `nextAction` compares the two files with `diff`. Then examine the first different state item in the emulator.
|
|
245
253
|
- `FAIL` without `--out`: `hint` tells you to give `--out`. A FAIL where an enemy or an event is different, but the input is the same, often shows that a `--pin` is missing.
|
|
246
254
|
- `FAIL` with no `firstDifference`: the rebuild did not get to all checkpoints. `reason` gives the number. Examine the rebuild in the emulator after its last checkpoint.
|
|
247
255
|
- `INCONCLUSIVE`: `reason` gives the cause:
|
|
248
|
-
- "does not reproduce": the
|
|
249
|
-
- "never came to the checkpoint": the
|
|
256
|
+
- "does not reproduce": the reference does not end the session with the recorded state. Record the session again.
|
|
257
|
+
- "never came to the checkpoint": the reference did not execute the checkpoint routine in the session. Give another routine.
|
|
250
258
|
- "is not the program of the recording": the program file changed after the recording. Record the session again.
|
|
251
259
|
|
|
252
260
|
Traps:
|
|
253
261
|
|
|
254
|
-
- `idleReads` counts the input reads of the rebuild that the recording had no value for. On the
|
|
255
|
-
- The script refuses a recording of version
|
|
262
|
+
- `idleReads` counts the input reads of the rebuild that the recording had no value for. On the reference, such a read makes the result INCONCLUSIVE. The rebuild can read input where the reference does not, for example in its loader before the start screen. Such reads do not change a PASS of the rebuild.
|
|
263
|
+
- The script refuses a recording of an older version in an old form with `invalid-input`. Record the session again.
|
|
256
264
|
|
|
257
265
|
---
|
|
258
266
|
|
|
@@ -9,7 +9,7 @@ A record file is one JSON object in a project file.
|
|
|
9
9
|
```json
|
|
10
10
|
{
|
|
11
11
|
"name": "first rooms",
|
|
12
|
-
"program": "
|
|
12
|
+
"program": "releases/game.prg",
|
|
13
13
|
"steps": [
|
|
14
14
|
{ "frames": 300 },
|
|
15
15
|
{ "joystick": { "port": 2, "direction": "center", "fire": true } },
|
|
@@ -72,7 +72,13 @@ The keyboard queue of the KERNAL holds 10 keys. If the keys of a `type` step and
|
|
|
72
72
|
|
|
73
73
|
RESTORE starts an NMI and is not a read. The recording keeps each RESTORE of a `press` step as an event of that step. The replay presses RESTORE again at the same read of the program.
|
|
74
74
|
|
|
75
|
-
`type`, `write`, `registers` and `runUntil` steps are events. The recording keeps a point in the program for each event.
|
|
75
|
+
`type`, `write`, `registers` and `runUntil` steps are events. The recording keeps a point in the program for each event. A replay does the event again at the same point:
|
|
76
|
+
|
|
77
|
+
- A `runUntil` step to an address: the point is the number of times that the CPU got to that address. This step does not need an input read.
|
|
78
|
+
- An event that comes directly after another event runs at once after that event.
|
|
79
|
+
- Each other event: the point is the next read at the input site with the most reads. That site is not in ROM. If the program does not read input in 600 frames, the session stops.
|
|
80
|
+
|
|
81
|
+
Some parts of a program read no input, for example an intro or a bonus screen. To do an event in such a part, put a `runUntil` step to an address before the event.
|
|
76
82
|
|
|
77
83
|
## Play
|
|
78
84
|
|
|
@@ -121,25 +127,25 @@ The page sends input only between Start and End. The input of the page goes into
|
|
|
121
127
|
|
|
122
128
|
A site is the address of the instruction that reads. The values are hex. `<from>` and `<count>` are decimal.
|
|
123
129
|
|
|
124
|
-
`replay` examines `recording.json` before the replay starts. A recording of version
|
|
130
|
+
`replay` examines `recording.json` before the replay starts. A recording of an older version can have events or a comparison in an old form. For example, `"at"` is in place of `"address"`, or a `runUntil` step to an address has no count of the CPU at its target. The script refuses such a recording with `invalid-input`, and the message names the event. Record the session again.
|
|
125
131
|
|
|
126
132
|
## Replay
|
|
127
133
|
|
|
128
|
-
`replay` replays the recording on the
|
|
134
|
+
`replay` replays the recording on the reference program first. The session must end with the recorded cycles and state hash. Else the result is INCONCLUSIVE. With `--rebuild`, `replay` then replays the recording on the rebuild. At each checkpoint, the rebuild first gets the pinned values of the reference. Then the script compares the state. The cycles can be different.
|
|
129
135
|
|
|
130
136
|
A recording without names (`symbols` is `none`) takes the names of the project knowledge at the time of the replay.
|
|
131
137
|
|
|
132
|
-
For the rebuild, the script finds each name with the names of the rebuild (`--symbols`). A `$` address is an address of the
|
|
138
|
+
For the rebuild, the script finds each name with the names of the rebuild (`--symbols`). A `$` address is an address of the reference. It moves with the name before it in the reference: the script finds the same name in the rebuild and adds the same offset. Code moves with a code label, and data with any name. A site in ROM does not move. Give a state item a name, or the state moves with the code before it.
|
|
133
139
|
|
|
134
140
|
The body of the envelope of `replay` has these fields:
|
|
135
141
|
|
|
136
142
|
- `result`: PASS, FAIL or INCONCLUSIVE.
|
|
137
|
-
- `side`: `
|
|
143
|
+
- `side`: `reference` for the check of the reference only, `rebuild` with `--rebuild`.
|
|
138
144
|
- `checkpoint`: the routine of the comparison.
|
|
139
|
-
- `checkpoints` and `compared`: the checkpoints of the
|
|
140
|
-
- `firstDifference`: on a FAIL, the checkpoint (1 is the first), the cycle on each side, and each state item that is different. An item has `address`, and the `
|
|
145
|
+
- `checkpoints` and `compared`: the checkpoints of the reference, and the checkpoints of the rebuild that were the same.
|
|
146
|
+
- `firstDifference`: on a FAIL, the checkpoint (1 is the first), the cycle on each side, and each state item that is different. An item has `address`, and the `reference` and `rebuild` values as hex.
|
|
141
147
|
- `reason`: why the result is FAIL or INCONCLUSIVE.
|
|
142
148
|
- `movedSites`: the number of sites at a different address in the rebuild.
|
|
143
149
|
- `startScreen`: `skipped` when the rebuild went past the wait of its start screen.
|
|
144
150
|
- `idleReads`: the input reads of the rebuild that the recording had no value for. Such a read is at a site that the recording does not have, or after its end. Each got the fixed value `$FF` (joystick, keyboard, paddles) or `$00`. An input site that the site map did not find shows here.
|
|
145
|
-
- `files`: with `--out`, the RAM of each side at the first different checkpoint, `
|
|
151
|
+
- `files`: with `--out`, the RAM of each side at the first different checkpoint, `reference-<n>.bin` and `rebuild-<n>.bin`.
|
|
@@ -7,7 +7,7 @@ A scenario is one JSON object in a project file.
|
|
|
7
7
|
```json
|
|
8
8
|
{
|
|
9
9
|
"name": "player moves left",
|
|
10
|
-
"
|
|
10
|
+
"reference": { "program": "releases/game.prg", "symbols": "knowledge" },
|
|
11
11
|
"rebuild": { "program": "build/clean.prg", "symbols": "build/symbols/clean.json" },
|
|
12
12
|
"steps": [
|
|
13
13
|
{ "frames": 150 },
|
|
@@ -23,7 +23,7 @@ A scenario is one JSON object in a project file.
|
|
|
23
23
|
|
|
24
24
|
## Subjects
|
|
25
25
|
|
|
26
|
-
`
|
|
26
|
+
`reference` and `rebuild` each have:
|
|
27
27
|
|
|
28
28
|
- `program`: a PRG file, relative to the project folder.
|
|
29
29
|
- `symbols`: where the names come from:
|
|
@@ -57,13 +57,15 @@ Before the first step of each side, the script does a hard reset. The CPU stops
|
|
|
57
57
|
| `{ "normalize": true }` | Write pages 0 to 3 and `$00`/`$01` from the entry state in the project knowledge. The entry state comes from a capture of the unpacked program. Then both sides have the same zero page, stack and KERNAL work area. |
|
|
58
58
|
| `{ "observe": "moved", ... }` | Record a checkpoint. |
|
|
59
59
|
|
|
60
|
+
The `timeoutFrames` of a `runUntil` step is from 1 to 30000. The default is 3000. For a longer wait, put `frames` steps before the `runUntil` step.
|
|
61
|
+
|
|
60
62
|
The `port` of a joystick is 1 or 2. The `direction` is `center`, `up`, `down`, `left`, `right`, `up-left`, `up-right`, `down-left` or `down-right`.
|
|
61
63
|
|
|
62
64
|
A `condition` has the `kind` `register`, `memory` or `raster`. A `register` condition has `register` (`a`, `x`, `y` or `sp`), `operator` and `value`. A `memory` condition has `address`, `operator` and `value`. A `raster` condition has `line` and an optional `cycle`.
|
|
63
65
|
|
|
64
66
|
`timeoutFrames` is from 1 to 30000, and 3000 by default. A `runUntil` that does not get to its target in `timeoutFrames` frames makes the result INCONCLUSIVE.
|
|
65
67
|
|
|
66
|
-
Each step except `observe` can have `"side": "
|
|
68
|
+
Each step except `observe` can have `"side": "reference"` or `"side": "rebuild"`. Then only that side does the step. Use it when only one side needs a step, for example a key for the intro of the reference. An `observe` step has no `side`, because it compares both sides.
|
|
67
69
|
|
|
68
70
|
Each side finds a name in its own symbols.
|
|
69
71
|
|
|
@@ -75,7 +77,7 @@ An `observe` step has a checkpoint name. A scenario can have each name only one
|
|
|
75
77
|
|---|---|
|
|
76
78
|
| `memory` | A list of names, `$` addresses, or objects. An object has `address`, `size` (1 to 65536, default 1), `view` (`cpu` or `ram`, default `cpu`), `tolerance` (0 to 255, default 0), `mask` and `exclude`. The view `ram` reads the RAM under the ROMs and the I/O area. |
|
|
77
79
|
| `registers` | A list of register names: `pc`, `a`, `x`, `y`, `sp`, `flags`. |
|
|
78
|
-
| `screen` | The screen of the rebuild against the screen of the
|
|
80
|
+
| `screen` | The screen of the rebuild against the screen of the reference. `maxMismatchRatio` (default 0) is the largest permitted part of different pixels. `mask` is a list of rectangles (`x`, `y`, `width`, `height`) that the comparison does not include. |
|
|
79
81
|
| `vicii` | The VIC-II state: mode, screen address, scroll and colors. |
|
|
80
82
|
| `sprites` | A list of sprite numbers from 0 to 7. The script compares their position, color and flags. |
|
|
81
83
|
|
|
@@ -95,7 +97,7 @@ A run file is one JSON object in a project file. It has:
|
|
|
95
97
|
- `start`: required. `{ "program": "game.prg" }` to autostart a program with a BASIC start line, `{ "program": "game.prg", "load": true }` to load it with the CPU stopped (set `pc` in a step), or `{ "snapshot": ".c64-re-tools/local/snapshots/room0.vsf" }`.
|
|
96
98
|
- `symbols`: optional, `knowledge`, `none` (default), or a JSON file as for a subject. Without `symbols`, a run has no names: give `"symbols": "knowledge"` to use the names of the knowledge.
|
|
97
99
|
- `videoStandard`: optional, `pal` (default) or `ntsc`.
|
|
98
|
-
- `steps`: required. At least one step. The steps `write`, `registers`, `joystick`, `type`, `frames` and `runUntil` of a scenario, and the run steps `snapshot`, `save`, `screen`, `coverage`, `trace`, `observe` and `expect`.
|
|
100
|
+
- `steps`: required. At least one step. The steps `write`, `registers`, `joystick`, `type`, `press`, `frames` and `runUntil` of a scenario, and the run steps `snapshot`, `save`, `screen`, `coverage`, `trace`, `observe` and `expect`.
|
|
99
101
|
|
|
100
102
|
The run steps have these effects:
|
|
101
103
|
|
|
@@ -112,7 +114,7 @@ The run steps have these effects:
|
|
|
112
114
|
|
|
113
115
|
A `trace` step has a name, `points` (1 to 8), `frames` (1 to 3000) and an optional `maxHits` (at most 20000). A point has `kind` (`exec`, `read` or `write`), `start` and an optional `end`. The step writes `<name>.json` with each hit. `results.json` gives the file, the count of hits, the frames and why the trace ended. A trace that a breakpoint, a watchpoint or a JAM ends also ends the run.
|
|
114
116
|
|
|
115
|
-
In a run, an `observe` step can have `memory`, `registers`, `vicii` and `sprites`. `registers` and `vicii` are `true` or `false`, not a list. `"registers": true` gives all registers. A scenario takes a list of register names, a run does not. `sprites` is a list of sprite numbers from 0 to 7.
|
|
117
|
+
In a run, an `observe` step can have `memory`, `registers`, `vicii` and `sprites`. `registers` and `vicii` are `true` or `false`, not a list. `"registers": true` gives all registers. A scenario takes a list of register names, a run does not. `sprites` is a list of sprite numbers from 0 to 7. In a run, the screen is not a key of `observe`. Write it with a `screen` step, for example `{ "screen": "room3" }`.
|
|
116
118
|
|
|
117
119
|
In a run, a memory item has `address`, `size` (1 to 65536) and `view`. An item larger than 4096 bytes goes into the file `<observe>-<address>.bin`, without the `$`. `results.json` gives the file name.
|
|
118
120
|
|
|
@@ -120,7 +122,7 @@ A name in `save`, `screen`, `coverage`, `observe` and `expect` has 1 to 64 lette
|
|
|
120
122
|
|
|
121
123
|
### Expected values
|
|
122
124
|
|
|
123
|
-
An `expect` step compares the memory and the registers with the values that the step gives. It writes no file. Use it to test a program that has no
|
|
125
|
+
An `expect` step compares the memory and the registers with the values that the step gives. It writes no file. Use it to test a program that has no reference, for example a new program or a fix.
|
|
124
126
|
|
|
125
127
|
```json
|
|
126
128
|
{ "expect": "title",
|