@henols/c64-re-tools 2.5.1-rc.1 → 2.5.1-rc.2

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.5.1-rc.1",
3
+ "version": "2.5.1-rc.2",
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",
@@ -87,7 +87,7 @@ Each flag applies only to the commands in the table. On another command, the scr
87
87
  | `--set-pc <address>` | `build` | The start address when the source does not set one, for example `'$0801'`. |
88
88
  | `--release <label>` | `build` | Build a release of the project knowledge. Each switch gets the value of that release. With `--compare`, the reference is the file of the release. |
89
89
  | `--compare` | `build` | Compare the program byte by byte with the program in the project knowledge, or with the file of `--release`, segment by segment. Off by default. |
90
- | `--space <space>` | `build` | The space of the program in the project knowledge: `c64`, `drive8`, or `bank0` to `bank255`. The default is `c64`. Give it only with `--compare` or `--release`. |
90
+ | `--space <space>` | `build` | The space of the program in the project knowledge: `c64`, `drive8`, `loading`, or `bank0` to `bank255`. The default is `c64`. Give it only with `--compare` or `--release`. |
91
91
  | `--plain` | `build` | Write only the bytes of the program, without the 2-byte load address. Off by default. |
92
92
  | `--all-symbols` | `build` | List also the constants that the source does not use. Off by default. |
93
93
  | `--max-listed <n>` | `build` | List at most `n` symbols. The default is 50. `symbols.count` always gives the count of all symbols. |
