@henols/c64-re-tools 2.6.0-rc.1 → 2.6.0-rc.11

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.
Files changed (91) hide show
  1. package/package.json +2 -2
  2. package/skills/c64-assembler/SKILL.md +27 -13
  3. package/skills/c64-assembler/scripts/assembler.ts +26 -14
  4. package/skills/c64-development/SKILL.md +2 -2
  5. package/skills/c64-docs/SKILL.md +4 -4
  6. package/skills/c64-docs/scripts/docs.ts +7 -7
  7. package/skills/c64-docs/scripts/lib/reference.ts +13 -5
  8. package/skills/c64-docs/scripts/lib/source-map.ts +9 -4
  9. package/skills/c64-knowledge/SKILL.md +60 -36
  10. package/skills/c64-knowledge/scripts/knowledge.ts +75 -59
  11. package/skills/c64-knowledge/scripts/lib/listing.ts +18 -3
  12. package/skills/c64-packer/SKILL.md +1 -1
  13. package/skills/c64-provenance/SKILL.md +11 -10
  14. package/skills/c64-provenance/scripts/lib/library.ts +16 -16
  15. package/skills/c64-provenance/scripts/provenance.ts +33 -23
  16. package/skills/c64-reverse-engineering/SKILL.md +17 -11
  17. package/skills/c64-source/SKILL.md +74 -49
  18. package/skills/c64-source/scripts/lib/export.ts +76 -32
  19. package/skills/c64-source/scripts/lib/loader.ts +33 -10
  20. package/skills/c64-source/scripts/lib/source.ts +14 -25
  21. package/skills/c64-source/scripts/lib/stage.ts +11 -5
  22. package/skills/c64-source/scripts/lib/start-screen.asm +4 -2
  23. package/skills/c64-source/scripts/source.ts +257 -134
  24. package/skills/c64-static-analysis/SKILL.md +8 -6
  25. package/skills/c64-static-analysis/scripts/lib/coverage.ts +2 -25
  26. package/skills/c64-static-analysis/scripts/lib/instructions.ts +22 -20
  27. package/skills/c64-static-analysis/scripts/lib/macros.ts +3 -1
  28. package/skills/c64-static-analysis/scripts/static-analysis.ts +36 -43
  29. package/skills/c64-testing/SKILL.md +5 -2
  30. package/skills/c64-testing/references/recording-format.md +18 -3
  31. package/skills/c64-testing/references/scenario-format.md +7 -6
  32. package/skills/c64-testing/scripts/lib/diff-files.ts +4 -18
  33. package/skills/c64-testing/scripts/lib/play.ts +39 -41
  34. package/skills/c64-testing/scripts/lib/recording.ts +46 -37
  35. package/skills/c64-testing/scripts/lib/replay.ts +1 -1
  36. package/skills/c64-testing/scripts/lib/runs.ts +2 -2
  37. package/skills/c64-testing/scripts/lib/scenario.ts +17 -10
  38. package/skills/c64-testing/scripts/testing.ts +6 -1
  39. package/skills/c64-unpacker/SKILL.md +6 -3
  40. package/skills/c64-unpacker/scripts/lib/loads.ts +34 -13
  41. package/skills/c64-unpacker/scripts/lib/machine.ts +7 -3
  42. package/skills/c64-unpacker/scripts/unpacker.ts +5 -3
  43. package/skills/emulator/SKILL.md +7 -12
  44. package/src/build-name.ts +50 -0
  45. package/src/c64-keys.ts +98 -0
  46. package/src/c64.ts +21 -1
  47. package/src/cli/main.ts +3 -29
  48. package/src/host/main.ts +1 -1
  49. package/src/host/tools/index.ts +1 -6
  50. package/src/host/vice/session.ts +88 -9
  51. package/src/host-client/steps.ts +17 -17
  52. package/src/host-client/tools.ts +2 -7
  53. package/src/host-client/vice-session.ts +7 -1
  54. package/src/knowledge/program.ts +44 -1
  55. package/src/knowledge/read.ts +33 -10
  56. package/src/knowledge/schema.ts +37 -11
  57. package/src/knowledge/start-screen.ts +68 -0
  58. package/src/knowledge/text.ts +5 -2
  59. package/src/knowledge/write.ts +69 -30
  60. package/src/mcp/inputs.ts +12 -0
  61. package/src/mcp/server.ts +1 -1
  62. package/src/mcp/tools/input.ts +38 -5
  63. package/src/mcp/tools/machine.ts +3 -42
  64. package/src/mcp/tools/media.ts +1 -1
  65. package/src/native/acme.ts +1 -1
  66. package/src/native/c64run.ts +1 -1
  67. package/src/native/discover.ts +3 -3
  68. package/src/native/dxa.ts +12 -1
  69. package/src/native/ghidra/analyze.ts +74 -63
  70. package/src/native/ghidra/c64rt-wasm.ts +4 -0
  71. package/src/native/ghidra/language/c64rt_6510.sla +0 -0
  72. package/src/native/ghidra/pcode.ts +222 -0
  73. package/src/native/ghidra/walk.ts +205 -0
  74. package/src/native/ghidra/wasm.ts +98 -0
  75. package/src/native/processes.ts +4 -4
  76. package/src/native/types.ts +2 -2
  77. package/src/platform.ts +30 -1
  78. package/src/project.ts +17 -4
  79. package/src/protocol/tools.ts +1 -45
  80. package/src/protocol/vice.ts +47 -0
  81. package/src/script.ts +3 -3
  82. package/src/vsf.ts +98 -0
  83. package/tools/c64run.c +9 -12
  84. package/tools/install-container.sh +1 -2
  85. package/src/cli/status.ts +0 -127
  86. package/src/host/tools/status.ts +0 -47
  87. package/src/native/ghidra/index.ts +0 -170
  88. package/src/native/ghidra/scripts/C64Export.java +0 -274
  89. package/src/native/ghidra/scripts/C64Prepare.java +0 -66
  90. package/src/native/status.ts +0 -135
  91. package/tools/install-ghidra.sh +0 -40
@@ -72,10 +72,10 @@ Each flag applies only to the commands in the table. On another command, the scr
72
72
 
73
73
  | Flag | Command | Effect |
74
74
  |---|---|---|
