@henols/c64-re-tools 2.2.0-rc.7 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henols/c64-re-tools",
3
- "version": "2.2.0-rc.7",
3
+ "version": "2.2.0",
4
4
  "description": "Agent-friendly Commodore 64 engineering toolkit for reverse engineering, debugging, development and testing.",
5
5
  "license": "MIT",
6
6
  "author": "Henrik Olsson",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: c64-docs
3
- description: Use this skill to write the documentation of a C64 program. The documentation puts first the development of the program and its copy protection, and explains them in depth. It tells the findings and what each one means in practice. It explains how the program works, with links to the main parts of the source, and tells the releases and cracks for preservation. The script generates the reference pages from the knowledge and the source. You write the other pages by the method of this skill. A second command of the script makes the links and checks every link. Use it after the source is identical, or to keep the documentation correct after a change to the knowledge.
3
+ description: Use this skill to write the documentation of a C64 program. The documentation puts first the development of the program and its copy protection, and explains them in depth. It tells the findings and what each one means in practice. It explains how the program works, with links to the main parts of the source, and lists the releases in short. The script generates the reference pages from the knowledge and the source. You write the other pages by the method of this skill. A second command of the script makes the links and checks every link. Use it after the source is identical, or to keep the documentation correct after a change to the knowledge.
4
4
  ---
5
5
 
6
6
  # c64-docs
@@ -9,7 +9,7 @@ description: Use this skill to write the documentation of a C64 program. The doc
9
9
 
10
10
  Write documentation that explains how a program works, and that points to the main parts of the code. The documentation is Markdown in the project. The entry page is `README.md` in the project folder. The other pages and the reference are in `docs/`. The documentation has two parts:
11
11
 
12
- - **The pages that you write.** They explain how the program works. They give the flows, the state machines, the data formats and the task of each part. They tell the development of the program and its copy protection first, in depth. They tell the findings and what each one means in practice, and the releases and cracks. They link only the main parts of the code. Use the page types in `references/page-types.md` and the rules in `references/style.md`.
12
+ - **The pages that you write.** They explain how the program works. They give the flows, the state machines, the data formats and the task of each part. They tell the development of the program and its copy protection first, in depth. They tell the findings and what each one means in practice. They list the releases in short. They link only the main parts of the code. Use the page types in `references/page-types.md` and the rules in `references/style.md`.
13
13
  - **The reference.** `docs.ts generate` generates it from the knowledge, the source map of c64-source and the image. It is the lookup for each routine, table and variable. It has a page for each module, with the routines, their callers and callees, the data and a call graph. It also has pages for the tables, the memory map with the variables, and the graphics. Do not edit these pages. The next run writes over them.
14
14
 
15
15
  `docs.ts link` makes the links of the pages that you write. A name and its address in backticks become one link to the line of the name in the source. When the source changes, `docs.ts link` moves the links to the new lines.
@@ -70,7 +70,7 @@ node <skill>/scripts/docs.ts link README.md docs --source src --check
70
70
  2. Generate the source with c64-source. Make sure that `check.identical` is `true`. The script also writes `source-map.json`.
71
71
  3. Run `docs.ts 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.
72
72
  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` in the project folder lists the pages. Use the page types in `references/page-types.md`.
73
- 5. Collect the facts about the development, the copy protection and the releases. These facts are the most interesting parts for a reader, so look for them carefully. Read the leftover spaces and their comments in the knowledge. If the knowledge has none, run `provenance.ts leftovers` of c64-provenance. For two or more releases, run `provenance.ts compare` of c64-provenance. Get the crack stages from c64-unpacker. Find each check of the copy protection in the code, and the effect of a failed check. These facts go into the development section, the copy protection section, the releases section and their pages.
73
+ 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. Read the leftover spaces and their comments in the knowledge. If the knowledge has none, run `provenance.ts leftovers` of c64-provenance. For two or more releases, run `provenance.ts compare` of c64-provenance to separate the program from the changes of each release. Find each check of the copy protection in the code, and the effect of a failed check. These facts go into the development section, the copy protection section and their pages. Do not examine the cracks in detail. They are not part of the program.
74
74
  6. Write each page. Read the code and the knowledge for each fact. Run the program with c64-testing or c64-emulator when a fact needs a run. Explain each part before you name the code. Link only the main parts: write `` `draw_room` `$09BC` `` for a link, and `` `draw_room` `` for each other mention. Mark each fact with its evidence. Several subagents can write the pages at the same time, one page each. Give each subagent `references/page-types.md` and `references/style.md`.
75
75
  7. Record each new fact in the knowledge first: a name, a comment, a region or a module. Then the source and the reference show it too. A fact only in a page is lost at the next change of the knowledge.
76
76
  8. Run `docs.ts link`. Read `problems` and correct each one. Then run `docs.ts link --check`. Make sure that `result` is `PASS`.
@@ -158,5 +158,4 @@ Do not store:
158
158
  - The source and its source map → c64-source
159
159
  - A fact that needs a run → c64-testing or c64-emulator
160
160
  - Leftovers, traces of the development and the differences of releases → c64-provenance
161
- - The stages of a crack or a packer → c64-unpacker
162
161
  - What an address of the C64 is → c64-memory-map
@@ -10,11 +10,11 @@ The most interesting parts for a reader are the development of the program and i
10
10
 
