@henols/c64-re-tools 2.6.0 → 2.7.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/c64-assembler/SKILL.md +4 -4
- package/skills/c64-basic/SKILL.md +1 -1
- package/skills/c64-development/SKILL.md +5 -5
- package/skills/c64-disk/SKILL.md +13 -13
- package/skills/c64-docs/SKILL.md +22 -9
- package/skills/c64-docs/references/page-types.md +11 -11
- package/skills/c64-docs/references/style.md +21 -0
- package/skills/c64-docs/scripts/docs.ts +64 -17
- package/skills/c64-docs/scripts/lib/links.ts +1 -1
- package/skills/c64-knowledge/SKILL.md +7 -7
- package/skills/c64-knowledge/scripts/knowledge.ts +1 -1
- package/skills/c64-memory-map/SKILL.md +1 -1
- package/skills/c64-packer/SKILL.md +1 -1
- package/skills/c64-provenance/SKILL.md +5 -4
- package/skills/c64-provenance/scripts/lib/compare.ts +1 -1
- package/skills/c64-reverse-engineering/SKILL.md +20 -11
- package/skills/c64-source/SKILL.md +8 -8
- package/skills/c64-source/scripts/lib/export.ts +7 -6
- package/skills/c64-source/scripts/lib/source.ts +3 -3
- package/skills/c64-source/scripts/source.ts +17 -17
- package/skills/c64-static-analysis/SKILL.md +1 -1
- package/skills/c64-testing/SKILL.md +25 -24
- package/skills/c64-testing/references/recording-format.md +7 -7
- package/skills/c64-testing/references/scenario-format.md +5 -5
- package/skills/c64-testing/scripts/lib/recording.ts +38 -38
- package/skills/c64-testing/scripts/lib/replay.ts +26 -26
- package/skills/c64-testing/scripts/lib/scenario.ts +28 -28
- package/skills/c64-testing/scripts/testing.ts +14 -14
- package/skills/c64-unpacker/SKILL.md +12 -12
- package/src/knowledge/separate.ts +2 -2
- package/src/knowledge/write.ts +1 -1
- package/src/project.ts +1 -1
- package/src/script.ts +1 -1
- package/tools/c64run.c +1 -1
package/package.json
CHANGED
|
@@ -30,7 +30,7 @@ To get the command list, run the script with no arguments.
|
|
|
30
30
|
| Build a generated source with the values of `config.asm` | `build src main.asm` |
|
|
31
31
|
| Build the loader of a generated source. For the packed form, this is only the copier. | `build src loader.asm` |
|
|
32
32
|
| Check that the rebuild is identical to the program in the project knowledge | `build src main.asm --compare` |
|
|
33
|
-
| Build a release and check it against the bytes of that release | `build src main.asm --release
|
|
33
|
+
| Build a release and check it against the bytes of that release | `build src main.asm --release FIRESTAR --compare` |
|
|
34
34
|
| Check the rebuild of a program in another space, for example the drive | `build src main.asm --out build/drive.prg --compare --space drive8` |
|
|
35
35
|
| List all symbols, also the constants that the source does not use | `build src main.a --out build/game.prg --all-symbols --max-listed 500` |
|
|
36
36
|
| Write only the bytes of the program, without the load address | `build src main.a --out build/game.bin --plain` |
|
|
@@ -63,7 +63,7 @@ Without `--out`, the name of the program tells what the build is:
|
|
|
63
63
|
|
|
64
64
|
| Build | Name |
|
|
65
65
|
|---|---|
|
|
66
|
-
| `--release <label>` | `release_<label>.prg`, for example `
|
|
66
|
+
| `--release <label>` | `release_<label>.prg`, for example `release_FIRESTAR.prg` |
|
|
67
67
|
| Each value of `config.asm` is its default | `clean.prg` |
|
|
68
68
|
| A value of `config.asm` is not its default | `custom_<switches>.prg`, for example `custom_trainer.prg`. A switch that is off has `no_` before its name, for example `custom_no_start_screen.prg`. |
|
|
69
69
|
| A source without `config.asm` | the name of the entry, for example `main.prg` |
|
|
@@ -75,7 +75,7 @@ An entry other than `main.asm` adds its name, for example `clean_loader.prg` for
|
|
|
75
75
|
- Give each path relative to the project folder. The project folder is the nearest folder at or above the working directory that holds `.c64-re-tools/`.
|
|
76
76
|
- If the working directory is not in a project, give `--project <folder>` to each command. If the working directory has projects below it, the script refuses and lists them.
|
|
77
77
|
- In a group folder, each version of a program is a project. The script refuses the group folder and each folder in it that is not a project. Give `--project` with a project of the group, for example `--project v1`.
|
|
78
|
-
- A path that a command only reads can go into another project of the group, for example `../v1/
|
|
78
|
+
- A path that a command only reads can go into another project of the group, for example `../v1/releases/game.prg`. The command writes only in its own project.
|
|
79
79
|
- An address is `$` and 1 to 4 hex digits, for example `'$c000'` or `'$fb'`, or a name. A name is a symbol, else an analyzer name that only one analyzer gives. Put an address in single quotes in a shell.
|
|
80
80
|
- A range is `<start>-<end>`, for example `'$c000-$cfff'`. In a JSON file, a range is `start` and `end`.
|
|
81
81
|
- Bytes in a JSON file are hex in a field `data`, for example `"data": "a900"`.
|
|
@@ -149,7 +149,7 @@ Do as the result tells:
|
|
|
149
149
|
|
|
150
150
|
The script does not keep the diagnostics or the program in the project knowledge.
|
|
151
151
|
|
|
152
|
-
To compare runs of the rebuild with runs of the
|
|
152
|
+
To compare runs of the rebuild with runs of the reference, give the symbols file to the test run as the symbols of the rebuild. A symbol of the rebuild gives the address of a routine in the rebuild.
|
|
153
153
|
|
|
154
154
|
---
|
|
155
155
|
|
|
@@ -36,7 +36,7 @@ To get the command list, run the script with no arguments.
|
|
|
36
36
|
- Give each path relative to the project folder. The project folder is the nearest folder at or above the working directory that holds `.c64-re-tools/`.
|
|
37
37
|
- If the working directory is not in a project, give `--project <folder>` to each command. If the working directory has projects below it, the script refuses and lists them.
|
|
38
38
|
- In a group folder, each version of a program is a project. The script refuses the group folder and each folder in it that is not a project. Give `--project` with a project of the group, for example `--project v1`.
|
|
39
|
-
- A path that a command only reads can go into another project of the group, for example `../v1/
|
|
39
|
+
- A path that a command only reads can go into another project of the group, for example `../v1/releases/game.prg`. The command writes only in its own project.
|
|
40
40
|
- An address is `$` and 1 to 4 hex digits, for example `'$c000'` or `'$fb'`, or a name. A name is a symbol, else an analyzer name that only one analyzer gives. Put an address in single quotes in a shell.
|
|
41
41
|
- A range is `<start>-<end>`, for example `'$c000-$cfff'`. In a JSON file, a range is `start` and `end`.
|
|
42
42
|
- Bytes in a JSON file are hex in a field `data`, for example `"data": "a900"`.
|
|
@@ -94,9 +94,9 @@ When the user must play or look at the program, open the emulator window for the
|
|
|
94
94
|
|
|
95
95
|
### C. A feature or a fix in a rebuilt program
|
|
96
96
|
|
|
97
|
-
A rebuilt program gets its source from the project knowledge. A change is a switch and its patches in the knowledge. The build of the base release stays identical to the
|
|
97
|
+
A rebuilt program gets its source from the project knowledge. A change is a switch and its patches in the knowledge. The build of the base release stays identical to the base release in the project knowledge.
|
|
98
98
|
|
|
99
|
-
1. Read the releases and the switches in the project knowledge. If the knowledge has no base release, record the
|
|
99
|
+
1. Read the releases and the switches in the project knowledge. If the knowledge has no base release, record the program file that you examine as the base release first, for example `releases/game.prg`.
|
|
100
100
|
2. Give each feature and each fix its own switch. Then each one can be on or off alone. Record the switch in the project knowledge. No release has your change, so do not give the switch a release. Select the kind of the switch:
|
|
101
101
|
- A fix: `fix`, for example `FIX_FLICKER`. The default build has it.
|
|
102
102
|
- A trainer or a cheat: `trainer` or `cheat`. The default build does not have it.
|
|
@@ -106,11 +106,11 @@ A rebuilt program gets its source from the project knowledge. A change is a swit
|
|
|
106
106
|
5. If the code does not fit, write a short patch with a `jsr` to the new code. Put the new code in a second patch of the same switch, in a range that the program does not use. The range must have evidence: a leftover that you found in the program, or code that no run executed and that the program cannot reach. If no range has this evidence, stop and ask the user.
|
|
107
107
|
6. Generate the source from the project knowledge into `src`. Continue only when the result of the generation is PASS. A switch with the result `overflow` or `does not assemble` has a patch that you must change.
|
|
108
108
|
7. Build the program:
|
|
109
|
-
- Build the base release and compare it with the
|
|
109
|
+
- Build the base release and compare it with the bytes of the base release in the project knowledge. This build must be identical to them.
|
|
110
110
|
- Build the default build.
|
|
111
111
|
- When the default build does not have the switch, set the switch to 1 in `src/config.asm`. Then build the default build. After the test, set the value back to the default if the user did not ask for the change.
|
|
112
112
|
8. Test the builds:
|
|
113
|
-
- When the behavior must stay the same as the
|
|
113
|
+
- When the behavior must stay the same as the base release, replay each recording on the default build. For a source with a loader, this is `build/clean_loader.prg`, else `build/clean.prg`. Do not replay a build with a switch that is not at its default. Run a test scenario in `tests/` only when no recording executes the changed code.
|
|
114
114
|
- On the build that has the switch, run a run file with `expect` steps that show the feature or the fix.
|
|
115
115
|
|
|
116
116
|
### The answer
|
|
@@ -136,7 +136,7 @@ Do not store:
|
|
|
136
136
|
|
|
137
137
|
## Result
|
|
138
138
|
|
|
139
|
-
A program that builds, with a run file in `tests/` for each acceptance check, and each run gives PASS. For a rebuilt program: a switch for each change, and a build of the base release that is identical to the
|
|
139
|
+
A program that builds, with a run file in `tests/` for each acceptance check, and each run gives PASS. For a rebuilt program: a switch for each change, and a build of the base release that is identical to the base release.
|
|
140
140
|
|
|
141
141
|
## Failure and conflicts
|
|
142
142
|
|
package/skills/c64-disk/SKILL.md
CHANGED
|
@@ -13,7 +13,7 @@ node <skill>/scripts/disk.ts <command>
|
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
`<skill>` is the base directory of this skill. Run the script with `node`. You can run it from any directory.
|
|
16
|
-
Each command in this skill, for example `directory
|
|
16
|
+
Each command in this skill, for example `directory releases/game.d64`, goes in the place of `<command>`.
|
|
17
17
|
Each command prints one JSON envelope on stdout. See the section "JSON output".
|
|
18
18
|
To get the command list, run the script with no arguments.
|
|
19
19
|
|
|
@@ -23,17 +23,17 @@ To get the command list, run the script with no arguments.
|
|
|
23
23
|
|
|
24
24
|
| Goal | Command |
|
|
25
25
|
|---|---|
|
|
26
|
-
| Get the disk name, the free blocks and the files of a disk | `directory
|
|
27
|
-
| Extract one file of a disk | `read
|
|
28
|
-
| Get the type, the size and the first block of one file | `entry
|
|
29
|
-
| Get the track and the sector of each block of one file | `chain
|
|
30
|
-
| Find the used sectors that no file uses | `bam
|
|
31
|
-
| Write the bytes of the used sectors that no file uses | `sectors
|
|
32
|
-
| Write the bytes of some sectors | `sectors
|
|
33
|
-
| Get the files of a tape | `directory
|
|
34
|
-
| Extract one file of a tape | `read
|
|
35
|
-
| Get the banks of a cartridge | `directory
|
|
36
|
-
| Write each bank of a cartridge as a PRG | `crt
|
|
26
|
+
| Get the disk name, the free blocks and the files of a disk | `directory releases/game.d64` |
|
|
27
|
+
| Extract one file of a disk | `read releases/game.d64 GAME --out extracted/game.prg` |
|
|
28
|
+
| Get the type, the size and the first block of one file | `entry releases/game.d64 GAME` |
|
|
29
|
+
| Get the track and the sector of each block of one file | `chain releases/game.d64 GAME` |
|
|
30
|
+
| Find the used sectors that no file uses | `bam releases/game.d64` |
|
|
31
|
+
| Write the bytes of the used sectors that no file uses | `sectors releases/game.d64 --unreferenced --out .c64-re-tools/local/hidden.bin` |
|
|
32
|
+
| Write the bytes of some sectors | `sectors releases/game.d64 18/0 20/5 --out .c64-re-tools/local/sectors.bin` |
|
|
33
|
+
| Get the files of a tape | `directory releases/game.t64` |
|
|
34
|
+
| Extract one file of a tape | `read releases/game.t64 GAME --out extracted/game.prg` |
|
|
35
|
+
| Get the banks of a cartridge | `directory releases/game.crt` |
|
|
36
|
+
| Write each bank of a cartridge as a PRG | `crt releases/game.crt --out cart` |
|
|
37
37
|
|
|
38
38
|
## Images and file names
|
|
39
39
|
|
|
@@ -62,7 +62,7 @@ To get the command list, run the script with no arguments.
|
|
|
62
62
|
- Give each path relative to the project folder. The project folder is the nearest folder at or above the working directory that holds `.c64-re-tools/`.
|
|
63
63
|
- If the working directory is not in a project, give `--project <folder>` to each command. If the working directory has projects below it, the script refuses and lists them.
|
|
64
64
|
- In a group folder, each version of a program is a project. The script refuses the group folder and each folder in it that is not a project. Give `--project` with a project of the group, for example `--project v1`.
|
|
65
|
-
- A path that a command only reads can go into another project of the group, for example `../v1/
|
|
65
|
+
- A path that a command only reads can go into another project of the group, for example `../v1/releases/game.prg`. The command writes only in its own project.
|
|
66
66
|
- An address is `$` and 1 to 4 hex digits, for example `'$c000'` or `'$fb'`, or a name. A name is a symbol, else an analyzer name that only one analyzer gives. Put an address in single quotes in a shell.
|
|
67
67
|
- A range is `<start>-<end>`, for example `'$c000-$cfff'`. In a JSON file, a range is `start` and `end`.
|
|
68
68
|
- Bytes in a JSON file are hex in a field `data`, for example `"data": "a900"`.
|
package/skills/c64-docs/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: c64-docs
|
|
3
|
-
description: Writes the documentation of a C64 program. You write the pages by the method of this skill. The script generates the reference pages from the project knowledge and the generated source. The pages put first the development of the program and its copy protection, in depth, with the findings and what each one means in practice. They explain how the program works, with links to the main parts of the source, and they list the releases in short. They tell the history of a crack only when the crack left traces in the program. Use it to document a program after its
|
|
3
|
+
description: Writes the documentation of a C64 program. You write the pages by the method of this skill. The script generates the reference pages from the project knowledge and the generated source. The pages put first the development of the program and its copy protection, in depth, with the findings and what each one means in practice. They explain how the program works, with links to the main parts of the source, and they list the releases in short. They tell the history of a crack only when the crack left traces in the program. Use it to document a program after the build of its source is identical to its base release. Use it to keep the documentation correct after a change to the project knowledge. It does not change the project knowledge, and it does not run the program.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# C64 documentation
|
|
@@ -25,7 +25,7 @@ To get the command list, run the script with no arguments.
|
|
|
25
25
|
|---|---|
|
|
26
26
|
| Generate the reference pages from the project knowledge and the source | `generate src --out docs/reference` |
|
|
27
27
|
| Link the names in the pages to the source, and check each link and image | `link README.md docs --source src` |
|
|
28
|
-
| Check that each link is up to date, and write
|
|
28
|
+
| Check that each link is up to date and that the evidence did not change, and write no page | `link README.md docs --source src --check` |
|
|
29
29
|
| Link the pages when the reference is in a folder with another name | `link README.md docs --source src --reference docs/lookup` |
|
|
30
30
|
| Link one page | `link docs/main_loop.md --source src` |
|
|
31
31
|
| In a group folder, link the shared pages and the pages of each project | `link README.md docs v1/README.md v1/docs v2/README.md v2/docs --source src` |
|
|
@@ -51,7 +51,7 @@ Get the values for the commands from these places:
|
|
|
51
51
|
- Give each path relative to the project folder. The project folder is the nearest folder at or above the working directory that holds `.c64-re-tools/`.
|
|
52
52
|
- If the working directory is not in a project, give `--project <folder>` to each command. If the working directory has projects below it, the script refuses and lists them.
|
|
53
53
|
- In a group folder, each version of a program is a project. The script refuses the group folder and each folder in it that is not a project. Give `--project` with a project of the group, for example `--project v1`.
|
|
54
|
-
- A path that a command only reads can go into another project of the group, for example `../v1/
|
|
54
|
+
- A path that a command only reads can go into another project of the group, for example `../v1/releases/game.prg`. The command writes only in its own project.
|
|
55
55
|
- An address is `$` and 1 to 4 hex digits, for example `'$c000'` or `'$fb'`, or a name. A name is a symbol, else an analyzer name that only one analyzer gives. Put an address in single quotes in a shell.
|
|
56
56
|
- A range is `<start>-<end>`, for example `'$c000-$cfff'`. In a JSON file, a range is `start` and `end`.
|
|
57
57
|
- Bytes in a JSON file are hex in a field `data`, for example `"data": "a900"`.
|
|
@@ -86,7 +86,7 @@ Each flag applies only to the commands in the table. On another command, the scr
|
|
|
86
86
|
| `--out <dir>` | `generate` | Required. The folder of the reference, relative to the project folder. `generate` writes only there. It refuses to start when the folder holds a page that it did not write. |
|
|
87
87
|
| `--source <dir>` | `link` | Required. The folder of the generated source, relative to the project folder. In a group folder, each project has its source in this folder. |
|
|
88
88
|
| `--reference <dir>` | `link` | The folder of the reference, relative to the project folder. In a group folder, each project has its reference in this folder. The default is the first `reference` folder in a given folder or beside a given page, for example `docs/reference`. |
|
|
89
|
-
| `--check` | `link` | Write
|
|
89
|
+
| `--check` | `link` | Write no page. `result` is `FAIL` when a link is not up to date, a page has a problem, or `evidence` has items. Off by default. |
|
|
90
90
|
| `--max-listed <n>` | `generate`, `link` | List at most `n` items in each list. The default is 50. The count is always in the body. |
|
|
91
91
|
|
|
92
92
|
---
|
|
@@ -170,20 +170,20 @@ In a group folder, a label names the project of a name. Write the label and a co
|
|
|
170
170
|
|
|
171
171
|
`body` holds:
|
|
172
172
|
|
|
173
|
-
- `result`: `PASS` when no page has a problem. `FAIL` when a page has a problem
|
|
173
|
+
- `result`: `PASS` when no page has a problem. `FAIL` when a page has a problem. With `--check`, also `FAIL` when a link is not up to date or `evidence` has items.
|
|
174
174
|
- `pages`: the count of the pages that it read.
|
|
175
175
|
- `reference`: the folder of the reference, or `none`.
|
|
176
176
|
- `linked`: `links`, the count of the links that it wrote, and `pages`, the pages that it changed. With `--check`, `notUpToDate` has the same fields for the links that are not up to date.
|
|
177
177
|
- `problems`: `byKind`, `count`, `listed` and `rest`. Each item has `at` (the page and the line), `kind` and `message`. In a group folder, each item also has `project`: the label of the project of the page, or `shared`.
|
|
178
178
|
- `group`: only in a group folder. `folder` is the group folder, relative to the folder of the pages. `projects` holds the labels.
|
|
179
|
-
- `evidence`: only when the project knowledge gives a file as evidence and the file is missing or changed. `count`, `listed` and `rest`. Each item has the `file`, its `state` (`missing` or `changed`) and the `revisions` that give the file. The project knowledge keeps the SHA-256 of each file of its evidence.
|
|
179
|
+
- `evidence`: only when the project knowledge gives a file as evidence and the file is missing or changed. `count`, `listed` and `rest`. Each item has the `file`, its `state` (`missing` or `changed`) and the `revisions` that give the file. The project knowledge keeps the SHA-256 of each file of its evidence. In a group folder, a shared page adds the evidence of each project, and each item also has `project`. With `--check`, an evidence item makes `result` a FAIL. Without `--check`, it does not.
|
|
180
180
|
|
|
181
181
|
`hint` and `nextAction`:
|
|
182
182
|
|
|
183
183
|
- A page has a problem: `hint` tells you to correct each problem. `nextAction` runs the same `link` command again.
|
|
184
184
|
- With `--check`, a link is not up to date and no page has a problem: `nextAction` runs `link` without `--check` to write the links.
|
|
185
185
|
- `reference` is `none`: no `reference` folder is in or beside the given pages. Give `--reference <dir>`, or run `generate` first.
|
|
186
|
-
- `evidence` has items: for a coverage map that changed, put the map into the project knowledge again. For a file that you did not change on purpose, restore it from git. Else examine the facts of the revisions against the new file. Give the new file as evidence of the next write of these facts.
|
|
186
|
+
- `evidence` has items: for a coverage map that changed, put the map into the project knowledge again. For a file that you did not change on purpose, restore it from git. Else examine the facts of the revisions against the new file. Give the new file as evidence of the next write of these facts. `nextAction` runs `link` with `--check`.
|
|
187
187
|
|
|
188
188
|
Do this for each `kind` of problem:
|
|
189
189
|
|
|
@@ -199,6 +199,7 @@ Do this for each `kind` of problem:
|
|
|
199
199
|
| `unknown-label` | No project of the group folder has the label. `message` gives the labels. Correct the label. |
|
|
200
200
|
| `unlabelled-name` | A shared page gives a name and its address without a label. Write the label of the project before the name. |
|
|
201
201
|
| `stale-reference` | The source or the reference is older than the project knowledge. `message` names the project. Do steps 2 and 3 of the workflow again for that project. |
|
|
202
|
+
| `unreadable-knowledge` | The script cannot read the project knowledge of the project that `message` names. Correct the knowledge as `message` tells. Then run `link` again. |
|
|
202
203
|
|
|
203
204
|
Errors:
|
|
204
205
|
|
|
@@ -207,19 +208,31 @@ Errors:
|
|
|
207
208
|
|
|
208
209
|
---
|
|
209
210
|
|
|
211
|
+
## Scope of the claims
|
|
212
|
+
|
|
213
|
+
The terms and the rules of scope are in `<skill>/references/style.md`. Before you write a claim about the history or the rebuild, find these facts:
|
|
214
|
+
|
|
215
|
+
- The label, the file and the SHA-256 of each reference file, and the stage of each capture.
|
|
216
|
+
- Find out if somebody examined an authenticated original. When nobody examined one, write this fact in the first paragraph of `README.md`.
|
|
217
|
+
- What each compare included, and what it proves.
|
|
218
|
+
|
|
219
|
+
`link --check` checks the links, the reference pages and the files of the evidence. It does not check if a claim is true. Read each claim against its evidence before you call the documentation complete.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
210
223
|
## Workflow
|
|
211
224
|
|
|
212
225
|
1. Read the project knowledge. The documentation can only be as good as the knowledge. Each routine needs a name and a comment. Each table needs a region and a name. Each file of the source needs a module with a title. Record what is missing in the project knowledge.
|
|
213
226
|
2. Generate the source from the project knowledge. Make sure that the check of the source gives identical bytes. This also writes the source map.
|
|
214
227
|
3. Run `generate`. Read `index.md` of the reference. A module with no routines, or a routine with no comment, shows what the knowledge does not have yet.
|
|
215
228
|
4. Make the plan of the pages. Start from the modules and the call graphs. Find the main loop, the interrupt chain, the dispatch tables, the state machines and the data formats. Each subsystem gets one page in `docs/`. The entry page `README.md` lists the pages. Use the page types in `<skill>/references/page-types.md`.
|
|
216
|
-
5. Collect the facts about the development and the copy protection. These facts are the most interesting parts for a reader, so look for them carefully.
|
|
229
|
+
5. Collect the facts about the development and the copy protection. Collect them from the reference files, not from a commercial original that nobody examined. These facts are the most interesting parts for a reader, so look for them carefully.
|
|
217
230
|
- Read the leftover spaces and their comments in the project knowledge. If the knowledge has none, find the leftovers of the development in the program.
|
|
218
231
|
- For two or more releases, compare the releases. Then you can separate the program from the changes of each release.
|
|
219
232
|
- Find each check of the copy protection in the code, and the effect of a failed check.
|
|
220
233
|
- Find the traces of each crack in the program. The bytes that the compare of the releases shows are the start. Examples are a check that the crack changed, a group text in the program, and bytes in memory that the program now uses.
|
|
221
234
|
- Do not examine the intro, the mover or the relocator of a crack. They are not part of the program.
|
|
222
|
-
6. Write each page. Read the code and the knowledge for each fact. When a fact needs a run, run the program in a test run or in the emulator. Explain each part before you name the code. Link only the main parts. Mark each fact with its evidence. Several subagents can write the pages at the same time, one page each. Give each subagent `<skill>/references/page-types.md` and `<skill>/references/style.md`.
|
|
235
|
+
6. Write each page. Read the code and the knowledge for each fact. When a fact needs a run, run the program in a test run or in the emulator. Explain each part before you name the code. Link only the main parts. Mark each fact with its evidence and its reference file. Do not write a conclusion as a fact. A compare with a crack is not proof about a release that you did not examine. Several subagents can write the pages at the same time, one page each. Give each subagent `<skill>/references/page-types.md` and `<skill>/references/style.md`.
|
|
223
236
|
7. Record each new fact in the project knowledge first: a name, a comment, a region or a module. Then the source and the reference show it too. A fact that is only in a page is lost at the next change of the knowledge.
|
|
224
237
|
8. Run `link`. Correct each problem. Then run `link` with `--check`. Make sure that `result` is `PASS`.
|
|
225
238
|
9. When the project folder is in a workspace with other projects, find `README.md` at the root of the workspace. This page lists each program of the workspace. Add one row for the program, with a link to `<project>/README.md` and one sentence. If the page does not exist, make it. Use the workspace index in `<skill>/references/page-types.md`. When the workspace folder is a group folder, run `link README.md --source src` in it to check the links of this page. Else `link` does not read this page.
|
|
@@ -8,13 +8,13 @@ One entry page for the program: `README.md` in the project folder. A large subsy
|
|
|
8
8
|
|
|
9
9
|
The most interesting parts for a reader are the development of the program and its copy protection. Put them first, and explain them in depth. The entry page of the program has these parts, in this order:
|
|
10
10
|
|
|
11
|
-
1. **One paragraph.** What the program is,
|
|
12
|
-
2. **The development.** How the authors made the program, as the code and the leftovers tell it. Explain each trace in depth: what the bytes are, how you identified them, and what they tell about the work of the authors. Use as many paragraphs as the traces need. Link the development page (section 6) for the full details.
|
|
13
|
-
3. **The copy protection.** How the
|
|
11
|
+
1. **One paragraph.** What the program is, the authors and the year, and the reference files that the documentation is for. Tell if somebody examined an authenticated original. Under it, one line defines the evidence marks: **Observed**, **Code** and **Conclusion**.
|
|
12
|
+
2. **The development.** How the authors made the program, as the code and the leftovers tell it. Bytes in a later copy can come from a crack or a release. Do not tell where they came from without evidence. Explain each trace in depth: what the bytes are, how you identified them, and what they tell about the work of the authors. Use as many paragraphs as the traces need. Link the development page (section 6) for the full details.
|
|
13
|
+
3. **The copy protection.** How the protection of the reference files works, in depth. Tell what the loader left in memory, and explain each check and where the program hides it. Tell what happens when a check fails, and how the rebuild turns it off. Link the copy protection page (section 7) for the full details.
|
|
14
14
|
4. **Findings.** The bugs and the facts that a reader does not expect. Write a bulleted list, not a table. Each item has a title in bold, the facts and the evidence. It also has a link to the page with the details. Then tell what the finding means in practice. Examples are what a player sees, what a test or a fix can use, and what a preservation project must know. Mark an idea that no run showed as **Conclusion**.
|
|
15
15
|
5. **How the program works.** A short walk through the program, from the start to the main loop. Tell what the program does at each stage and why. Use one mermaid diagram of the layers and one of the flow of the player. Under the diagrams, a numbered list tells how the layers work together. Link only the entry of each layer, for example the cold start, the main loop and the interrupt. Use about 5 to 8 links in the full section.
|
|
16
16
|
6. **The pages.** A table with one row for each page: the link and one sentence about its content. The sentences have no links to the code.
|
|
17
|
-
7. **The releases.** A small table gives each
|
|
17
|
+
7. **The releases.** A small table gives each examined release: the label, the file, the SHA-256 of the file and where it came from. Then one line for each crack tells the group, what the crack adds around the program, and the bytes of the program that it changed. When a crack left a trace in the program that is interesting, give it a short paragraph. Tell what the trace is, how you identified it, and what it means in practice. Link the code of the trace one time. A group that left no such trace gets only its line. Do not describe the intro, the mover or the relocator of a crack. They are not part of the program.
|
|
18
18
|
|
|
19
19
|
Examples of traces that are interesting:
|
|
20
20
|
|
|
@@ -24,7 +24,7 @@ The most interesting parts for a reader are the development of the program and i
|
|
|
24
24
|
- A release is a memory dump of a program that ran.
|
|
25
25
|
- A crack put a text or a tag into the program.
|
|
26
26
|
- A crack damaged a part of the program, for example a level that does not load.
|
|
27
|
-
8. **The rebuild.** Which release is the base release, the program of the knowledge. Which changes of the release to the machine state stay, and how the loader sets them. A table of the switches of the project knowledge: the name, the kind, the default and the releases that have the switch on. How to build the default program and each release. What the runs that compare the
|
|
27
|
+
8. **The rebuild.** Which release is the base release, the program of the knowledge. Which changes of the release to the machine state stay, and how the loader sets them. A table of the switches of the project knowledge: the name, the kind, the default and the releases that have the switch on. How to build the default program and each release. What the runs that compare the reference file with the rebuild do, in words, and the ranges that they compare.
|
|
28
28
|
9. **Still open.** What is not known yet, and which run can find it.
|
|
29
29
|
10. **The reference.** One line with a link to `docs/reference/index.md`.
|
|
30
30
|
|
|
@@ -39,7 +39,7 @@ Look for findings of these kinds. They are often the most useful to a reader:
|
|
|
39
39
|
```markdown
|
|
40
40
|
# <Program>
|
|
41
41
|
|
|
42
|
-
<What the program is. The authors and the year. The
|
|
42
|
+
<What the program is. The authors and the year. The reference files that this documentation is for, and where they came from. Tell if somebody examined an authenticated original.>
|
|
43
43
|
|
|
44
44
|
**Evidence.** **Observed** marks a fact that a run showed. **Code** marks a fact from the code only. **Conclusion** marks an interpretation.
|
|
45
45
|
|
|
@@ -101,7 +101,7 @@ A workspace with several projects has one `README.md` at its root. It lists each
|
|
|
101
101
|
```markdown
|
|
102
102
|
# C64 games
|
|
103
103
|
|
|
104
|
-
Reverse-engineered C64 games. Each game has its own folder with
|
|
104
|
+
Reverse-engineered C64 games. Each game has its own folder with its reference files, the rebuilt source and the documentation. A reference file can be a commercial release, a crack or a snapshot.
|
|
105
105
|
|
|
106
106
|
| Game | |
|
|
107
107
|
|---|---|
|
|
@@ -112,7 +112,7 @@ Reverse-engineered C64 games. Each game has its own folder with the original dis
|
|
|
112
112
|
|
|
113
113
|
A program with two or more versions in a group folder has one `README.md` in the group folder. It tells the parts of the program that the versions share. Each version has its own entry page in its project folder. The group entry page has these parts, in this order:
|
|
114
114
|
|
|
115
|
-
1. **One paragraph.** What the program is, who made it and when, and which versions the documentation is for. Under it, one line defines the evidence marks.
|
|
115
|
+
1. **One paragraph.** What the program is, who made it and when, and which versions and reference files the documentation is for. Tell if somebody examined an authenticated original. Under it, one line defines the evidence marks.
|
|
116
116
|
2. **The versions.** A table with one row for each version: the link to its entry page, the releases of the version, and its entry address. Under the table, tell how the versions are different and why the versions need a project each.
|
|
117
117
|
3. **The development**, **The copy protection** and **Findings**, as in the entry page of section 1, for the facts that the versions share. Write the label of the version before each name, for example `` `v1:speech_irq` `$29C8` ``.
|
|
118
118
|
4. **The pages.** A table of the shared pages in `docs/`, for example the development, the changes between the versions, the releases and the disk layout.
|
|
@@ -213,7 +213,7 @@ One page for each format of data, for example a packed map, a music stream or a
|
|
|
213
213
|
|
|
214
214
|
## 6. The development page
|
|
215
215
|
|
|
216
|
-
One page, `docs/development.md`, that tells how the authors made the program. The facts come from the code, the texts and the leftovers. Get the leftovers from the leftover spaces of the project knowledge. If the knowledge has none, find the leftovers of the development in the program. This page is one of the most interesting pages for a reader. Explain each trace in depth: what the bytes are, how you identified them, and what they tell. Compare an old copy with the version that runs, byte by byte when it helps. Use the parts that the program has evidence for:
|
|
216
|
+
One page, `docs/development.md`, that tells how the authors made the program, as the code and the data tell it. Keep the bytes that you found apart from your conclusions about where they came from. The facts come from the code, the texts and the leftovers. Get the leftovers from the leftover spaces of the project knowledge. If the knowledge has none, find the leftovers of the development in the program. This page is one of the most interesting pages for a reader. Explain each trace in depth: what the bytes are, how you identified them, and what they tell. Compare an old copy with the version that runs, byte by byte when it helps. Use the parts that the program has evidence for:
|
|
217
217
|
|
|
218
218
|
1. **The authors and the version.** The names, the dates and the version texts in the program, for example a credit line or "REV.2".
|
|
219
219
|
2. **The tools and the computer of the development.** The format of the source text in the leftovers, and the assembler. The computer that the authors used, for example an Apple II with a cross-assembler.
|
|
@@ -221,7 +221,7 @@ One page, `docs/development.md`, that tells how the authors made the program. Th
|
|
|
221
221
|
4. **Old versions in the image.** Old copies of code, tables, graphics or music. Tell what changed between the old copy and the version that runs.
|
|
222
222
|
5. **The original names.** Fragments of a symbol table or source text that give the names of the authors. Tell which names of the knowledge come from them.
|
|
223
223
|
6. **Unused and unfinished parts.** Code that nothing calls, texts and graphics that nothing shows, debug code and test code. Tell what each part did, or was to do.
|
|
224
|
-
7. **What the development tells.** A short conclusion, marked **Conclusion**, for example
|
|
224
|
+
7. **What the development tells.** A short conclusion, marked **Conclusion**, for example a possible order in which the authors made the parts. Give the other possible interpretations.
|
|
225
225
|
|
|
226
226
|
For each fact, give the evidence. A leftover in another space of the knowledge has no line in the source. Write its name without its address. Then give its space and its address, for example "`old_demo_input_stream` in bank3 at `$F300`".
|
|
227
227
|
|
|
@@ -229,7 +229,7 @@ For each fact, give the evidence. A leftover in another space of the knowledge h
|
|
|
229
229
|
|
|
230
230
|
One page, `docs/protection.md`, that explains the copy protection of the program in depth. This page is one of the most interesting pages for a reader. It has these parts:
|
|
231
231
|
|
|
232
|
-
1. **The scheme.** How the
|
|
232
|
+
1. **The scheme.** How the protection works as a whole. Tell about the disk or the loader, and the marks that the loader leaves in memory. Tell which keys the program compares.
|
|
233
233
|
2. **Each check.** For each check, tell where it is and when it runs. Tell what it compares, and how the program hides it. Link the code of the check one time. Use a table for a summary of the checks, without links.
|
|
234
234
|
3. **The effect of a failed check.** What the program does when a check fails. Examples are a crash at once, a slow change of code, damaged data and a wipe of memory. Tell how long the effect takes to show.
|
|
235
235
|
4. **The releases.** In one or two sentences: which checks still run in each release. When a crack changed bytes of the program to stop a check, tell which bytes, and link the code of the change one time.
|
|
@@ -34,6 +34,27 @@ These rules apply to each page that you write. The `link` command checks the rul
|
|
|
34
34
|
- Do not link to a file in `.c64-re-tools/local/`.
|
|
35
35
|
- Do not write a fact that you did not check in the code, the knowledge or a run. Put a question in **Still open**.
|
|
36
36
|
|
|
37
|
+
## Terms and scope
|
|
38
|
+
|
|
39
|
+
Use these terms with these meanings:
|
|
40
|
+
|
|
41
|
+
- **Reference file**: the program file or the capture that you examined. A test compares the rebuild with it. It can be a crack, a snapshot, a memory dump, a disk image or a commercial release.
|
|
42
|
+
- **Base release**: the release whose bytes are the program of the project knowledge. Its label and its folder do not tell where the bytes came from.
|
|
43
|
+
- **Commercial original**: the release that the publisher sold. You can use this term also when nobody examined that release.
|
|
44
|
+
- **Authenticated original**: a commercial original with recorded evidence that it is genuine, for example the disk of the publisher.
|
|
45
|
+
- **Default build**: `build/clean.prg`, or `build/clean_loader.prg` for a source with a loader.
|
|
46
|
+
|
|
47
|
+
Rules:
|
|
48
|
+
|
|
49
|
+
- Give the release label of the reference file before you give the result of a byte compare. When the compare does not include all of the program, give the ranges.
|
|
50
|
+
- Write that a rebuild is identical to the commercial original only after a compare with an authenticated original. A PASS of a compare is true only for the bytes of its reference file, for example a crack.
|
|
51
|
+
- Two releases that can come from the same copy do not give two items of evidence. A byte that most releases have is not always a byte of the commercial original.
|
|
52
|
+
- **Observed**: a run showed it. A capture of a run and a compare of the releases count as runs. Tell in words what the run did, not the name of its file. Observed does not tell who made the program, its history, or the bytes of a release that you did not examine.
|
|
53
|
+
- **Code**: the code shows it, and no run showed it. Code does not tell that a release that you did not examine does the same.
|
|
54
|
+
- **Conclusion** tells your interpretation. Give the facts that it uses and the other possible interpretations. For example, source text in the format of an Apple II assembler does not prove the computer of the authors.
|
|
55
|
+
- Bytes that no run read are not always bytes that the program cannot read. Give the runs and the checks that show the limit.
|
|
56
|
+
- Write the limits in the first paragraph. Write them again in each short summary that can tell more than the evidence shows.
|
|
57
|
+
|
|
37
58
|
## Diagrams and images
|
|
38
59
|
|
|
39
60
|
- Use mermaid for the diagrams: `flowchart` for calls and data flow, `stateDiagram-v2` for state machines.
|
|
@@ -7,16 +7,18 @@
|
|
|
7
7
|
|
|
8
8
|
import { existsSync, readdirSync, readFileSync, rmSync, statSync } from "node:fs";
|
|
9
9
|
import { basename, join, posix } from "node:path";
|
|
10
|
+
import type { DatabaseSync } from "node:sqlite";
|
|
10
11
|
|
|
11
12
|
import { Refusal } from "#src/errors.ts";
|
|
12
13
|
import { WireFailure } from "#src/host-client/tools.ts";
|
|
13
14
|
import { writeProjectFile, writeReported } from "#src/host-client/transfer.ts";
|
|
14
15
|
import { conflicts } from "#src/knowledge/conflicts.ts";
|
|
15
|
-
import { openForRead } from "#src/knowledge/database.ts";
|
|
16
|
+
import { openForRead, TEXT_DIRECTORY } from "#src/knowledge/database.ts";
|
|
16
17
|
import { changedEvidence, type EvidenceChange } from "#src/knowledge/evidence.ts";
|
|
17
18
|
import { programImage, type ProgramImage } from "#src/knowledge/program.ts";
|
|
18
19
|
import { listComments, listModules, listReferences, listRegions, listSymbols, sourceRevision } from "#src/knowledge/read.ts";
|
|
19
|
-
import {
|
|
20
|
+
import { compareText } from "#src/knowledge/text.ts";
|
|
21
|
+
import { groupOf, namedGroup, PROJECT_DIRECTORY, projectRoot, resolveProjectFile, resolveProjectPath, type ProjectGroup } from "#src/project.ts";
|
|
20
22
|
import { GENERATED_MARK, referenceStamp } from "#src/reference-pages.ts";
|
|
21
23
|
import { listed, OPTIONS, reply, runScript, UsageError, type Call, type Reply } from "#src/script.ts";
|
|
22
24
|
import { checkLinks, linkPage, type Files, type LinkContext, type Names, type Problem } from "./lib/links.ts";
|
|
@@ -250,29 +252,64 @@ function link(call: Call): Reply {
|
|
|
250
252
|
const referenceOf = (member: Member) => (reference === undefined ? undefined : posix.join(member.prefix, reference));
|
|
251
253
|
const problems: Problem[] = [];
|
|
252
254
|
/** The evidence files of the knowledge of each read project that are missing or changed, with paths relative to the root of the run. */
|
|
253
|
-
const evidence: EvidenceChange
|
|
255
|
+
const evidence: Array<EvidenceChange & { project?: string }> = [];
|
|
256
|
+
const evidenceRead = new Set<Member>();
|
|
257
|
+
const addEvidence = (member: Member, db: DatabaseSync | undefined) => {
|
|
258
|
+
if (evidenceRead.has(member)) return;
|
|
259
|
+
evidenceRead.add(member);
|
|
260
|
+
for (const change of changedEvidence(db, member.root)) evidence.push({ ...change, file: posix.join(member.prefix, change.file), ...(member.label === undefined ? {} : { project: member.label }) });
|
|
261
|
+
};
|
|
262
|
+
/** The projects whose knowledge cannot be read: one problem each, not the end of the run. */
|
|
263
|
+
const unreadableKnowledge = new Set<Member>();
|
|
264
|
+
const markUnreadable = (member: Member, error: Refusal) => {
|
|
265
|
+
if (unreadableKnowledge.has(member)) return;
|
|
266
|
+
unreadableKnowledge.add(member);
|
|
267
|
+
problems.push({ page: posix.join(member.prefix, PROJECT_DIRECTORY, TEXT_DIRECTORY), line: 1, kind: "unreadable-knowledge", message: `The knowledge of the project ${member.label} cannot be read: ${error.message}` });
|
|
268
|
+
};
|
|
269
|
+
/** The evidence of a project that no page names. */
|
|
270
|
+
const readEvidence = (member: Member) => {
|
|
271
|
+
if (evidenceRead.has(member) || unreadableKnowledge.has(member)) return;
|
|
272
|
+
let db: DatabaseSync | undefined;
|
|
273
|
+
try {
|
|
274
|
+
db = openForRead(member.root);
|
|
275
|
+
addEvidence(member, db);
|
|
276
|
+
} catch (error) {
|
|
277
|
+
if (!(error instanceof Refusal)) throw error;
|
|
278
|
+
markUnreadable(member, error);
|
|
279
|
+
} finally {
|
|
280
|
+
db?.close();
|
|
281
|
+
}
|
|
282
|
+
};
|
|
254
283
|
|
|
255
284
|
/** The names of a project, read the first time a page needs them. A project with given pages is read before the pages. */
|
|
256
285
|
const loaded = new Map<Member, Names>();
|
|
257
|
-
const load = (member: Member, required: boolean): Names => {
|
|
286
|
+
const load = (member: Member, required: boolean): Names | undefined => {
|
|
258
287
|
const done = loaded.get(member);
|
|
259
288
|
if (done !== undefined) return done;
|
|
260
289
|
const of = member.label === undefined ? "" : ` of the project ${member.label}`;
|
|
261
290
|
const inProject = (path: string) => posix.join(member.prefix, path);
|
|
262
|
-
|
|
291
|
+
// The knowledge first: a project that a page only names, with knowledge that cannot be read, is one problem and has no names.
|
|
292
|
+
let db: DatabaseSync | undefined;
|
|
263
293
|
try {
|
|
264
|
-
|
|
294
|
+
db = openForRead(member.root);
|
|
265
295
|
} catch (error) {
|
|
266
|
-
if (
|
|
267
|
-
|
|
296
|
+
if (required || !(error instanceof Refusal)) throw error;
|
|
297
|
+
markUnreadable(member, error);
|
|
298
|
+
return undefined;
|
|
268
299
|
}
|
|
269
|
-
|
|
300
|
+
let map;
|
|
270
301
|
let symbols;
|
|
271
302
|
let revision;
|
|
272
303
|
try {
|
|
304
|
+
try {
|
|
305
|
+
map = readSourceMap(source, member.root);
|
|
306
|
+
} catch (error) {
|
|
307
|
+
if (member.label === undefined || !(error instanceof WireFailure)) throw error;
|
|
308
|
+
throw new WireFailure(error.code, `In the project ${member.label}: ${error.message}`);
|
|
309
|
+
}
|
|
273
310
|
revision = sourceRevision(db, map.space);
|
|
274
311
|
symbols = listSymbols(db, undefined, undefined, undefined, map.space);
|
|
275
|
-
|
|
312
|
+
addEvidence(member, db);
|
|
276
313
|
} finally {
|
|
277
314
|
db?.close();
|
|
278
315
|
}
|
|
@@ -348,16 +385,21 @@ function link(call: Call): Reply {
|
|
|
348
385
|
for (const member of members) if (pagesGiven.some((page) => memberOf(page) === member)) load(member, true);
|
|
349
386
|
|
|
350
387
|
const labels = members.map((member) => member.label!);
|
|
388
|
+
/** The names of a project that a page names: a project whose knowledge cannot be read has none, so its mentions stay as they are. */
|
|
389
|
+
const loadNamed = (member: Member): Names | undefined => {
|
|
390
|
+
if (unreadableKnowledge.has(member)) return undefined;
|
|
391
|
+
return load(member, false);
|
|
392
|
+
};
|
|
351
393
|
const namesFor = (page: string) => (label: string | undefined): ReturnType<LinkContext["names"]> => {
|
|
352
394
|
if (group === undefined) return label === undefined ? load(members[0]!, false) : undefined;
|
|
353
395
|
if (label === undefined) {
|
|
354
396
|
const own = memberOf(page);
|
|
355
|
-
if (own !== undefined) return
|
|
397
|
+
if (own !== undefined) return loadNamed(own);
|
|
356
398
|
return { kind: "unlabelled-name", message: `A page of the group folder must name the project of each name. Write the folder of the project before the name, for example \`${labels[0]}:name\`.` };
|
|
357
399
|
}
|
|
358
400
|
const member = members.find((each) => each.label === label);
|
|
359
401
|
if (member === undefined) return { kind: "unknown-label", message: `${label} is no project of the group folder. The projects are ${labels.join(", ")}. Correct the label.` };
|
|
360
|
-
return
|
|
402
|
+
return loadNamed(member);
|
|
361
403
|
};
|
|
362
404
|
const managed = (path: string) => members.some((member) => within(path, posix.join(member.prefix, source)) || within(path, referenceOf(member)));
|
|
363
405
|
|
|
@@ -385,6 +427,8 @@ function link(call: Call): Reply {
|
|
|
385
427
|
writeProjectFile(page, Buffer.from(linked.text, "utf8"), { root });
|
|
386
428
|
texts.set(page, linked.text);
|
|
387
429
|
}
|
|
430
|
+
// A shared page of the group folder can tell about each project: the evidence of each project counts, also of a project that no page names. After the pages, a project that a page names is read once.
|
|
431
|
+
if (pagesGiven.some((page) => memberOf(page) === undefined)) members.forEach(readEvidence);
|
|
388
432
|
const byKind: Record<string, number> = {};
|
|
389
433
|
for (const problem of problems) byKind[problem.kind] = (byKind[problem.kind] ?? 0) + 1;
|
|
390
434
|
const shownProblems = listed(problems, call.count("max-listed")!, (problem) => ({
|
|
@@ -400,6 +444,8 @@ function link(call: Call): Reply {
|
|
|
400
444
|
...(check ? { notUpToDate: { links, pages: changedPages } } : { linked: { links, pages: changedPages } }),
|
|
401
445
|
problems: { byKind, ...shownProblems },
|
|
402
446
|
};
|
|
447
|
+
// Two projects can give the same file, one of them through a ../ path: the project orders them.
|
|
448
|
+
evidence.sort((a, b) => compareText(a.file, b.file) || compareText(a.project ?? "", b.project ?? ""));
|
|
403
449
|
const shownEvidence = listed(evidence, call.count("max-listed")!, (change) => ({ ...change, file: shown(change.file) }));
|
|
404
450
|
if (evidence.length > 0) output.evidence = shownEvidence;
|
|
405
451
|
const again = (withCheck: boolean) =>
|
|
@@ -409,7 +455,7 @@ function link(call: Call): Reply {
|
|
|
409
455
|
if (reference === undefined) hints.push("No reference/ folder is in or beside the given pages, so the links to the reference are not checked. Give --reference <dir>, or run generate first.");
|
|
410
456
|
if (evidence.length > 0) {
|
|
411
457
|
hints.push(
|
|
412
|
-
"The project knowledge gives the files in evidence as evidence, and each file is missing or changed since the revisions in its item. For a coverage map that changed, put the map into the project knowledge again. For a file that you did not change on purpose, restore it from git. Else examine the facts of the revisions against the new file, and give the new file as evidence of the next write of these facts.",
|
|
458
|
+
"The project knowledge gives the files in evidence as evidence, and each file is missing or changed since the revisions in its item. For a coverage map that changed, put the map into the project knowledge again. For a file that you did not change on purpose, restore it from git. Else examine the facts of the revisions against the new file, and give the new file as evidence of the next write of these facts. Then run nextAction.",
|
|
413
459
|
);
|
|
414
460
|
if (shownEvidence.rest !== undefined) hints.push(`evidence is cut. To list all files, give ${shownEvidence.rest}.`);
|
|
415
461
|
}
|
|
@@ -420,8 +466,9 @@ function link(call: Call): Reply {
|
|
|
420
466
|
} else if (check && links > 0) {
|
|
421
467
|
hints.push("Some links are not up to date. Run nextAction to write them.");
|
|
422
468
|
nextAction = again(false);
|
|
423
|
-
}
|
|
424
|
-
|
|
469
|
+
} else if (evidence.length > 0) nextAction = again(true);
|
|
470
|
+
// Evidence fails only a check: link without --check still writes the links.
|
|
471
|
+
return reply({ result: problems.length > 0 || (check && (links > 0 || evidence.length > 0)) ? "FAIL" : "PASS", ...output }, { ...(hints.length === 0 ? {} : { hint: hints.join(" ") }), nextAction });
|
|
425
472
|
}
|
|
426
473
|
|
|
427
474
|
const SOURCE = { kind: "path", value: "<dir>", help: "the folder of the source that was generated from the knowledge, relative to the project folder" } as const;
|
|
@@ -446,13 +493,13 @@ await runScript({
|
|
|
446
493
|
},
|
|
447
494
|
{
|
|
448
495
|
name: "link",
|
|
449
|
-
summary: "Links each name with its address in the pages to its line in the source, and checks every link and image. result is FAIL when a page has a problem, or with --check when a link is not up to date.",
|
|
496
|
+
summary: "Links each name with its address in the pages to its line in the source, and checks every link and image. result is FAIL when a page has a problem, or with --check when a link is not up to date or a file of the evidence of the knowledge is missing or changed.",
|
|
450
497
|
subjects: [{ name: "<page>", help: ".md files and folders of the documentation, relative to the project folder or the group folder, for example README.md docs. link reads each file and every .md file below each folder", list: true }],
|
|
451
498
|
options: {
|
|
452
499
|
// Text, not a path of the run: in a group, each project has the source and the reference at this path.
|
|
453
500
|
source: { kind: "text", value: "<dir>", help: `${SOURCE.help}. In a group, the same folder in each project`, required: true },
|
|
454
501
|
reference: { kind: "text", value: "<dir>", help: "the folder of the reference pages of generate, relative to the project folder; in a group, the same folder in each project. The default is the first reference/ folder in a given folder or beside a given page" },
|
|
455
|
-
check: { kind: "flag", help: "write
|
|
502
|
+
check: { kind: "flag", help: "write no page. FAIL when a link is not up to date, a page has a problem, or a file of the evidence of the knowledge is missing or changed" },
|
|
456
503
|
"max-listed": OPTIONS["max-listed"],
|
|
457
504
|
},
|
|
458
505
|
notes: "A name in backticks with its address in backticks after it, for example `draw_room` `$09BC`, becomes one link to the line of the name in the source. A name without an address gets no link. A name gets one link in each section, and a table gets no links. In a group folder, write the folder of the project before the name, for example `v2:draw_room` `$09BC`.",
|
|
@@ -40,7 +40,7 @@ export interface LinkContext {
|
|
|
40
40
|
managed: (path: string) => boolean;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export type ProblemKind = "unknown-name" | "wrong-address" | "repeated-link" | "link-in-table" | "missing-file" | "missing-anchor" | "missing-line" | "outside-project" | "outside-group" | "unknown-label" | "unlabelled-name" | "stale-reference";
|
|
43
|
+
export type ProblemKind = "unknown-name" | "wrong-address" | "repeated-link" | "link-in-table" | "missing-file" | "missing-anchor" | "missing-line" | "outside-project" | "outside-group" | "unknown-label" | "unlabelled-name" | "stale-reference" | "unreadable-knowledge";
|
|
44
44
|
|
|
45
45
|
export interface Problem {
|
|
46
46
|
page: string;
|
|
@@ -35,7 +35,7 @@ The knowledge is text in `.c64-re-tools/knowledge/` of the project. Commit that
|
|
|
35
35
|
| Write all knowledge to one file | `export --out .c64-re-tools/local/knowledge.json` |
|
|
36
36
|
| Find what the knowledge holds of the program | `program` |
|
|
37
37
|
| Put a captured program into the knowledge | `image .c64-re-tools/local/capture/image.json` |
|
|
38
|
-
| Put a PRG into the knowledge | `image
|
|
38
|
+
| Put a PRG into the knowledge | `image releases/game.prg` |
|
|
39
39
|
| Put drive code into the knowledge | `image drive.prg --space drive8` |
|
|
40
40
|
| Add the coverage of runs | `coverage .c64-re-tools/local/runs/rooms/room0.bin` |
|
|
41
41
|
| Name the symbol at an address | `rename '$2100' update_player --kind routine --reason 'reads joystick 2'` |
|
|
@@ -48,8 +48,8 @@ The knowledge is text in `.c64-re-tools/knowledge/` of the project. Commit that
|
|
|
48
48
|
| Find the places that a removal blocks | `suppressions --range '$2000-$2fff'` |
|
|
49
49
|
| Start a file of the generated source | `module '$2000' game/player.asm --title 'Player movement'` |
|
|
50
50
|
| Write the operand of an instruction as an expression | `operand '$8079' --lo irq_handler` |
|
|
51
|
-
| Record a release of the program | `release
|
|
52
|
-
| Write a switch | `switch PROTECTION --kind protection --releases
|
|
51
|
+
| Record a release of the program | `release FIRESTAR --file releases/game.prg --base` |
|
|
52
|
+
| Write a switch | `switch PROTECTION --kind protection --releases FIRESTAR` |
|
|
53
53
|
| Write the code of a switch for a range | `patch '$100e-$1010' PROTECTION --code-file no-check.asm` |
|
|
54
54
|
| List the releases, switches and patches | `switches` |
|
|
55
55
|
| Record the start screen of the program | `start-screen --mode multicolour --screen '$5c00' --bitmap '$6000' --colours '$8328' --border 0 --background 0` |
|
|
@@ -82,7 +82,7 @@ The knowledge is text in `.c64-re-tools/knowledge/` of the project. Commit that
|
|
|
82
82
|
- Give each path relative to the project folder. The project folder is the nearest folder at or above the working directory that holds `.c64-re-tools/`.
|
|
83
83
|
- If the working directory is not in a project, give `--project <folder>` to each command. If the working directory has projects below it, the script refuses and lists them.
|
|
84
84
|
- In a group folder, each version of a program is a project. The script refuses the group folder and each folder in it that is not a project. Give `--project` with a project of the group, for example `--project v1`.
|
|
85
|
-
- A path that a command only reads can go into another project of the group, for example `../v1/
|
|
85
|
+
- A path that a command only reads can go into another project of the group, for example `../v1/releases/game.prg`. The command writes only in its own project.
|
|
86
86
|
- An address is `$` and 1 to 4 hex digits, for example `'$c000'` or `'$fb'`, or a name. A name is a symbol, else an analyzer name that only one analyzer gives. Put an address in single quotes in a shell.
|
|
87
87
|
- A range is `<start>-<end>`, for example `'$c000-$cfff'`. In a JSON file, a range is `start` and `end`.
|
|
88
88
|
- Bytes in a JSON file are hex in a field `data`, for example `"data": "a900"`.
|
|
@@ -396,7 +396,7 @@ A rebuild keeps all of the program in the source: unused bytes, dead code, old c
|
|
|
396
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
397
|
|
|
398
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 `
|
|
399
|
+
- A label is upper case, for example `FIRESTAR`, `TBC` or `V2`.
|
|
400
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
401
|
- A space has one base release. Record the base release before the first switch.
|
|
402
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.
|
|
@@ -435,8 +435,8 @@ Use this when a stage of the loading shows the screen, and the program at the en
|
|
|
435
435
|
#### A start screen in the program
|
|
436
436
|
|
|
437
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
|
|
439
|
-
- Find the 1000 colour bytes in the program: compare them with the colour RAM at $d800 while
|
|
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
440
|
|
|
441
441
|
#### The rules of the VIC-II
|
|
442
442
|
|