@henols/c64-re-tools 2.3.0-rc.1 → 2.3.0-rc.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/package.json +2 -3
- package/skills/c64-assembler/SKILL.md +4 -6
- package/skills/c64-basic/SKILL.md +2 -4
- package/skills/c64-development/SKILL.md +3 -3
- package/skills/c64-disk/SKILL.md +3 -7
- package/skills/c64-docs/SKILL.md +2 -4
- package/skills/c64-export/SKILL.md +4 -4
- package/skills/c64-knowledge/SKILL.md +3 -3
- package/skills/c64-memory-map/SKILL.md +1 -3
- package/skills/c64-packer/SKILL.md +9 -11
- package/skills/c64-packer/scripts/packer.ts +2 -20
- package/skills/c64-provenance/SKILL.md +18 -7
- package/skills/c64-provenance/scripts/lib/compare.ts +144 -16
- package/skills/c64-provenance/scripts/provenance.ts +37 -8
- package/skills/c64-reverse-engineering/SKILL.md +3 -3
- package/skills/c64-source/SKILL.md +37 -18
- package/skills/c64-source/scripts/lib/loader.ts +281 -43
- package/skills/c64-source/scripts/source.ts +37 -9
- package/skills/c64-static-analysis/SKILL.md +4 -4
- package/skills/c64-testing/SKILL.md +13 -13
- package/skills/c64-testing/references/recording-format.md +1 -1
- package/skills/c64-testing/references/scenario-format.md +3 -3
- package/skills/c64-testing/scripts/lib/play.ts +4 -4
- package/skills/c64-testing/scripts/testing.ts +1 -1
- package/skills/c64-unpacker/SKILL.md +12 -12
- package/skills/c64-unpacker/scripts/lib/loads.ts +17 -4
- package/skills/c64-unpacker/scripts/unpacker.ts +15 -3
- package/skills/emulator/SKILL.md +3 -3
- package/src/cli/cleanup.ts +30 -0
- package/src/cli/main.ts +5 -1
- package/src/compare.ts +18 -0
- package/src/host-client/coverage.ts +26 -0
- package/src/mcp/tools/machine.ts +2 -2
- package/README.md +0 -143
|
@@ -43,7 +43,7 @@ import { platformNames } from "#src/platform.ts";
|
|
|
43
43
|
import { projectRoot } from "#src/project.ts";
|
|
44
44
|
import { knowledgeAt, knowledgeNames } from "#src/knowledge/names.ts";
|
|
45
45
|
import { listed, OPTIONS, runScript, UsageError, type Call, type CommandSpec } from "#src/script.ts";
|
|
46
|
-
import { compareReleases, identicalShare, shiftSuggestion, suggestShifts, type Release } from "./lib/compare.ts";
|
|
46
|
+
import { align, compareReleases, identicalShare, shiftSuggestion, suggestShifts, type Release } from "./lib/compare.ts";
|
|
47
47
|
import { findRoutine, libraryFolder, readLibrary, routineFrom, saveRoutine, suggest } from "./lib/library.ts";
|
|
48
48
|
import { watchRelease, type Start } from "./lib/runtime.ts";
|
|
49
49
|
import { findLeftovers } from "./lib/leftovers.ts";
|
|
@@ -100,7 +100,10 @@ function readRelease(name: string, shift: number): LoadedRelease {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
/**
|
|
103
|
+
/** Most blocks and ranges that a list of --align shows. */
|
|
104
|
+
const MAX_ALIGNED = 64;
|
|
105
|
+
|
|
106
|
+
/** compare: the releases byte by byte, with --align a map of two releases in blocks, and with --frames the first access of each difference in each release. */
|
|
104
107
|
async function compare(call: Call): Promise<unknown> {
|
|
105
108
|
const positionals = call.subjects;
|
|
106
109
|
if (positionals.length < 2) throw new UsageError("compare needs two or more releases");
|
|
@@ -117,12 +120,40 @@ async function compare(call: Call): Promise<unknown> {
|
|
|
117
120
|
const frames = call.count("frames");
|
|
118
121
|
const stepsFile = call.string("steps");
|
|
119
122
|
if (stepsFile !== undefined && frames === undefined) throw new UsageError("--steps works only with --frames");
|
|
123
|
+
const aligned = call.flag("align");
|
|
124
|
+
const minBlock = call.count("min-block");
|
|
125
|
+
if (minBlock !== undefined && !aligned) throw new UsageError("--min-block works only with --align");
|
|
126
|
+
if (aligned) {
|
|
127
|
+
if (shifts.size > 0) throw new UsageError("--align does not work with --shift: --align finds the shift of each block itself. Remove --shift");
|
|
128
|
+
if (frames !== undefined) throw new UsageError("--align does not work with --frames: --align gives no differences to run. Run --frames without --align");
|
|
129
|
+
if (positionals.length !== 2) throw new UsageError(`--align maps two releases, not ${positionals.length}. Give two releases`);
|
|
130
|
+
}
|
|
120
131
|
const steps: ActionStep[] = stepsFile === undefined ? [] : readActionSteps(stepsFile, "--steps", knowledgeAt());
|
|
121
132
|
const loaded = positionals.map((path, index) => readRelease(path, shifts.get(index + 1) ?? 0));
|
|
122
133
|
const releases = loaded.map((item) => item.release);
|
|
123
134
|
const range = call.range("range");
|
|
124
135
|
const comparison = compareReleases(releases, range === undefined ? {} : { from: range.start, to: range.end });
|
|
125
136
|
const share = identicalShare(comparison.identicalBytes, comparison.differingBytes);
|
|
137
|
+
const show = (range: AddressRange) => ({ start: formatC64Address(range.start), end: formatC64Address(range.end) });
|
|
138
|
+
const compared = {
|
|
139
|
+
releases: loaded.map((item) => ({ name: item.release.name, shift: item.shift, segments: item.release.segments.map(show) })),
|
|
140
|
+
common: comparison.common.map(show),
|
|
141
|
+
identicalBytes: comparison.identicalBytes,
|
|
142
|
+
differingBytes: comparison.differingBytes,
|
|
143
|
+
identicalShare: share,
|
|
144
|
+
};
|
|
145
|
+
if (aligned) {
|
|
146
|
+
// Code added and data moved: one shift for the release cannot fit, so each block of equal bytes gets its own.
|
|
147
|
+
const alignment = align(releases[0]!, releases[1]!, range ?? { start: 0x0000, end: 0xffff }, minBlock ?? 16);
|
|
148
|
+
const capped = <T>(name: string, items: T[]) => ({ [name]: items.slice(0, MAX_ALIGNED), ...(items.length > MAX_ALIGNED ? { [`more${name[0]!.toUpperCase()}${name.slice(1)}`]: items.length - MAX_ALIGNED } : {}) });
|
|
149
|
+
return {
|
|
150
|
+
...compared,
|
|
151
|
+
alignedShare: alignment.alignedShare,
|
|
152
|
+
...capped("blocks", alignment.blocks.map((block) => ({ a: show(block.a), b: show(block.b), shift: block.shift, bytes: block.bytes }))),
|
|
153
|
+
...capped("onlyInA", alignment.onlyInA.map(show)),
|
|
154
|
+
...capped("onlyInB", alignment.onlyInB.map(show)),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
126
157
|
// A poor match at the load addresses can mean that the releases are placed differently.
|
|
127
158
|
// Each release gets its best shifts: data that stayed can outvote code that moved, so one is not enough.
|
|
128
159
|
const applied = loaded.map((item) => item.shift);
|
|
@@ -165,11 +196,7 @@ async function compare(call: Call): Promise<unknown> {
|
|
|
165
196
|
}
|
|
166
197
|
|
|
167
198
|
return {
|
|
168
|
-
|
|
169
|
-
common: comparison.common.map((range) => ({ start: formatC64Address(range.start), end: formatC64Address(range.end) })),
|
|
170
|
-
identicalBytes: comparison.identicalBytes,
|
|
171
|
-
differingBytes: comparison.differingBytes,
|
|
172
|
-
identicalShare: share,
|
|
199
|
+
...compared,
|
|
173
200
|
differences: comparison.differences.map((difference, index) => ({
|
|
174
201
|
start: formatC64Address(difference.start),
|
|
175
202
|
end: formatC64Address(difference.end),
|
|
@@ -460,7 +487,7 @@ const LIBRARY = { kind: "text", value: "<folder>", required: true, help: "the li
|
|
|
460
487
|
const COMMANDS: CommandSpec[] = [
|
|
461
488
|
{
|
|
462
489
|
name: "compare",
|
|
463
|
-
summary: "Compares releases byte by byte, in their common ranges, and suggests shifts when they are placed differently.",
|
|
490
|
+
summary: "Compares releases byte by byte, in their common ranges, and suggests shifts when they are placed differently. With --align, maps two releases with moved code in blocks of equal bytes, each with its own shift.",
|
|
464
491
|
subjects: [{ name: "<release>", help: "knowledge (the program in the knowledge), a PRG at its load address, or an image.json of the c64-unpacker skill with the entry_state.json beside it. Two or more", list: true }],
|
|
465
492
|
options: {
|
|
466
493
|
shift: {
|
|
@@ -472,6 +499,8 @@ const COMMANDS: CommandSpec[] = [
|
|
|
472
499
|
example: (given) => `2:${given !== undefined && /^-\d+$/.test(given) ? given : "-256"}`,
|
|
473
500
|
},
|
|
474
501
|
range: { ...OPTIONS.range, help: "compare only the addresses from start to end" },
|
|
502
|
+
align: { kind: "flag", help: "map the first release to the second in blocks of equal bytes, each with its own shift, for releases with added code and moved data. Two releases; not with --shift or --frames" },
|
|
503
|
+
"min-block": { kind: "count", value: "<n>", min: 8, max: 0x10000, help: "with --align: the fewest bytes in a block (default 16)" },
|
|
475
504
|
frames: { ...OPTIONS.frames, max: MAX_EXECUTION_COUNT, help: "run each release in its own emulator for n frames, and give each listed difference its first access and whether it changed" },
|
|
476
505
|
steps: { ...OPTIONS.steps, help: "with --frames: action steps (JSON) to run before the frames" },
|
|
477
506
|
},
|
|
@@ -22,9 +22,9 @@ This skill does not do the specialist work itself.
|
|
|
22
22
|
- reverse engineer and rebuild the whole program
|
|
23
23
|
- The current project knowledge.
|
|
24
24
|
|
|
25
|
-
## Tools
|
|
25
|
+
## Tools
|
|
26
26
|
|
|
27
|
-
This skill uses the other skills. It does not use the
|
|
27
|
+
This skill uses the other skills. It does not use the emulator tools directly.
|
|
28
28
|
|
|
29
29
|
### Project folder
|
|
30
30
|
|
|
@@ -175,7 +175,7 @@ A clear answer for the scope, with the durable conclusions in the project knowle
|
|
|
175
175
|
|
|
176
176
|
## Failure and conflicts
|
|
177
177
|
|
|
178
|
-
- A skill reports `installation-incomplete
|
|
178
|
+
- A skill reports `installation-incomplete` or `machine-unavailable`: stop the whole task. Give the message to the user and wait for the user. Do not continue with other skills. Do not install, start or change a tool yourself. Do not make a replacement for the tool, for example your own disk parser, disassembler or emulator script.
|
|
179
179
|
- A tool gives a wrong result, and the exit check of a stage cannot be true. Tell the user the defect and the evidence, and wait for the user. Do not make a workaround, for example a change to a generated file. When the user accepts an exception, give the defect and the exception in the answer of stage 12.
|
|
180
180
|
- If the evidence does not support a conclusion, keep the unknown and get more evidence. Do not make up a meaning.
|
|
181
181
|
- Before you replace current knowledge from the user or the LLM, read its history and the evidence for it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: c64-source
|
|
3
|
-
description: Use this skill to generate ACME source code for a C64 program from the project knowledge. The knowledge holds the program, its entry state, the coverage and the names. The script
|
|
3
|
+
description: Use this skill to generate ACME source code for a C64 program from the project knowledge. The knowledge holds the program, its entry state, the coverage and the names. The script writes the source files. It checks that the source assembles to the same bytes as the program. It can also write a loader that sets the entry state of an unpacked program. It can also export the program as the start of a new program. The export is a new project with one value for each switch and without unused code. Use it to make a rebuild. Do not edit the generated files. Change the knowledge and generate again.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# c64-source
|
|
@@ -15,13 +15,11 @@ This skill does not change the knowledge.
|
|
|
15
15
|
|
|
16
16
|
- The program in the knowledge. Put it in with `image` of the c64-knowledge skill: a capture of the c64-unpacker skill, or a PRG.
|
|
17
17
|
- The output directory for the source files, relative to the project folder.
|
|
18
|
-
- Optional entry points
|
|
18
|
+
- Optional entry points of code.
|
|
19
19
|
- Optional: the coverage in the knowledge. Add it with `coverage` of the c64-knowledge skill.
|
|
20
20
|
- For the loader: the entry state of a capture in the knowledge.
|
|
21
21
|
|
|
22
|
-
## Tools
|
|
23
|
-
|
|
24
|
-
The script runs Ghidra and ACME on this machine. With `--loader`, it also runs the loader in the emulator through the host runtime.
|
|
22
|
+
## Tools
|
|
25
23
|
|
|
26
24
|
```
|
|
27
25
|
node <skill>/scripts/source.ts generate --out src
|
|
@@ -32,13 +30,13 @@ node <skill>/scripts/source.ts generate --out src --loader
|
|
|
32
30
|
| Option | Meaning |
|
|
33
31
|
|---|---|
|
|
34
32
|
| `--out src` | The directory for the source files. The script writes over the files that it generated before. It removes a generated `.asm` file that this run does not write. A run without `--loader` keeps `loader.asm` and `loader.prg` of an earlier run. |
|
|
35
|
-
| `--entry '$080d'` | An
|
|
33
|
+
| `--entry '$080d'` | An address where code starts. Use it again for more entry points. The entry of the program, the routines and the code regions in the knowledge are entry points too. |
|
|
36
34
|
| `--analyzer-names` | Name an address that has no symbol and no platform name with its analyzer name, for example `FUN_17e2`. The order is heuristic, Ghidra, then DXA. Without it, the source makes its own names, for example `l_17e2`. |
|
|
37
35
|
| `--space drive8` | Generate the source of drive code or a cartridge bank from the knowledge of that space. The coverage, `--loader` and the platform names are only for `c64`. |
|
|
38
36
|
| `--loader` | Also write `loader.asm` and `loader.prg`. This needs a capture in the knowledge, with its entry and its entry state. |
|
|
39
37
|
| `--max-listed 20` | List at most this number of items in each list. The default is 50. The counts are always in the result. |
|
|
40
38
|
|
|
41
|
-
When the knowledge has coverage, code that no run executed gets the line `; not executed` with its range. `notExecuted` lists it. The executed code is
|
|
39
|
+
When the knowledge has coverage, code that no run executed gets the line `; not executed` with its range. `notExecuted` lists it. The executed code is always instructions in the source.
|
|
42
40
|
|
|
43
41
|
### Calling the script
|
|
44
42
|
|
|
@@ -83,7 +81,7 @@ When the knowledge has coverage, code that no run executed gets the line `; not
|
|
|
83
81
|
- A label or a constant gets the name of the address in the knowledge. Without a knowledge name, it gets the platform name of the c64-memory-map skill, for example `EXTCOL` or `CHROUT`. A platform name wins over a name from an analyzer (`dxa`, `ghidra` or `heuristic`), for example `EXTCOL` over `ld020`. A `user` or `llm` name wins over a platform name. An address in the program without a name gets `l_xxxx`.
|
|
84
82
|
- The source uses the names of a ROM only when the program uses that ROM. When the knowledge has coverage, a ROM is in use when a run executed code of it. A read of ROM bytes as data does not count. Without coverage, `$01` of the entry state tells which ROMs are in. When the program uses neither ROM, the zero page and pages 2 and 3 get no system names. `romNamesLeftOut` gives the ROMs that the source did not name, and the evidence. An operand expression or a macro use with such a name gets that reason.
|
|
85
83
|
- `sta $d011 ; $d011: yScroll 3, rows 25, displayEnabled` is a store of an immediate to a register that the c64-memory-map skill decodes. The side comment gives the decoded value. A side comment in the knowledge replaces it.
|
|
86
|
-
- Code regions, and the instructions
|
|
84
|
+
- Code regions, and the decoded instructions outside of data regions, become instructions.
|
|
87
85
|
- Data regions become data by their type: `!byte`, `!word`, `!pet`, `!scr`, `!fill`, tables of labels, and sprite bytes in binary.
|
|
88
86
|
- `lda+2 $0012` is an absolute operand below $0100. `+1` is a zero-page operand with a label.
|
|
89
87
|
- `sta NMINV+1` is an address inside a platform entry of more than one byte, for example the high byte of a vector.
|
|
@@ -92,7 +90,7 @@ When the knowledge has coverage, code that no run executed gets the line `; not
|
|
|
92
90
|
- `lda #<irq_handler` and `lda bar_colours-1,x` are operand expressions of the knowledge. The script writes each name of an expression with the name of its address in the source. An operand expression in a non-immediate mode that starts with a bracket gets `0+` before it, because ACME reads `(...)` as indirect.
|
|
93
91
|
- `; = <irq_handler` at the end of an instruction with a number: the source cannot use this operand expression. `operandsAsNumbers` gives the reason.
|
|
94
92
|
- `!byte` with an instruction as its comment: ACME writes this instruction with a different opcode. The bytes keep the source identical.
|
|
95
|
-
- `not decoded` marks bytes in a code region that
|
|
93
|
+
- `not decoded` marks bytes in a code region that the script did not decode.
|
|
96
94
|
- `; not executed $xxxx-$yyyy` starts code that no run of the coverage executed. The range is the same as in `not_executed.json`.
|
|
97
95
|
- `+inc16 ptr` is a use of a macro of the knowledge. `macros.asm` holds the macros. `main.asm` and `loader.asm` include it. The comments inside a use go to its side comment.
|
|
98
96
|
- `!zone patch_PROTECTION_100e` starts a patch of the knowledge. The condition is the state that the program does not have. It is `!if TRAINER` when the base release has the switch off. It is `!if PROTECTION = 0` when the base release has it on. The block has the code of the patch and NOP to the end of the range. `else` has the original code. The labels inside the range come before the zone as `name = * + n`. Thus all builds have them.
|
|
@@ -136,10 +134,30 @@ The copy table, the copier and the jump to the entry use labels, not numbers. `l
|
|
|
136
134
|
|
|
137
135
|
The flags go through the free stack byte below the stack pointer (`stackByte`). The loader changes this byte. The loader does not set the SID, the time of day of the CIAs, the CIA interrupt flags or the interrupt registers of the VIC-II. `loader.limits` names each CIA value that the loader cannot set as it was at the entry. A program that reads the SID voice 3 for random numbers can still differ in a scenario. A raster sync does not change a timer or the SID. Then observe after the program sets up its own random numbers. To sync the original and the rebuild in a test, see the sync rules of the c64-testing skill.
|
|
138
136
|
|
|
139
|
-
The script
|
|
137
|
+
The script runs `loader.prg` to its jump to the entry. It compares the memory, $00/$01, the registers, the screen registers of the VIC-II, the VIC bank and the raster line with the entry state there. It also compares the CIA timers, latches and interrupt masks. `loader.verified: true` tells that all of them are equal. An interrupt can run right at the entry, as in the original program.
|
|
140
138
|
|
|
141
139
|
The entry state is the state of the base release. Thus the script builds and checks `loader.prg` with the switch values of the base release. For a loader of the default build, build `loader.asm` with the c64-assembler skill and no option.
|
|
142
140
|
|
|
141
|
+
### The packed loader
|
|
142
|
+
|
|
143
|
+
A loader file that loads into $d000 or higher writes the I/O area. When the image is too large for one loader file, `loader.asm` has the packed form. It has these differences:
|
|
144
|
+
|
|
145
|
+
- `loader.asm` holds only the copier and the bytes below $0400: pages $0002-$03ff of the entry state and the parts of segments there. The copier is in one free range, at `loader.copier`. The bytes below $0400 go into free ranges. When one range is too small, they go into more ranges, and each piece is a copy. Between these ranges, `loader.asm` holds the bytes of the image. The segments at $0400 and higher are not in `loader.asm`.
|
|
146
|
+
- The script packs the build of `main.asm` from $0400 and the build of `loader.asm` into `loader.prg`. Where the two builds overlap, the bytes of `loader.asm` are in `loader.prg`.
|
|
147
|
+
- `10 SYS` starts the unpacker. The unpacker writes all bytes, also at $d000-$dfff. Then it jumps to the copier with all RAM visible ($01 = $34).
|
|
148
|
+
- The unpacker uses the zero page and $0334-$03ff. Thus the copier writes pages $0002-$03ff after the unpack. Then it does steps 4 to 6.
|
|
149
|
+
- The jump to the entry uses the address of the entry, not its label. The build of `loader.asm` does not include `main.asm`.
|
|
150
|
+
|
|
151
|
+
The script checks the unpack. All bytes of the two builds must be correct, and the unpacker must jump to the copier. Then the script checks `loader.prg` as for the plain loader. `loader.packed` gives `packedBytes` and `unpackedBytes`.
|
|
152
|
+
|
|
153
|
+
To make the packed loader for other switch values, do these steps:
|
|
154
|
+
|
|
155
|
+
1. Build the program with the c64-assembler skill: `assembler.ts build src main.asm --out build/main.prg`.
|
|
156
|
+
2. Build the copier with the c64-assembler skill: `assembler.ts build src loader.asm --out build/copier.prg`.
|
|
157
|
+
3. Pack the two files with the c64-packer skill: `packer.ts pack build/main.prg build/copier.prg --entry '$c000' --exit-memory '$34' --out build/loader.prg`. The comment at the start of `loader.asm` gives the `--entry` value.
|
|
158
|
+
|
|
159
|
+
These commands do not work when a segment starts below $0400. Then the build of `main.asm` has bytes in the area of the unpacker. They also do not work when a patch is between the ranges of `loader.asm`, because there `loader.asm` has the bytes of the image. In these cases, use `generate --loader` for the base release.
|
|
160
|
+
|
|
143
161
|
## Export for a new application
|
|
144
162
|
|
|
145
163
|
`export` writes the program of the knowledge as the start of a new program: a new project folder and a zip file of it. A person changes the source of the new project directly. The c64-export skill gives the full procedure.
|
|
@@ -166,7 +184,7 @@ The script does these steps. It writes nothing until all the checks pass.
|
|
|
166
184
|
- `change`: its default.
|
|
167
185
|
3. It builds the program with these values. This build can change bytes only in the patches.
|
|
168
186
|
4. It finds the free ranges. Each free range gets the bytes $00 and the label `free_xxxx`. No address moves.
|
|
169
|
-
5. It makes the source of the new program.
|
|
187
|
+
5. It makes the source of the new program. The source must assemble to the new program byte by byte. For a capture with an entry state, the script also makes `loader.asm` and checks its copies. It does not run the loader.
|
|
170
188
|
6. It writes the new project and the zip file.
|
|
171
189
|
|
|
172
190
|
### The free ranges
|
|
@@ -240,13 +258,13 @@ Do not store:
|
|
|
240
258
|
- `removed`: the files of an earlier run that the script removed from `--out` and did not write again.
|
|
241
259
|
- `instructions`, `dataBytes` and `undecodedBytes`.
|
|
242
260
|
- `labels`: `named` labels from the knowledge and `generated` labels `l_xxxx`.
|
|
243
|
-
- `entriesInData`: each `--entry` in a data region of the knowledge, with the `region` and its `origin`.
|
|
261
|
+
- `entriesInData`: each `--entry` in a data region of the knowledge, with the `region` and its `origin`. The script does not decode an entry in a data region.
|
|
244
262
|
- `asBytes`: the instructions that the source has as bytes.
|
|
245
263
|
- `operandExpressions`: the count of instructions that the source has with an operand expression.
|
|
246
|
-
- `operandsAsNumbers`: the operand expressions that the source has as a number with a side comment, each with its `address`, `expression` and `reason`. An expression becomes a number when no instruction with an operand value is at the address, or when a name has no address. An expression that
|
|
264
|
+
- `operandsAsNumbers`: the operand expressions that the source has as a number with a side comment, each with its `address`, `expression` and `reason`. An expression becomes a number when no instruction with an operand value is at the address, or when a name has no address. An expression that does not assemble to the program also becomes a number.
|
|
247
265
|
- `unusedModules`: modules in the knowledge whose start is in no segment of the program. Often this tells that the program does not hold code that the knowledge describes.
|
|
248
266
|
- `entryOutside`: the entry is in no segment of the program in the knowledge, with a `reason`. The capture does not hold the program.
|
|
249
|
-
- `dataOnly`: the knowledge has no entry, no routine, no code region and no executed address in the space. Thus the source has only data
|
|
267
|
+
- `dataOnly`: the knowledge has no entry, no routine, no code region and no executed address in the space. Thus the source has only data. A table or a key page in a cartridge bank is an example.
|
|
250
268
|
- `notExecuted`: when the knowledge has coverage, the count of instructions that no run executed, the count of their ranges, and the first ranges. `rest` names the file `not_executed.json` in `--out` when the list is not complete. This file has all of the ranges. Each range has its source `file` and the `routine` before it. `files` counts the ranges in each file.
|
|
251
269
|
- `macroUses`: the count of macro uses that the source has.
|
|
252
270
|
- `macrosAsInstructions`: the macro uses that the source has as instructions, each with its `start`, `end`, `macro` and `reason`.
|
|
@@ -255,9 +273,9 @@ Do not store:
|
|
|
255
273
|
- `switches`: the build of each switch that has patches. Each item has `kind`, `default`, `base`, the `define` for the c64-assembler skill and the patches. `result` is the result of the build with the switch at the value that is not `base`. `fits` tells that the build is good, and `changedBytes` counts the changed bytes. `overflow` tells that the code of a patch is longer than its range. `changes outside` gives the first byte outside the ranges that changed. `does not assemble` gives the diagnostics of ACME. `insideNames` lists the labels inside a patch. Code that writes to one of these labels changes the patch when the switch is on.
|
|
256
274
|
- `default`: the default build. `in` lists the switches whose patches are in. `result` and `changedBytes` are as in `switches`.
|
|
257
275
|
- `releases`: the build of each release. Each item has `label`, `base`, `file`, the `define` and the `result`. `identical` tells that the build gives the bytes of the file. `different` gives the segments that differ. `layout differs` tells that the release has other segments than the program: patches cannot move code, so this result does not fail the run. `file changed` tells that the file is not the file that the knowledge recorded. `does not assemble` gives the diagnostics of ACME.
|
|
258
|
-
- `loader`: the program, the copies in their order, the copier page, `stackByte`, `verified` and `differences`. `limits` lists the CIA values that the loader cannot set. An entry state from an old capture has no CIA values. Then `limits` tells you to capture the program again. When the script cannot make the loader, `loader` has `verified: false` and a `reason`. The loader includes the source. Thus a source that does not assemble to the program also stops the loader.
|
|
276
|
+
- `loader`: the program, the copies in their order, the copier page, `stackByte`, `verified` and `differences`. A packed loader also has `packed` with `packedBytes` and `unpackedBytes`. `limits` lists the CIA values that the loader cannot set. An entry state from an old capture has no CIA values. Then `limits` tells you to capture the program again. When the script cannot make the loader, `loader` has `verified: false` and a `reason`. The loader includes the source. Thus a source that does not assemble to the program also stops the loader.
|
|
259
277
|
|
|
260
|
-
`result` is `PASS` when the source is identical and the
|
|
278
|
+
`result` is `PASS` when the source is identical and the check of the loader passes. `result` is `FAIL` for a failed check and for an entry in no segment. These also give `FAIL`:
|
|
261
279
|
|
|
262
280
|
- a patch that the source does not have
|
|
263
281
|
- a switch or a default build that does not fit
|
|
@@ -282,13 +300,14 @@ Do not store:
|
|
|
282
300
|
- `dataOnly`: this is not a failure. If the space has code, give `--entry` or classify the code with the c64-knowledge skill. Then generate again.
|
|
283
301
|
- `entriesInData`: an analyzer region of data hides the code at the entry. If the entry is code, record a code region at the entry with the c64-knowledge skill, for example `classify '$0500-$05ff' code`. A region of the user or the LLM replaces the analyzer region. Then generate again.
|
|
284
302
|
- `loader.verified: false` with a `reason`: the script did not make the loader. The script still writes and checks the source. When no copy order or no free pages exist, or the loader needs too many copies, the reason gives the ranges. Capture the program again with fewer segments, or write the loader by hand.
|
|
303
|
+
- `loader.verified: false` with a `reason` about the packed form: the image is too large for one loader file. If the reason tells that a tool is missing, stop the task. Give the message to the user. If the free ranges are too small for the copier and the bytes below $0400, the reason gives the largest free ranges. Write the loader by hand. If the unpack check fails, give the reason to the user.
|
|
285
304
|
- `loader.verified: false` with `differences`: the loader ran, and `differences` gives the bytes and registers that are not equal.
|
|
286
|
-
- `loader.verified: false` with `stop`: the loader did not get to its copier or to its jump. `stop` gives the address where it stopped and `port`, the value of $01. `history` gives the last 16 instructions. `cause` gives the first byte of the copier that is not equal to its byte in the loader file. If the copier ran, `cause` can also give the first byte that a copy did not write correctly.
|
|
305
|
+
- `loader.verified: false` with `stop`: the loader did not get to its copier or to its jump. `stop` gives the address where it stopped and `port`, the value of $01. `history` gives the last 16 instructions. `cause` gives the first byte of the copier that is not equal to its byte in the loader file. For a packed loader, `cause` gives the first byte of the copier that the unpack did not write. If the copier ran, `cause` can also give the first byte that a copy did not write correctly.
|
|
287
306
|
- `export` with `stage: "original"`: the source of the knowledge does not pass. Run `generate`, and correct the knowledge until `generate` gives PASS.
|
|
288
307
|
- `export` with `stage: "switches"`: the build with the export values changes bytes outside the patches, or a patch does not fit. Read `build`. Correct the patches.
|
|
289
308
|
- `export` refuses two switches that change one range: the export puts both alternatives in. Give all but one of them the kind `change` and the default of the base release with `switch` of the c64-knowledge skill.
|
|
290
309
|
- `export` refuses `--drop`: read the message. It names the code that stays and goes to the range or reads it, or the code or region that the range cuts.
|
|
291
|
-
- `installation-incomplete
|
|
310
|
+
- `installation-incomplete` or `machine-unavailable`: stop the task. Give the message to the user and wait for the user. Do not install, start or change a tool yourself. Do not make a replacement for the tool, for example your own disassembler or emulator script.
|
|
292
311
|
|
|
293
312
|
## Handoffs
|
|
294
313
|
|