@henols/c64-re-tools 2.0.0-rc.15 → 2.0.0-rc.16

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.0.0-rc.15",
3
+ "version": "2.0.0-rc.16",
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",
@@ -136,7 +136,7 @@ One JSON object:
136
136
  - `patchesNotWritten`: the patches that the source does not have, each with its range, `switch` and `reason`.
137
137
  - `check`: `identical`, and the result for each segment. A different segment gives its first different address.
138
138
  - `switches`: the build of each switch. Each item has the `define` for the c64-assembler skill, the patches and the `result` of the build with the switch on. `fits` tells that the build is good, and `changedBytes` counts the changed bytes. `overflow` tells that the code of a patch is longer than its range. `changes outside` gives the first byte outside the ranges that changed. `does not assemble` gives the diagnostics of ACME. `insideNames` lists the labels inside a patch. Code that writes to one of these labels changes the patch when the switch is on.
139
- - `loader`: the program, the copies in their order, the copier page, `stackByte`, `verified` and `differences`. `limits` lists the CIA values that the loader cannot set. When the script cannot make the loader, `loader` has `verified: false` and a `reason`. The loader includes the source. Thus a source that does not assemble to the image also stops the loader.
139
+ - `loader`: the program, the copies in their order, the copier page, `stackByte`, `verified` and `differences`. `limits` lists the CIA values that the loader cannot set. An entry state from an old capture has no CIA values. Then `limits` tells you to capture the program again. When the script cannot make the loader, `loader` has `verified: false` and a `reason`. The loader includes the source. Thus a source that does not assemble to the image also stops the loader.
140
140
 
141
141
  The exit status is 0 when the source is identical and the emulator check of the loader passes. The exit status is 1 for a failed check, for an entry in no segment, and for an error. A patch that the source does not have, or a switch that does not fit, also gives 1. The exit status is 2 for a wrong argument.
142
142
 
@@ -30,7 +30,7 @@ import { GHIDRA_LIMITS, type AssembledSymbol, type Diagnostic } from "#src/nativ
30
30
  import { describeAddress, platformNames } from "#src/platform.ts";
31
31
  import { resolveProjectPath } from "#src/project.ts";
32
32
  import { runScript, UsageError } from "#src/script.ts";
33
- import { LOADER_JUMP, planLoader, rasterLine, readEntryState, simulate, VIC_DISPLAY_REGISTERS, type EntryState, type LoaderPlan } from "./lib/loader.ts";
33
+ import { LOADER_JUMP, loaderLimits, planLoader, rasterLine, readEntryState, simulate, VIC_DISPLAY_REGISTERS, type EntryState, type LoaderPlan } from "./lib/loader.ts";
34
34
  import { OPCODES } from "./lib/opcodes.ts";
35
35
  import { entriesInData, entryOutsideImage, instructionText, layout, literalOperand, probeForms, render, switchesOf, type Layout, type PatchBlock, type Range, type Rendered } from "./lib/source.ts";
36
36
 
@@ -672,7 +672,7 @@ async function run(argv: string[]): Promise<{ output: Record<string, unknown>; f
672
672
  stackByte: formatC64Address(loader.stackByte),
673
673
  ...ran,
674
674
  // What the loader cannot set as it was at the entry (D63).
675
- ...(loader.cia === undefined || loader.cia.limits.length === 0 ? {} : { limits: loader.cia.limits }),
675
+ ...(loaderLimits(loader).length === 0 ? {} : { limits: loaderLimits(loader) }),
676
676
  };
677
677
  return { output, failed: !ran.verified || sourceFailed };
678
678
  }
@@ -129,6 +129,17 @@ export interface LoaderPlan {
129
129
  cia?: CiaPlan;
130
130
  }
131
131
 
132
+ /**
133
+ * What the loader cannot set as it was at the entry (D63). An entry state
134
+ * without CIA values (from a capture before D63) gives no timers at all.
135
+ */
136
+ export function loaderLimits(plan: { cia?: CiaPlan }): string[] {
137
+ if (plan.cia === undefined) {
138
+ return ["The entry state has no CIA values, so the loader does not set the CIA timers. Capture the program again with c64-unpacker to get them."];
139
+ }
140
+ return plan.cia.limits;
141
+ }
142
+
132
143
  /** The label of the loader's jump to the entry, in ACME's symbol list. */
133
144
  export const LOADER_JUMP = "c64_source_loader_jump";
134
145