75
- | `--out <dir>` | `generate` | The folder for the source files. It is necessary. The script writes over the files of an earlier run. It removes a generated `.asm` file that this run does not write. A run without `--loader` keeps `loader.asm`, `loader.prg`, `start_screen.asm` and `start_screen_stage.asm` of an earlier run. `staleLoader` tells when they are of another knowledge revision. |
75
+ | `--out <dir>` | `generate` | The folder for the source files. It is necessary. The script writes over the files of an earlier run. It removes a generated `.asm` file that this run does not write, also in a folder of `--out`. A folder with a generated `main.asm` is the source of another space, and it stays. A run without `--loader` keeps `loader.asm`, the loader program, `start_screen.asm` and `start_screen_stage.asm` of an earlier run. `staleLoader` tells when they are of another knowledge revision. |
76
76
  | `--entry <address>` | `generate` | An address where code starts. Give the flag again for more addresses. There is no default. |
77
- | `--space <space>` | `generate` | The knowledge space: `c64`, `drive8`, or `bank0` to `bank255`. The default is `c64`. `--loader` and the platform names apply only to `c64`. The coverage is the coverage of the space. |
78
- | `--loader` | `generate` | Also write `loader.asm` and `loader.prg`, and `start_screen.asm` when the knowledge has a start screen. A start screen of a captured stage also gives `start_screen_stage.asm`. The script writes `loader.prg` only after the check of the new loader ran. Else the `loader.prg` of an earlier run stays. It needs a capture in the knowledge. The default is no loader. |
77
+ | `--space <space>` | `generate` | The knowledge space: `c64`, `drive8`, `loading`, or `bank0` to `bank255`. The default is `c64`. `--loader` and the platform names apply only to `c64`. The coverage is the coverage of the space. |
78
+ | `--loader` | `generate` | Also write `loader.asm` and the loader program, and `start_screen.asm` when the knowledge has a start screen. A start screen of a captured stage also gives `start_screen_stage.asm`. The script writes the loader program only after the check of the new loader ran. Else the loader program of an earlier run stays. It needs a capture in the knowledge. The default is no loader. |
79
79
  | `--analyzer-names` | `generate` | Name an address without a name of the user or the LLM, and without a platform name, with its analyzer name, for example `FUN_17e2`. Without the flag, the source makes its own name, for example `l_17e2`. |
80
80
  | `--to <folder>` | `export` | The folder of the new project. It is necessary. The script also writes `<folder>.zip` beside the folder. |
81
81
  | `--name <name>` | `export` | The name of `baseline/<name>.prg` and `build/<name>.prg`. The default is the name of the folder. |
@@ -89,7 +89,8 @@ Each flag applies only to the commands in the table. On another command, the scr
89
89
 
90
90
  ### `generate --out <dir>`
91
91
 
92
- The command writes the source files, `source-map.json` and `not_executed.json` in `--out`. Then it checks them.
92
+ The command writes the source files in `--out`. Then it checks them.
93
+ The folder `--out` gets only source files. The command writes `source-map.json` and `not_executed.json` in `.c64-re-tools/local/generated/<dir>/`. Git ignores this folder.
93
94
  The same knowledge always gives the same source.
94
95
  Do not edit the generated files. The next run writes over them. The values in `config.asm` are the one exception.
95
96
  To make the source better, change the project knowledge. Then generate again.
@@ -97,7 +98,7 @@ To make the source better, change the project knowledge. Then generate again.
97
98
  `body` holds these fields:
98
99
 
99
100
  - `result`: `PASS` when every check passes, else `FAIL`.
100
- - `files`: the files in `--out`, each with `out`, `bytes` and `sha256`. `sourceMap` names `source-map.json`.
101
+ - `files`: the files that the command wrote, each with `out`, `bytes` and `sha256`. `sourceMap` names `source-map.json`.
101
102
  - `removed`: the files of an earlier run that the script removed.
102
103
  - `instructions`, `dataBytes` and `undecodedBytes`.
103
104
  - `labels`: `named` labels from the knowledge, and `generated` labels `l_xxxx`.
@@ -110,7 +111,7 @@ To make the source better, change the project knowledge. Then generate again.
110
111
  - `asBytes`: the instructions that the source has as bytes.
111
112
  - `notExecuted`: with coverage, the count of instructions that no run executed, and their ranges. `rest` names `not_executed.json`, which has all the ranges. Each range there has its source `file` and the `routine` before it.
112
113
  - `unusedModules`: modules whose start is in no segment of the program. Often the program does not hold the code that the knowledge describes.
113
- - `leftovers`: the bytes that nothing uses, with `bytes` and each range with its `file`. See "The leftovers". `noCoverage` tells that the knowledge has no coverage, so no range is a leftover.
114
+ - `leftovers`: the bytes that nothing uses, with `bytes` and each range with its `file`. See "The leftovers". `noCoverage` tells that the knowledge has no coverage, so no range is a leftover. `changed` gives the ranges that are `added` to the leftovers and `removed` from them since the earlier run in `--out`.
114
115
  - `operandExpressions`: the count of instructions with an operand expression.
115
116
  - `operandsAsNumbers`: each operand expression that the source has as a number, with its `address`, `expression` and `reason`.
116
117
  - `macroUses`: the count of macro uses in the source.
@@ -118,7 +119,7 @@ To make the source better, change the project knowledge. Then generate again.
118
119
  - `patchesNotWritten`: each patch that the source does not have, with its range, `switch` and `reason`.
119
120
  - `switches`, `default`, `releases`: the checks of the switches. See "Switches and releases".
120
121
  - `loader`: the check of the loader. See "The loader".
121
- - `staleLoader`: a run without `--loader` kept `loader.asm` and `loader.prg` of another knowledge revision. `files` gives the files. `revision` gives the revision of `loader.asm`. Without `revision`, `loader.asm` does not give one. `noEntryState: true` tells that the knowledge has no entry state for a new loader.
122
+ - `staleLoader`: a run without `--loader` kept `loader.asm` and the loader program of another knowledge revision, or of another version of the toolkit. `files` gives the files. `revision` gives the revision of `loader.asm`, and `version` its toolkit version. Without `revision`, `loader.asm` does not give one. `noEntryState: true` tells that the knowledge has no entry state for a new loader. A change in a space that the loader does not hold does not make the loader stale. The loader holds space `c64` and the space of the stage of the start screen.
122
123
 
123
124
  `result` is `FAIL` for each of these:
124
125
 
@@ -126,7 +127,7 @@ To make the source better, change the project knowledge. Then generate again.
126
127
  - The entry is in no segment of the program.
127
128
  - A patch is in `patchesNotWritten`.
128
129
  - A switch or the default build does not fit.
129
- - A release does not give its file. A release with `layout differs` does not give `FAIL`. But the base release must be `identical`.
130
+ - A release does not give its bytes.
130
131
  - The loader is not verified.
131
132
 
