@henols/c64-re-tools 2.7.0 → 2.8.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 +23 -38
- package/skills/c64-assembler/scripts/assembler.ts +114 -16
- package/skills/c64-basic/SKILL.md +11 -31
- package/skills/c64-basic/scripts/basic.ts +4 -1
- package/skills/c64-development/SKILL.md +2 -2
- package/skills/c64-disk/SKILL.md +11 -32
- package/skills/c64-docs/SKILL.md +27 -45
- package/skills/c64-docs/references/page-types.md +20 -18
- package/skills/c64-docs/references/style.md +10 -4
- package/skills/c64-docs/scripts/docs.ts +13 -2
- package/skills/c64-docs/scripts/lib/reference.ts +47 -5
- package/skills/c64-knowledge/SKILL.md +138 -267
- package/skills/c64-knowledge/references/batches.md +48 -0
- package/skills/c64-knowledge/references/coverage.md +29 -0
- package/skills/c64-knowledge/references/source-knowledge.md +72 -0
- package/skills/c64-knowledge/references/start-screen.md +44 -0
- package/skills/c64-knowledge/scripts/knowledge.ts +266 -61
- package/skills/c64-knowledge/scripts/lib/check.ts +133 -0
- package/skills/c64-knowledge/scripts/lib/listing.ts +72 -8
- package/skills/c64-memory-map/SKILL.md +11 -32
- package/skills/c64-packer/SKILL.md +11 -31
- package/skills/c64-provenance/SKILL.md +40 -62
- package/skills/c64-provenance/scripts/lib/leftovers.ts +8 -3
- package/skills/c64-provenance/scripts/provenance.ts +64 -55
- package/skills/c64-reverse-engineering/SKILL.md +20 -47
- package/skills/c64-reverse-engineering/references/comment-check.md +42 -0
- package/skills/c64-reverse-engineering/references/versions.md +47 -0
- package/skills/c64-source/SKILL.md +43 -235
- package/skills/c64-source/references/export.md +50 -0
- package/skills/c64-source/references/loader.md +78 -0
- package/skills/c64-source/references/source-format.md +46 -0
- package/skills/c64-source/scripts/lib/export.ts +20 -7
- package/skills/c64-source/scripts/lib/loader.ts +116 -104
- package/skills/c64-source/scripts/source.ts +62 -52
- package/skills/c64-static-analysis/SKILL.md +51 -52
- package/skills/c64-static-analysis/scripts/lib/coverage.ts +55 -2
- package/skills/c64-static-analysis/scripts/lib/idioms.ts +28 -9
- package/skills/c64-static-analysis/scripts/static-analysis.ts +69 -15
- package/skills/c64-testing/SKILL.md +77 -59
- package/skills/c64-testing/references/recording-format.md +5 -79
- package/skills/c64-testing/references/scenario-format.md +4 -12
- package/skills/c64-testing/scripts/lib/play.ts +16 -8
- package/skills/c64-testing/scripts/lib/recording.ts +76 -9
- package/skills/c64-testing/scripts/lib/replay.ts +14 -0
- package/skills/c64-testing/scripts/lib/runs.ts +112 -1
- package/skills/c64-testing/scripts/lib/scenario.ts +12 -6
- package/skills/c64-testing/scripts/lib/start-screen.ts +27 -0
- package/skills/c64-testing/scripts/testing.ts +37 -15
- package/skills/c64-unpacker/SKILL.md +10 -30
- package/skills/emulator/SKILL.md +7 -36
- package/src/build-name.ts +12 -1
- package/src/knowledge/history.ts +8 -0
- package/src/knowledge/program.ts +73 -1
- package/src/knowledge/read.ts +46 -2
- package/src/knowledge/recording-files.ts +32 -0
- package/src/knowledge/schema.ts +3 -1
- package/src/knowledge/separate.ts +90 -3
- package/src/knowledge/start-screen.ts +99 -17
- package/src/knowledge/text.ts +2 -1
- package/src/knowledge/write.ts +15 -8
- package/src/loader.ts +167 -0
- package/src/native/c64run.ts +11 -0
- package/src/native/decompiler/analyze.ts +7 -6
- package/src/native/decompiler/walk.ts +32 -2
- package/src/native/dxa.ts +4 -4
- package/src/native/types.ts +32 -4
- package/src/script.ts +87 -17
- package/skills/c64-export/SKILL.md +0 -63
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: c64-knowledge
|
|
3
|
-
description: Reads and changes the durable knowledge of a C64 project
|
|
3
|
+
description: Reads and changes the durable knowledge of a C64 project. The knowledge holds the program and the coverage of the runs. It holds the names, regions, comments and references, and the releases, switches, patches, macros and start screen of the source. It keeps the history of each change. Use it to find the knowledge and the access of the runs at addresses or names. Use it to record a name, a region, a comment or a reference after you interpret the evidence. Use it to put a program, the coverage of runs or a recording into the project. Use it to record the releases, switches, patches, macros and start screen of the generated source. Use it to read the history, to revert to an earlier revision, or to decide the conflicts of a git merge. Use it to start a check of the comments by another agent, to record the verdicts of the check and to get its result. It does not run the program, analyze the machine code or generate the source.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# C64 knowledge
|
|
@@ -17,7 +17,7 @@ Each command in this skill, for example `at '$2100'`, goes in the place of `<com
|
|
|
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
|
|
|
20
|
-
|
|
20
|
+
Commit the folder `.c64-re-tools/knowledge/` of the project with git.
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
@@ -25,19 +25,24 @@ The knowledge is text in `.c64-re-tools/knowledge/` of the project. Commit that
|
|
|
25
25
|
|
|
26
26
|
| Goal | Command |
|
|
27
27
|
|---|---|
|
|
28
|
-
| Find all knowledge at
|
|
28
|
+
| Find all knowledge and the access of the runs at addresses | `at '$2100' '$2104' '$3000'` |
|
|
29
29
|
| Find names and comment text | `search player` |
|
|
30
30
|
| List the symbols in a range | `symbols --range '$2000-$2fff'` |
|
|
31
31
|
| List the names that the analyzers gave | `symbols --analyzer` |
|
|
32
|
-
| List
|
|
33
|
-
|
|
|
32
|
+
| List the regions in a range, and count the bytes of each type | `regions --range '$2000-$2fff'` |
|
|
33
|
+
| Find the references into a range, counted by kind and target | `references --range '$2000-$2fff' --direction in` |
|
|
34
|
+
| Find the routines that a range calls | `references --range '$2000-$2fff' --direction out --kind call` |
|
|
34
35
|
| Show the code of a range with names, comments, access and references | `listing '$0400-$04ff'` |
|
|
36
|
+
| Show only the instructions of a range | `listing '$0400-$04ff' --code` |
|
|
37
|
+
| Start a check of 30 comments, selected at random | `sample` |
|
|
38
|
+
| Get the comments and the verdicts of a check | `checks 4711` |
|
|
39
|
+
| Record the verdict of one comment of a check | `verdict 4711 '$2100' wrong --class callers --why 'JSR at $1f00 calls it too' --text 'Moves the player.'` |
|
|
35
40
|
| Write all knowledge to one file | `export --out .c64-re-tools/local/knowledge.json` |
|
|
36
41
|
| Find what the knowledge holds of the program | `program` |
|
|
37
42
|
| Put a captured program into the knowledge | `image .c64-re-tools/local/capture/image.json` |
|
|
38
43
|
| Put a PRG into the knowledge | `image releases/game.prg` |
|
|
39
|
-
| Put drive code into the knowledge | `image drive.prg --space drive8` |
|
|
40
44
|
| Add the coverage of runs | `coverage .c64-re-tools/local/runs/rooms/room0.bin` |
|
|
45
|
+
| Add the coverage of a recording | `coverage tests/recordings/walk` |
|
|
41
46
|
| Name the symbol at an address | `rename '$2100' update_player --kind routine --reason 'reads joystick 2'` |
|
|
42
47
|
| Remove a symbol | `remove-symbol '$2100'` |
|
|
43
48
|
| Classify memory | `classify '$3000-$303f' sprite` |
|
|
@@ -45,16 +50,16 @@ The knowledge is text in `.c64-re-tools/knowledge/` of the project. Commit that
|
|
|
45
50
|
| Make memory unknown, and keep the analyzers out of it | `unclassify '$3000-$303f'` |
|
|
46
51
|
| Write a comment | `comment '$2100' line Reads joystick 2.` |
|
|
47
52
|
| Add a reference | `reference '$2000' '$2100' call` |
|
|
48
|
-
| Find the places that a removal blocks | `suppressions --range '$2000-$2fff'` |
|
|
49
53
|
| Start a file of the generated source | `module '$2000' game/player.asm --title 'Player movement'` |
|
|
50
54
|
| Write the operand of an instruction as an expression | `operand '$8079' --lo irq_handler` |
|
|
51
55
|
| Record a release of the program | `release FIRESTAR --file releases/game.prg --base` |
|
|
56
|
+
| Get the files of the releases and their SHA-256 | `releases` |
|
|
52
57
|
| Write a switch | `switch PROTECTION --kind protection --releases FIRESTAR` |
|
|
53
58
|
| Write the code of a switch for a range | `patch '$100e-$1010' PROTECTION --code-file no-check.asm` |
|
|
54
|
-
|
|
|
55
|
-
|
|
|
59
|
+
| Record the patch from the bytes of a release | `patch '$100e-$1010' FIX_LIVES --from-release V2` |
|
|
60
|
+
| List the switches and the ranges of their patches | `switches` |
|
|
61
|
+
| Record the start screen in the program from a capture | `start-screen --capture .c64-re-tools/local/title/image.json` |
|
|
56
62
|
| Record the start screen of a captured stage, and its tune | `start-screen --stage loading --call '$9000'` |
|
|
57
|
-
| Remove the start screen | `unstart-screen` |
|
|
58
63
|
| Write a macro | `macro inc16 --params dst --body-file inc16.asm` |
|
|
59
64
|
| Write instructions as one use of a macro | `use '$1005-$100a' inc16 --args ptr` |
|
|
60
65
|
| Do many writes as one revision | `apply .c64-re-tools/local/batch.json` |
|
|
@@ -62,6 +67,7 @@ The knowledge is text in `.c64-re-tools/knowledge/` of the project. Commit that
|
|
|
62
67
|
| Write the batches of parallel agents as one revision | `join a.json b.json --apply` |
|
|
63
68
|
| Read the history of an address or a name | `history '$2100'` |
|
|
64
69
|
| Read the last revisions | `revisions` |
|
|
70
|
+
| See what one revision changed | `revision 20261015T2145` |
|
|
65
71
|
| Go back to an earlier state | `revert 20261015T2145` |
|
|
66
72
|
| Decide the conflicts after a git merge | `merge --reason 'merge of two computers'` |
|
|
67
73
|
|
|
@@ -73,8 +79,8 @@ The knowledge is text in `.c64-re-tools/knowledge/` of the project. Commit that
|
|
|
73
79
|
- An analyzer name is a second name from DXA, the decompiler or an idiom search, for example `FUN_17e2`. Each analyzer keeps its own name at an address. Get them from `at`, `search` or `symbols --analyzer`.
|
|
74
80
|
- The generated source uses only the symbols. To use an analyzer name in the source, give the address that name with `rename`.
|
|
75
81
|
- A symbol name is a label for ACME: a letter or an underscore, then letters, digits or underscores. The knowledge refuses the name of a 6502 instruction, for example `lda`, in upper or lower case.
|
|
76
|
-
- A space is `c64` (the default), `drive8` for code in the 1541 drive, `loading` or `bank0` to `bank255`. `loading` is the captured stage of the loading that shows the start screen. `bank0` to `bank255` are cartridge banks, or other memory images of the program, for example a file that the program loads later.
|
|
77
|
-
- A revision id has the form `20261015T214501.123-k3f9qz`.
|
|
82
|
+
- A space is `c64` (the default), `drive8` for code in the 1541 drive, `loading` or `bank0` to `bank255`. `loading` is the captured stage of the loading that shows the start screen. `bank0` to `bank255` are cartridge banks, or other memory images of the program, for example a file that the program loads later. Each space has its own knowledge. A name is unique in one space.
|
|
83
|
+
- A revision id has the form `20261015T214501.123-k3f9qz`. Give the full id, or a start of the id that only one revision has. Get the ids from `revisions`, or from the `revision` field of a result. The revision `0` is the knowledge before the first revision.
|
|
78
84
|
- A file of a capture is the `image.json` that the capture of a packed program wrote. The other files of the capture must be next to it.
|
|
79
85
|
|
|
80
86
|
### Paths and the project folder
|
|
@@ -87,14 +93,14 @@ The knowledge is text in `.c64-re-tools/knowledge/` of the project. Commit that
|
|
|
87
93
|
- A range is `<start>-<end>`, for example `'$c000-$cfff'`. In a JSON file, a range is `start` and `end`.
|
|
88
94
|
- Bytes in a JSON file are hex in a field `data`, for example `"data": "a900"`.
|
|
89
95
|
- Write each file that you make for your work in `.c64-re-tools/local/` of the project. Git ignores that folder. Examples are results, batches, step files, runs, snapshots and memory dumps.
|
|
90
|
-
- The script refuses an `--out` path in `.c64-re-tools/knowledge
|
|
96
|
+
- The script refuses an `--out` path in `.c64-re-tools/knowledge/`. Change the project knowledge only with the commands that change it.
|
|
91
97
|
- The script refuses a folder where the command writes a file. It refuses a file where the command writes a folder.
|
|
92
98
|
- When a test or another file is the evidence for a finding in the project knowledge, move it out of `.c64-re-tools/local/` first. The project knowledge refuses that evidence in that folder.
|
|
93
|
-
- A coverage map can stay in `.c64-re-tools/local/`.
|
|
94
|
-
-
|
|
95
|
-
- Put a run that is evidence in `runs/<name>/`, with its run file, its results and its snapshot files. Change the paths in the run file to the new paths. Then git keeps them, and another person can do the run again.
|
|
99
|
+
- A coverage map can stay in `.c64-re-tools/local/`. Do not move a coverage map after you put it into the project knowledge.
|
|
100
|
+
- To keep a run as evidence, use the command that keeps a run. It copies the run, its results and its snapshot files into `runs/<name>/`, and it changes the paths in the copy. Then git keeps them, and another person can do the run again.
|
|
96
101
|
- A shell redirect (`>`) is relative to the working directory, not to the project folder. From the folder above the project, write `<folder>/.c64-re-tools/local/result.json`.
|
|
97
102
|
|
|
103
|
+
|
|
98
104
|
---
|
|
99
105
|
|
|
100
106
|
## Flags
|
|
@@ -103,21 +109,26 @@ Each flag applies only to the commands in the table. On another command, the scr
|
|
|
103
109
|
|
|
104
110
|
| Flag | Command | Effect |
|
|
105
111
|
|---|---|---|
|
|
106
|
-
| `--space <space>` | All commands | The space of the command: `c64`, `drive8`, `loading`, or `bank0` to `bank255`. The default is `c64`. Without `--space`, `revert` reverts all spaces. |
|
|
112
|
+
| `--space <space>` | All commands except `verdict` and `checks` | The space of the command: `c64`, `drive8`, `loading`, or `bank0` to `bank255`. The default is `c64`. Without `--space`, `revert` reverts all spaces. |
|
|
107
113
|
| `--by <user\|llm>` | All commands in "Change the knowledge" | Who decided the change. The default is `llm`. Give `user` only when the user decided the change. |
|
|
108
114
|
| `--reason <text>` | All commands in "Change the knowledge" | Why you make the change. The revision keeps it, and `history` shows it. |
|
|
109
115
|
| `--evidence <kind:ref>` | All commands in "Change the knowledge" | One thing that the change rests on: `coverage:<map>`, `test:<file>`, `file:<file>` or `note:<text>`. You can give it more than one time. |
|
|
110
116
|
| `--expect-revision <revision>` | All commands in "Change the knowledge" | Refuse the change when the knowledge changed after this revision. Give the `revision` of your last read. |
|
|
111
|
-
| `--
|
|
112
|
-
| `--reason <text>` | `join` | With `--apply`: the same as for the commands in "Change the knowledge". |
|
|
113
|
-
| `--evidence <kind:ref>` | `join` | With `--apply`: the same as for the commands in "Change the knowledge". |
|
|
114
|
-
| `--expect-revision <revision>` | `join` | With `--apply`: the same as for the commands in "Change the knowledge". |
|
|
115
|
-
| `--range <start>-<end>` | `symbols`, `regions`, `comments`, `references`, `suppressions`, `modules`, `operands`, `patches`, `uses`, `export` | Only the rows in this range. The default is all addresses. |
|
|
117
|
+
| `--range <start>-<end>` | `symbols`, `regions`, `comments`, `sample`, `references`, `suppressions`, `modules`, `operands`, `patches`, `uses`, `export` | Only the rows in this range. The default is all addresses. |
|
|
116
118
|
| `--origin <origin>` | `search`, `symbols`, `regions`, `comments`, `references`, `modules`, `operands`, `patches`, `macros`, `uses`, `export` | Only the rows of these origins: `user`, `llm`, `dxa`, `decompiler`, `heuristic`, `semantic` (user and llm), `analyzer` (dxa, decompiler and heuristic), or a comma list. The default is all origins. |
|
|
117
|
-
| `--
|
|
119
|
+
| `--origin <origin>` | `sample` | Only the comments of these origins. The default is `llm`. |
|
|
120
|
+
| `--count <n>` | `sample` | The number of comments in the sample. The default is 30. |
|
|
121
|
+
| `--seed <n>` | `sample` | A whole number from 0 to 999999 that selects the sample. Without it, the script selects one. |
|
|
122
|
+
| `--placement <line\|side>` | `verdict` | The placement of the comment. Give it when the sample has a line and a side comment at the address. |
|
|
123
|
+
| `--class <class>` | `verdict` | With `wrong`: the class of the error: `callers`, `bits`, `registers`, `bounds`, `units`, `paths`, `tables`, `hardware`, `place` or `scope`. |
|
|
124
|
+
| `--why <text>` | `verdict` | With `wrong`: the evidence, with the addresses and the instructions. With `unsure`: the run that can show the claim. |
|
|
125
|
+
| `--text <text>` | `verdict` | With `wrong`: the correct comment. |
|
|
126
|
+
| `--name <name>` | `verdict` | With `wrong`: the correct name at the address. |
|
|
127
|
+
| `--max-listed <n>` | `search`, `symbols`, `regions`, `comments`, `references`, `suppressions`, `modules`, `operands`, `patches`, `switches`, `releases`, `macros`, `uses`, `spaces`, `history`, `revisions`, `revision`, `listing`, `join`, `checks` | The most items in each list of the body. The default is 50. The counts are always complete. |
|
|
118
128
|
| `--kind <kind>` | `symbols`, `rename` | The symbol kind: `label`, `routine`, `variable`, `data` or `vector`. A read gives all kinds by default. A new symbol without `--kind` is a `label`. A `rename` without `--kind` keeps the kind of the symbol. |
|
|
119
129
|
| `--kind <kind>` | `references` | Only references of this kind: `call`, `jump`, `read`, `write`, `reference` or `pointer`. |
|
|
120
130
|
| `--kind <kind>` | `switch` | Necessary. The switch kind: `protection`, `trainer`, `cheat`, `crack`, `fix` or `change`. |
|
|
131
|
+
| `--direction <in\|out\|inside>` | `references` | With `--range`: `in` from outside into the range, `out` from the range to outside, or `inside` with both ends in the range. |
|
|
121
132
|
| `--analyzer` | `symbols` | List the analyzer names in place of the symbols. |
|
|
122
133
|
| `--type <type>` | `regions` | Only regions of this type. |
|
|
123
134
|
| `--switch <switch>` | `patches`, `unpatch` | Only the patches of this switch. For `unpatch`, the switch of the patch to remove. |
|
|
@@ -128,6 +139,7 @@ Each flag applies only to the commands in the table. On another command, the scr
|
|
|
128
139
|
| `--before <revision>` | `revisions` | Only the revisions before this one. |
|
|
129
140
|
| `--out <file>` | `export` | Necessary. The JSON file to write. |
|
|
130
141
|
| `--apply` | `join` | Write the joined writes to the project knowledge as one revision. Without it, `join` writes nothing. |
|
|
142
|
+
| `--code` | `listing` | Only the instructions of the code regions. No data lines. |
|
|
131
143
|
| `--out <file>` | `listing` | Write the listing as text to this file in place of the lines in the body. |
|
|
132
144
|
| `--element <n>` | `classify` | The bytes of one element of a table. The length of the range must be a multiple of it. |
|
|
133
145
|
| `--title <text>` | `module` | The title of the file. A `module` write without a title keeps the title that the module has. |
|
|
@@ -139,55 +151,55 @@ Each flag applies only to the commands in the table. On another command, the scr
|
|
|
139
151
|
| `--code <text>` | `patch` | The ACME code of the patch. |
|
|
140
152
|
| `--code-file <file>` | `patch` | A project file with the ACME code of the patch. |
|
|
141
153
|
| `--nop` | `patch` | The patch is NOP only. |
|
|
154
|
+
| `--from-release <label>` | `patch` | The code is the bytes of this release in the range. The base release is not permitted. |
|
|
142
155
|
| `--comment <text>` | `patch`, `switch`, `release`, `macro`, `start-screen` | A comment for the row. A `patch`, `switch`, `macro` or `start-screen` write without `--comment` keeps the comment that the row has. |
|
|
143
|
-
| `--default <0\|1>` | `switch` | The value in the default build. See
|
|
156
|
+
| `--default <0\|1>` | `switch` | The value in the default build. See "Switches" of `<skill>/references/source-knowledge.md`. |
|
|
144
157
|
| `--releases <A,B>` | `switch` | The labels of the releases that have the switch on, as a comma list. A write without it keeps the releases that the switch has. |
|
|
145
|
-
| `--file <file>` | `release` | Necessary. The PRG or `image.json` of the release
|
|
158
|
+
| `--file <file>` | `release` | Necessary. The PRG or `image.json` of the release. |
|
|
146
159
|
| `--base` | `release` | This release is the program of the knowledge. |
|
|
147
160
|
| `--params <a,b>` | `macro` | The params of the macro, as a comma list without a dot. The default is no params. |
|
|
148
161
|
| `--body <text>` | `macro` | The body of the macro. |
|
|
149
162
|
| `--body-file <file>` | `macro` | A project file with the body of the macro. |
|
|
150
163
|
| `--args <x, y>` | `use` | One expression for each param of the macro, as a comma list. |
|
|
151
|
-
| `--
|
|
152
|
-
| `--
|
|
164
|
+
| `--capture <image.json>` | `start-screen` | A capture of the program while it shows the screen. The script takes the screen and its colours from it. |
|
|
165
|
+
| `--stage <space>` | `start-screen` | The space of the captured stage that shows the screen: `loading`. The script takes the screen and its colours from the capture of the stage. |
|
|
166
|
+
| `--call <address>` | `start-screen` | A routine of the stage that the start screen calls before it waits, for example the start of the loading tune. It must return with RTS. It needs `--stage`. |
|
|
167
|
+
| `--mode <mode>` | `start-screen` | The mode of the VIC-II: `text`, `hires` or `multicolour`. Necessary without `--capture` and `--stage`. |
|
|
168
|
+
| `--screen <address>` | `start-screen` | The address of the screen memory: 1000 bytes. Necessary without `--capture` and `--stage`. |
|
|
153
169
|
| `--bitmap <address>` | `start-screen` | The address of the bitmap: 8000 bytes. `hires` and `multicolour` need it. |
|
|
154
170
|
| `--charset <address>` | `start-screen` | The address of the charset: 2048 bytes. `text` needs it. |
|
|
155
171
|
| `--colours <address>` | `start-screen` | The address of the 1000 bytes that the loader copies to the colour RAM. |
|
|
156
172
|
| `--colour <0-15>` | `start-screen` | One colour for all of the colour RAM, in place of `--colours`. |
|
|
157
|
-
| `--border <0-15>` | `start-screen` | The border colour. Necessary without `--stage`. |
|
|
158
|
-
| `--background <0-15>` | `start-screen` | The background colour. Necessary without `--stage`. |
|
|
159
|
-
| `--stage <space>` | `start-screen` | The space of the captured stage that shows the screen: `loading`. The script takes the mode, the addresses and the colours from the capture. Without it, the bytes are in the program at the entry. |
|
|
160
|
-
| `--call <address>` | `start-screen` | A routine of the stage that the start screen calls before it waits, for example the start of the loading tune. It must return with RTS. It needs `--stage`. |
|
|
173
|
+
| `--border <0-15>` | `start-screen` | The border colour. Necessary without `--capture` and `--stage`. |
|
|
174
|
+
| `--background <0-15>` | `start-screen` | The background colour. Necessary without `--capture` and `--stage`. |
|
|
161
175
|
|
|
162
176
|
---
|
|
163
177
|
|
|
164
178
|
## Read the knowledge
|
|
165
179
|
|
|
166
|
-
A read writes nothing. A project without knowledge gives empty lists and the revision `0`.
|
|
180
|
+
A read writes nothing. A project without knowledge gives empty lists and the revision `0`. Each row in a body has `origin` and `revision`. A row of a space other than `c64` also has `space`.
|
|
167
181
|
|
|
168
|
-
|
|
182
|
+
When a git merge left conflicts in the knowledge, each read body also has `conflicts`. Each item gives the `conflict` and its `rows`. Each write stops until you run `merge`, the `nextAction` of the read.
|
|
169
183
|
|
|
170
|
-
|
|
184
|
+
### `at <address>...`
|
|
171
185
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
- `body`
|
|
175
|
-
- `
|
|
176
|
-
- Use `at` for the addresses of the question before other work.
|
|
186
|
+
- Give all addresses of the question to one `at`. Do not run `at` in a loop.
|
|
187
|
+
- `body.revision` is the current revision of the knowledge. Give it to `--expect-revision` of your next write.
|
|
188
|
+
- `body.addresses` has one item for each address, with `address`, `comments`, `referencesFrom` and `referencesTo`. When the knowledge has them, an item also has `symbol`, `analyzerNames`, `region`, `operand`, `patch`, `macroUse` and `suppressions`.
|
|
189
|
+
- When the space has coverage maps, an item also has `coverage` and `access`. `coverage` gives the `map` and the `access` of each map. `access` is the access of all maps: `x`, `rw`, `r`, `w` or `-`. See "Access" of `<skill>/references/coverage.md`.
|
|
177
190
|
|
|
178
191
|
### `search <text>`
|
|
179
192
|
|
|
180
|
-
- `body` holds the lists `symbols`, `analyzerNames` and `comments` with the text in their names or comment text.
|
|
181
|
-
- If a list is long, give a longer text.
|
|
193
|
+
- `body` holds the lists `symbols`, `analyzerNames` and `comments` with the text in their names or comment text. If a list is long, give a longer text.
|
|
182
194
|
|
|
183
195
|
### `symbols`
|
|
184
196
|
|
|
185
|
-
- `body.symbols` lists the symbols, each with `address`, `name` and `kind`.
|
|
186
|
-
- With `--analyzer`, `body.analyzerNames` lists the analyzer names in place of the symbols.
|
|
197
|
+
- `body.symbols` lists the symbols, each with `address`, `name` and `kind`. With `--analyzer`, `body.analyzerNames` lists the analyzer names in place of the symbols.
|
|
187
198
|
|
|
188
199
|
### `regions`
|
|
189
200
|
|
|
190
201
|
- `body.regions` lists the regions, each with `start`, `end` and `type`. A table also has `element` and `count`.
|
|
202
|
+
- `body.byType` gives the `count` of the regions of each type, and their `bytes` in the range. It counts all regions that the flags select, also the regions that `listed` does not show.
|
|
191
203
|
|
|
192
204
|
### `comments`
|
|
193
205
|
|
|
@@ -195,15 +207,14 @@ When a git merge left conflicts in the knowledge, each read body also has `confl
|
|
|
195
207
|
|
|
196
208
|
### `references`
|
|
197
209
|
|
|
198
|
-
- `body.references` lists the references, each with `from`, `to` and `kind`.
|
|
210
|
+
- `body.references` lists the references, each with `from`, `to` and `kind`. Without `--direction`, a reference with one end in the range is in the list.
|
|
211
|
+
- `body.byKind` gives the number of references of each kind. `body.byTarget` lists the targets, the target of the most references first. Each item has `to`, `count`, and `name` when the target has a name.
|
|
199
212
|
|
|
200
213
|
### `suppressions`
|
|
201
214
|
|
|
202
215
|
- `body.suppressions` lists the places that a removal blocks. Each item has `suppresses` (`symbol`, `region` or `reference`), the place, and the `reason` of the removal.
|
|
203
|
-
- `unclassify` and `unreference` block the place for
|
|
204
|
-
- `remove-symbol` does not block the address, because an analyzer name never becomes a symbol.
|
|
216
|
+
- `unclassify` and `unreference` block the place for the analyzers. A later analysis does not add a region in that range or that reference again. This is also true for a fact from the LLM.
|
|
205
217
|
- A `rename`, `classify` or `reference` at a blocked place ends the block there. A `revert` to a revision before the removal also ends the block.
|
|
206
|
-
- `at` and `history` also show the blocks.
|
|
207
218
|
|
|
208
219
|
### `modules`
|
|
209
220
|
|
|
@@ -219,13 +230,12 @@ When a git merge left conflicts in the knowledge, each read body also has `confl
|
|
|
219
230
|
|
|
220
231
|
### `switches`
|
|
221
232
|
|
|
222
|
-
- `body.switches` lists the switches. Each item has `name`, `kind`, `default`, `base`, `releases`, `comment` and the ranges of its `patches`.
|
|
223
|
-
- `base` is the value of the switch in the program of the knowledge.
|
|
233
|
+
- `body.switches` lists the switches. Each item has `name`, `kind`, `default`, `base`, `releases`, `comment` and the ranges of its `patches`. `base` is the value of the switch in the program of the knowledge.
|
|
224
234
|
|
|
225
235
|
### `releases`
|
|
226
236
|
|
|
227
|
-
- `body.releases` lists the releases, the base release first. Each item has `label`, `base` and `define
|
|
228
|
-
- `
|
|
237
|
+
- `body.releases` lists the releases, the base release first. Each item has `label`, `base`, `define`, `file` and `sha256`. `define` is the assembler define that builds the release.
|
|
238
|
+
- `file` is the path of the file of the release, and `sha256` is the SHA-256 of that file. Use them for the facts of a release, for example in a README. Do not calculate a SHA-256 yourself.
|
|
229
239
|
|
|
230
240
|
### `macros`
|
|
231
241
|
|
|
@@ -248,18 +258,17 @@ When a git merge left conflicts in the knowledge, each read body also has `confl
|
|
|
248
258
|
|
|
249
259
|
### `listing <range>`
|
|
250
260
|
|
|
251
|
-
- `body.lines` has `count` and `listed`. `
|
|
252
|
-
-
|
|
253
|
-
- `
|
|
254
|
-
-
|
|
255
|
-
- With `--out`,
|
|
256
|
-
-
|
|
257
|
-
- Use `listing` in place of your own disassembler.
|
|
261
|
+
- `body.lines` has `count` and `listed`. Each line has `address`, `bytes`, `text`, `referencesIn` and `referencesOut`. It can also have `label`, `analyzerNames`, `lineComments` (the line comments before the line), `comment` (the side comment) and `access`.
|
|
262
|
+
- `text` is the instruction with the names of its target. An operand expression of the knowledge replaces the operand. A table of addresses or words shows its values as `!word` lines, with the name of each target. A split table and the other bytes show as `!byte` lines.
|
|
263
|
+
- `access` is there when the knowledge has coverage: `x`, `r`, `w` or `-`. See "Reads that the program does not do" of `<skill>/references/coverage.md`.
|
|
264
|
+
- With `--code`, `lines` has only the instructions of the code regions.
|
|
265
|
+
- With `--out`, `body.lines` is a number, and the body has `out`, `bytes` and `sha256` of the text file.
|
|
266
|
+
- Use `listing` in place of your own disassembler. To find the targets of a table, classify the table with its type. Then read its listing. Do not decode the bytes of a table yourself.
|
|
258
267
|
|
|
259
268
|
### `export`
|
|
260
269
|
|
|
261
270
|
- `body` holds `counts`, `revision`, `out`, `bytes` and `sha256`. `counts` gives the number of rows of each kind in the file.
|
|
262
|
-
- The file has all current knowledge of the space in the range, with the analyzer names
|
|
271
|
+
- The file has all current knowledge of the space in the range, with the analyzer names, the source knowledge and the start screen.
|
|
263
272
|
|
|
264
273
|
---
|
|
265
274
|
|
|
@@ -278,14 +287,15 @@ When a git merge left conflicts in the knowledge, each read body also has `confl
|
|
|
278
287
|
|
|
279
288
|
### `revision <revision>`
|
|
280
289
|
|
|
281
|
-
- `body.revision` gives the revision. `body.
|
|
282
|
-
-
|
|
290
|
+
- `body.revision` gives the revision. `body.counts` gives the number of rows that it `added` and `closed`, for each kind of row.
|
|
291
|
+
- `body.added` and `body.closed` list the rows. They include the memory, entry and coverage rows of the program. A coverage row gives the `map`, the access `kind` and the number of `ranges` of that kind in the map.
|
|
292
|
+
- Use `revision` to see what one revision changed.
|
|
283
293
|
|
|
284
294
|
---
|
|
285
295
|
|
|
286
296
|
## Change the knowledge
|
|
287
297
|
|
|
288
|
-
Each command in this group writes one revision.
|
|
298
|
+
Each command in this group writes one revision. A refused write writes nothing.
|
|
289
299
|
|
|
290
300
|
- `body.revision` is the new revision. A `revision` of `null` tells that nothing changed.
|
|
291
301
|
- When the write replaced a row of a different origin, `body.previous` gives that row as it was before. For example, an `llm` write over a `user` name gives `previous`. Read `previous` and tell the user about the change.
|
|
@@ -303,8 +313,7 @@ Errors of this group:
|
|
|
303
313
|
|
|
304
314
|
### `rename <address> <name>`
|
|
305
315
|
|
|
306
|
-
- `body.symbol` gives the symbol after the write.
|
|
307
|
-
- A `rename` changes the name in each operand expression and in each argument of a macro use.
|
|
316
|
+
- `body.symbol` gives the symbol after the write. A `rename` changes the name in each operand expression and in each argument of a macro use.
|
|
308
317
|
|
|
309
318
|
### `remove-symbol <address>`
|
|
310
319
|
|
|
@@ -313,7 +322,6 @@ Errors of this group:
|
|
|
313
322
|
### `classify <range> <type>`
|
|
314
323
|
|
|
315
324
|
- `body.regions` gives the regions after the write. A classification inside a region splits that region. Thus regions never overlap.
|
|
316
|
-
- With `--element`, each region item also has `element` and `count`.
|
|
317
325
|
|
|
318
326
|
| Type | Meaning |
|
|
319
327
|
|---|---|
|
|
@@ -351,13 +359,9 @@ Errors of this group:
|
|
|
351
359
|
|
|
352
360
|
### `module <start> <file.asm>`
|
|
353
361
|
|
|
354
|
-
- A module tells where a file of the generated source starts. The file runs to the next module or to the end of its segment.
|
|
362
|
+
- A module tells where a file of the generated source starts. The file runs to the next module or to the end of its segment. The title becomes the first line of the file.
|
|
363
|
+
- A file name ends in `.asm` and can have one folder, for example `music/driver.asm`. Put the modules of one part of the program in one folder, for example `music/`, `irq/` or `graphics/`.
|
|
355
364
|
- Each address has one module, and each file name has one module.
|
|
356
|
-
- A file name has letters, digits, underscores or hyphens, and ends in `.asm`. It can have one folder, for example `music/driver.asm`. A folder name has lower-case letters, digits, underscores or hyphens.
|
|
357
|
-
- Put the modules of one part of the program in one folder, for example `music/`, `irq/` or `graphics/`.
|
|
358
|
-
- The generated source has the files `main.asm`, `loader.asm`, `switches.asm`, `config.asm`, `constants.asm`, `macros.asm` and `start_screen.asm` already. It also has the folders `leftovers/` and `segments/`. Thus a module cannot have one of these files, also in a folder, or one of these folders, in upper or lower case.
|
|
359
|
-
- Two modules cannot have file names that are different only in upper or lower case.
|
|
360
|
-
- The title becomes the first line of the file.
|
|
361
365
|
- `body.module` gives the module after the write.
|
|
362
366
|
|
|
363
367
|
### `unmodule <start>`
|
|
@@ -375,12 +379,9 @@ An operand expression tells the generated source how to write the operand of one
|
|
|
375
379
|
| `--value bar_colours --offset=-1` | `lda bar_colours-1,x` |
|
|
376
380
|
| `--expr '(sprite_bank + 5*64) / 64'` | `lda #(sprite_bank + 5*64) / 64` |
|
|
377
381
|
|
|
378
|
-
- Give exactly one of `--lo`, `--hi`, `--value` and `--expr`.
|
|
379
|
-
- The
|
|
380
|
-
- The
|
|
381
|
-
- A name is a symbol of the knowledge or a platform name of the C64 memory map.
|
|
382
|
-
- `--expr` takes `$`, `%` and decimal numbers, names, brackets, the operators `+ - * / % << >> >>> & | XOR`, and `<`, `>`, `-` and `!` before an operand.
|
|
383
|
-
- The script compares the value of the expression with the operand in the program. If they are not equal, the script refuses the write. The `error` gives both values.
|
|
382
|
+
- Give exactly one of `--lo`, `--hi`, `--value` and `--expr`. A name is a symbol of the knowledge or a platform name of the C64 memory map.
|
|
383
|
+
- The address is the start of an instruction in a code region, as `listing` shows it.
|
|
384
|
+
- The script refuses an expression whose value is not the operand in the program. The `error` gives both values.
|
|
384
385
|
- Each name in the expression gets a `pointer` reference from the instruction. Thus `at` on the named address shows the code that uses the address.
|
|
385
386
|
- `body.operand` gives the expression after the write, with its `text`.
|
|
386
387
|
- Write an operand expression for each immediate that is a byte of an address. Also write one for each table read through the byte before the table. The pointer candidates of a static analysis show many of these places.
|
|
@@ -391,61 +392,16 @@ An operand expression tells the generated source how to write the operand of one
|
|
|
391
392
|
|
|
392
393
|
### `release <label>`
|
|
393
394
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
Do not write a file of the rebuild by hand, for example a boot file, a packed picture or a script that changes bytes. Record each change in the knowledge, and generate the source.
|
|
397
|
-
|
|
398
|
-
- `--file` is a PRG or the `image.json` of a capture. The project knowledge keeps the bytes of the release. After the write, the project does not need the file. A capture can stay in `.c64-re-tools/local/`.
|
|
399
|
-
- A label is upper case, for example `FIRESTAR`, `TBC` or `V2`.
|
|
400
|
-
- The base release is the release whose bytes are the program of the knowledge. Record it with `--base`. The script refuses `--base` when the segments or the bytes of the file are not the program.
|
|
401
|
-
- A space has one base release. Record the base release before the first switch.
|
|
402
|
-
- The build of a release gives each switch the value of that release. The check of the generated source compares that build with the bytes of the release in the project knowledge.
|
|
403
|
-
- To change the bytes of a release, record the release again with its new file.
|
|
404
|
-
- `body.release` gives the release, with its `define`. `body.bytes` gives the number of bytes of the file.
|
|
395
|
+
- `body.release` gives the release, with its `define`, `file` and `sha256`. `body.bytes` gives the number of bytes of the file.
|
|
396
|
+
- See "Releases" of `<skill>/references/source-knowledge.md`.
|
|
405
397
|
|
|
406
398
|
### `unrelease <label>`
|
|
407
399
|
|
|
408
|
-
- The knowledge refuses a release that a switch names
|
|
400
|
+
- The knowledge refuses a release that a switch names, and the base release while the knowledge has switches.
|
|
409
401
|
|
|
410
402
|
### `start-screen`
|
|
411
403
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
- Record only a screen of the program itself. Do not record a screen of a crack, for example a picture, an intro or a credit screen of a crack group.
|
|
415
|
-
- If a release changed the screen of the program, stop and ask the user how to deal with it. An example is a picture with the text of a crack in it. Do not decide alone. Give the user these options:
|
|
416
|
-
1. Record patches under a switch that take out the change.
|
|
417
|
-
2. Use the screen as it is.
|
|
418
|
-
3. Do not record a start screen.
|
|
419
|
-
- The bytes of the screen must be in the program of the knowledge at the entry, or in a captured stage.
|
|
420
|
-
|
|
421
|
-
#### A start screen of a captured stage
|
|
422
|
-
|
|
423
|
-
Use this when a stage of the loading shows the screen, and the program at the entry does not have it. Do these steps:
|
|
424
|
-
|
|
425
|
-
1. Capture the stage while it shows the screen. Do not exclude the memory of the screen.
|
|
426
|
-
2. Put the capture into the knowledge in the space `loading`: `image stage/image.json --space loading`. Do not use another space for it.
|
|
427
|
-
3. If the stage plays a tune or does other work during the screen, find the routine that starts it. Run the stage with coverage while that routine runs. Put the map into the knowledge with `coverage <map> --space loading`.
|
|
428
|
-
4. Record the start screen with `start-screen --stage loading`, and with `--call` for the routine.
|
|
429
|
-
|
|
430
|
-
- The script takes the mode, the screen, the bitmap or the charset, the colours and the colour RAM from the capture. Do not find the addresses or the colours yourself.
|
|
431
|
-
- The generated source puts the screen in memory. It does not matter where the stage keeps its bytes, if the memory has enough room.
|
|
432
|
-
- A flag that you give replaces the value of the capture. Give a flag only to correct a value.
|
|
433
|
-
- A capture of an older version has no colour RAM. Then capture the stage again.
|
|
434
|
-
|
|
435
|
-
#### A start screen in the program
|
|
436
|
-
|
|
437
|
-
- Capture the program while the bytes of the screen are in memory.
|
|
438
|
-
- Get the mode, the addresses and the colours from the VIC-II while the program of the base release shows the screen.
|
|
439
|
-
- Find the 1000 colour bytes in the program: compare them with the colour RAM at $d800 while that program shows the screen. Give their address with `--colours`. If the program does not have them, give one colour with `--colour`.
|
|
440
|
-
|
|
441
|
-
#### The rules of the VIC-II
|
|
442
|
-
|
|
443
|
-
- `text` needs `--charset`. `hires` and `multicolour` need `--bitmap`. `text` and `multicolour` need `--colours` or `--colour`. `hires` uses neither.
|
|
444
|
-
- The screen is at a step of $0400, the bitmap at a step of $2000 and the charset at a step of $0800. They must be in one VIC bank of 16 KB.
|
|
445
|
-
- In VIC bank 0 and 2, the VIC-II reads the character ROM at $1000-$1fff of the bank. A screen or a bitmap cannot be there. A charset at $1000 or $1800 of the bank is the character ROM.
|
|
446
|
-
- No part can be in $0000-$03ff. The colours cannot be in $d000-$dfff.
|
|
447
|
-
- A space has one start screen, and only the space `c64` has one. A write replaces the start screen of the knowledge.
|
|
448
|
-
- The generated source has the switches `START_SCREEN` and `LEFTOVERS`. Thus no symbol and no switch can have these names.
|
|
404
|
+
- When the program at the entry has the screen, give `--capture` with a capture of the program while it shows the screen. When a stage of the loading shows the screen, give `--stage loading`. See "Start screens" of `<skill>/references/start-screen.md`.
|
|
449
405
|
- `body.startScreen` gives the start screen after the write.
|
|
450
406
|
|
|
451
407
|
### `unstart-screen`
|
|
@@ -454,24 +410,7 @@ Use this when a stage of the loading shows the screen, and the program at the en
|
|
|
454
410
|
|
|
455
411
|
### `switch <name>`
|
|
456
412
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
| Kind | What it changes | Default |
|
|
460
|
-
|---|---|---|
|
|
461
|
-
| `protection` | A copy protection | 0 (off) |
|
|
462
|
-
| `trainer` | A trainer, for example infinite lives | 0 (off) |
|
|
463
|
-
| `cheat` | A cheat | 0 (off) |
|
|
464
|
-
| `crack` | A change that a cracker made in the program, for example a credit text | 0 (off) |
|
|
465
|
-
| `fix` | A correction that one or more releases have | 1 (on). Give `--default 0` only for an alternative (see `patch`). |
|
|
466
|
-
| `change` | Another difference between releases | Give `--default 0` or `--default 1`. |
|
|
467
|
-
|
|
468
|
-
- The default build is the clean program. It has no copy protection, trainer, cheat or crack change, and it has all corrections. Thus the script refuses `--default 1` for `protection`, `trainer`, `cheat` and `crack`.
|
|
469
|
-
- A switch that no release has on, for example a trainer of your own, has no `--releases`.
|
|
470
|
-
- The base value of a switch is 1 when the base release has it on, else 0. The program of the knowledge has the base value of each switch.
|
|
471
|
-
- A switch name is upper case, for example `PROTECTION`, `TRAINER` or `FIX_LIVES`. It cannot start with `RELEASE_`. It cannot be the name of a symbol or a platform name.
|
|
472
|
-
- The script refuses a change of the base value while the switch has patches. Remove the patches first, because they hold the other state.
|
|
473
|
-
- The script refuses defaults that put in two alternatives.
|
|
474
|
-
- `body.switch` gives the switch after the write, with its `base`.
|
|
413
|
+
- `body.switch` gives the switch after the write, with its `base`. See "Switches" of `<skill>/references/source-knowledge.md`.
|
|
475
414
|
|
|
476
415
|
### `unswitch <name>`
|
|
477
416
|
|
|
@@ -479,26 +418,7 @@ A switch has a kind, a default, and the releases that have it on. The generated
|
|
|
479
418
|
|
|
480
419
|
### `patch <range> <switch>`
|
|
481
420
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
- The base release has a copy protection. The switch `PROTECTION` names the base release. The code is the program without the protection, for example NOP in place of the `JSR` to the check.
|
|
485
|
-
- The base release has the protection already removed, and another release has it. The code is the bytes of the protection from that release. When no release has these bytes, write in a comment that the crack removed the protection.
|
|
486
|
-
- A correction is only in release `V2`. The switch `FIX_LIVES` names `V2`, and the code is the bytes of `V2`.
|
|
487
|
-
- A correction is in the base release and not in `V1`. The switch names the base release, and the code is the bytes of `V1`.
|
|
488
|
-
|
|
489
|
-
Rules:
|
|
490
|
-
|
|
491
|
-
- Give exactly one of `--code`, `--code-file` and `--nop`.
|
|
492
|
-
- Write the switch first. `patch` refuses a switch that the knowledge does not have.
|
|
493
|
-
- Many patches can have the same switch.
|
|
494
|
-
- The code must fit in the range. NOP (`$EA`) fills the bytes after the code.
|
|
495
|
-
- `patch` refuses code that is longer than the range when each line is a 6510 instruction, `!byte`, `!word`, `!fill` or a comment. It does not check the length of other code, for example code with a label or a macro. The check of the generated source finds these errors.
|
|
496
|
-
- The code can use the labels and the macros of the source, and local labels with a dot, for example `.skip`.
|
|
497
|
-
- The braces in the code must be pairs.
|
|
498
|
-
- Patches of different switches can have the same range. They are alternatives, for example two releases with two different corrections of one bug. The default build can put in only one of them.
|
|
499
|
-
- The knowledge refuses all other overlaps of patches. A patch cannot overlap a macro use.
|
|
500
|
-
- A patch with the same start and the same switch replaces the patch.
|
|
501
|
-
- Each byte of the range must be in the program of the knowledge.
|
|
421
|
+
- The code is the bytes of the switch in the state that the base release does not have. When another release has these bytes, give `--from-release` with its label. See "Patches" of `<skill>/references/source-knowledge.md`.
|
|
502
422
|
- `body.patch` gives the patch after the write.
|
|
503
423
|
|
|
504
424
|
### `unpatch <start>`
|
|
@@ -507,11 +427,7 @@ Rules:
|
|
|
507
427
|
|
|
508
428
|
### `macro <name>`
|
|
509
429
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
- Give `--body` or `--body-file`. The body uses each param with a dot, for example `.dst`.
|
|
513
|
-
- The knowledge refuses a change of the number of params while the macro has uses.
|
|
514
|
-
- `body.macro` gives the macro after the write.
|
|
430
|
+
- `body.macro` gives the macro after the write. See "Macros" of `<skill>/references/source-knowledge.md`.
|
|
515
431
|
|
|
516
432
|
### `unmacro <name>`
|
|
517
433
|
|
|
@@ -519,11 +435,7 @@ A macro writes a run of instructions as one line of the source, for example `+in
|
|
|
519
435
|
|
|
520
436
|
### `use <range> <macro>`
|
|
521
437
|
|
|
522
|
-
-
|
|
523
|
-
- Each name in an argument is a symbol of the knowledge or a platform name.
|
|
524
|
-
- A use cannot overlap a patch or another use.
|
|
525
|
-
- The generated source writes a use only when the use gives the bytes of the program. Else it writes the instructions and gives the reason.
|
|
526
|
-
- `body.use` gives the use after the write.
|
|
438
|
+
- `body.use` gives the use after the write. See "Macro uses" of `<skill>/references/source-knowledge.md`.
|
|
527
439
|
|
|
528
440
|
### `unuse <start>`
|
|
529
441
|
|
|
@@ -534,61 +446,34 @@ A macro writes a run of instructions as one line of the source, for example `+in
|
|
|
534
446
|
- `<file>` is the `image.json` of a capture, or a PRG. A PRG has the extension `.prg` or no extension. The script refuses a file with another extension.
|
|
535
447
|
- For drive code or a cartridge bank, give `--space drive8` or `--space bank0`.
|
|
536
448
|
- `body` holds `revision`, `bytes`, `rowsAdded`, `rowsClosed` and `entryChanged`.
|
|
537
|
-
-
|
|
538
|
-
- After the import, you do not need the file of the capture. Keep it in `.c64-re-tools/local/`.
|
|
449
|
+
- A new image replaces the program of the space. After the import, the project does not need the file of the capture.
|
|
539
450
|
|
|
540
451
|
### `coverage <map>...`
|
|
541
452
|
|
|
542
|
-
- `<map>` is a 64 KiB coverage map of a run.
|
|
543
|
-
- `body` holds `revision`, `imported`, `replaced`, `known`, `added` and `removed`. `imported` lists the new maps. `replaced` lists the new maps that replace an earlier map of the same path. `known` lists the maps that
|
|
544
|
-
-
|
|
545
|
-
-
|
|
546
|
-
- `coverage` puts each map into the space of `--space`. You can add the same map to each space.
|
|
547
|
-
- `--evidence coverage:<map>` names a map by its path at the import. It refers to the last import of that map into the space of the write.
|
|
453
|
+
- `<map>` is a 64 KiB coverage map of a run, or a recording folder. For a recording folder, the script takes the coverage map of the recording.
|
|
454
|
+
- `body` holds `revision`, `imported`, `replaced`, `known`, `added` and `removed`. `imported` lists the new maps. `replaced` lists the new maps that replace an earlier map of the same path. `known` lists the maps that the space has already. `added` and `removed` count the ranges of accesses that the coverage gets and loses.
|
|
455
|
+
- When `added` or `removed` is not 0, do as `hint` tells.
|
|
456
|
+
- After you record a run again into the same place, put its map into the knowledge again. See "Maps and their paths" of `<skill>/references/coverage.md`.
|
|
548
457
|
|
|
549
458
|
### `apply <file>`
|
|
550
459
|
|
|
551
|
-
- `<file>` is a JSON list of writes. Give `-` to read the list from standard input.
|
|
552
|
-
- `body` holds `revision`, `writes` and `replaced`. `replaced` lists each write that replaced a row of a different origin
|
|
553
|
-
-
|
|
554
|
-
- Each write has `op` and the fields of the command with the same name. Each write can also have `space`. For example:
|
|
555
|
-
|
|
556
|
-
```json
|
|
557
|
-
[
|
|
558
|
-
{ "op": "rename", "address": "$2100", "name": "update_player", "kind": "routine" },
|
|
559
|
-
{ "op": "classify", "start": "$3000", "end": "$303b", "type": "bytes", "element": 6 },
|
|
560
|
-
{ "op": "comment", "address": "$2100", "placement": "line", "text": "Reads joystick 2." }
|
|
561
|
-
]
|
|
562
|
-
```
|
|
460
|
+
- `<file>` is a JSON list of writes. Give `-` to read the list from standard input. See "Writes of a batch" of `<skill>/references/batches.md`.
|
|
461
|
+
- `body` holds `revision`, `writes` and `replaced`. `replaced` lists each write that replaced a row of a different origin. Each item has the number of the `write`, its `op` and its `previous`.
|
|
462
|
+
- If the knowledge refuses one write, the script writes nothing, and the `error` names the write.
|
|
563
463
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
| `uncomment` | `address`, `placement` |
|
|
572
|
-
| `reference`, `unreference` | `from`, `to`, `kind` |
|
|
573
|
-
| `module` | `start`, `file`, `title` (optional) |
|
|
574
|
-
| `unmodule` | `start` |
|
|
575
|
-
| `operand` | `address`, `select` (`lo`, `hi`, `value` or `expr`), `symbol` and `offset` (optional), or `expression` for `expr` |
|
|
576
|
-
| `unoperand` | `address` |
|
|
577
|
-
| `patch` | `start`, `end`, `switch`, `code` (empty for NOP only), `comment` (optional) |
|
|
578
|
-
| `unpatch` | `start`, `switch` (optional) |
|
|
579
|
-
| `macro` | `name`, `params` (a list or a comma list), `body`, `comment` (optional) |
|
|
580
|
-
| `unmacro` | `name` |
|
|
581
|
-
| `use` | `start`, `end`, `macro`, `args` (a list or a comma list) |
|
|
582
|
-
| `unuse` | `start` |
|
|
583
|
-
|
|
584
|
-
- The script checks an `operand`, `patch` or `use` write against the program of its space.
|
|
464
|
+
### `join <batch>...`
|
|
465
|
+
|
|
466
|
+
- `join` joins the batches of agents that name the program at the same time. See "Batches of parallel agents" of `<skill>/references/batches.md`.
|
|
467
|
+
- Without `--apply`, `join` writes no knowledge. `body` holds `writes`, `repeated` and `choices`. `writes` lists the joined writes. `choices` lists each place where the batches gave different values, with the value that stays.
|
|
468
|
+
- Examine `choices` and `writes`. `nextAction` is the same `join` with `--apply`. Run it when the choices agree with your task.
|
|
469
|
+
- With `--apply`, `join` writes the joined writes as one revision, or nothing when the knowledge refuses one write. Then `body` holds `revision`, `writes`, `replaced`, `repeated` and `choices`, as for `apply`.
|
|
470
|
+
- When one name or one module file is at two addresses, `join` writes nothing and gives the error `conflict`. Correct the batches that the `error` names. Then do `join` again.
|
|
585
471
|
|
|
586
472
|
### `revert <revision>`
|
|
587
473
|
|
|
588
474
|
- Makes the knowledge the same as at the revision. Without `--space`, all spaces revert. With `--space`, only that space reverts.
|
|
589
475
|
- `body` holds `revision`, `restores`, and `spaces: "all"` or `space`.
|
|
590
|
-
- A revert is a new revision. The history stays complete.
|
|
591
|
-
- A revert also gives back the coverage maps of that revision. A revert to a revision before an import removes the map and its ranges. Then `--evidence coverage:<map>` refuses the map until you import it again.
|
|
476
|
+
- A revert is a new revision. The history stays complete. A revert also gives back the coverage maps of that revision.
|
|
592
477
|
|
|
593
478
|
### `merge`
|
|
594
479
|
|
|
@@ -597,31 +482,34 @@ A macro writes a run of instructions as one line of the source, for example `+in
|
|
|
597
482
|
|
|
598
483
|
---
|
|
599
484
|
|
|
600
|
-
##
|
|
485
|
+
## Check the comments
|
|
601
486
|
|
|
602
|
-
|
|
487
|
+
A check measures how many comments are wrong. An agent that did not write the comments gives a verdict for each comment of a sample: `correct`, `wrong` or `unsure`. A check writes no knowledge.
|
|
603
488
|
|
|
604
|
-
### `
|
|
489
|
+
### `sample`
|
|
605
490
|
|
|
606
|
-
- `
|
|
607
|
-
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
-
|
|
612
|
-
-
|
|
613
|
-
-
|
|
614
|
-
-
|
|
615
|
-
|
|
491
|
+
- Starts a check. `body` holds `seed`, `revision`, `population` and `sampled`. `population` is the number of comments that the script selected from. `sampled` is the number of comments of the check.
|
|
492
|
+
- Keep the `seed`. It identifies the check. If the check of the seed has verdicts, the script refuses. Give another seed.
|
|
493
|
+
|
|
494
|
+
### `verdict <seed> <address> <verdict>`
|
|
495
|
+
|
|
496
|
+
- Records the verdict of one comment of the check. A new verdict of a comment replaces its earlier verdict.
|
|
497
|
+
- A `wrong` verdict needs `--class`, `--why`, and `--text` or `--name`. An `unsure` verdict needs `--why`. A `correct` verdict takes no `--class`, `--text` or `--name`.
|
|
498
|
+
- The script refuses an address that is not in the sample of the check.
|
|
499
|
+
- `body` holds `seed`, `verdict`, `checked` and `sampled`. `checked` is the number of comments that have a verdict.
|
|
500
|
+
|
|
501
|
+
### `checks [<seed>]`
|
|
502
|
+
|
|
503
|
+
- Without a seed, `body.checks` lists each check, newest first. Each item has `seed`, `createdAt`, `revision`, `sampled`, `checked`, `correct`, `wrong` and `unsure`.
|
|
504
|
+
- With a seed, `body` holds the same fields for that check, and `files` and `items`.
|
|
505
|
+
- `items` lists each comment of the sample with `address`, `placement` and `text`, and `name` when the address has a symbol. A comment with a verdict also has `verdict` and `why`. A `wrong` comment also has `class` and `correction`, with the correct `text` or `name`.
|
|
506
|
+
- `files.verdicts` is the file of the verdicts. Give it as `--evidence file:<file>` of each correction.
|
|
616
507
|
|
|
617
508
|
---
|
|
618
509
|
|
|
619
510
|
## Workflow
|
|
620
511
|
|
|
621
|
-
Read:
|
|
622
|
-
|
|
623
|
-
1. Run `at` for the addresses of the question.
|
|
624
|
-
2. Run `history` when the current knowledge is surprising or disputed. Each row gives the `reason` and the `evidence` of the revision that wrote it.
|
|
512
|
+
Read: run `at` with all addresses of the question. Run `history` when the current knowledge is surprising or disputed.
|
|
625
513
|
|
|
626
514
|
Write:
|
|
627
515
|
|
|
@@ -634,21 +522,16 @@ Put the program into the knowledge:
|
|
|
634
522
|
|
|
635
523
|
1. For a packed program, capture the unpacked program into `.c64-re-tools/local/`. Then run `image` with its `image.json`.
|
|
636
524
|
2. For a program without a packer, drive code or a cartridge bank, run `image` with the PRG.
|
|
637
|
-
3.
|
|
525
|
+
3. Run `coverage` with the coverage map of each run and with each recording folder.
|
|
638
526
|
4. Run `program` to see the segments, the entry and the coverage maps.
|
|
639
527
|
|
|
640
528
|
Write knowledge only after interpretation:
|
|
641
529
|
|
|
642
530
|
- a symbol name that tells what a routine or a variable does
|
|
643
|
-
- a region type that the evidence supports
|
|
644
|
-
- a comment that explains behavior that a name cannot show
|
|
645
|
-
- a reference that the evidence supports.
|
|
531
|
+
- a region type or a reference that the evidence supports
|
|
532
|
+
- a comment that explains behavior that a name cannot show.
|
|
646
533
|
|
|
647
|
-
Do not write
|
|
648
|
-
|
|
649
|
-
- temporary investigation state
|
|
650
|
-
- a guess, only because a routine needs a temporary name
|
|
651
|
-
- confidence or status words in comment text.
|
|
534
|
+
Do not write temporary investigation state, a guess only because a routine needs a temporary name, or confidence or status words in comment text.
|
|
652
535
|
|
|
653
536
|
For runtime evidence, examine the program in the emulator. For static evidence, analyze the machine code. To make the source from the knowledge, generate the source. To name the routines that other programs share, match the program against a routine library.
|
|
654
537
|
|
|
@@ -656,24 +539,15 @@ For runtime evidence, examine the program in the emulator. For static evidence,
|
|
|
656
539
|
|
|
657
540
|
Each command prints one JSON envelope on one line on stdout. Notes go to stderr.
|
|
658
541
|
|
|
659
|
-
On success, the exit code is 0:
|
|
660
|
-
|
|
661
|
-
```json
|
|
662
|
-
{"ok": true, "command": "<command>", "body": {}, "hint": "...", "nextAction": "..."}
|
|
663
|
-
```
|
|
664
|
-
|
|
665
|
-
On failure, the exit code is 2:
|
|
666
|
-
|
|
667
|
-
```json
|
|
668
|
-
{"ok": false, "command": "<command>", "code": "<code>", "error": "...", "hint": "...", "nextAction": "..."}
|
|
669
|
-
```
|
|
670
|
-
|
|
542
|
+
- On success, the exit code is 0: `{"ok": true, "command": "<command>", "body": {}, "hint": "...", "nextAction": "..."}`
|
|
543
|
+
- On failure, the exit code is 2: `{"ok": false, "command": "<command>", "code": "<code>", "error": "...", "hint": "...", "nextAction": "..."}`
|
|
671
544
|
- `body` holds the result. The section of each command gives the fields of its body.
|
|
672
545
|
- A check gives its verdict in `body.result`: `PASS`, `FAIL` or `INCONCLUSIVE`. The exit code is 0 for each verdict. Thus read `body.result`, not the exit code.
|
|
673
|
-
- `error` is one sentence. It tells what is wrong.
|
|
674
|
-
- `
|
|
675
|
-
- `
|
|
676
|
-
- `
|
|
546
|
+
- `error` is one sentence. It tells what is wrong. `hint` tells what to do or what to examine. Read it before your next step.
|
|
547
|
+
- `nextAction` is a full command line. It runs from any directory. Run it when it agrees with your task.
|
|
548
|
+
- A list has `count`, `listed` and `rest`. `listed` holds at most `--max-listed` items. `rest` tells how to get the other items. A file that the command wrote has `out`, `bytes` and `sha256`.
|
|
549
|
+
- To get only some fields of `body`, give `--fields <path>,<path>`, for example `--fields count,listed.start`. A path through a list gives that field of each item. Do not write code to filter an envelope.
|
|
550
|
+
- To get the command list, run the script with no arguments. To get the subjects and the flags of one command, run `<command> --help`.
|
|
677
551
|
|
|
678
552
|
| `code` | Action |
|
|
679
553
|
|---|---|
|
|
@@ -682,12 +556,9 @@ On failure, the exit code is 2:
|
|
|
682
556
|
| `operation-failed` | Give `error` and `hint` to the user. |
|
|
683
557
|
| Another code | Do as `hint` tells. |
|
|
684
558
|
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
| Field | Meaning |
|
|
688
|
-
|---|---|
|
|
689
|
-
| `out`, `bytes`, `sha256` | A file that the command wrote: its path, its size and its SHA-256. |
|
|
690
|
-
| `count`, `listed`, `rest` | A list. `count` is the number of items. `listed` holds the first items, at most `--max-listed`. `rest` tells how to get the other items. |
|
|
559
|
+
## Reference
|
|
691
560
|
|
|
692
|
-
|
|
693
|
-
|
|
561
|
+
- `<skill>/references/source-knowledge.md`: the rules of the releases, the switches, the patches, the macros and the macro uses.
|
|
562
|
+
- `<skill>/references/start-screen.md`: how to record the start screen from a capture of the program or of a stage. It also gives the flags that correct a capture, and the rules of the VIC-II.
|
|
563
|
+
- `<skill>/references/batches.md`: the writes of a batch for `apply`, and the batches of parallel agents for `join`.
|
|
564
|
+
- `<skill>/references/coverage.md`: the coverage maps and their paths, the access at an address, and the reads that the program does not do.
|