@henols/c64-re-tools 2.8.0-rc.1 → 2.8.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/package.json +1 -1
  2. package/skills/c64-assembler/SKILL.md +7 -4
  3. package/skills/c64-assembler/scripts/assembler.ts +73 -44
  4. package/skills/c64-disk/scripts/disk.ts +3 -3
  5. package/skills/c64-disk/scripts/lib/containers.ts +2 -2
  6. package/skills/c64-docs/SKILL.md +1 -1
  7. package/skills/c64-docs/scripts/docs.ts +12 -20
  8. package/skills/c64-docs/scripts/lib/links.ts +1 -1
  9. package/skills/c64-docs/scripts/lib/markdown.ts +1 -1
  10. package/skills/c64-docs/scripts/lib/reference.ts +59 -13
  11. package/skills/c64-knowledge/SKILL.md +17 -8
  12. package/skills/c64-knowledge/scripts/knowledge.ts +200 -218
  13. package/skills/c64-knowledge/scripts/lib/check.ts +2 -3
  14. package/skills/c64-knowledge/scripts/lib/listing.ts +62 -31
  15. package/skills/c64-packer/scripts/packer.ts +3 -3
  16. package/skills/c64-provenance/SKILL.md +28 -18
  17. package/skills/c64-provenance/scripts/lib/compare.ts +31 -21
  18. package/skills/c64-provenance/scripts/lib/leftovers.ts +17 -35
  19. package/skills/c64-provenance/scripts/lib/library.ts +10 -10
  20. package/skills/c64-provenance/scripts/lib/runtime.ts +3 -14
  21. package/skills/c64-provenance/scripts/provenance.ts +144 -113
  22. package/skills/c64-source/SKILL.md +6 -1
  23. package/skills/c64-source/references/loader.md +2 -1
  24. package/skills/c64-source/scripts/lib/export.ts +54 -301
  25. package/skills/c64-source/scripts/lib/loader.ts +31 -51
  26. package/skills/c64-source/scripts/lib/source.ts +53 -45
  27. package/skills/c64-source/scripts/lib/stage.ts +9 -25
  28. package/skills/c64-source/scripts/source.ts +134 -294
  29. package/skills/c64-static-analysis/SKILL.md +13 -7
  30. package/skills/c64-static-analysis/scripts/lib/coverage.ts +1 -3
  31. package/skills/c64-static-analysis/scripts/lib/findings.ts +16 -3
  32. package/skills/c64-static-analysis/scripts/lib/idioms.ts +98 -19
  33. package/skills/c64-static-analysis/scripts/lib/triage.ts +112 -0
  34. package/skills/c64-static-analysis/scripts/static-analysis.ts +249 -147
  35. package/skills/c64-testing/SKILL.md +13 -7
  36. package/skills/c64-testing/scripts/lib/diff-files.ts +6 -13
  37. package/skills/c64-testing/scripts/lib/recording.ts +47 -66
  38. package/skills/c64-testing/scripts/lib/replay.ts +53 -9
  39. package/skills/c64-testing/scripts/lib/runs.ts +11 -29
  40. package/skills/c64-testing/scripts/lib/scenario.ts +30 -31
  41. package/skills/c64-testing/scripts/lib/start-screen.ts +42 -5
  42. package/skills/c64-testing/scripts/testing.ts +32 -7
  43. package/skills/c64-unpacker/SKILL.md +9 -7
  44. package/skills/c64-unpacker/scripts/lib/evidence.ts +23 -38
  45. package/skills/c64-unpacker/scripts/lib/loads.ts +24 -39
  46. package/skills/c64-unpacker/scripts/lib/machine.ts +38 -18
  47. package/skills/c64-unpacker/scripts/lib/stages.ts +124 -40
  48. package/skills/c64-unpacker/scripts/unpacker.ts +81 -68
  49. package/skills/emulator/SKILL.md +1 -0
  50. package/src/c64.ts +133 -10
  51. package/src/cli/ap-sdk.ts +1 -1
  52. package/src/cli/cleanup.ts +4 -2
  53. package/src/compare.ts +36 -16
  54. package/src/errors.ts +10 -1
  55. package/src/host/main.ts +2 -1
  56. package/src/host/server.ts +7 -11
  57. package/src/host/tools/c1541.ts +9 -3
  58. package/src/host/vice/adapter.ts +20 -43
  59. package/src/host/vice/binary-monitor.ts +22 -21
  60. package/src/host/vice/process.ts +31 -40
  61. package/src/host/vice/session.ts +187 -247
  62. package/src/host/vice/text-monitor.ts +3 -3
  63. package/src/host-client/autostart.ts +1 -1
  64. package/src/host-client/connect.ts +2 -1
  65. package/src/host-client/coverage.ts +0 -3
  66. package/src/host-client/entry-state.ts +4 -11
  67. package/src/host-client/image.ts +6 -11
  68. package/src/host-client/steps.ts +13 -113
  69. package/src/host-client/tools.ts +4 -4
  70. package/src/host-client/transfer.ts +10 -0
  71. package/src/host-client/vice-session.ts +10 -6
  72. package/src/knowledge/code-reach.ts +364 -0
  73. package/src/knowledge/conflicts.ts +34 -72
  74. package/src/knowledge/database.ts +40 -28
  75. package/src/knowledge/evidence.ts +2 -2
  76. package/src/knowledge/graph.ts +3 -3
  77. package/src/knowledge/history.ts +50 -90
  78. package/src/knowledge/import.ts +28 -68
  79. package/src/knowledge/join.ts +1 -1
  80. package/src/knowledge/names.ts +12 -7
  81. package/src/knowledge/program.ts +59 -72
  82. package/src/knowledge/read.ts +104 -100
  83. package/src/knowledge/schema.ts +9 -3
  84. package/src/knowledge/separate.ts +175 -80
  85. package/src/knowledge/start-screen.ts +7 -5
  86. package/src/knowledge/text.ts +56 -33
  87. package/src/knowledge/write.ts +274 -515
  88. package/src/loader.ts +7 -25
  89. package/src/mcp/inputs.ts +3 -3
  90. package/src/mcp/server.ts +19 -38
  91. package/src/mcp/session-source.ts +2 -1
  92. package/src/mcp/tools/debug.ts +97 -24
  93. package/src/mcp/tools/execution.ts +1 -1
  94. package/src/mcp/tools/input.ts +3 -3
  95. package/src/mcp/tools/machine.ts +3 -3
  96. package/src/mcp/tools/media.ts +4 -4
  97. package/src/mcp/tools/memory.ts +13 -17
  98. package/src/mcp/tools/video.ts +11 -25
  99. package/src/native/acme.ts +3 -3
  100. package/src/native/c64run.ts +2 -1
  101. package/src/native/decompiler/analyze.ts +11 -8
  102. package/src/native/decompiler/walk.ts +3 -4
  103. package/src/native/decompiler/wasm.ts +2 -2
  104. package/src/native/discover.ts +1 -1
  105. package/src/native/dxa.ts +9 -11
  106. package/src/native/exomizer.ts +1 -1
  107. package/src/native/processes.ts +4 -1
  108. package/src/native/run.ts +3 -3
  109. package/src/native/types.ts +9 -8
  110. package/src/opcodes.ts +3 -0
  111. package/src/platform.ts +9 -10
  112. package/src/program-code.ts +151 -0
  113. package/src/project.ts +8 -5
  114. package/src/protocol/framing.ts +51 -18
  115. package/src/protocol/messages.ts +1 -11
  116. package/src/protocol/tools.ts +0 -3
  117. package/src/protocol/vice.ts +588 -773
  118. package/src/script.ts +25 -23
  119. package/src/time.ts +1 -1
  120. package/src/trace.ts +3 -2