132
133
  `hint` gives the action for each finding. When a change of the project knowledge corrects a finding, `nextAction` is the same `generate` command. Run it after the change. A `PASS` without findings gives a `hint` and no `nextAction`.
@@ -151,16 +152,16 @@ Do these actions for the findings:
151
152
  #### The source files
152
153
 
153
154
  - `main.asm` sets the address of each segment. It includes the files in address order.
154
- - Each module in the knowledge is one file. A module starts at its address. It stops at the next module or at the end of its segment. Without modules, each segment is one file, `segment_xxxx.asm`.
155
+ - Each module in the knowledge is one file. A module starts at its address. It stops at the next module or at the end of its segment. The file of a module can be in a folder, for example `music/driver.asm`. Without modules, each segment is one file, `segments/segment_xxxx.asm`.
155
156
  - `constants.asm` holds the names of addresses outside the program, for example `EXTCOL = $d020`. It also holds the register names in the program, for example `RASTER = $d012`. The names are in groups by memory area, in address order. Drive code and banks have one group only.
156
157
  - The side comment of a constant is the knowledge comment of the address. Without a comment, it is the platform meaning. When the knowledge name is not the platform name, the platform name comes first. For an I/O mirror without a meaning, the comment gives the register that the mirror repeats.
157
- - After the side comment, `Used:` counts how the source uses the name. The kinds are `read`, `written`, `modified`, `called`, `jumped to`, `jumped through`, `branched to`, `pointer`, `address`, `table` and `macro argument`. `address` is an immediate operand expression. `table` is an entry in a table of addresses.
158
+ - After the side comment, `Used:` counts how the source uses the name. The kinds are `read`, `written`, `modified`, `called`, `jumped to`, `jumped through`, `branched to`, `pointer`, `address`, `table` and `macro argument`. `address` is an immediate operand expression. `table` is an entry in a table of addresses. A macro line counts one `macro argument` for each name in its args. The other bytes that the macro reads or writes, for example the high byte of a 16-bit value, count for no name.
158
159
  - `config.asm` holds the value of each switch, for example `PROTECTION = 0`. The switches are in groups by kind. The side comment gives the releases that have the switch on, the ranges of its patches and the comment of the switch.
159
160
  - You can change a value in `config.asm` to 0 or 1. The next run keeps the values of the file. It adds a new switch with its default. It removes a switch that the knowledge does not have.
160
161
  - When the knowledge has a start screen, `config.asm` also has `START_SCREEN = 1`. Set it to 0 to start the program at once. Then assemble `loader.asm` again.
161
162
  - `start_screen.asm` is the code that shows the start screen and waits. It is the same for each program. `loader.asm` gives it the values of the start screen.
162
163
  - `switches.asm` holds each release of the knowledge. `main.asm` and `loader.asm` include it first. The script writes it only when the knowledge has switches or releases, or when the source has leftovers. For each release, a block `!ifdef RELEASE_<label>` gives each switch the value of that release.
163
- - `leftover_xxxx.asm` holds a range of leftovers. See "The leftovers".
164
+ - `leftovers/leftover_xxxx.asm` holds a range of leftovers. See "The leftovers".
164
165
  - `macros.asm` holds the macros of the knowledge. `main.asm` and `loader.asm` include it.
165
166
 
166
167
  #### Names in the source
@@ -194,15 +195,16 @@ Do these actions for the findings:
194
195
 
195
196
  #### The leftovers
196
197
 
197
- A leftover is a range of the program that nothing uses: unused code, old copies and old data. The script finds the leftovers from the coverage, as the export finds its free ranges (see "The free ranges"). The start screen, the patches, the macro uses and the addresses that the code of a patch names are never leftovers.
198
+ A leftover is a range of the program that nothing uses: unused code, old copies and old data. The script finds the leftovers from the coverage, as the export finds its free ranges (see "The free ranges"). The start screen, the patches and the addresses that the code of a patch names are never leftovers. A macro use in code that nothing uses is in the leftover with that code. A leftover never cuts a macro use in two.
198
199
 
199
- - Each range of leftovers is a file `leftover_xxxx.asm`. When a range cuts a module, the module continues after the range in `<module>_xxxx.asm`. The module in the knowledge does not change.
200
+ - Each range of leftovers is a file `leftovers/leftover_xxxx.asm`. When a range cuts a module, the module continues after the range in `<module>_xxxx.asm`, in the folder of the module. The module in the knowledge does not change.
200
201
  - `main.asm` builds a leftover file only when `LEFTOVERS` is 1. When it is 0, the build skips the bytes. Thus the addresses after the range do not change.
201
202
  - `config.asm` has `LEFTOVERS = 0`. Thus the default build is the clean program, without the leftovers.
202
- - Each release has `LEFTOVERS = 1`. Thus the build of a release gives the bytes of its file.
203
- - `loader.prg` never has the leftovers. The loader does not copy them, and the memory there keeps the bytes that were in it before.
203
+ - Each release has `LEFTOVERS = 1`. Thus the build of a release gives the bytes of the release.
204
+ - The loader program never has the leftovers. The plain form does not copy them, and the memory there keeps the bytes that were in it before. The packed form unpacks the build of `main.asm` in one piece, so the leftovers are $00.
204
205
  - Without coverage, no range is a leftover. Put the coverage of the runs into the project knowledge. Then generate again.
205
- - A leftover can be wrong when the coverage does not show a use. For example, the VIC-II reads a range, or the program reads a range before it writes it. Then a test of `loader.prg` fails. Record the region in the project knowledge, or put the coverage of more runs into it. Do not change the source.
206
+ - When `leftovers.changed` has ranges, the default build and the loader program now leave out other bytes. A test that observes the `added` bytes on the loader program gets other values there. Fill the `added` ranges in the test of the leftovers. In a test that compares them, exclude them with the reason that they are leftovers.
207
+ - A leftover can be wrong when the coverage does not show a use. For example, the VIC-II reads a range, or the program reads a range before it writes it. Then a test of the loader program fails. Record the region in the project knowledge, or put the coverage of more runs into it. Do not change the source.
206
208
 
207
209
  #### Switches and releases
208
210
 
@@ -213,7 +215,7 @@ The command does these checks. They use the defaults and the values of the knowl
213
215
  1. `check`: the build of the base release must give the program byte by byte. In this build, each switch has its base value, and `LEFTOVERS` is 1.
214
216
  2. `switches`: each switch alone at its other value. The build must have the same length as the base release. It can change bytes only in the patches of the switch.
215
217
  3. `default`: the default build. It must have the same length. It can change bytes only in the patches of the switches in `default.in` and in the leftovers.