@@ -45,7 +45,7 @@ await runScript({
45
45
  "set-pc": { kind: "address", value: "<address>", help: "the start address when the source sets none, for example '$0801'" },
46
46
  release: { kind: "text", value: "<label>", help: `build a release of the knowledge: defines ${RELEASE_DEFINE}<label>=1, so each switch has the value of that release. With --compare, the reference is the file of the release` },
47
47
  compare: { kind: "flag", help: "check the program byte by byte against the program in the knowledge (or the file of --release), each segment" },
48
- space: { kind: "space", value: "<space>", help: "with --compare or --release: the knowledge space of the program: c64 (the default), drive8, or bank0 to bank255" },
48
+ space: { kind: "space", value: "<space>", help: "with --compare or --release: the knowledge space of the program: c64 (the default), drive8, loading, or bank0 to bank255" },
49
49
  plain: { kind: "flag", help: "write the bytes only, without the 2-byte load address of a PRG" },
50
50
  "all-symbols": { kind: "flag", help: "list also the constants that the source does not use" },
51
51
  "max-listed": { ...OPTIONS["max-listed"], help: "list at most n symbols (default 50). The count is always given" },
@@ -53,7 +53,7 @@ The knowledge is text in `.c64-re-tools/knowledge/` of the project. Commit that
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` |
56
- | Record the start screen of a captured stage, and its tune | `start-screen --stage bank1 --call '$9000'` |
56
+ | Record the start screen of a captured stage, and its tune | `start-screen --stage loading --call '$9000'` |
57
57
  | Remove the start screen | `unstart-screen` |
58
58
  | Write a macro | `macro inc16 --params dst --body-file inc16.asm` |
59
59
  | Write instructions as one use of a macro | `use '$1005-$100a' inc16 --args ptr` |
@@ -72,7 +72,7 @@ The knowledge is text in `.c64-re-tools/knowledge/` of the project. Commit that
72
72
  - An analyzer name is a second name from DXA, Ghidra or an idiom search, for example `FUN_17e2`. Each analyzer keeps its own name at an address. Get them from `at`, `search` or `symbols --analyzer`.
73
73
  - The generated source uses only the symbols. To use an analyzer name in the source, give the address that name with `rename`.
74
74
  - A symbol name is a label for ACME: a letter or an underscore, then letters, digits or underscores. The knowledge refuses the name of a 6502 instruction, for example `lda`, in upper or lower case.
75
- - A space is `c64` (the default), `drive8` for code in the 1541 drive, or `bank0` to `bank255` for cartridge banks and for a captured stage of the loading. Drive code, banks and stages use the same addresses as the C64. Thus each space has its own knowledge. A name is unique in one space.
75
+ - A space is `c64` (the default), `drive8` for code in the 1541 drive, `loading` or `bank0` to `bank255`. `loading` is the captured stage of the loading that shows the start screen. `bank0` to `bank255` are cartridge banks. Drive code, the stage and banks use the same addresses as the C64. Thus each space has its own knowledge. A name is unique in one space.
76
76
  - A revision id has the form `20261015T214501.123-k3f9qz`. It starts with the date and the time. Give the full id, or a start of the id that only one revision has. Get the ids from `revisions`, or from the `revision` field of a result. The revision `0` is the knowledge before the first revision.
77
77
  - A file of a capture is the `image.json` that the capture of a packed program wrote. Keep the other files of the capture next to it.
78
78
 
@@ -102,7 +102,7 @@ Each flag applies only to the commands in the table. On another command, the scr
102
102
 
103
103
  | Flag | Command | Effect |
104
104
  |---|---|---|
105
- | `--space <space>` | All commands | The space of the command: `c64`, `drive8`, or `bank0` to `bank255`. The default is `c64`. Without `--space`, `revert` reverts all spaces. |
105
+ | `--space <space>` | All commands | The space of the command: `c64`, `drive8`, `loading`, or `bank0` to `bank255`. The default is `c64`. Without `--space`, `revert` reverts all spaces. |
106
106
  | `--by <user\|llm>` | All commands in "Change the knowledge" | Who decided the change. The default is `llm`. Give `user` only when the user decided the change. |
107
107
  | `--reason <text>` | All commands in "Change the knowledge" | Why you make the change. The revision keeps it, and `history` shows it. |
108
108
  | `--evidence <kind:ref>` | All commands in "Change the knowledge" | One thing that the change rests on: `coverage:<map>`, `test:<file>`, `file:<file>` or `note:<text>`. You can give it more than one time. |
@@ -150,7 +150,7 @@ Each flag applies only to the commands in the table. On another command, the scr
150
150
  | `--colour <0-15>` | `start-screen` | One colour for all of the colour RAM, in place of `--colours`. |
151
151
  | `--border <0-15>` | `start-screen` | The border colour. Necessary without `--stage`. |
152
152
  | `--background <0-15>` | `start-screen` | The background colour. Necessary without `--stage`. |
153
- | `--stage <space>` | `start-screen` | The space of a captured stage that shows the screen, for example `bank1`. The script takes the mode, the addresses and the colours from the capture. Without it, the bytes are in the program at the entry. |
153
+ | `--stage <space>` | `start-screen` | The space of the captured stage that shows the screen: `loading`. The script takes the mode, the addresses and the colours from the capture. Without it, the bytes are in the program at the entry. |
154
154
  | `--call <address>` | `start-screen` | A routine of the stage that the start screen calls before it waits, for example the start of the loading tune. It must return with RTS. It needs `--stage`. |
155
155
 
156
156
  ---
@@ -414,9 +414,9 @@ A start screen is a loading screen, a title screen or a presentation screen of t
414
414
  Use this when a stage of the loading shows the screen, and the program at the entry does not have it. Do these steps:
415
415
 
416
416
  1. Capture the stage while it shows the screen. Do not exclude the memory of the screen.
417
- 2. Put the capture into the knowledge in a space of its own, for example `image stage/image.json --space bank1`.
418
- 3. If the stage plays a tune or does other work during the screen, find the routine that starts it. Run the stage with coverage while that routine runs. Put the map into the knowledge with `coverage <map> --space bank1`.
419
- 4. Record the start screen with `start-screen --stage bank1`, and with `--call` for the routine.
417
+ 2. Put the capture into the knowledge in the space `loading`: `image stage/image.json --space loading`. Do not use another space for it.
418
+ 3. If the stage plays a tune or does other work during the screen, find the routine that starts it. Run the stage with coverage while that routine runs. Put the map into the knowledge with `coverage <map> --space loading`.
419
+ 4. Record the start screen with `start-screen --stage loading`, and with `--call` for the routine.
420
420
 
421
421
  - The script takes the mode, the screen, the bitmap or the charset, the colours and the colour RAM from the capture. Do not find the addresses or the colours yourself.
422
422
  - The generated source puts the screen in memory. It does not matter where the stage keeps its bytes, if the memory has enough room.
@@ -949,7 +949,7 @@ const WRITE_COMMANDS: CommandSpec[] = [
949
949
  colour: { kind: "count", value: "<0-15>", min: 0, max: 15, help: "one colour for all of the colour RAM, in place of --colours" },
950
950
  border: { kind: "count", value: "<0-15>", min: 0, max: 15, help: "the border colour. Necessary without --stage" },
951
951
  background: { kind: "count", value: "<0-15>", min: 0, max: 15, help: "the background colour. Necessary without --stage" },
952
- stage: { kind: "text", value: "<space>", help: "the space of a captured stage that shows the screen, for example bank1. The script takes the mode, the addresses and the colours from the capture of the stage. Without it, the bytes are in the program at the entry" },
952
+ stage: { kind: "text", value: "<space>", help: "the space of the captured stage that shows the screen: loading. The script takes the mode, the addresses and the colours from the capture of the stage. Without it, the bytes are in the program at the entry" },
953
953
  call: { kind: "address", value: "<address>", help: "a routine of the stage that the start screen calls before it waits, for example the routine that starts the loading tune. It must return with RTS. Needs --stage" },
954
954
  comment: { kind: "text", value: "<text>", help: "what the screen is" },
955
955
  },
@@ -1087,7 +1087,7 @@ const WRITE_COMMANDS: CommandSpec[] = [
1087
1087
  name: "revert",
1088
1088
  summary: "Makes the knowledge the same as at one revision: all spaces, or with --space only that space. The revert is a new revision: the history stays complete.",
1089
1089
  subjects: [REVISION],
1090
- options: { space: { kind: "space", value: "<space>", help: "revert only this space: c64, drive8, or bank0 to bank255. The other spaces do not change. Without --space, every space reverts" } },
1090
+ options: { space: { kind: "space", value: "<space>", help: "revert only this space: c64, drive8, loading, or bank0 to bank255. The other spaces do not change. Without --space, every space reverts" } },
1091
1091
  },
1092
1092
  (call) => {
1093
1093
  const context = contextOf(call);
@@ -1265,7 +1265,7 @@ function batchFields(fields: Record<string, unknown>, at: string, address: (text
1265
1265
 
1266
1266
  await runScript({
1267
1267
  name: "knowledge",
1268
- summary: "Reads and writes the knowledge of the project: names, regions, comments, references, the program and its coverage, and the source knowledge. A read needs no knowledge folder. Every command takes --space: c64 (the default), drive8 for 1541 drive code, or bank0 to bank255 for cartridge banks. revert without --space reverts all spaces.",
1268
+ summary: "Reads and writes the knowledge of the project: names, regions, comments, references, the program and its coverage, and the source knowledge. A read needs no knowledge folder. Every command takes --space: c64 (the default), drive8 for 1541 drive code, loading for a captured stage of the loading, or bank0 to bank255 for cartridge banks. revert without --space reverts all spaces.",
1269
1269
  names: knowledgeNames,
1270
1270
  commands: [...READ_COMMANDS, ...WRITE_COMMANDS, JOIN],
1271
1271
  });
@@ -37,7 +37,7 @@ These rules apply to each rebuild:
37
37
 
38
38
  - Do not keep a cracktro. A capture of a packed program starts at the last stage, so the code of a cracktro is not in the program. When the capture has data of a cracktro that the program does not read, capture again and exclude that range.
39
39
  - Keep the start screen of the program, for example the loading picture of the publisher. Keep its bytes in the capture, and record the start screen in the project knowledge. The loader of the rebuild then shows it and waits for a key or a fire button. Do not keep a screen of a crack, for example a picture, an intro or a credit screen of a crack group.
40
- - When the start screen is only in a stage of the loading, capture that stage while it shows the screen. Put the capture into the project knowledge in a space of its own. Then record the start screen of that stage. Keep its tune: record the routine that starts the tune as the call of the start screen.
40
+ - When the start screen is only in a stage of the loading, capture that stage while it shows the screen. Put the capture into the project knowledge in the space `loading`. Then record the start screen of that stage. Keep its tune: record the routine that starts the tune as the call of the start screen.
41
41
  - A release can change the start screen, for example with the text of a crack. Then stop and ask the user how to deal with it. Do not decide alone.
42
42
  - Keep all other bytes: unused bytes, dead code, old copies, texts and leftovers of the development. Record each one as a region with a comment. Do not remove them. The source keeps them, and the build of each release has them. The default build and the loader do not have them.
43
43
  - 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 project knowledge, and generate the source.
@@ -74,7 +74,7 @@ Each flag applies only to the commands in the table. On another command, the scr
74
74
  |---|---|---|
75
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. |
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. |
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
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. |
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. |
@@ -264,7 +264,8 @@ The start screen:
264
264
 
265
265
  - 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
266
  - 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.
267
+ - The start screen is part of the clean build only. `loader.prg` always shows it. A release build has no start screen, and `LEFTOVERS = 1` also turns it off.
268
+ - 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.
268
269
  - 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`.
269
270
 
270
271
  `loader` holds these fields:
@@ -293,7 +294,7 @@ Do these actions when `verified` is `false`:
293
294
 
294
295
  #### The start screen of a captured stage
295
296
 
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.
297
+ 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.
297
298
 
298
299
  The loader then always has the packed form, and the start screen is a program of its own in front of it:
299
300
 
@@ -977,7 +977,7 @@ export function configText(layout: Pick<Layout, "switches" | "patches" | "startS
977
977
  }
978
978
  }
979
979
  if (layout.startScreen) {
980
- out.push("", "; Start screen: on by default", `${START_SCREEN_SWITCH} = ${values.get(START_SCREEN_SWITCH) ?? 1} ; the loader shows the start screen and waits for a key or a fire button. 0 starts the program at once`);
980
+ out.push("", "; Start screen: on by default", `${START_SCREEN_SWITCH} = ${values.get(START_SCREEN_SWITCH) ?? 1} ; the loader shows the start screen and waits for a key or a fire button. 0 starts the program at once. Only the clean build has it: a release and LEFTOVERS = 1 have none`);
981
981
  }
982
982
  if (layout.leftovers.length > 0) {
983
983
  const bytes = layout.leftovers.reduce((sum, range) => sum + range.end - range.start + 1, 0);
@@ -1006,6 +1006,8 @@ function switchesText(layout: Layout): string {
1006
1006
  out.push(`!ifdef ${RELEASE_DEFINE}${release.label} {`);
1007
1007
  for (const row of layout.switches) out.push(`${INDENT}${row.name} = ${row.releases.includes(release.label) ? 1 : 0}`);
1008
1008
  if (layout.leftovers.length > 0) out.push(`${INDENT}${LEFTOVERS_SWITCH} = 1`);
1009
+ // The start screen is part of the clean build only: the build of a release is the bytes of its file.
1010
+ if (layout.startScreen) out.push(`${INDENT}${START_SCREEN_SWITCH} = 0`);
1009
1011
  out.push("}");
1010
1012
  }
1011
1013
  if (hasConfigFile(layout)) {
@@ -4,7 +4,8 @@
4
4
  ; The loader includes this file in its copier, with the interrupts off. The
5
5
  ; code uses no stack and writes only the I/O area, the colour RAM and its own
6
6
  ; bytes: the copies wrote pages 0-3 of the entry state already.
7
- ; Set START_SCREEN = 0 in config.asm to start the program at once.
7
+ ; Set START_SCREEN = 0 in config.asm to start the program at once. The start
8
+ ; screen is part of the clean build only: a release and LEFTOVERS = 1 have none.
8
9
  ; loader.asm sets these values from the start screen of the knowledge:
9
10
  ; c64_source_ss_d011, c64_source_ss_d016, c64_source_ss_d018: the VIC-II mode
10
11
  ; c64_source_ss_bank: the VIC bank, as bits 0-1 of $dd00
@@ -19,8 +20,9 @@
19
20
  ; wait, so each read of the keyboard and the joysticks is done with SEI.
20
21
 
21
22
  !ifndef START_SCREEN { START_SCREEN = 1 }
23
+ !ifndef LEFTOVERS { LEFTOVERS = 0 }
22
24
 
23
- lda #START_SCREEN
25
+ lda #START_SCREEN & (1 - LEFTOVERS)
24
26
  bne .on
25
27
  jmp .end
26
28
  .port !byte 0
@@ -1711,7 +1711,7 @@ await runScript({
1711
1711
  options: {
1712
1712
  out: { ...OPTIONS.out, output: "folder", value: "<dir>", help: "the folder for the source files, relative to the project folder", required: true },
1713
1713
  entry: { ...OPTIONS.entry, multiple: true, help: "an address where code starts. The entry of the program, the routines and the code regions of the knowledge are entry points too" },
1714
- space: { ...OPTIONS.space, help: "the knowledge space of the program: c64 (the default), drive8, or bank0 to bank255. --loader is for c64 only" },
1714
+ space: { ...OPTIONS.space, help: "the knowledge space of the program: c64 (the default), drive8, loading, or bank0 to bank255. --loader is for c64 only" },
1715
1715
  loader: { kind: "flag", help: "also write loader.asm and loader.prg: the loader copies the segments into place, sets the entry state of the knowledge, and jumps to the entry. It is checked in the emulator. The loader leaves out the leftovers. When the check cannot run, the script keeps the loader.prg of an earlier run" },
1716
1716
  "analyzer-names": { kind: "flag", help: "name an address that has no name of the user or the LLM, and no platform name, with its analyzer name" },
1717
1717
  "max-listed": OPTIONS["max-listed"],
@@ -260,7 +260,7 @@ Traps:
260
260
  5. Make sure that the result is the program. The code at the entry must not be the unpacker again. A segment can be data that a loader or a cracktro left, for example intro graphics. Keep it until other evidence shows that the program does not use it. Then capture again with `--exclude` for that range.
261
261
  - Exclude each range of a cracktro that the program does not read. A rebuild has no cracktro. Also exclude a picture, an intro or a credit screen of a crack.
262
262
  - Do not exclude the start screen of the program, also when the program does not read it. An example is the loading picture of the publisher. Record it as the start screen in the project knowledge. The loader of the rebuild shows it.
263
- - When the start screen is only in an earlier stage of the loading, capture that stage too, while it shows the screen. Do not exclude the memory of the screen in that capture. Put it into the project knowledge in a space of its own, for example `bank1`. The capture holds the VIC-II registers and the colour RAM, so the start screen needs nothing more.
263
+ - When the start screen is only in an earlier stage of the loading, capture that stage too, while it shows the screen. Do not exclude the memory of the screen in that capture. Put it into the project knowledge in the space `loading`. The capture holds the VIC-II registers and the colour RAM, so the start screen needs nothing more.
264
264
  - Do not exclude other unused bytes, for example leftovers of the development or an old copy of a routine. A rebuild keeps them.
265
265
  - Keep a crack change that the program reads, for example a credit text in the game. Record it as a `crack` switch in the project knowledge.
266
266
  6. Put `<out>/image.json` into the project knowledge. The knowledge keeps the segments, the entry, the entry state and the stages. After that, you do not need the files in `<out>`.
package/src/c64.ts CHANGED
@@ -33,7 +33,7 @@ export interface AddressRange {
33
33
  }
34
34
 
35
35
  /** The knowledge spaces: the C64, the 1541 drive in unit 8, and cartridge banks 0 to 255. */
36
- export const SPACE_PATTERN = /^(c64|drive8|bank(0|[1-9][0-9]?|1[0-9]{2}|2[0-4][0-9]|25[0-5]))$/;
36
+ export const SPACE_PATTERN = /^(c64|drive8|loading|bank(0|[1-9][0-9]?|1[0-9]{2}|2[0-4][0-9]|25[0-5]))$/;
37
37
 
38
38
  /** VIC-II state with its addresses as $xxxx; the other values stay numbers. */
39
39
  export function formatVicii<T extends { screenAddress: number; graphicsAddress: number }>(state: T): Omit<T, "screenAddress" | "graphicsAddress"> & { screenAddress: string; graphicsAddress: string } {
@@ -745,7 +745,7 @@ export function listSpaces(db: DatabaseSync | undefined): Space[] {
745
745
  `SELECT space FROM current_symbols UNION SELECT space FROM current_analyzer_names UNION SELECT space FROM current_regions UNION SELECT space FROM current_comments UNION SELECT space FROM current_references UNION SELECT space FROM current_suppressions UNION SELECT space FROM current_modules UNION SELECT space FROM current_operands UNION SELECT space FROM current_patches UNION SELECT space FROM current_switches UNION SELECT space FROM current_releases UNION SELECT space FROM current_macros UNION SELECT space FROM current_macro_uses UNION SELECT space FROM current_start_screens UNION SELECT space FROM current_memory UNION SELECT space FROM current_entries UNION SELECT space FROM current_coverage`,
746
746
  )
747
747
  .all() as Array<{ space: Space }>;
748
- const order = (space: Space) => (space === "c64" ? -2 : space === "drive8" ? -1 : Number(space.slice(4)));
748
+ const order = (space: Space) => (space === "c64" ? -3 : space === "drive8" ? -2 : space === "loading" ? -1 : Number(space.slice(4)));
749
749
  return rows.map((row) => row.space).sort((a, b) => order(a) - order(b));
750
750
  }
751
751
 
@@ -114,7 +114,7 @@ export function isGeneratedFile(file: string): boolean {
114
114
  */
115
115
  export type Space = string;
116
116
  export const DEFAULT_SPACE: Space = "c64";
117
- const SPACE_CHECK = "space IN ('c64', 'drive8') OR space GLOB 'bank[0-9]' OR space GLOB 'bank[1-9][0-9]' OR space GLOB 'bank[12][0-9][0-9]'";
117
+ const SPACE_CHECK = "space IN ('c64', 'drive8', 'loading') OR space GLOB 'bank[0-9]' OR space GLOB 'bank[1-9][0-9]' OR space GLOB 'bank[12][0-9][0-9]'";
118
118
 
119
119
  const list = (values: readonly string[]) => values.map((value) => `'${value}'`).join(", ");
120
120
 
@@ -399,7 +399,7 @@ function createSchema(db: DatabaseSync): void {
399
399
  }
400
400
 
401
401
  /** The version of the index this build makes. An index with another version is emptied and made again. */
402
- export const INDEX_VERSION = 12;
402
+ export const INDEX_VERSION = 13;
403
403
 
404
404
  function indexVersion(db: DatabaseSync): number | undefined {
405
405
  const hasMeta = db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'meta'").get();
package/src/script.ts CHANGED
@@ -88,7 +88,7 @@ export type OptionKind =
88
88
  | "number" // a value: $ and hex digits, decimal, or % and binary digits
89
89
  | "address" // $ and 1 to 4 hex digits, or a name
90
90
  | "range" // <start>-<end>, each an address
91
- | "space" // c64, drive8, or bank0 to bank255
91
+ | "space" // c64, drive8, loading, or bank0 to bank255
92
92
  | "choice"; // one of `choices`
93
93
 
94
94
  export interface OptionSpec {
@@ -121,7 +121,7 @@ export interface OptionSpec {
121
121
  /** The options that have one meaning in every script. A command can change the help, the value and whether it is required, never the kind. */
122
122
  export const OPTIONS = {
123
123
  out: { kind: "path", value: "<path>", help: "write the output here, relative to the project folder" },
124
- space: { kind: "space", value: "<space>", help: "the knowledge space: c64 (the default), drive8 for 1541 drive code, or bank0 to bank255 for a cartridge bank", default: "c64" },
124
+ space: { kind: "space", value: "<space>", help: "the knowledge space: c64 (the default), drive8 for 1541 drive code, loading for a captured stage of the loading, or bank0 to bank255 for a cartridge bank", default: "c64" },
125
125
  range: { kind: "range", value: "<start>-<end>", help: "only the addresses from start to end, for example '$c000-$cfff'" },
126
126
  entry: { kind: "address", value: "<address>", help: "an entry point of the program" },
127
127
  steps: { kind: "path", value: "<file>", help: "a JSON file of action steps that run after the start" },
@@ -608,7 +608,7 @@ export function parseCall(script: ScriptSpec, command: CommandSpec, argv: readon
608
608
  if (text === "") throw new UsageError(`--${name} needs a value`);
609
609
  if (spec.kind === "address" && !isAddressText(text)) throw new UsageError(`--${name} must be ${ADDRESS_FORM}, not ${JSON.stringify(text)}`);
610
610
  if (spec.kind === "range" && rangeParts(text) === undefined) throw new UsageError(`--${name} must be <start>-<end>, each ${ADDRESS_FORM}, for example '$c000-$cfff', not ${JSON.stringify(text)}`);
611
- if (spec.kind === "space" && !SPACE_PATTERN.test(text)) throw new UsageError(`--${name} must be c64, drive8, or bank0 to bank255, not ${JSON.stringify(text)}`);
611
+ if (spec.kind === "space" && !SPACE_PATTERN.test(text)) throw new UsageError(`--${name} must be c64, drive8, loading, or bank0 to bank255, not ${JSON.stringify(text)}`);
612
612
  if (spec.kind === "choice" && !(spec.choices ?? []).includes(text)) throw new UsageError(`--${name} must be one of ${(spec.choices ?? []).join(", ")}, not ${JSON.stringify(text)}`);
613
613
  if (spec.kind === "path") {
614
614
  if (spec.output === undefined) checkPath(text, `--${name}`, true);