@@ -121,7 +121,7 @@ Each flag applies only to the commands in the table. On another command, the scr
121
121
  | `--seed <n>` | `sample` | A whole number from 0 to 999999 that selects the sample. Without it, the script selects one. |
122
122
  | `--placement <line\|side>` | `verdict` | The placement of the comment. Give it when the sample has a line and a side comment at the address. |
123
123
  | `--class <class>` | `verdict` | With `wrong`: the class of the error: `callers`, `bits`, `registers`, `bounds`, `units`, `paths`, `tables`, `hardware`, `place` or `scope`. |
124
- | `--why <text>` | `verdict` | With `wrong`: the evidence, with the addresses and the instructions. With `unsure`: the run that can show the claim. |
124
+ | `--why <text>` | `verdict` | With `wrong`: the evidence, with the addresses and the instructions. With `unsure`: the run that can show the claim. With `correct`: the evidence. It is optional. |
125
125
  | `--text <text>` | `verdict` | With `wrong`: the correct comment. |
126
126
  | `--name <name>` | `verdict` | With `wrong`: the correct name at the address. |
127
127
  | `--max-listed <n>` | `search`, `symbols`, `regions`, `comments`, `references`, `suppressions`, `modules`, `operands`, `patches`, `switches`, `releases`, `macros`, `uses`, `spaces`, `history`, `revisions`, `revision`, `listing`, `join`, `checks` | The most items in each list of the body. The default is 50. The counts are always complete. |