216
- 4. `releases`: each release, built with `RELEASE_<label>=1`, against the file of the release.
218
+ 4. `releases`: each release, built with `RELEASE_<label>=1`, against the bytes of the release in the project knowledge.
217
219
 
218
220
  Each item of `switches` has `name`, `kind`, `default`, `base`, `define` and the patches.
219
221
 
@@ -225,13 +227,12 @@ Each item of `switches` has `name`, `kind`, `default`, `base`, `define` and the
225
227
 
226
228
  `default` has `in`, `result` and `changedBytes`, as in `switches`. When `default` has `overflow` and the message `turn on one of them`, two alternatives are in the default build. Give one of the switches the default of the base release.
227
229
 
228
- Each item of `releases` has `label`, `base`, `file`, `define` and `result`:
230
+ Each item of `releases` has `label`, `base`, `define` and `result`. The check compares the build with each segment of the release. The build compare of the assembler does the same.
229
231
 
230
- - `identical`: the build gives the bytes of the file.
232
+ - `identical`: the build gives the bytes of each segment of the release.
231
233
  - `different`: the release has bytes that no patch gives. Compare the release with the program. Then record a switch and a patch for each difference.
232
- - `layout differs`: the release has other segments than the program. Patches cannot move code. This result does not fail the run.
233
- - `file changed`: the file is not the file that the knowledge recorded. Put back the file, or record the release again in the project knowledge.
234
234
  - `does not assemble`: read the ACME diagnostics.
235
+ - `notInRelease`: the ranges of the program that the release does not have. The check does not compare them.
235
236
 
236
237
  The script writes a patch only when its range is complete items of one file. A patch cannot cut an instruction. Its switch name cannot be a name of the source.
237
238
  The script writes a macro use only when the use gives the bytes of the program. A label inside the range of a use also keeps the instructions. The macro line has no place for the label.
@@ -244,7 +245,14 @@ Build the program from the source in these ways:
244
245
 
245
246
  #### The loader
246
247
 
247
- `--loader` writes `loader.asm` and assembles it to `loader.prg`. The loader does these steps:
248
+ `--loader` writes `loader.asm` in `--out`. It assembles `loader.asm` to the loader program in `build/`. Git ignores `build/`. The name of the loader program tells its build:
249
+
250
+ - `clean_loader.prg`: each value of `config.asm` is its default. This is the clean program.
251
+ - `custom_<switches>_loader.prg`: the names of the switches that are not at their default. A switch that is off has `no_` before its name, for example `custom_no_start_screen_loader.prg`.
252
+
253
+ The symbols of the loader program are in `build/symbols/<name>.json`, for example `build/symbols/clean_loader.json`. They hold the labels of `loader.asm`, `main.asm` and `start_screen_stage.asm`. Give this file to a test of the loader program as its symbols. When the name changes, the script removes the loader program of the earlier run and its symbols.
254
+
255
+ The loader does these steps:
248
256
 
249
257
  1. `10 SYS 2061` starts it.
250
258
  2. It stops the interrupts and makes all RAM visible. It moves its copier to two free pages.