11
11
  1. **One paragraph.** What the program is, who made it and when, and which release the documentation is for. Under it, one line defines the evidence marks: **Observed**, **Code** and **Conclusion**.
12
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 original protection 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. Tell which parts of it each release still has, and how the rebuild turns it off. Link the copy protection page (section 7) for the full details.
13
+ 3. **The copy protection.** How the original protection 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. **Releases and cracks.** The known releases, what each crack changed, and what a preservation project must know. Give a summary here. When the facts fill more than a screen, put them on a releases page (section 8) and link it.
17
+ 7. **The releases.** A short section. A small table gives each known release: the label, the file and the SHA-256 of the file. Then one line for each crack tells what it adds around the program, and the bytes of the program that it changed. Do not describe the intro, the mover or the relocator of a crack in detail. They are not part of the program.
18
18
  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 from `knowledge.ts switches`: the name, the kind, the default and the releases that have the switch on. How to build the default program and each release. Which scenarios compare the original with the rebuild.
19
19
  9. **Still open.** What is not known yet, and which run can find it.
20
20
  10. **The reference.** One line with a link to `docs/reference/index.md`.
@@ -40,7 +40,7 @@ Look for findings of these kinds. They are often the most useful to a reader:
40
40
 
41
41
  ## The copy protection
42
42
 
43
- <Several paragraphs: the marks of the loader, each check, what a failed check does, and the state in each release.> The details are on [docs/protection.md](docs/protection.md).
43
+ <Several paragraphs: the marks of the loader, each check, and what a failed check does.> The details are on [docs/protection.md](docs/protection.md).
44
44
 
45
45
  ## Findings
46
46
 
@@ -66,9 +66,9 @@ flowchart TB
66
66
  |---|---|
67
67
  | [docs/main_loop.md](docs/main_loop.md) | **The main loop.** <one sentence> |
68
68
 
69
- ## Releases and cracks
69
+ ## The releases
70
70
 
71
- <Summary, or a link to docs/releases.md.>
71
+ <A small table of the releases, and one line for each crack.>
72
72
 
73
73
  ## The rebuild
74
74
 
@@ -102,7 +102,7 @@ Reverse-engineered C64 games. Each game has its own folder with the original dis
102
102
  One page for each subsystem, for example the main loop, the interrupt chain, the room generation or the sound player. It has these parts:
103
103
 
104
104
  1. **What it does.** One paragraph in the words of the program. Tell what the subsystem does for the player and why the program needs it. Do not list the routines.
105
- 2. **The conventions.** The terms of the page, for example "a pass is one run of the main loop". Use the conventions block of section 9.
105
+ 2. **The conventions.** The terms of the page, for example "a pass is one run of the main loop". Use the conventions block of section 8.
106
106
  3. **How it works.** A small mermaid flowchart, then the explanation in prose. Put a fact that a reader does not expect into the text where it belongs. The findings of the entry page link to it. Link the entry routine of the subsystem one time. For the main routine, give a numbered list of what it does and why, in the order of the code. Name a helper routine only when the reader needs it. Add pseudo-code when a loop or a condition is not clear from the list.
107
107
  4. **The data.** Only the data that a reader needs to understand the subsystem. For each structure, give the layout: the bytes, the entries and the meaning of each byte. The reference lists every variable, so do not make a table of each variable.
108
108
  5. **The state machine.** For code that changes from one state to another: a mermaid `stateDiagram-v2` and a transition table. The transition table has the state, the condition, the next state and the name of the code that makes the change, without a link.
@@ -178,21 +178,11 @@ One page, `docs/protection.md`, that explains the copy protection of the program
178
178
  1. **The scheme.** How the original 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.
179
179
  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.
180
180
  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.
181
- 4. **The releases.** What each crack did to the protection: removed it, set the marks again, or left it as it is. Tell which checks still run in each release.
181
+ 4. **The releases.** In one or two sentences: which checks still run in each release.
182
182
  5. **The rebuild.** The switch that turns the protection off, the bytes that it changes, and the scenarios that show that the program runs without it.
183
183
  6. **Still open.** The checks that no run reached, and the run that can reach them.
184
184
 
185
- ## 8. The releases page
186
-
187
- One page, `docs/releases.md`, for the releases of the program and the facts that a preservation project needs. Get the differences from `provenance.ts compare` of c64-provenance, and the crack stages from c64-unpacker. It has these parts:
188
-
189
- 1. **The known releases.** A table with one row for each release. A row gives the label, the disk image, the file, the group, the date and the SHA-256 of the file. The file is the file of the release, for example the PRG on the disk. Write "unknown" for a value that no source gives.
190
- 2. **The original.** Which release is nearest to the original program, and the evidence. Tell what is missing, for example the original loader or a release without a crack.
191
- 3. **The cracks.** For each crack: the intro, the mover, the relocator, the packer, a trainer and the texts that it changed. Tell what the crack did to the copy protection, and link the copy protection page.
192
- 4. **Traces of other people.** A release made from another crack, a memory dump of a program that ran, or tools on the disk.
193
- 5. **The differences.** A table of the bytes where the releases differ, what each difference does, and the switch that gives it in the rebuild.
194
-
195
- ## 9. The conventions block
185
+ ## 8. The conventions block
196
186
 
197
187
  Put this block near the top of each subsystem page. Change the terms for the program.
198
188