@@ -140,7 +140,7 @@ Each flag applies only to the commands in the table. On another command, the scr
140
140
  | `--out <file>` | `export` | Necessary. The JSON file to write. |
141
141
  | `--apply` | `join` | Write the joined writes to the project knowledge as one revision. Without it, `join` writes nothing. |
142
142
  | `--code` | `listing` | Only the instructions of the code regions. No data lines. |
143
- | `--out <file>` | `listing` | Write the listing as text to this file in place of the lines in the body. |
143
+ | `--out <file>` | `listing` | Write the lines to this text file in place of the lines in the body. |
144
144
  | `--element <n>` | `classify` | The bytes of one element of a table. The length of the range must be a multiple of it. |
145
145
  | `--title <text>` | `module` | The title of the file. A `module` write without a title keeps the title that the module has. |
146
146
  | `--lo <symbol>` | `operand` | The operand is the low byte of the symbol plus the offset. |
@@ -258,11 +258,20 @@ When a git merge left conflicts in the knowledge, each read body also has `confl
258
258
 
259
259
  ### `listing <range>`
260
260
 
261
- - `body.lines` has `count` and `listed`. Each line has `address`, `bytes`, `text`, `referencesIn` and `referencesOut`. It can also have `label`, `analyzerNames`, `lineComments` (the line comments before the line), `comment` (the side comment) and `access`.
262
- - `text` is the instruction with the names of its target. An operand expression of the knowledge replaces the operand. A table of addresses or words shows its values as `!word` lines, with the name of each target. A split table and the other bytes show as `!byte` lines.
263
- - `access` is there when the knowledge has coverage: `x`, `r`, `w` or `-`. See "Reads that the program does not do" of `<skill>/references/coverage.md`.
264
- - With `--code`, `lines` has only the instructions of the code regions.
265
- - With `--out`, `body.lines` is a number, and the body has `out`, `bytes` and `sha256` of the text file.
261
+ - `body.lines` has `count` and `listed`. Each item of `listed` is one text line. Read the lines as they are. Do not filter them with code.
262
+ - A line of the program has these parts, with two spaces between them. A part that the line does not have is not there.
263
+ 1. The address, for example `$09bc`.
264
+ 2. The bytes, as hex.
265
+ 3. The access, when the knowledge has coverage: `x` (executed), `r` (read) and `w` (written) as the runs did them, for example `xr`, or `-` for none. See "Reads that the program does not do" of `<skill>/references/coverage.md`.
266
+ 4. The ACME line. The name of the address comes first, with a colon after it, for example `draw_room: lda SCROLY`.
267
+ 5. The notes, after `;` and with `|` between them: the side comment, `refs in <n> out <n>` (the references to the line and from the line), and `also <names>` (the analyzer names).
268
+ - Example: `$09bc ad 11 d0 x draw_room: lda SCROLY ; refs in 3 out 1 | also FUN_09bc`.
269
+ - A line comment is a line of its own before its line, for example `; Draws the room.`.
270
+ - The ACME line is the instruction with the names of its target. An operand expression of the knowledge replaces the operand. A table of addresses or words shows its values as `!word` lines, with the name of each target. A split table and the other bytes show as `!byte` lines.
271
+ - The names are the names of the generated source. A platform name of a ROM shows only when the program uses that ROM. A line in the I/O area (`$D000-$DFFF`) gets no platform name, because that name is the name of the register and not of the RAM. A target inside a data region shows as `<name>+<offset>` only when a symbol is at the start of the region.
272
+ - A range outside the program has no lines. Then the `hint` gives the ranges where the program has bytes.
273
+ - With `--code`, `lines` has only the instructions of the code regions and their line comments.
274
+ - With `--out`, the text file has the lines, one on each line. `body.lines` is the number of lines, and the body has `out`, `bytes` and `sha256` of the text file.
266
275
  - Use `listing` in place of your own disassembler. To find the targets of a table, classify the table with its type. Then read its listing. Do not decode the bytes of a table yourself.
267
276
 
268
277
  ### `export`
@@ -309,7 +318,7 @@ Errors of this group:
309
318
  - `conflict` with "from a git merge": git joined the knowledge of two computers, and two rows are current where the knowledge permits one row. Run `merge`. Then write again.
310
319
  - `stale-revision`: the knowledge changed after the revision of `--expect-revision`. Read the knowledge again. Then decide again.
311
320
  - `not-found`: there is nothing to remove, no such revision, or no such file.
312
- - `invalid-database` or `unsupported-schema`: give `error` and `hint` to the user. Do not edit the knowledge files.
321
+ - `invalid-database`: give `error` and `hint` to the user. Do not edit the knowledge files.
313
322
 
314
323
  ### `rename <address> <name>`
315
324