@@ -258,25 +266,26 @@ The copy table, the copier and the jump use labels, not numbers. `loader_from_xx
258
266
 
259
267
  The loader changes the free stack byte below the stack pointer (`stackByte`). It does not set the SID, the time of day of the CIAs, the CIA interrupt flags or the interrupt registers of the VIC-II. A program that reads SID voice 3 for random numbers can thus give a different result. A start screen writes the colour RAM, and the loader does not set it again. When you compare the original and the rebuild, observe after the program sets its own random numbers.
260
268
 
261
- The script builds and checks `loader.prg` with the values of `config.asm`. With the defaults, `loader.prg` is the clean program: no copy protection, all corrections and no leftovers. The entry state is the state of the base release. For a loader of a release, build `loader.asm` with the build option `--release <label>`. That loader also does not have the leftovers.
269
+ The script builds and checks the loader program with the values of `config.asm`. With the defaults, the loader program is the clean program: no copy protection, all corrections and no leftovers. The entry state is the state of the base release. For a loader of a release, build `loader.asm` with the build option `--release <label>`. That loader also does not have the leftovers.
262
270
 
263
271
  The start screen:
264
272
 
265
273
  - The start screen needs the VIC-II values of the entry state. Its screen, bitmap, charset and colours must be in a segment of the program, or in a captured stage. See "The start screen of a captured stage".
266
274
  - With a start screen, the copier uses three pages, not two.
267
- - `loader.prg` always shows the start screen. To start the program at once, set `START_SCREEN = 0` in `config.asm`, and assemble `loader.asm`. Do not define `START_SCREEN` on the command line of the build: `config.asm` sets it. The build of a release does not read `config.asm`, so it shows the start screen.
268
- - A test that runs `loader.prg` stops at the start screen, because the emulator cannot press a key of the keyboard matrix. Run until `loader_start_screen_wait`. Then set the PC to `loader_start_screen_continue`.
275
+ - The start screen is part of the clean build only. The loader program always shows it. A release build has no start screen, and `LEFTOVERS = 1` also turns it off.
276
+ - To start the program at once, set `START_SCREEN = 0` in `config.asm`, and assemble `loader.asm`. Do not define `START_SCREEN` on the command line of the build: `config.asm` sets it.
277
+ - A test that runs the loader program stops at the start screen, because the start screen waits for a key. Run until `loader_start_screen_wait`. Then set the PC to `loader_start_screen_continue`.
269
278
 
270
279
  `loader` holds these fields:
271
280
 
272
281
  - `program`, the `copies` in their order, `copier` and `stackByte`.
273
- - `verified: true`: the check ran `loader.prg` to its jump to the entry. There, the memory, $00/$01, the registers and the VIC-II are equal to the entry state. The raster line and the CIA values are also equal. An interrupt can run right at the entry, as in the original program.
282
+ - `verified: true`: the check ran the loader program to its jump to the entry. There, the memory, $00/$01, the registers and the VIC-II are equal to the entry state. The raster line and the CIA values are also equal. An interrupt can run right at the entry, as in the original program.
274
283
  - `limits`: each CIA value that the loader cannot set as it was at the entry. An old capture has no CIA values. Then capture the program again at its entry point.
275
284
  - `startScreen`: with a start screen, `shown: true` when the VIC-II had the values of the start screen, and `waits: true` when the start screen waited without a key. `wait` and `continue` are the addresses of the wait and of the code after it. The check sets the PC to `continue`, and then runs the loader to its jump.
276
- - `packed`: `packedBytes` and `unpackedBytes` of the packed form.
277
- - `stage`: the show stage of a start screen of a captured stage. It has the `space` of the stage and the address of the show `code`. It also has the `bytes` of the stage in `loader.prg`, the `stash` copies, `packedBytes` and `unpackedBytes`. `startScreen.stage` names the space.
278
- - When the check of `loader.prg` cannot run, the script does not write `loader.prg`. The `loader.prg` of an earlier run stays as it was. `loader.asm` is new. `reason` tells why the check did not run.
279
- - `kept`: when the result has no new `loader.prg`, the path of the `loader.prg` of an earlier run. That file is not of this source.
285
+ - `packed`: `packedBytes` and `unpackedBytes` of the packed form. With a start screen of a captured stage, this is the packed program in the loader program.
286
+ - `stage`: the show stage of a start screen of a captured stage. It has the `space` of the stage and the address of the show `code`. It also has the `bytes` of the stage in the loader program, the `stash` copies, `packedBytes` and `unpackedBytes`. `startScreen.stage` names the space.
287
+ - When the check of the loader program cannot run, the script does not write a loader program. The loader program of an earlier run stays as it was. `loader.asm` is new. `reason` tells why the check did not run.
288
+ - `kept`: when the result has no new loader program, the paths of the loader programs of an earlier run. They are not of this source.
280
289
 
281
290
  Do these actions when `verified` is `false`:
282
291
 
@@ -286,42 +295,48 @@ Do these actions when `verified` is `false`:
286
295
  | `reason` about the packed form | If a tool is missing, stop the task and give the message to the user. If the free ranges are too small, write the loader by hand. If the check of the unpack fails, give the reason to the user. |
287
296
  | `reason` that the source does not assemble | Correct the source first. The loader includes the source. |
288
297
  | `reason` about the start screen | Correct the start screen in the project knowledge, or capture the program again with the start screen in memory. If the start screen is not necessary, remove it from the project knowledge. |
289
- | `reason` about the show stage | If the reason names the coverage of the stage, run the stage with coverage. Put the map into the project knowledge in the space of the stage. If the memory is too small, capture the stage again with less memory. If a tool is missing, stop the task and give the message to the user. |
290
- | `reason` that the check of `loader.prg` did not run | Stop the task and give the reason to the user. When the user tells you that the emulator is available, run the same command again. |
298
+ | `reason` about the show stage | If the reason names the coverage of the stage, run the stage with coverage. Put the map into the project knowledge in the space of the stage. If the memory is too small, capture the stage again with less memory. If a tool is missing, stop the task and give the message to the user. If `start_screen_stage.asm` does not assemble, stop the task and give the reason to the user. The reason names the file in `.c64-re-tools/local/` with the source that failed. |
299
+ | `reason` that the check of the loader program did not run | Stop the task and give the reason to the user. When the user tells you that the emulator is available, run the same command again. |
291
300
  | `differences` | The loader ran. The list gives the bytes and the registers that are not equal. |
292
301
  | `stop` | The loader did not get to its copier or its jump. `stop` gives the address and `port`, the value of $01. `history` gives the last 16 instructions. `cause` gives the first byte of the copier or of a copy that is not correct. |
293
302
 
294
303
  #### The start screen of a captured stage
295
304
 
296
- Often the loading stage of a program shows a picture that is not in memory at the entry. Then the knowledge has the picture in a captured stage: a space such as `bank1`. `--stage` of the start screen names that space. `--call` names a routine of the stage, for example the routine that starts the loading tune.
305
+ Often the loading stage of a program shows a picture that is not in memory at the entry. Then the knowledge has the picture in the captured stage of the space `loading`. `--stage` of the start screen names that space. `--call` names a routine of the stage, for example the routine that starts the loading tune.
306
+
307
+ The loader then always has the packed form, and the start screen is a program of its own in front of it:
297
308
 
298
- `loader.prg` then starts with a show stage, before the loader:
309
+ 1. Exomizer packs the program with the copier. This is the packed loader.
310
+ 2. Exomizer packs the packed loader, the bytes of the stage and the show code into the loader program.
311
+ 3. When the loader program starts, Exomizer unpacks these parts. The program stays packed. The bytes of the packed loader under the stage go to a stash in free memory.
312
+ 4. The show code shows the start screen with `start_screen.asm`. With a call, it sets $01 to $37, starts the interrupts and calls the routine.
313
+ 5. It waits for a key or a fire button, as the start screen in the program does.
314
+ 6. It stops the interrupts and the sound, and it stops the screen. It sets the CIA timers as RUN leaves them.
315
+ 7. It copies the stash back to the packed loader. Then it starts the packed loader, which unpacks the program over the start screen.
299
316
 
300
- 1. Exomizer unpacks the loader, the bytes of the stage and the show code. The bytes of the loader under the stage go to a stash in free memory.
301
- 2. The show code shows the start screen with `start_screen.asm`. With a call, it sets $01 to $37, starts the interrupts and calls the routine.
302
- 3. It waits for a key or a fire button, as the start screen in the program does.
303
- 4. It stops the interrupts and the sound, and it stops the screen. It sets the CIA timers as RUN leaves them.
304
- 5. It copies the stash back to the loader. Then it starts the loader.
317
+ The program is packed while the screen shows. Thus the picture and the tune have more free memory.
305
318
 
306
- - `loader.prg` has only the bytes of the stage that the start screen uses. These are the screen, the bitmap, the charset and the colours. With a call, they are also each byte of the stage that is not free from the call, as in "The free ranges". A call thus needs the coverage of the stage.
319
+ - The script puts everything in memory. It does not matter where the stage keeps its bytes, if the memory has enough room.
320
+ - The loader program has only the bytes of the stage that the start screen uses. These are the screen, the bitmap and the charset. With a call, they are also each byte of the stage that is not free from the call, as in "The free ranges". A call thus needs the coverage of the stage.
321
+ - With colours from the colour RAM of the capture, the show code holds the 1000 colours. It copies them to the colour RAM.
307
322
  - The patches of the stage are in at the defaults of their switches. Thus a patch under a switch can remove the text of a crack from the picture.
308
- - `start_screen_stage.asm` holds the show code and the bytes of the stage. Do not edit it. To make `loader.prg` again, run `generate --loader`.
323
+ - `start_screen_stage.asm` holds the show code and the bytes of the stage. Do not edit it. To make the loader program again, run `generate --loader`.
309
324
  - The show stage needs Exomizer. The show code needs free memory in $0400-$9fff or $c000-$cfff. When the memory is too small, the reason gives the largest free ranges.
310
- - The check runs `loader.prg` to `loader_start_screen_wait` of the show stage. There, it compares the VIC-II with the start screen, and the screen bytes in memory with the stage. Then it sets the PC to `loader_start_screen_continue`, and it checks the loader as usual.
325
+ - The check runs the loader program to `loader_start_screen_wait` of the show stage. There, it compares the VIC-II with the start screen, the screen bytes in memory with the stage, and the colour RAM with the capture. Then it sets the PC to `loader_start_screen_continue`, and it checks the loader as usual.
311
326
 
312
327
  #### The packed loader
313
328
 
314
329
  A loader file that loads into $d000 or higher writes the I/O area. When the program is too large for one loader file, `loader.asm` has the packed form:
315
330
 
316
331
  - `loader.asm` holds only the copier and the bytes below $0400. The segments at $0400 and higher are not in `loader.asm`. Between its free ranges, `loader.asm` holds the bytes of the program.
317
- - `loader.prg` is the build of `main.asm` from $0400 and the build of `loader.asm`, packed into one file. Where the two builds overlap, `loader.prg` has the bytes of `loader.asm`.
332
+ - The loader program is the build of `main.asm` from $0400 and the build of `loader.asm`, packed into one file. Where the two builds overlap, the loader program has the bytes of `loader.asm`.
318
333
  - The jump to the entry uses the address of the entry, not its label.
319
334
 
320
335
  To make the packed loader for other switch values, do these steps:
321
336
 
322
- 1. Assemble `main.asm` to `build/main.prg`. The leftovers are $00 in this build.
323
- 2. Assemble `loader.asm` to `build/copier.prg`.
324
- 3. Pack the two files into `build/loader.prg`. The start address is the copier address in the comment at the start of `loader.asm`. The memory configuration at the exit is `$34`.
337
+ 1. Assemble `main.asm` without an output path. The build name of the program tells the switch values, for example `build/custom_trainer.prg`. The leftovers are $00 in this build.
338
+ 2. Assemble `loader.asm` without an output path, for example to `build/custom_trainer_loader.prg`. This is the copier.
339
+ 3. Pack the two files into `build/custom_trainer_packed.prg`. The start address is the copier address in the comment at the start of `loader.asm`. The memory configuration at the exit is `$34`.
325
340
 
326
341
  These steps do not work when a segment starts below $0400. They also do not work when a patch is between the free ranges of `loader.asm`. In these cases, use `generate --loader` for the base release.
327
342
 
@@ -380,6 +395,16 @@ A block of code stops after RTS, RTI, JMP, BRK or a JAM, and before a gap. A blo
380
395
  - No run of the coverage executed it.
381
396
  - No path gets to it from the entry, the hardware vectors or the code that stays. A path is a call, a jump, a branch, a reference of the knowledge or an operand expression. An entry of a table, and two immediate operands that give its address, are paths too.
382
397
 
398
+ Two immediate operands give an address only in these cases:
399
+
400
+ - The code stores the low byte and the high byte to two adjacent addresses outside $d000-$dfff.
401
+ - The code calls a routine with the low byte and the high byte in two registers.
402
+ - The code pushes the high byte and then the low byte onto the stack.
403
+
404
+ An operand expression of the knowledge at an immediate operand replaces these cases for that operand. Thus an operand expression with a constant stops a wrong address.
405
+
406
+ A call or a jump to ROM is not a path. The coverage shows where the CPU sees ROM. Without coverage, $01 of the entry state shows it. Known code of the knowledge is never ROM.
407
+
383
408
  Code that a run executed always stays. `unreachableExecuted` lists the executed code that the entry and the vectors do not get to. An example is a copy check whose call the export removed. Give its `drop` value to `export` to make it free.
384
409
 
385
410
  Data becomes free only when all of these are true:
@@ -387,7 +412,7 @@ Data becomes free only when all of these are true:
387
412
  - Its region type is `bytes`, `words`, a table of addresses, `petscii`, `workspace` or `unused`.
388
413
  - No run read, wrote or executed a byte of it.
389
414
  - No code that stays reads it or names it. No table that stays has an entry in it.
390
- - It is not at the first address of the program, and not at $fffa-$ffff.
415
+ - It is not in the BASIC line that starts the program, and not at $fffa-$ffff.
391
416
 
392
417
  The coverage does not show the reads of the VIC-II. Thus `charset`, `sprite`, `bitmap` and `screen` data stay, unless `--drop` names them. The bytes of the start screen always stay. Bytes without a region also stay.
393
418
 
@@ -397,7 +422,7 @@ The entry is the entry of the knowledge. Without it, the entry is the address of
397
422
 
398
423
  ```text
