@henols/c64-re-tools 2.4.0 → 2.5.0-rc.1
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 +1 -1
- package/skills/c64-docs/references/page-types.md +3 -3
- package/skills/c64-docs/references/style.md +3 -1
- package/skills/c64-knowledge/SKILL.md +34 -3
- package/skills/c64-knowledge/scripts/knowledge.ts +64 -1
- package/skills/c64-reverse-engineering/SKILL.md +1 -0
- package/skills/c64-source/SKILL.md +21 -9
- package/skills/c64-source/scripts/lib/export.ts +3 -0
- package/skills/c64-source/scripts/lib/loader.ts +140 -20
- package/skills/c64-source/scripts/lib/source.ts +15 -4
- package/skills/c64-source/scripts/lib/start-screen.asm +139 -0
- package/skills/c64-source/scripts/source.ts +99 -17
- package/skills/c64-unpacker/SKILL.md +3 -2
- package/src/knowledge/conflicts.ts +4 -0
- package/src/knowledge/history.ts +5 -0
- package/src/knowledge/read.ts +55 -2
- package/src/knowledge/schema.ts +32 -2
- package/src/knowledge/text.ts +19 -0
- package/src/knowledge/write.ts +122 -1
|
@@ -26,8 +26,8 @@ import { conflicts } from "#src/knowledge/conflicts.ts";
|
|
|
26
26
|
import { openForRead, withWrite } from "#src/knowledge/database.ts";
|
|
27
27
|
import { identifiers } from "#src/knowledge/expression.ts";
|
|
28
28
|
import { analyzedBytes, memoryRows, programCoverage, requireProgram, type ProgramImage } from "#src/knowledge/program.ts";
|
|
29
|
-
import { ANALYZER_NAME_ORDER, baseValue, currentRevision, listAnalyzerNames, listComments, listMacros, listMacroUses, listModules, listOperands, listPatches, listReferences, listRegions, listReleases, listSpaces, listSwitches, listSymbols, type ReleaseRow, type SymbolRow } from "#src/knowledge/read.ts";
|
|
30
|
-
import { CODE_REGION_TYPES, DEFAULT_SPACE, isSemantic, RELEASE_DEFINE, type Space } from "#src/knowledge/schema.ts";
|
|
29
|
+
import { ANALYZER_NAME_ORDER, baseValue, currentRevision, currentStartScreen, startScreenRanges, listAnalyzerNames, listComments, listMacros, listMacroUses, listModules, listOperands, listPatches, listReferences, listRegions, listReleases, listSpaces, listSwitches, listSymbols, type ReleaseRow, type SymbolRow } from "#src/knowledge/read.ts";
|
|
30
|
+
import { CODE_REGION_TYPES, DEFAULT_SPACE, isSemantic, RELEASE_DEFINE, START_SCREEN_SWITCH, type Space } from "#src/knowledge/schema.ts";
|
|
31
31
|
import { subtract, write } from "#src/knowledge/write.ts";
|
|
32
32
|
import { assemble, symbolsFileText } from "#src/native/acme.ts";
|
|
33
33
|
import { analyze } from "#src/native/ghidra/analyze.ts";
|
|
@@ -39,10 +39,28 @@ import { isoCet } from "#src/time.ts";
|
|
|
39
39
|
import { zipFiles } from "#src/zip.ts";
|
|
40
40
|
import { listed, OPTIONS, reply, runScript, UsageError, type Call, type Reply } from "#src/script.ts";
|
|
41
41
|
import { knowledgeNames } from "#src/knowledge/names.ts";
|
|
42
|
-
import {
|
|
42
|
+
import {
|
|
43
|
+
COPIER_SOURCE,
|
|
44
|
+
LOADER_JUMP,
|
|
45
|
+
loaderLimits,
|
|
46
|
+
packLoader,
|
|
47
|
+
planLoader,
|
|
48
|
+
rasterLine,
|
|
49
|
+
loaderState,
|
|
50
|
+
simulate,
|
|
51
|
+
START_SCREEN_CODE,
|
|
52
|
+
START_SCREEN_CONTINUE,
|
|
53
|
+
START_SCREEN_FILE,
|
|
54
|
+
START_SCREEN_WAIT,
|
|
55
|
+
stopCause,
|
|
56
|
+
VIC_DISPLAY_REGISTERS,
|
|
57
|
+
type EntryState,
|
|
58
|
+
type LoaderPlan,
|
|
59
|
+
type PackedLoader,
|
|
60
|
+
} from "./lib/loader.ts";
|
|
43
61
|
import { instructionWith, OPCODES } from "#src/opcodes.ts";
|
|
44
62
|
import { freeName, planDrops, readmeText, rewriteTest } from "./lib/export.ts";
|
|
45
|
-
import { CONFIG_FILE, configText, configValues, entriesInData, entryOutsideImage, hasSwitchFile, layout, literalOperand, probeForms, render, switchesOf, type Layout, type PatchBlock, type Rendered, type SourceSwitch } from "./lib/source.ts";
|
|
63
|
+
import { CONFIG_FILE, configText, configValues, entriesInData, entryOutsideImage, hasConfigFile, hasSwitchFile, layout, literalOperand, probeForms, render, switchesOf, type Layout, type PatchBlock, type Rendered, type SourceSwitch } from "./lib/source.ts";
|
|
46
64
|
|
|
47
65
|
/** At most this many diagnostics or differences of one check. */
|
|
48
66
|
const MAX_DIAGNOSTICS = 20;
|
|
@@ -87,6 +105,8 @@ function readKnowledge(space: Space, analyzerNames = false) {
|
|
|
87
105
|
releases,
|
|
88
106
|
macros: listMacros(db, undefined, space),
|
|
89
107
|
macroUses: listMacroUses(db, undefined, undefined, undefined, space),
|
|
108
|
+
// The start screen is of the C64 program: the loader shows it.
|
|
109
|
+
startScreen: space === DEFAULT_SPACE ? currentStartScreen(db, space) : undefined,
|
|
90
110
|
};
|
|
91
111
|
} finally {
|
|
92
112
|
db?.close();
|
|
@@ -409,7 +429,7 @@ function compareBuilds(built: Assembled, ranges: readonly AddressRange[], base:
|
|
|
409
429
|
* from config.asm: a define of a switch is an error, because config.asm also
|
|
410
430
|
* gives it a value. A switch without a value has its default.
|
|
411
431
|
*/
|
|
412
|
-
function withValues(files: Array<{ name: string; text: string }>, laid: Pick<Layout, "switches" | "patches">, values: ReadonlyMap<string, number>): Array<{ name: string; text: string }> {
|
|
432
|
+
function withValues(files: Array<{ name: string; text: string }>, laid: Pick<Layout, "switches" | "patches" | "startScreen">, values: ReadonlyMap<string, number>): Array<{ name: string; text: string }> {
|
|
413
433
|
return files.map((file) => (file.name === CONFIG_FILE ? { ...file, text: configText(laid, values) } : file));
|
|
414
434
|
}
|
|
415
435
|
|
|
@@ -504,14 +524,21 @@ interface LoaderRun {
|
|
|
504
524
|
verified: boolean;
|
|
505
525
|
differences: string[];
|
|
506
526
|
stop?: { pc: string; port: string; cause?: string; history: string[] };
|
|
527
|
+
/** The start screen: shown with its VIC-II values, and still waiting after START_SCREEN_FRAMES frames. */
|
|
528
|
+
startScreen?: { shown: boolean; waits: boolean; wait: string; continue: string };
|
|
507
529
|
}
|
|
508
530
|
|
|
531
|
+
/** The frames that the check of the loader lets the start screen wait without a key. */
|
|
532
|
+
const START_SCREEN_FRAMES = 50;
|
|
533
|
+
|
|
509
534
|
/** The history entries that a stop of the loader gives, so the agent sees the last instructions. */
|
|
510
535
|
const STOP_HISTORY = 16;
|
|
511
536
|
|
|
512
537
|
/** How the check of the loader runs it: the copier's address in the loader file, the file byte there, and the frames to the copier. */
|
|
513
538
|
interface LoaderRunPlan {
|
|
514
539
|
jump: number;
|
|
540
|
+
/** The wait of the start screen and the code after it, when the loader has a start screen. */
|
|
541
|
+
startScreen?: { wait: number; continue: number };
|
|
515
542
|
copierSource: number;
|
|
516
543
|
fileByte: (address: number) => number;
|
|
517
544
|
copierFrames: number;
|
|
@@ -535,6 +562,28 @@ async function runLoader(path: string, program: Buffer, plan: LoaderPlan, image:
|
|
|
535
562
|
};
|
|
536
563
|
const copier = await client.runUntil({ target: { kind: "address", address: plan.copier, space: "c64" }, timeoutFrames: run.copierFrames });
|
|
537
564
|
if (!copier.reached) return await stopped(copier.pc, false, `its copier at ${formatC64Address(plan.copier)}`);
|
|
565
|
+
// The start screen waits for a key or a fire button. The emulator cannot press a key of the keyboard matrix
|
|
566
|
+
// on each VICE, so the check lets it wait, then sets the PC to the code after the wait.
|
|
567
|
+
let screen: LoaderRun["startScreen"];
|
|
568
|
+
const screenDifferences: string[] = [];
|
|
569
|
+
if (run.startScreen !== undefined && plan.startScreen !== undefined) {
|
|
570
|
+
const labels = { wait: formatC64Address(run.startScreen.wait), continue: formatC64Address(run.startScreen.continue) };
|
|
571
|
+
const atWait = await client.runUntil({ target: { kind: "address", address: run.startScreen.wait, space: "c64" }, timeoutFrames: LOADER_FRAMES });
|
|
572
|
+
if (!atWait.reached) return await stopped(atWait.pc, true, `its start screen at ${labels.wait}`);
|
|
573
|
+
const held = await client.runUntil({ target: { kind: "address", address: run.startScreen.continue, space: "c64" }, timeoutFrames: START_SCREEN_FRAMES });
|
|
574
|
+
const vic = Buffer.from((await client.ioRead(0xd000, 0x2f)).data, "hex");
|
|
575
|
+
const bank = 3 - (Buffer.from((await client.ioRead(0xdd00, 1)).data, "hex")[0]! & 0x03);
|
|
576
|
+
const wanted = plan.startScreen;
|
|
577
|
+
const shown: Array<[number, number]> = [[0x11, wanted.d011], [0x15, 0], [0x16, wanted.d016], [0x18, wanted.d018], [0x20, wanted.border], [0x21, wanted.background]];
|
|
578
|
+
for (const [register, value] of shown) {
|
|
579
|
+
const mask = VIC_DISPLAY_REGISTERS.find((item) => item.register === register)!.mask;
|
|
580
|
+
if ((vic[register]! & mask) !== (value & mask)) screenDifferences.push(`the start screen has ${formatC64Address(0xd000 + register)} = $${(vic[register]! & mask).toString(16).padStart(2, "0")}, not $${(value & mask).toString(16).padStart(2, "0")}`);
|
|
581
|
+
}
|
|
582
|
+
if (bank !== wanted.bank) screenDifferences.push(`the start screen is in VIC bank ${bank}, not ${wanted.bank}`);
|
|
583
|
+
screen = { shown: screenDifferences.length === 0, waits: !held.reached, ...labels };
|
|
584
|
+
if (held.reached) screenDifferences.push(`the start screen did not wait: it got to ${labels.continue} without a key or a fire button`);
|
|
585
|
+
if (!held.reached) await client.registersSet("c64", { pc: run.startScreen.continue });
|
|
586
|
+
}
|
|
538
587
|
const atJump = await client.runUntil({ target: { kind: "address", address: jump, space: "c64" }, timeoutFrames: LOADER_FRAMES });
|
|
539
588
|
if (!atJump.reached) return await stopped(atJump.pc, true, `its jump to the entry at ${formatC64Address(jump)}`);
|
|
540
589
|
const memory = await readRam(client, 0x0000, 0x10000);
|
|
@@ -582,7 +631,8 @@ async function runLoader(path: string, program: Buffer, plan: LoaderPlan, image:
|
|
|
582
631
|
}
|
|
583
632
|
plan.cia.masks.forEach((mask, index) => differ(`CIA ${index + 1} interrupt mask`, chips[index]!.interruptMask, mask));
|
|
584
633
|
}
|
|
585
|
-
|
|
634
|
+
differences.unshift(...screenDifferences);
|
|
635
|
+
return { verified: differences.length === 0, differences: differences.slice(0, MAX_DIAGNOSTICS), ...(screen === undefined ? {} : { startScreen: screen }) };
|
|
586
636
|
} finally {
|
|
587
637
|
await client.close();
|
|
588
638
|
}
|
|
@@ -614,7 +664,7 @@ function sourceMapText(rendered: Rendered, space: string, revision: string | nul
|
|
|
614
664
|
}
|
|
615
665
|
|
|
616
666
|
/** The files of the loader. Only a run with --loader writes them, so only such a run removes them. */
|
|
617
|
-
const LOADER_FILES: ReadonlySet<string> = new Set(["loader.asm", "loader.prg"]);
|
|
667
|
+
const LOADER_FILES: ReadonlySet<string> = new Set(["loader.asm", "loader.prg", START_SCREEN_FILE]);
|
|
618
668
|
|
|
619
669
|
/** The start of the line of loader.asm that gives the knowledge revision of the loader. */
|
|
620
670
|
const LOADER_REVISION = "Loader generated by c64-source from knowledge revision ";
|
|
@@ -680,6 +730,8 @@ interface SourceOptions {
|
|
|
680
730
|
/** With an entry state, the loader is planned too. */
|
|
681
731
|
state?: EntryState;
|
|
682
732
|
loaderHeader?: string[];
|
|
733
|
+
/** The source of an export: no config.asm, so START_SCREEN has the default of start_screen.asm. */
|
|
734
|
+
exported?: boolean;
|
|
683
735
|
}
|
|
684
736
|
|
|
685
737
|
/**
|
|
@@ -711,6 +763,7 @@ async function buildSource(knowledge: SourceKnowledge, options: SourceOptions) {
|
|
|
711
763
|
releases: knowledge.releases.map((release) => ({ label: release.label, file: release.file, base: release.base, ...(release.comment === undefined ? {} : { comment: release.comment }) })),
|
|
712
764
|
macros: knowledge.macros,
|
|
713
765
|
macroUses: knowledge.macroUses,
|
|
766
|
+
startScreen: knowledge.startScreen !== undefined && options.exported !== true,
|
|
714
767
|
...(coverage === undefined || !options.notExecutedMarks ? {} : { coverage }),
|
|
715
768
|
// The platform names are C64 names: drive code and banks get none. A ROM that the program does not use gives none.
|
|
716
769
|
...(space === DEFAULT_SPACE ? { platform, platformLeftOut: leftOutNames(platform), describe: describeAddress, decode: decodeRegister, io: IO_RAM } : {}),
|
|
@@ -727,7 +780,18 @@ async function buildSource(knowledge: SourceKnowledge, options: SourceOptions) {
|
|
|
727
780
|
const segments = image.segments.map((segment) => ({ ...segment, files: laid.pieces.filter((piece) => piece.start >= segment.start && piece.start <= segment.end).map((piece) => piece.file) }));
|
|
728
781
|
try {
|
|
729
782
|
const entryName = laid.names.get(image.entry!);
|
|
730
|
-
loader = planLoader({
|
|
783
|
+
loader = planLoader({
|
|
784
|
+
segments,
|
|
785
|
+
byteAt: image.byteAt,
|
|
786
|
+
state,
|
|
787
|
+
entry: image.entry!,
|
|
788
|
+
...(entryName === undefined ? {} : { entryName }),
|
|
789
|
+
switches: hasSwitchFile(laid),
|
|
790
|
+
config: hasConfigFile(laid),
|
|
791
|
+
macros: laid.macros.length > 0,
|
|
792
|
+
header: options.loaderHeader ?? [],
|
|
793
|
+
...(knowledge.startScreen === undefined ? {} : { startScreen: knowledge.startScreen }),
|
|
794
|
+
});
|
|
731
795
|
} catch (error) {
|
|
732
796
|
if (!isRefusal(error)) throw error;
|
|
733
797
|
loaderRefused = error.message;
|
|
@@ -737,7 +801,7 @@ async function buildSource(knowledge: SourceKnowledge, options: SourceOptions) {
|
|
|
737
801
|
const { mark } = options;
|
|
738
802
|
const marked = (list: Array<{ name: string; text: string }>) => (mark === undefined ? list : list.map((file) => (file.name === CONFIG_FILE ? file : { ...file, text: `${mark}\n${file.text}` })));
|
|
739
803
|
const markLines = mark === undefined ? 0 : 1;
|
|
740
|
-
const loaderFiles = loader === undefined ? [] : [{ name: "loader.asm", text: loader.text }];
|
|
804
|
+
const loaderFiles = loader === undefined ? [] : [{ name: "loader.asm", text: loader.text }, ...(loader.startScreen === undefined ? [] : [{ name: START_SCREEN_FILE, text: START_SCREEN_CODE }])];
|
|
741
805
|
const numbers = new Map<number, string>();
|
|
742
806
|
const asInstructions = new Map<number, string>();
|
|
743
807
|
let rendered = render(laid, asBytes, header, numbers, asInstructions);
|
|
@@ -762,7 +826,14 @@ async function buildSource(knowledge: SourceKnowledge, options: SourceOptions) {
|
|
|
762
826
|
* loader as it loads, then every copy in its order, byte by byte. A layout
|
|
763
827
|
* other than the plan is a defect of the script.
|
|
764
828
|
*/
|
|
765
|
-
async function buildLoader(
|
|
829
|
+
async function buildLoader(
|
|
830
|
+
files: Array<{ name: string; text: string }>,
|
|
831
|
+
laid: Layout,
|
|
832
|
+
loader: LoaderPlan,
|
|
833
|
+
image: ProgramImage,
|
|
834
|
+
state: EntryState,
|
|
835
|
+
values: ReadonlyMap<string, number>,
|
|
836
|
+
): Promise<{ program: Buffer; symbols: AssembledSymbol[]; jump: number; copierSource: number; expected: (address: number) => number; startScreen?: { wait: number; continue: number } } | { diagnostics: Diagnostic[] }> {
|
|
766
837
|
const loaderBuilt = await assembleFiles(withValues(files, laid, values), "loader.asm");
|
|
767
838
|
if (loaderBuilt.program === undefined) return { diagnostics: loaderBuilt.diagnostics.slice(0, MAX_DIAGNOSTICS) };
|
|
768
839
|
const program = loaderBuilt.program;
|
|
@@ -784,7 +855,8 @@ async function buildLoader(files: Array<{ name: string; text: string }>, laid: L
|
|
|
784
855
|
const jump = symbolValue(LOADER_JUMP);
|
|
785
856
|
const wrong = simulate(memory, loader.copies, expected);
|
|
786
857
|
if (wrong !== undefined) throw new WireFailure("operation-failed", `The simulated loader writes a wrong byte at ${formatC64Address(wrong)}. This is a defect of the script.`);
|
|
787
|
-
|
|
858
|
+
const startScreen = loader.startScreen === undefined ? undefined : { wait: symbolValue(START_SCREEN_WAIT), continue: symbolValue(START_SCREEN_CONTINUE) };
|
|
859
|
+
return { program, symbols: loaderBuilt.symbols ?? [], jump, copierSource: symbolValue(COPIER_SOURCE), expected, ...(startScreen === undefined ? {} : { startScreen }) };
|
|
788
860
|
}
|
|
789
861
|
|
|
790
862
|
/** The first line of each file that generate writes. */
|
|
@@ -820,8 +892,10 @@ async function generate(call: Call): Promise<{ output: Record<string, unknown>;
|
|
|
820
892
|
// config.asm keeps the value of each switch that it already has: the user sets the switches there.
|
|
821
893
|
const configPath = resolveProjectPath(`${out}/${CONFIG_FILE}`);
|
|
822
894
|
const given = existsSync(configPath) ? configValues(readFileSync(configPath, "utf8")) : new Map<string, 0 | 1>();
|
|
823
|
-
|
|
824
|
-
const
|
|
895
|
+
// START_SCREEN is a switch of the start screen, with the default 1.
|
|
896
|
+
const configured = [...laid.switches, ...(laid.startScreen ? [{ name: START_SCREEN_SWITCH, default: 1 }] : [])];
|
|
897
|
+
const kept = new Map(configured.flatMap((row) => (given.has(row.name) ? [[row.name, given.get(row.name)!] as const] : [])));
|
|
898
|
+
const notDefault = configured.flatMap((row) => (kept.has(row.name) && kept.get(row.name) !== row.default ? [{ name: row.name, value: kept.get(row.name)!, default: row.default }] : []));
|
|
825
899
|
const removed = removeOldFiles(out, new Set(files.map((file) => file.name)), loaderWanted).map((name) => `${out}/${name}`);
|
|
826
900
|
const stale = loaderWanted || space !== DEFAULT_SPACE ? undefined : staleLoader(out, knowledge.revision);
|
|
827
901
|
const written: Written[] = withValues(files, laid, kept).map((file) => writeReported(`${out}/${file.name}`, file.text, { what: "--out" }));
|
|
@@ -930,7 +1004,7 @@ async function generate(call: Call): Promise<{ output: Record<string, unknown>;
|
|
|
930
1004
|
// The entry state is the state of the base release: the loader is built and checked with it.
|
|
931
1005
|
const loaderBuilt = await buildLoader(files, laid, loader, image, state, baseValues);
|
|
932
1006
|
if ("diagnostics" in loaderBuilt) return { output: { ...output, loader: { verified: false, reason: "loader.asm does not assemble.", diagnostics: loaderBuilt.diagnostics } }, removed, failed: true };
|
|
933
|
-
const { jump, copierSource, expected } = loaderBuilt;
|
|
1007
|
+
const { jump, copierSource, expected, startScreen } = loaderBuilt;
|
|
934
1008
|
const copierBuild = loaderBuilt.program;
|
|
935
1009
|
const fileByte = (address: number) => copierBuild[2 + address - (loader.packed?.start ?? 0x0801)]!;
|
|
936
1010
|
// The packed form: Exomizer packs the build of main.asm with the copier. Without Exomizer, or when its check fails, there is no loader.prg.
|
|
@@ -950,7 +1024,7 @@ async function generate(call: Call): Promise<{ output: Record<string, unknown>;
|
|
|
950
1024
|
const copierFrames = packed === undefined ? RUN_LIMIT_FRAMES : packed.cycles === undefined ? LOADER_FRAMES : RUN_LIMIT_FRAMES + Math.ceil(packed.cycles / PAL_FRAME_CYCLES);
|
|
951
1025
|
let ran: LoaderRun;
|
|
952
1026
|
try {
|
|
953
|
-
ran = await runLoader(loaderPath, program, loader, image, state, { jump, copierSource, fileByte, copierFrames }, expected);
|
|
1027
|
+
ran = await runLoader(loaderPath, program, loader, image, state, { jump, copierSource, fileByte, copierFrames, ...(startScreen === undefined ? {} : { startScreen }) }, expected);
|
|
954
1028
|
} catch (error) {
|
|
955
1029
|
// A loader.prg without its check does not stay: it looks like a checked loader.
|
|
956
1030
|
rmSync(resolveProjectPath(loaderPath), { force: true });
|
|
@@ -1032,7 +1106,7 @@ async function exportProject(call: Call): Promise<Record<string, unknown>> {
|
|
|
1032
1106
|
const { root: to, zip } = newProjectFolder(call.string("to")!, project);
|
|
1033
1107
|
const name = call.string("name") ?? basename(to);
|
|
1034
1108
|
if (!NAME_PATTERN.test(name)) throw new UsageError(`--name ${name}: a name has letters, digits, dots, underscores and hyphens, and starts with a letter or a digit. Give --name`);
|
|
1035
|
-
const
|
|
1109
|
+
const given = call.ranges("keep");
|
|
1036
1110
|
const drop = call.ranges("drop");
|
|
1037
1111
|
const max = call.count("max-listed")!;
|
|
1038
1112
|
const shownRange = (range: AddressRange) => ({ start: formatC64Address(range.start), end: formatC64Address(range.end) });
|
|
@@ -1048,6 +1122,9 @@ async function exportProject(call: Call): Promise<Record<string, unknown>> {
|
|
|
1048
1122
|
})();
|
|
1049
1123
|
const knowledge = readKnowledge(DEFAULT_SPACE);
|
|
1050
1124
|
const image = knowledge.program;
|
|
1125
|
+
// The VIC-II reads the start screen, and the coverage does not show those reads: it stays.
|
|
1126
|
+
const screenParts = knowledge.startScreen === undefined ? [] : startScreenRanges(knowledge.startScreen).map((part) => part.range);
|
|
1127
|
+
const keep = [...given, ...screenParts.filter((range) => image.segments.some((segment) => range.start >= segment.start && range.end <= segment.end))];
|
|
1051
1128
|
const state = image.state === undefined || image.entry === undefined ? undefined : loaderState(image.state, "the entry state of the knowledge");
|
|
1052
1129
|
|
|
1053
1130
|
// 1. The source of the knowledge must give the base release byte for byte, with every patch in it.
|
|
@@ -1161,6 +1238,7 @@ async function exportProject(call: Call): Promise<Record<string, unknown>> {
|
|
|
1161
1238
|
values: new Map(),
|
|
1162
1239
|
decoded: { instructions, dataOnly: decoded.dataOnly },
|
|
1163
1240
|
notExecutedMarks: false,
|
|
1241
|
+
exported: true,
|
|
1164
1242
|
...(state === undefined ? {} : { state, loaderHeader: [`The loader of ${name}.`, "It copies the segments into place, sets the entry state and jumps to the entry."] }),
|
|
1165
1243
|
});
|
|
1166
1244
|
if (exported.built.program === undefined) return { result: "FAIL", stage: "export", reason: "The source of the export does not assemble. This is a defect of the script.", diagnostics: exported.built.diagnostics.slice(0, MAX_DIAGNOSTICS) };
|
|
@@ -1210,6 +1288,10 @@ async function exportProject(call: Call): Promise<Record<string, unknown>> {
|
|
|
1210
1288
|
for (const { revision: _revision, ...comment } of comments) change.insertComment(comment);
|
|
1211
1289
|
for (const { revision: _revision, ...region } of exportRegions) change.insertRegion(region);
|
|
1212
1290
|
for (const { revision: _revision, ...module } of knowledge.modules) change.insertModule(module);
|
|
1291
|
+
if (knowledge.startScreen !== undefined) {
|
|
1292
|
+
const { revision: _revision, ...screen } = knowledge.startScreen;
|
|
1293
|
+
change.insertStartScreen({ ...screen, origin: "llm" });
|
|
1294
|
+
}
|
|
1213
1295
|
}),
|
|
1214
1296
|
to,
|
|
1215
1297
|
);
|
|
@@ -1218,7 +1300,7 @@ async function exportProject(call: Call): Promise<Record<string, unknown>> {
|
|
|
1218
1300
|
files.push(
|
|
1219
1301
|
put(
|
|
1220
1302
|
"README.md",
|
|
1221
|
-
readmeText({ name, project: basename(project), revision: knowledge.revision, date: isoCet().slice(0, 10), entryFile: baseline.entryFile, free, switches, tests: { written: tests.map(({ file, kind }) => ({ file, kind })), leftOut: testsLeftOut } }),
|
|
1303
|
+
readmeText({ name, project: basename(project), revision: knowledge.revision, date: isoCet().slice(0, 10), entryFile: baseline.entryFile, free, switches, tests: { written: tests.map(({ file, kind }) => ({ file, kind })), leftOut: testsLeftOut }, startScreen: exported.loader?.startScreen !== undefined }),
|
|
1222
1304
|
),
|
|
1223
1305
|
);
|
|
1224
1306
|
for (const file of exported.files) files.push(put(`src/${file.name}`, file.text));
|
|
@@ -257,7 +257,8 @@ Traps:
|
|
|
257
257
|
- Disassemble the code at the address. Make sure that it is the start of the program. The start of a program often sets the stack pointer, the interrupts and the vectors.
|
|
258
258
|
4. Run `capture` with that address in `--until` and a folder in `--out`. Give the same `--steps` as before.
|
|
259
259
|
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.
|
|
260
|
-
- Exclude each range of a cracktro that the program does not read. A rebuild has no cracktro.
|
|
260
|
+
- 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.
|
|
261
|
+
- 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.
|
|
261
262
|
- Do not exclude other unused bytes, for example leftovers of the development or an old copy of a routine. A rebuild keeps them.
|
|
262
263
|
- 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.
|
|
263
264
|
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>`.
|
|
@@ -279,7 +280,7 @@ Do not record the unpacker in the project knowledge, unless the user asks you to
|
|
|
279
280
|
]
|
|
280
281
|
```
|
|
281
282
|
|
|
282
|
-
2. Run `loads` with the steps file and a folder in `--out`. Add `--drive` when the program has its own drive code, for example a fast loader. Add `--exclude` for each range of a loader
|
|
283
|
+
2. Run `loads` with the steps file and a folder in `--out`. Add `--drive` when the program has its own drive code, for example a fast loader. Add `--exclude` for each range of a loader or of a crack that the program does not read. Do not exclude the start screen of the program.
|
|
283
284
|
3. Put `<out>/<name>/image.json` of the part that you work on into the project knowledge.
|
|
284
285
|
4. With `--drive`, put `<out>/<name>/drive8.prg` into the project knowledge in the space `drive8`. Then analyze the drive code in the space `drive8`.
|
|
285
286
|
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
PATCH_COLUMNS,
|
|
17
17
|
REFERENCE_COLUMNS,
|
|
18
18
|
RELEASE_COLUMNS,
|
|
19
|
+
START_SCREEN_COLUMNS,
|
|
19
20
|
SWITCH_COLUMNS,
|
|
20
21
|
REGION_COLUMNS,
|
|
21
22
|
SUPPRESSION_COLUMNS,
|
|
@@ -28,6 +29,7 @@ import {
|
|
|
28
29
|
toPatch,
|
|
29
30
|
toReference,
|
|
30
31
|
toRelease,
|
|
32
|
+
toStartScreen,
|
|
31
33
|
toSwitch,
|
|
32
34
|
toRegion,
|
|
33
35
|
toSuppression,
|
|
@@ -56,6 +58,7 @@ export const CONFLICT_RULES = {
|
|
|
56
58
|
switch: "two switches with one name",
|
|
57
59
|
release: "two releases with one label",
|
|
58
60
|
"release-base": "two base releases",
|
|
61
|
+
"start-screen": "two start screens",
|
|
59
62
|
macro: "two macros with one name",
|
|
60
63
|
"macro-use": "macro uses that overlap",
|
|
61
64
|
} as const;
|
|
@@ -116,6 +119,7 @@ const RULES: readonly TableRule[] = [
|
|
|
116
119
|
{ rule: "switch", table: "switches", entity: "switch", columns: SWITCH_COLUMNS, map: toSwitch, key: ["name"] },
|
|
117
120
|
{ rule: "release", table: "releases", entity: "release", columns: RELEASE_COLUMNS, map: toRelease, key: ["label"] },
|
|
118
121
|
{ rule: "release-base", table: "releases", entity: "release", columns: RELEASE_COLUMNS, map: toRelease, key: ["base"], where: "base = 1" },
|
|
122
|
+
{ rule: "start-screen", table: "start_screens", entity: "start-screen", columns: START_SCREEN_COLUMNS, map: toStartScreen, key: [] },
|
|
119
123
|
{ rule: "macro", table: "macros", entity: "macro", columns: MACRO_COLUMNS, map: toMacro, key: ["name"] },
|
|
120
124
|
{ rule: "macro-use", table: "macro_uses", entity: "macro-use", columns: MACRO_USE_COLUMNS, map: toMacroUse, key: "overlap" },
|
|
121
125
|
];
|
package/src/knowledge/history.ts
CHANGED
|
@@ -26,6 +26,8 @@ import {
|
|
|
26
26
|
toPatch,
|
|
27
27
|
toReference,
|
|
28
28
|
toRelease,
|
|
29
|
+
toStartScreen,
|
|
30
|
+
START_SCREEN_COLUMNS,
|
|
29
31
|
toSwitch,
|
|
30
32
|
toRegion,
|
|
31
33
|
toSuppression,
|
|
@@ -38,6 +40,7 @@ import {
|
|
|
38
40
|
type PatchRow,
|
|
39
41
|
type ReferenceRow,
|
|
40
42
|
type ReleaseRow,
|
|
43
|
+
type StartScreenRow,
|
|
41
44
|
type SwitchRow,
|
|
42
45
|
type RegionRow,
|
|
43
46
|
type SuppressionRow,
|
|
@@ -109,6 +112,7 @@ export type HistoryEntry =
|
|
|
109
112
|
| { entity: "patch"; row: PatchRow; from: string; to?: string }
|
|
110
113
|
| { entity: "switch"; row: SwitchRow; from: string; to?: string }
|
|
111
114
|
| { entity: "release"; row: ReleaseRow; from: string; to?: string }
|
|
115
|
+
| { entity: "start-screen"; row: StartScreenRow; from: string; to?: string }
|
|
112
116
|
| { entity: "macro"; row: MacroRow; from: string; to?: string }
|
|
113
117
|
| { entity: "macro-use"; row: MacroUseRow; from: string; to?: string };
|
|
114
118
|
|
|
@@ -265,6 +269,7 @@ export function revision(db: DatabaseSync | undefined, text: string): RevisionCh
|
|
|
265
269
|
["patch", "patches", PATCH_COLUMNS, toPatch],
|
|
266
270
|
["switch", "switches", SWITCH_COLUMNS, toSwitch],
|
|
267
271
|
["release", "releases", RELEASE_COLUMNS, toRelease],
|
|
272
|
+
["start-screen", "start_screens", START_SCREEN_COLUMNS, toStartScreen],
|
|
268
273
|
["macro", "macros", MACRO_COLUMNS, toMacro],
|
|
269
274
|
["macro-use", "macro_uses", MACRO_USE_COLUMNS, toMacroUse],
|
|
270
275
|
] as const;
|
package/src/knowledge/read.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { DatabaseSync } from "node:sqlite";
|
|
|
6
6
|
|
|
7
7
|
import type { AddressRange } from "../c64.ts";
|
|
8
8
|
import { Refusal } from "../errors.ts";
|
|
9
|
-
import { DEFAULT_SPACE, type CommentPlacement, type OperandSelect, type Origin, type ReferenceKind, type RegionType, type Space, type SuppressionEntity, type SwitchKind, type SymbolKind } from "./schema.ts";
|
|
9
|
+
import { DEFAULT_SPACE, type CommentPlacement, type OperandSelect, type Origin, type ReferenceKind, type RegionType, type Space, type StartScreenMode, type SuppressionEntity, type SwitchKind, type SymbolKind } from "./schema.ts";
|
|
10
10
|
import { NO_REVISION } from "./text.ts";
|
|
11
11
|
|
|
12
12
|
export interface SymbolRow {
|
|
@@ -126,6 +126,37 @@ export interface ReleaseRow {
|
|
|
126
126
|
revision: string;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
/**
|
|
130
|
+
* The start screen of the program: a screen of the program itself, not of a
|
|
131
|
+
* crack, that the loader of the generated source shows before the entry.
|
|
132
|
+
* A text screen has a charset, a bitmap screen has a bitmap. The colour RAM
|
|
133
|
+
* comes from 1000 bytes at `colours` or is one `colour`; a hires bitmap has none.
|
|
134
|
+
*/
|
|
135
|
+
export interface StartScreenRow {
|
|
136
|
+
space: Space;
|
|
137
|
+
mode: StartScreenMode;
|
|
138
|
+
screen: number;
|
|
139
|
+
bitmap?: number;
|
|
140
|
+
charset?: number;
|
|
141
|
+
colours?: number;
|
|
142
|
+
colour?: number;
|
|
143
|
+
border: number;
|
|
144
|
+
background: number;
|
|
145
|
+
comment?: string;
|
|
146
|
+
origin: Extract<Origin, "user" | "llm">;
|
|
147
|
+
revision: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** The memory that a start screen shows: each part with its range. A ROM charset is not RAM, so it has no range. */
|
|
151
|
+
export function startScreenRanges(row: Pick<StartScreenRow, "screen" | "bitmap" | "charset" | "colours">): Array<{ what: string; range: AddressRange }> {
|
|
152
|
+
const part = (what: string, start: number | undefined, size: number) => (start === undefined ? [] : [{ what, range: { start, end: start + size - 1 } }]);
|
|
153
|
+
const romFont = row.charset !== undefined && isRomFont(row.charset);
|
|
154
|
+
return [...part("screen", row.screen, 1000), ...part("bitmap", row.bitmap, 8000), ...(romFont ? [] : part("charset", row.charset, 2048)), ...part("colours", row.colours, 1000)];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** True for a charset address where the VIC-II reads the character ROM: $1000 or $1800 in VIC bank 0 or 2. */
|
|
158
|
+
export const isRomFont = (address: number) => (address & 0x7fff) === 0x1000 || (address & 0x7fff) === 0x1800;
|
|
159
|
+
|
|
129
160
|
/** An ACME macro of the generated source. The body names a parameter with a dot in front: .dst. */
|
|
130
161
|
export interface MacroRow {
|
|
131
162
|
space: Space;
|
|
@@ -166,6 +197,7 @@ export const SWITCH_COLUMNS = "space, name, kind, default_value, releases, comme
|
|
|
166
197
|
export const RELEASE_COLUMNS = "space, label, file, sha256, base, comment, origin, valid_from_revision";
|
|
167
198
|
export const MACRO_COLUMNS = "space, name, params, body, comment, origin, valid_from_revision";
|
|
168
199
|
export const MACRO_USE_COLUMNS = "space, start_address, end_address, macro, args, origin, valid_from_revision";
|
|
200
|
+
export const START_SCREEN_COLUMNS = "space, mode, screen, bitmap, charset, colours, colour, border, background, comment, origin, valid_from_revision";
|
|
169
201
|
|
|
170
202
|
export function toSymbol(row: Raw): SymbolRow {
|
|
171
203
|
return { space: row.space as Space, address: row.address as number, name: row.name as string, kind: row.kind as SymbolKind, origin: row.origin as Origin, revision: row.valid_from_revision as string };
|
|
@@ -275,6 +307,21 @@ export function toRelease(row: Raw): ReleaseRow {
|
|
|
275
307
|
return release;
|
|
276
308
|
}
|
|
277
309
|
|
|
310
|
+
export function toStartScreen(row: Raw): StartScreenRow {
|
|
311
|
+
const value: StartScreenRow = {
|
|
312
|
+
space: row.space as Space,
|
|
313
|
+
mode: row.mode as StartScreenMode,
|
|
314
|
+
screen: row.screen as number,
|
|
315
|
+
border: row.border as number,
|
|
316
|
+
background: row.background as number,
|
|
317
|
+
origin: row.origin as StartScreenRow["origin"],
|
|
318
|
+
revision: row.valid_from_revision as string,
|
|
319
|
+
};
|
|
320
|
+
for (const key of ["bitmap", "charset", "colours", "colour"] as const) if (row[key] !== null && row[key] !== undefined) value[key] = row[key] as number;
|
|
321
|
+
if (row.comment !== null && row.comment !== undefined) value.comment = row.comment as string;
|
|
322
|
+
return value;
|
|
323
|
+
}
|
|
324
|
+
|
|
278
325
|
export function toMacro(row: Raw): MacroRow {
|
|
279
326
|
const macro: MacroRow = { space: row.space as Space, name: row.name as string, params: items(row.params as string), body: row.body as string, origin: row.origin as MacroRow["origin"], revision: row.valid_from_revision as string };
|
|
280
327
|
if (row.comment !== null && row.comment !== undefined) macro.comment = row.comment as string;
|
|
@@ -523,6 +570,12 @@ export function listReleases(db: DatabaseSync | undefined, origins?: OriginFilte
|
|
|
523
570
|
.filter(kept(origins));
|
|
524
571
|
}
|
|
525
572
|
|
|
573
|
+
/** The current start screen of a space, if the knowledge has one. */
|
|
574
|
+
export function currentStartScreen(db: DatabaseSync | undefined, space: Space = DEFAULT_SPACE): StartScreenRow | undefined {
|
|
575
|
+
const row = db?.prepare(`SELECT ${START_SCREEN_COLUMNS} FROM current_start_screens WHERE space = ?`).get(space) as Raw | undefined;
|
|
576
|
+
return row === undefined ? undefined : toStartScreen(row);
|
|
577
|
+
}
|
|
578
|
+
|
|
526
579
|
/**
|
|
527
580
|
* The value of a switch in the program of the knowledge: 1 when the base
|
|
528
581
|
* release has it on. A patch holds the code of the other value.
|
|
@@ -679,7 +732,7 @@ export function listSpaces(db: DatabaseSync | undefined): Space[] {
|
|
|
679
732
|
if (db === undefined) return [];
|
|
680
733
|
const rows = db
|
|
681
734
|
.prepare(
|
|
682
|
-
`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_memory UNION SELECT space FROM current_entries UNION SELECT space FROM current_coverage`,
|
|
735
|
+
`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`,
|
|
683
736
|
)
|
|
684
737
|
.all() as Array<{ space: Space }>;
|
|
685
738
|
const order = (space: Space) => (space === "c64" ? -2 : space === "drive8" ? -1 : Number(space.slice(4)));
|
package/src/knowledge/schema.ts
CHANGED
|
@@ -73,6 +73,14 @@ export const SWITCH_KINDS = ["protection", "trainer", "cheat", "crack", "fix", "
|
|
|
73
73
|
export type SwitchKind = (typeof SWITCH_KINDS)[number];
|
|
74
74
|
/** The kinds that are always off by default: the default build is the clean program. */
|
|
75
75
|
export const OFF_KINDS: readonly SwitchKind[] = ["protection", "trainer", "cheat", "crack"];
|
|
76
|
+
/**
|
|
77
|
+
* The display mode of a start screen: a text screen, a hires bitmap or a
|
|
78
|
+
* multicolour bitmap. The loader of the generated source shows it.
|
|
79
|
+
*/
|
|
80
|
+
export const START_SCREEN_MODES = ["text", "hires", "multicolour"] as const;
|
|
81
|
+
export type StartScreenMode = (typeof START_SCREEN_MODES)[number];
|
|
82
|
+
/** The switch of the start screen in the generated source: no symbol, switch or release can have this name. */
|
|
83
|
+
export const START_SCREEN_SWITCH = "START_SCREEN";
|
|
76
84
|
/** A macro name and a macro parameter. The body names a parameter with a dot in front: .dst. */
|
|
77
85
|
export const MACRO_NAME = /^[A-Za-z_][A-Za-z0-9_]{0,31}$/;
|
|
78
86
|
export const MACRO_PARAM = /^[a-z_][a-z0-9_]{0,31}$/;
|
|
@@ -88,7 +96,7 @@ export type CoverageKind = (typeof COVERAGE_KINDS)[number];
|
|
|
88
96
|
export const MEMORY_ROW = 64;
|
|
89
97
|
|
|
90
98
|
/** Files that c64-source writes itself: no module can have these names. */
|
|
91
|
-
export const GENERATED_FILES = ["main.asm", "loader.asm", "switches.asm", "config.asm", "constants.asm", "macros.asm"] as const;
|
|
99
|
+
export const GENERATED_FILES = ["main.asm", "loader.asm", "switches.asm", "config.asm", "constants.asm", "macros.asm", "start_screen.asm"] as const;
|
|
92
100
|
|
|
93
101
|
/** True for a generated file name in any letter case: the file systems of macOS and Windows ignore case. */
|
|
94
102
|
export function isGeneratedFile(file: string): boolean {
|
|
@@ -295,6 +303,27 @@ function createSchema(db: DatabaseSync): void {
|
|
|
295
303
|
valid_to_revision TEXT REFERENCES revisions (id)
|
|
296
304
|
);
|
|
297
305
|
CREATE INDEX macros_name ON macros (space, name);
|
|
306
|
+
CREATE TABLE start_screens (
|
|
307
|
+
id TEXT PRIMARY KEY,
|
|
308
|
+
space TEXT NOT NULL DEFAULT 'c64' CHECK (space = 'c64'),
|
|
309
|
+
mode TEXT NOT NULL CHECK (mode IN (${list(START_SCREEN_MODES)})),
|
|
310
|
+
screen INTEGER NOT NULL CHECK (screen BETWEEN 0 AND 65535),
|
|
311
|
+
bitmap INTEGER CHECK (bitmap BETWEEN 0 AND 65535),
|
|
312
|
+
charset INTEGER CHECK (charset BETWEEN 0 AND 65535),
|
|
313
|
+
colours INTEGER CHECK (colours BETWEEN 0 AND 65535),
|
|
314
|
+
colour INTEGER CHECK (colour BETWEEN 0 AND 15),
|
|
315
|
+
border INTEGER NOT NULL CHECK (border BETWEEN 0 AND 15),
|
|
316
|
+
background INTEGER NOT NULL CHECK (background BETWEEN 0 AND 15),
|
|
317
|
+
comment TEXT CHECK (comment IS NULL OR length(comment) > 0),
|
|
318
|
+
origin TEXT NOT NULL CHECK (origin IN ('user', 'llm')),
|
|
319
|
+
valid_from_revision TEXT NOT NULL REFERENCES revisions (id),
|
|
320
|
+
valid_to_revision TEXT REFERENCES revisions (id),
|
|
321
|
+
CHECK ((mode = 'text') = (charset IS NOT NULL)),
|
|
322
|
+
CHECK ((mode = 'text') = (bitmap IS NULL)),
|
|
323
|
+
CHECK (colours IS NULL OR colour IS NULL),
|
|
324
|
+
CHECK ((mode = 'hires') = (colours IS NULL AND colour IS NULL))
|
|
325
|
+
);
|
|
326
|
+
CREATE INDEX start_screens_space ON start_screens (space);
|
|
298
327
|
CREATE TABLE macro_uses (
|
|
299
328
|
id TEXT PRIMARY KEY,
|
|
300
329
|
space TEXT NOT NULL DEFAULT 'c64' CHECK (${SPACE_CHECK}),
|
|
@@ -355,11 +384,12 @@ function createSchema(db: DatabaseSync): void {
|
|
|
355
384
|
CREATE VIEW current_releases AS SELECT * FROM releases WHERE valid_to_revision IS NULL;
|
|
356
385
|
CREATE VIEW current_macros AS SELECT * FROM macros WHERE valid_to_revision IS NULL;
|
|
357
386
|
CREATE VIEW current_macro_uses AS SELECT * FROM macro_uses WHERE valid_to_revision IS NULL;
|
|
387
|
+
CREATE VIEW current_start_screens AS SELECT * FROM start_screens WHERE valid_to_revision IS NULL;
|
|
358
388
|
`);
|
|
359
389
|
}
|
|
360
390
|
|
|
361
391
|
/** The version of the index this build makes. An index with another version is emptied and made again. */
|
|
362
|
-
export const INDEX_VERSION =
|
|
392
|
+
export const INDEX_VERSION = 10;
|
|
363
393
|
|
|
364
394
|
function indexVersion(db: DatabaseSync): number | undefined {
|
|
365
395
|
const hasMeta = db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'meta'").get();
|
package/src/knowledge/text.ts
CHANGED
|
@@ -185,6 +185,25 @@ export const TABLES: readonly TableSpec[] = [
|
|
|
185
185
|
sort: "start_address",
|
|
186
186
|
fields: [space, field("start", "start_address", "address"), field("end", "end_address", "address"), field("macro", "macro", "text"), field("args", "args", "text"), origin],
|
|
187
187
|
},
|
|
188
|
+
// The start screen of the program: the loader of the generated source shows it before the entry.
|
|
189
|
+
{
|
|
190
|
+
table: "start_screens",
|
|
191
|
+
file: "start_screen.jsonl",
|
|
192
|
+
sort: "screen",
|
|
193
|
+
fields: [
|
|
194
|
+
space,
|
|
195
|
+
field("mode", "mode", "text"),
|
|
196
|
+
field("screen", "screen", "address"),
|
|
197
|
+
field("bitmap", "bitmap", "address", true),
|
|
198
|
+
field("charset", "charset", "address", true),
|
|
199
|
+
field("colours", "colours", "address", true),
|
|
200
|
+
field("colour", "colour", "integer", true),
|
|
201
|
+
field("border", "border", "integer"),
|
|
202
|
+
field("background", "background", "integer"),
|
|
203
|
+
field("comment", "comment", "text", true),
|
|
204
|
+
origin,
|
|
205
|
+
],
|
|
206
|
+
},
|
|
188
207
|
// The program itself: its bytes, at most 64 to a row, so a changed byte changes one line.
|
|
189
208
|
{ table: "memory", file: "memory.jsonl", sort: "address", fields: [space, field("at", "address", "address"), field("bytes", "bytes", "hex"), origin] },
|
|
190
209
|
// Where the program starts, the machine state there, and the stages of its unpacker.
|