399
424
  README.md the steps to build and test, the free ranges and the origin
400
- src/ main.asm, constants.asm, macros.asm, the modules and loader.asm
425
+ src/ main.asm, constants.asm, macros.asm, the modules in their folders and loader.asm
401
426
  baseline/<name>.prg the exported program, and baseline/<name>.json with its symbols
402
427
  tests/ the tests of the project, changed for the new program
403
428
  .c64-re-tools/knowledge/ the knowledge of the new program
@@ -422,7 +447,7 @@ tests/ the tests of the project, changed for the new program
422
447
  5. Record names, comments, regions and modules in the project knowledge.
423
448
  6. Run `generate` again. Do steps 4 to 6 again until the source is clear.
424
449
  7. Assemble `main.asm` to a program. This is the default build. For a release, give the build option `--release <label>`.
425
- 8. For an unpacked program, run `generate` with `--loader` at the end. Compare `loader.prg` with the original program in a test.
450
+ 8. For an unpacked program, run `generate` with `--loader` at the end. Compare the loader program with the original program in a test.
426
451
  9. To start a new program from the rebuild, run `export`.
427
452
 
428
453
  ---
@@ -10,6 +10,7 @@
10
10
  // tells what stays. Without coverage nothing becomes free by itself.
11
11
 
12
12
  import { type AddressRange, COVERAGE, formatC64Address, pointerTableEntries, POINTER_TABLE_TYPES, type PointerTableType } from "#src/c64.ts";
13
+ import { symbolsPath } from "#src/build-name.ts";
13
14
  import { Refusal } from "#src/errors.ts";
14
15
  import { NO_FALL_THROUGH, type Root, separate } from "#src/knowledge/separate.ts";
15
16
  import type { RegionType } from "#src/knowledge/schema.ts";
@@ -28,8 +29,19 @@ const CODE_TYPES: readonly RegionType[] = ["code", "jumps", "dual-use"];
28
29
  /** The hardware vectors $fffa-$ffff: they stay when the image holds them. */
29
30
  const VECTORS: AddressRange = { start: 0xfffa, end: 0xffff };
30
31
 
31
- /** Two immediate operands at most this many immediates apart can be the low and high byte of one address. */
32
- const PAIR_WINDOW = 4;
32
+ /** The I/O area: two immediates stored there are chip values, such as a timer latch, not an address. */
33
+ const IO_AREA: AddressRange = { start: 0xd000, end: 0xdfff };
34
+
35
+ /** The registers that each instruction changes, other than by a load of an immediate or a transfer. */
36
+ const WRITES_A = new Set(["lda", "adc", "sbc", "and", "ora", "eor", "pla", "lax", "anc", "asr", "arr", "ane", "lxa", "las", "slo", "rla", "sre", "rra", "isc"]);
37
+ const WRITES_X = new Set(["ldx", "inx", "dex", "tsx", "lax", "sbx", "lxa", "las"]);
38
+ const WRITES_Y = new Set(["ldy", "iny", "dey"]);
39
+ /** The registers that a JSR gets an address in, low byte first, as the KERNAL and BASIC routines get a pointer. */
40
+ const CALL_PAIRS = [
41
+ ["x", "y"],
42
+ ["a", "y"],
43
+ ["a", "x"],
44
+ ] as const;
33
45
 
34
46
  export interface DropInput {
35
47
  segments: readonly AddressRange[];
@@ -41,8 +53,12 @@ export interface DropInput {
41
53
  coverage?: Uint8Array;
42
54
  regions: ReadonlyArray<{ start: number; end: number; type: RegionType }>;
43
55
  references: ReadonlyArray<{ from: number; to: number; kind: string }>;
44
- /** The addresses that the operand expression of an instruction names, by the address of the instruction. */
56
+ /** The addresses that the operand expression of an instruction names, by the address of each instruction with an operand expression; none for a constant. */
45
57
  operandTargets: ReadonlyMap<number, readonly number[]>;
58
+ /** The ranges where the CPU sees ROM and not the RAM of the image: code does not go there, and no address points there. */
59
+ rom?: readonly AddressRange[];
60
+ /** The BASIC line that starts the program: RUN reads it, which no coverage from the entry shows. */
61
+ basic?: AddressRange;
46
62
  /** The patch ranges whose bytes the export changed. */
47
63
  changed: readonly AddressRange[];
48
64
  keep: readonly AddressRange[];
@@ -115,42 +131,72 @@ function flowsOf(input: DropInput, inImage: (address: number) => boolean, indexe
115
131
  const reads: DataReference[] = [];
116
132
  const { memory } = input;
117
133
  const word = (at: number) => memory[at]! | (memory[(at + 1) & 0xffff]! << 8);
118
- const immediates: Array<{ at: number; value: number }> = [];
119
- let previousEnd = -2;
120
- const pairs = () => {
121
- // A low byte and a high byte near each other in one block: the address of a vector, a table or an RTS target.
122
- immediates.forEach((low, index) => {
123
- for (let other = Math.max(0, index - PAIR_WINDOW); other <= Math.min(immediates.length - 1, index + PAIR_WINDOW); other++) {
124
- if (other === index) continue;
125
- const target = low.value | (immediates[other]!.value << 8);
126
- if (!inImage(target)) continue;
127
- flows.push({ from: low.at, to: target }, { from: low.at, to: (target + 1) & 0xffff });
128
- reads.push({ from: low.at, start: target, end: target });
129
- }
130
- });
131
- immediates.length = 0;
134
+ const rom = (address: number) => inside(address, input.rom ?? []);
135
+ // The address of a vector, a table or an RTS target in two immediates of one block: the low byte and the high byte
136
+ // go into a pointer (two stores to N and N+1), into the registers of a JSR, or onto the stack (PHA high, PHA low).
137
+ type Immediate = { at: number; value: number } | undefined;
138
+ const registers: { a: Immediate; x: Immediate; y: Immediate } = { a: undefined, x: undefined, y: undefined };
139
+ const stores = new Map<number, NonNullable<Immediate>>();
140
+ const pushes: Immediate[] = [];
141
+ const pair = (low: Immediate, high: Immediate) => {
142
+ if (low === undefined || high === undefined) return;
143
+ const target = low.value | (high.value << 8);
144
+ if (!inImage(target) || rom(target)) return;
145
+ flows.push({ from: low.at, to: target }, { from: low.at, to: (target + 1) & 0xffff });
146
+ reads.push({ from: low.at, start: target, end: target });
147
+ };
148
+ const endBlock = () => {
149
+ registers.a = registers.x = registers.y = undefined;
150
+ stores.clear();
151
+ pushes.length = 0;
132
152
  };
153
+ let previousEnd = -2;
133
154
  for (const at of [...input.instructions.keys()].sort((a, b) => a - b)) {
134
155
  const opcode = memory[at]!;
135
- const { mode } = OPCODES[opcode]!;
136
- if (at > previousEnd + 1) pairs();
156
+ const { mnemonic, mode } = OPCODES[opcode]!;
157
+ if (at > previousEnd + 1) endBlock();
137
158
  previousEnd = at + input.instructions.get(at)! - 1;
138
159
  const operand = input.instructions.get(at) === 3 ? word(at + 1) : memory[at + 1]!;
160
+ // The registers: a load of an immediate that no operand expression explains, a transfer, a store, a push, a call.
161
+ const loaded = mode === "imm" && !input.operandTargets.has(at) ? { at, value: operand } : undefined;
162
+ if (WRITES_A.has(mnemonic) || (mode === "imp" && ["asl", "lsr", "rol", "ror"].includes(mnemonic))) registers.a = mnemonic === "lda" ? loaded : undefined;
163
+ if (WRITES_X.has(mnemonic)) registers.x = mnemonic === "ldx" ? loaded : undefined;
164
+ if (WRITES_Y.has(mnemonic)) registers.y = mnemonic === "ldy" ? loaded : undefined;
165
+ if (mnemonic === "tax") registers.x = registers.a;
166
+ if (mnemonic === "tay") registers.y = registers.a;
167
+ if (mnemonic === "txa") registers.a = registers.x;
168
+ if (mnemonic === "tya") registers.a = registers.y;
169
+ const stored = { sta: registers.a, stx: registers.x, sty: registers.y }[mnemonic];
170
+ if ((mode === "zp" || mode === "abs") && ["sta", "stx", "sty"].includes(mnemonic) && !inside(operand, [IO_AREA])) {
171
+ stores.delete(operand);
172
+ if (stored !== undefined) {
173
+ stores.set(operand, stored);
174
+ pair(stored, stores.get((operand + 1) & 0xffff));
175
+ pair(stores.get((operand - 1) & 0xffff), stored);
176
+ }
177
+ }
178
+ if (mnemonic === "pha") {
179
+ pushes.push(registers.a);
180
+ if (pushes.length >= 2) pair(pushes.at(-1), pushes.at(-2));
181
+ }
182
+ if (mnemonic === "pla") pushes.pop();
183
+ if (mnemonic === "jsr") {
184
+ for (const [low, high] of CALL_PAIRS) pair(registers[low], registers[high]);
185
+ registers.a = registers.x = registers.y = undefined;
186
+ }
139
187
  switch (mode) {
140
188
  case "rel":
141
189
  flows.push({ from: at, to: (at + 2 + (operand < 0x80 ? operand : operand - 0x100)) & 0xffff });
142
190
  break;
143
- case "imm":
144
- immediates.push({ at, value: operand });
145
- break;
146
191
  case "ind":
147
192
  reads.push({ from: at, start: operand, end: (operand + 1) & 0xffff });
148
193
  if (inImage(operand) && inImage((operand + 1) & 0xffff)) flows.push({ from: at, to: word(operand) });
149
194
  break;
150
195
  case "abs":
151
196
  case "zp":
152
- if (opcode === 0x20 || opcode === 0x4c) flows.push({ from: at, to: operand });
153
- else reads.push({ from: at, start: operand, end: operand });
197
+ if (opcode === 0x20 || opcode === 0x4c) {
198
+ if (!rom(operand)) flows.push({ from: at, to: operand });
199
+ } else reads.push({ from: at, start: operand, end: operand });
154
200
  break;
155
201
  case "abx":
156
202
  case "aby":
@@ -165,9 +211,8 @@ function flowsOf(input: DropInput, inImage: (address: number) => boolean, indexe
165
211
  default:
166
212
  break;
167
213
  }
168
- if (NO_FALL_THROUGH.has(opcode)) pairs();
214
+ if (NO_FALL_THROUGH.has(opcode)) endBlock();
169
215
  }
170
- pairs();
171
216
  for (const reference of input.references) {
172
217
  if (inside(reference.from, input.changed)) continue;
173
218
  if (reference.kind === "call" || reference.kind === "jump" || reference.kind === "pointer") flows.push({ from: reference.from, to: reference.to });
@@ -275,11 +320,10 @@ export function planDrops(input: DropInput): DropPlan {
275
320
 
276
321
  // Data: a region of a droppable type that no run touched and that nothing that stays names.
277
322
  const gone = [...input.drop, ...droppedCode];
278
- const imageStart = Math.min(...input.segments.map((segment) => segment.start));
279
323
  const units = automatic
280
324
  ? regions.filter((region) => {
281
325
  if (!DROPPABLE_DATA.includes(region.type) || gone.some((range) => overlaps(range, region))) return false;
282
- if ([...input.keep, ...input.changed, VECTORS].some((range) => overlaps(range, region)) || (region.start <= imageStart && imageStart <= region.end)) return false;
326
+ if ([...input.keep, ...input.changed, VECTORS, ...(input.basic === undefined ? [] : [input.basic])].some((range) => overlaps(range, region))) return false;
283
327
  for (let address = region.start; address <= region.end; address++) if (touched(address)) return false;
284
328
  return true;
285
329
  })
@@ -377,7 +421,7 @@ export function rewriteTest(text: string, name: string, symbols: ReadonlyMap<str
377
421
  if (inside(address, free)) return { reason: `it names ${location}, which is in a free range` };
378
422
  } else if (!symbols.has(location)) return { reason: `it names ${location}, which the exported program does not have` };
379
423
  }
380
- const side = (program: string) => ({ program: `${program}.prg`, symbols: `${program}.json` });
424
+ const side = (program: string) => ({ program: `${program}.prg`, symbols: symbolsPath(`${program}.prg`) });
381
425
  if (scenario) {
382
426
  // Both sides are the exported program now: a step of the original alone (for example a key for its intro) goes, and a step of the rebuild alone runs on both sides.
383
427
  const { original: _original, rebuild: _rebuild, steps, ...rest } = test;
@@ -389,7 +433,7 @@ export function rewriteTest(text: string, name: string, symbols: ReadonlyMap<str
389
433
  return { kind: "scenario", text: `${JSON.stringify({ ...rest, original: side(`baseline/${name}`), rebuild: side(`build/${name}`), steps: both }, null, 2)}\n` };
390
434
  }
391
435
  const start = test.start as Record<string, unknown>;
392
- const symbolsFile = test.symbols === undefined || test.symbols === "none" ? {} : { symbols: `build/${name}.json` };
436
+ const symbolsFile = test.symbols === undefined || test.symbols === "none" ? {} : { symbols: symbolsPath(`build/${name}.prg`) };
393
437
  return { kind: "run", text: `${JSON.stringify({ ...test, start: { ...start, program: `build/${name}.prg` }, ...symbolsFile }, null, 2)}\n` };
394
438
  }
395
439
 
@@ -417,7 +461,7 @@ export function readmeText(input: ReadmeInput): string {
417
461
  "",
418
462
  "## Build",
419
463
  "",
420
- `Assemble \`src/${input.entryFile}\` to \`build/${name}.prg\`, with its symbols in \`build/${name}.json\`.`,
464
+ `Assemble \`src/${input.entryFile}\` to \`build/${name}.prg\`, with its symbols in \`${symbolsPath(`build/${name}.prg`)}\`.`,
421
465
  input.entryFile === "main.asm"
422
466
  ? "Compare the build with the program in the project knowledge: the source must give that program."
423
467
  : "Assemble `src/main.asm` to `.c64-re-tools/local/program.prg`, and compare it with the program in the project knowledge: the source must give that program.",
@@ -449,7 +493,7 @@ export function readmeText(input: ReadmeInput): string {
449
493
  "## Files",
450
494
  "",
451
495
  `- \`src/\`: the source. You own it now: change it as you like.`,
452
- `- \`baseline/${name}.prg\` and \`baseline/${name}.json\`: the exported program and its symbols, the reference of the scenarios.`,
496
+ `- \`baseline/${name}.prg\` and \`${symbolsPath(`baseline/${name}.prg`)}\`: the exported program and its symbols, the reference of the scenarios.`,
453
497
  "- `tests/`: the tests.",
454
498
  "- `.c64-re-tools/knowledge/`: the names, comments and memory map of the exported program. They do not follow your changes to the source.",
455
499
  "",