@joezilla/8sim 0.10.0
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/LICENSE +201 -0
- package/README.md +542 -0
- package/dist/8sim.browser.js +4728 -0
- package/dist/bundles/CardBundle.d.ts +83 -0
- package/dist/bundles/CardBundle.d.ts.map +1 -0
- package/dist/bundles/CardBundle.js +41 -0
- package/dist/bundles/CardBundle.js.map +1 -0
- package/dist/bundles/kernels.d.ts +48 -0
- package/dist/bundles/kernels.d.ts.map +1 -0
- package/dist/bundles/kernels.js +132 -0
- package/dist/bundles/kernels.js.map +1 -0
- package/dist/bundles/seed/index.d.ts +24 -0
- package/dist/bundles/seed/index.d.ts.map +1 -0
- package/dist/bundles/seed/index.js +266 -0
- package/dist/bundles/seed/index.js.map +1 -0
- package/dist/bus/Bus.d.ts +21 -0
- package/dist/bus/Bus.d.ts.map +1 -0
- package/dist/bus/Bus.js +62 -0
- package/dist/bus/Bus.js.map +1 -0
- package/dist/bus/BusRegion.d.ts +8 -0
- package/dist/bus/BusRegion.d.ts.map +1 -0
- package/dist/bus/BusRegion.js +8 -0
- package/dist/bus/BusRegion.js.map +1 -0
- package/dist/bus/SnoopBus.d.ts +15 -0
- package/dist/bus/SnoopBus.d.ts.map +1 -0
- package/dist/bus/SnoopBus.js +41 -0
- package/dist/bus/SnoopBus.js.map +1 -0
- package/dist/cards/BankRamCard.d.ts +35 -0
- package/dist/cards/BankRamCard.d.ts.map +1 -0
- package/dist/cards/BankRamCard.js +56 -0
- package/dist/cards/BankRamCard.js.map +1 -0
- package/dist/cards/DazzlerCard.d.ts +42 -0
- package/dist/cards/DazzlerCard.d.ts.map +1 -0
- package/dist/cards/DazzlerCard.js +83 -0
- package/dist/cards/DazzlerCard.js.map +1 -0
- package/dist/cards/DisplaySurface.d.ts +32 -0
- package/dist/cards/DisplaySurface.d.ts.map +1 -0
- package/dist/cards/DisplaySurface.js +11 -0
- package/dist/cards/DisplaySurface.js.map +1 -0
- package/dist/cards/FdcPlusClient.d.ts +35 -0
- package/dist/cards/FdcPlusClient.d.ts.map +1 -0
- package/dist/cards/FdcPlusClient.js +130 -0
- package/dist/cards/FdcPlusClient.js.map +1 -0
- package/dist/cards/ImsaiMioCard.d.ts +36 -0
- package/dist/cards/ImsaiMioCard.d.ts.map +1 -0
- package/dist/cards/ImsaiMioCard.js +48 -0
- package/dist/cards/ImsaiMioCard.js.map +1 -0
- package/dist/cards/ImsaiSioCard.d.ts +19 -0
- package/dist/cards/ImsaiSioCard.d.ts.map +1 -0
- package/dist/cards/ImsaiSioCard.js +54 -0
- package/dist/cards/ImsaiSioCard.js.map +1 -0
- package/dist/cards/KeyboardCard.d.ts +37 -0
- package/dist/cards/KeyboardCard.d.ts.map +1 -0
- package/dist/cards/KeyboardCard.js +79 -0
- package/dist/cards/KeyboardCard.js.map +1 -0
- package/dist/cards/Mc6850Acia.d.ts +68 -0
- package/dist/cards/Mc6850Acia.d.ts.map +1 -0
- package/dist/cards/Mc6850Acia.js +132 -0
- package/dist/cards/Mc6850Acia.js.map +1 -0
- package/dist/cards/Mits2SioCard.d.ts +27 -0
- package/dist/cards/Mits2SioCard.d.ts.map +1 -0
- package/dist/cards/Mits2SioCard.js +36 -0
- package/dist/cards/Mits2SioCard.js.map +1 -0
- package/dist/cards/MitsDcddCard.d.ts +52 -0
- package/dist/cards/MitsDcddCard.d.ts.map +1 -0
- package/dist/cards/MitsDcddCard.js +294 -0
- package/dist/cards/MitsDcddCard.js.map +1 -0
- package/dist/cards/ParallelCard.d.ts +35 -0
- package/dist/cards/ParallelCard.d.ts.map +1 -0
- package/dist/cards/ParallelCard.js +32 -0
- package/dist/cards/ParallelCard.js.map +1 -0
- package/dist/cards/Port8212.d.ts +31 -0
- package/dist/cards/Port8212.d.ts.map +1 -0
- package/dist/cards/Port8212.js +47 -0
- package/dist/cards/Port8212.js.map +1 -0
- package/dist/cards/RtcCard.d.ts +30 -0
- package/dist/cards/RtcCard.d.ts.map +1 -0
- package/dist/cards/RtcCard.js +61 -0
- package/dist/cards/RtcCard.js.map +1 -0
- package/dist/cards/SerialCard.d.ts +31 -0
- package/dist/cards/SerialCard.d.ts.map +1 -0
- package/dist/cards/SerialCard.js +28 -0
- package/dist/cards/SerialCard.js.map +1 -0
- package/dist/cards/Tr1602Uart.d.ts +55 -0
- package/dist/cards/Tr1602Uart.d.ts.map +1 -0
- package/dist/cards/Tr1602Uart.js +102 -0
- package/dist/cards/Tr1602Uart.js.map +1 -0
- package/dist/cards/Usart8251.d.ts +28 -0
- package/dist/cards/Usart8251.d.ts.map +1 -0
- package/dist/cards/Usart8251.js +88 -0
- package/dist/cards/Usart8251.js.map +1 -0
- package/dist/cards/VdmCard.d.ts +27 -0
- package/dist/cards/VdmCard.d.ts.map +1 -0
- package/dist/cards/VdmCard.js +40 -0
- package/dist/cards/VdmCard.js.map +1 -0
- package/dist/clock/ImmediateClock.d.ts +8 -0
- package/dist/clock/ImmediateClock.d.ts.map +1 -0
- package/dist/clock/ImmediateClock.js +13 -0
- package/dist/clock/ImmediateClock.js.map +1 -0
- package/dist/clock/SystemClock.d.ts +45 -0
- package/dist/clock/SystemClock.d.ts.map +1 -0
- package/dist/clock/SystemClock.js +71 -0
- package/dist/clock/SystemClock.js.map +1 -0
- package/dist/cpu/Cpu8080.d.ts +34 -0
- package/dist/cpu/Cpu8080.d.ts.map +1 -0
- package/dist/cpu/Cpu8080.js +126 -0
- package/dist/cpu/Cpu8080.js.map +1 -0
- package/dist/cpu/Decoder.d.ts +12 -0
- package/dist/cpu/Decoder.d.ts.map +1 -0
- package/dist/cpu/Decoder.js +23 -0
- package/dist/cpu/Decoder.js.map +1 -0
- package/dist/cpu/Flags.d.ts +18 -0
- package/dist/cpu/Flags.d.ts.map +1 -0
- package/dist/cpu/Flags.js +33 -0
- package/dist/cpu/Flags.js.map +1 -0
- package/dist/cpu/Registers.d.ts +22 -0
- package/dist/cpu/Registers.d.ts.map +1 -0
- package/dist/cpu/Registers.js +26 -0
- package/dist/cpu/Registers.js.map +1 -0
- package/dist/cpu/instructions/alu.d.ts +3 -0
- package/dist/cpu/instructions/alu.d.ts.map +1 -0
- package/dist/cpu/instructions/alu.js +221 -0
- package/dist/cpu/instructions/alu.js.map +1 -0
- package/dist/cpu/instructions/branch.d.ts +3 -0
- package/dist/cpu/instructions/branch.d.ts.map +1 -0
- package/dist/cpu/instructions/branch.js +117 -0
- package/dist/cpu/instructions/branch.js.map +1 -0
- package/dist/cpu/instructions/control.d.ts +3 -0
- package/dist/cpu/instructions/control.d.ts.map +1 -0
- package/dist/cpu/instructions/control.js +12 -0
- package/dist/cpu/instructions/control.js.map +1 -0
- package/dist/cpu/instructions/data.d.ts +3 -0
- package/dist/cpu/instructions/data.d.ts.map +1 -0
- package/dist/cpu/instructions/data.js +137 -0
- package/dist/cpu/instructions/data.js.map +1 -0
- package/dist/cpu/instructions/io.d.ts +3 -0
- package/dist/cpu/instructions/io.d.ts.map +1 -0
- package/dist/cpu/instructions/io.js +18 -0
- package/dist/cpu/instructions/io.js.map +1 -0
- package/dist/cpu/instructions/logical.d.ts +3 -0
- package/dist/cpu/instructions/logical.d.ts.map +1 -0
- package/dist/cpu/instructions/logical.js +129 -0
- package/dist/cpu/instructions/logical.js.map +1 -0
- package/dist/cpu/instructions/rotate.d.ts +3 -0
- package/dist/cpu/instructions/rotate.d.ts.map +1 -0
- package/dist/cpu/instructions/rotate.js +34 -0
- package/dist/cpu/instructions/rotate.js.map +1 -0
- package/dist/cpu/instructions/stack.d.ts +3 -0
- package/dist/cpu/instructions/stack.d.ts.map +1 -0
- package/dist/cpu/instructions/stack.js +84 -0
- package/dist/cpu/instructions/stack.js.map +1 -0
- package/dist/cpu/status8080.d.ts +33 -0
- package/dist/cpu/status8080.d.ts.map +1 -0
- package/dist/cpu/status8080.js +73 -0
- package/dist/cpu/status8080.js.map +1 -0
- package/dist/cpu/z80/CpuZ80.d.ts +53 -0
- package/dist/cpu/z80/CpuZ80.d.ts.map +1 -0
- package/dist/cpu/z80/CpuZ80.js +168 -0
- package/dist/cpu/z80/CpuZ80.js.map +1 -0
- package/dist/cpu/z80/DecoderZ80.d.ts +26 -0
- package/dist/cpu/z80/DecoderZ80.d.ts.map +1 -0
- package/dist/cpu/z80/DecoderZ80.js +107 -0
- package/dist/cpu/z80/DecoderZ80.js.map +1 -0
- package/dist/cpu/z80/FlagsZ80.d.ts +27 -0
- package/dist/cpu/z80/FlagsZ80.d.ts.map +1 -0
- package/dist/cpu/z80/FlagsZ80.js +47 -0
- package/dist/cpu/z80/FlagsZ80.js.map +1 -0
- package/dist/cpu/z80/RegistersZ80.d.ts +60 -0
- package/dist/cpu/z80/RegistersZ80.d.ts.map +1 -0
- package/dist/cpu/z80/RegistersZ80.js +90 -0
- package/dist/cpu/z80/RegistersZ80.js.map +1 -0
- package/dist/cpu/z80/flagHelpers.d.ts +25 -0
- package/dist/cpu/z80/flagHelpers.d.ts.map +1 -0
- package/dist/cpu/z80/flagHelpers.js +136 -0
- package/dist/cpu/z80/flagHelpers.js.map +1 -0
- package/dist/cpu/z80/instructions/alu16.d.ts +4 -0
- package/dist/cpu/z80/instructions/alu16.d.ts.map +1 -0
- package/dist/cpu/z80/instructions/alu16.js +27 -0
- package/dist/cpu/z80/instructions/alu16.js.map +1 -0
- package/dist/cpu/z80/instructions/alu8.d.ts +4 -0
- package/dist/cpu/z80/instructions/alu8.d.ts.map +1 -0
- package/dist/cpu/z80/instructions/alu8.js +100 -0
- package/dist/cpu/z80/instructions/alu8.js.map +1 -0
- package/dist/cpu/z80/instructions/bits.d.ts +10 -0
- package/dist/cpu/z80/instructions/bits.d.ts.map +1 -0
- package/dist/cpu/z80/instructions/bits.js +164 -0
- package/dist/cpu/z80/instructions/bits.js.map +1 -0
- package/dist/cpu/z80/instructions/block.d.ts +10 -0
- package/dist/cpu/z80/instructions/block.d.ts.map +1 -0
- package/dist/cpu/z80/instructions/block.js +141 -0
- package/dist/cpu/z80/instructions/block.js.map +1 -0
- package/dist/cpu/z80/instructions/control.d.ts +4 -0
- package/dist/cpu/z80/instructions/control.d.ts.map +1 -0
- package/dist/cpu/z80/instructions/control.js +62 -0
- package/dist/cpu/z80/instructions/control.js.map +1 -0
- package/dist/cpu/z80/instructions/ed.d.ts +4 -0
- package/dist/cpu/z80/instructions/ed.d.ts.map +1 -0
- package/dist/cpu/z80/instructions/ed.js +149 -0
- package/dist/cpu/z80/instructions/ed.js.map +1 -0
- package/dist/cpu/z80/instructions/exchange.d.ts +4 -0
- package/dist/cpu/z80/instructions/exchange.d.ts.map +1 -0
- package/dist/cpu/z80/instructions/exchange.js +37 -0
- package/dist/cpu/z80/instructions/exchange.js.map +1 -0
- package/dist/cpu/z80/instructions/io.d.ts +8 -0
- package/dist/cpu/z80/instructions/io.d.ts.map +1 -0
- package/dist/cpu/z80/instructions/io.js +22 -0
- package/dist/cpu/z80/instructions/io.js.map +1 -0
- package/dist/cpu/z80/instructions/jump.d.ts +4 -0
- package/dist/cpu/z80/instructions/jump.d.ts.map +1 -0
- package/dist/cpu/z80/instructions/jump.js +113 -0
- package/dist/cpu/z80/instructions/jump.js.map +1 -0
- package/dist/cpu/z80/instructions/load.d.ts +7 -0
- package/dist/cpu/z80/instructions/load.d.ts.map +1 -0
- package/dist/cpu/z80/instructions/load.js +103 -0
- package/dist/cpu/z80/instructions/load.js.map +1 -0
- package/dist/cpu/z80/instructions/rotate.d.ts +9 -0
- package/dist/cpu/z80/instructions/rotate.d.ts.map +1 -0
- package/dist/cpu/z80/instructions/rotate.js +48 -0
- package/dist/cpu/z80/instructions/rotate.js.map +1 -0
- package/dist/cpu/z80/instructions/stack.d.ts +4 -0
- package/dist/cpu/z80/instructions/stack.d.ts.map +1 -0
- package/dist/cpu/z80/instructions/stack.js +19 -0
- package/dist/cpu/z80/instructions/stack.js.map +1 -0
- package/dist/cpu/z80/regcodes.d.ts +22 -0
- package/dist/cpu/z80/regcodes.d.ts.map +1 -0
- package/dist/cpu/z80/regcodes.js +93 -0
- package/dist/cpu/z80/regcodes.js.map +1 -0
- package/dist/cpu/z80/types.d.ts +59 -0
- package/dist/cpu/z80/types.d.ts.map +1 -0
- package/dist/cpu/z80/types.js +2 -0
- package/dist/cpu/z80/types.js.map +1 -0
- package/dist/cpu/z80/views.d.ts +8 -0
- package/dist/cpu/z80/views.d.ts.map +1 -0
- package/dist/cpu/z80/views.js +40 -0
- package/dist/cpu/z80/views.js.map +1 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/IBus.d.ts +8 -0
- package/dist/interfaces/IBus.d.ts.map +1 -0
- package/dist/interfaces/IBus.js +2 -0
- package/dist/interfaces/IBus.js.map +1 -0
- package/dist/interfaces/IBusObserver.d.ts +7 -0
- package/dist/interfaces/IBusObserver.d.ts.map +1 -0
- package/dist/interfaces/IBusObserver.js +2 -0
- package/dist/interfaces/IBusObserver.js.map +1 -0
- package/dist/interfaces/IClock.d.ts +6 -0
- package/dist/interfaces/IClock.d.ts.map +1 -0
- package/dist/interfaces/IClock.js +2 -0
- package/dist/interfaces/IClock.js.map +1 -0
- package/dist/interfaces/ICpu.d.ts +46 -0
- package/dist/interfaces/ICpu.d.ts.map +1 -0
- package/dist/interfaces/ICpu.js +2 -0
- package/dist/interfaces/ICpu.js.map +1 -0
- package/dist/interfaces/IIODevice.d.ts +7 -0
- package/dist/interfaces/IIODevice.d.ts.map +1 -0
- package/dist/interfaces/IIODevice.js +2 -0
- package/dist/interfaces/IIODevice.js.map +1 -0
- package/dist/interfaces/IInterruptController.d.ts +8 -0
- package/dist/interfaces/IInterruptController.d.ts.map +1 -0
- package/dist/interfaces/IInterruptController.js +2 -0
- package/dist/interfaces/IInterruptController.js.map +1 -0
- package/dist/interfaces/IMemory.d.ts +9 -0
- package/dist/interfaces/IMemory.d.ts.map +1 -0
- package/dist/interfaces/IMemory.js +2 -0
- package/dist/interfaces/IMemory.js.map +1 -0
- package/dist/interfaces/IModule.d.ts +5 -0
- package/dist/interfaces/IModule.d.ts.map +1 -0
- package/dist/interfaces/IModule.js +2 -0
- package/dist/interfaces/IModule.js.map +1 -0
- package/dist/interfaces/IS100Card.d.ts +6 -0
- package/dist/interfaces/IS100Card.d.ts.map +1 -0
- package/dist/interfaces/IS100Card.js +2 -0
- package/dist/interfaces/IS100Card.js.map +1 -0
- package/dist/interfaces/index.d.ts +10 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +2 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interrupt/InterruptController.d.ts +13 -0
- package/dist/interrupt/InterruptController.d.ts.map +1 -0
- package/dist/interrupt/InterruptController.js +36 -0
- package/dist/interrupt/InterruptController.js.map +1 -0
- package/dist/io/IoSpace.d.ts +9 -0
- package/dist/io/IoSpace.d.ts.map +1 -0
- package/dist/io/IoSpace.js +30 -0
- package/dist/io/IoSpace.js.map +1 -0
- package/dist/machine/MachineRunner.d.ts +54 -0
- package/dist/machine/MachineRunner.d.ts.map +1 -0
- package/dist/machine/MachineRunner.js +102 -0
- package/dist/machine/MachineRunner.js.map +1 -0
- package/dist/machine/MachineSpec.d.ts +80 -0
- package/dist/machine/MachineSpec.d.ts.map +1 -0
- package/dist/machine/MachineSpec.js +9 -0
- package/dist/machine/MachineSpec.js.map +1 -0
- package/dist/machine/buildMachine.d.ts +19 -0
- package/dist/machine/buildMachine.d.ts.map +1 -0
- package/dist/machine/buildMachine.js +122 -0
- package/dist/machine/buildMachine.js.map +1 -0
- package/dist/memory/MemoryMappedIOAdapter.d.ts +14 -0
- package/dist/memory/MemoryMappedIOAdapter.d.ts.map +1 -0
- package/dist/memory/MemoryMappedIOAdapter.js +23 -0
- package/dist/memory/MemoryMappedIOAdapter.js.map +1 -0
- package/dist/memory/Ram.d.ts +17 -0
- package/dist/memory/Ram.d.ts.map +1 -0
- package/dist/memory/Ram.js +36 -0
- package/dist/memory/Ram.js.map +1 -0
- package/dist/memory/Rom.d.ts +13 -0
- package/dist/memory/Rom.d.ts.map +1 -0
- package/dist/memory/Rom.js +25 -0
- package/dist/memory/Rom.js.map +1 -0
- package/dist/util/bits.d.ts +11 -0
- package/dist/util/bits.d.ts.map +1 -0
- package/dist/util/bits.js +35 -0
- package/dist/util/bits.js.map +1 -0
- package/dist/util/hostConsole.d.ts +2 -0
- package/dist/util/hostConsole.d.ts.map +1 -0
- package/dist/util/hostConsole.js +4 -0
- package/dist/util/hostConsole.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { CardFactory, MemoryRegionSpec, CpuKind } from '../machine/MachineSpec.js';
|
|
2
|
+
/**
|
|
3
|
+
* Declarative description of a card's configurable surface — the source both
|
|
4
|
+
* the settings UI (later, fdcplus-web) and define-time validation are generated
|
|
5
|
+
* from. Kept minimal and 8sim-native; the rich catalog metadata (docs, media,
|
|
6
|
+
* identity, versioning) lives in fdcplus-web.
|
|
7
|
+
*/
|
|
8
|
+
export type ConfigParamType = 'u8' | 'u16' | 'enum';
|
|
9
|
+
export interface ConfigParamSpec {
|
|
10
|
+
type: ConfigParamType;
|
|
11
|
+
default: number | string;
|
|
12
|
+
min?: number;
|
|
13
|
+
max?: number;
|
|
14
|
+
enum?: ReadonlyArray<number | string>;
|
|
15
|
+
description?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The kind of bus primitive this bundle models. An S-100 machine is assembled
|
|
19
|
+
* from `card`s (things that occupy a bus slot); a `chip` is a component that
|
|
20
|
+
* lives ON a card (e.g. a 6850 ACIA on the 88-2SIO). 8sim can also expose a
|
|
21
|
+
* bare chip as a minimal bus device (via `deviceCard`), so a `chip` primitive
|
|
22
|
+
* is placeable, but it is a component reference — not a real S-100 board.
|
|
23
|
+
*/
|
|
24
|
+
export type PrimitiveKind = 'card' | 'chip';
|
|
25
|
+
export interface CardManifest {
|
|
26
|
+
/** Bundle name (Identity is `name@version`). */
|
|
27
|
+
name: string;
|
|
28
|
+
version: string;
|
|
29
|
+
type: 'cpu' | 'serial' | 'floppy' | 'memory' | 'panel' | 'other';
|
|
30
|
+
/** Bus-ontology kind: an S-100 board vs. a component chip. Defaults to `card`. */
|
|
31
|
+
kind?: PrimitiveKind;
|
|
32
|
+
maker?: string;
|
|
33
|
+
summary?: string;
|
|
34
|
+
configSchema: Record<string, ConfigParamSpec>;
|
|
35
|
+
}
|
|
36
|
+
/** Resolved config → declared bus resources, for define-time collision rejection. */
|
|
37
|
+
export type ClaimsFn = (config: Record<string, unknown>) => {
|
|
38
|
+
ports?: number[];
|
|
39
|
+
irq?: number | null;
|
|
40
|
+
};
|
|
41
|
+
/** Resolved config → the memory region(s) this card maps onto the bus. A memory
|
|
42
|
+
* card (RAM/EPROM board) resolves to regions; the host hoists them into the
|
|
43
|
+
* machine's declared `MachineSpec.memory` so they're overlap-validated (see the
|
|
44
|
+
* buildMachine note). Absent on pure I/O cards. */
|
|
45
|
+
export type MemoryFn = (config: Record<string, unknown>) => MemoryRegionSpec[];
|
|
46
|
+
/** Resolved config → the CPU this card provides. On real S-100 hardware the
|
|
47
|
+
* processor is a card (the 8080/Z80 CPU board), and it carries settings the bus
|
|
48
|
+
* doesn't — notably the power-on jump (`resetVector`), classically a CPU-card
|
|
49
|
+
* feature. A machine has exactly one CPU card; the host resolves its output into
|
|
50
|
+
* `MachineSpec.cpuKind`/`resetVector`. Absent on every non-CPU card. */
|
|
51
|
+
export type CpuFn = (config: Record<string, unknown>) => {
|
|
52
|
+
kind: CpuKind;
|
|
53
|
+
resetVector?: number;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* A self-contained card bundle (AR-5): the manifest (data) + the uniform
|
|
57
|
+
* factory (code) + a claims deriver. Seed bundles wrap the built-in 8sim card
|
|
58
|
+
* classes; downstream bundles have the same shape. A `memory` card additionally
|
|
59
|
+
* declares the RAM/ROM region(s) it maps; a `cpu` card declares the processor —
|
|
60
|
+
* both resolved by the host into the MachineSpec (memory map / CPU).
|
|
61
|
+
*/
|
|
62
|
+
export interface CardBundle {
|
|
63
|
+
manifest: CardManifest;
|
|
64
|
+
cardFactory: CardFactory;
|
|
65
|
+
claims: ClaimsFn;
|
|
66
|
+
memory?: MemoryFn;
|
|
67
|
+
cpu?: CpuFn;
|
|
68
|
+
}
|
|
69
|
+
/** Thrown when a card config violates its manifest's Config Schema. */
|
|
70
|
+
export declare class CardConfigError extends Error {
|
|
71
|
+
constructor(message: string);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Merge a resolved config over the manifest's schema defaults, validating each
|
|
75
|
+
* value against its ConfigParamSpec (range for `u8`/`u16`, membership for
|
|
76
|
+
* `enum`). Throws {@link CardConfigError} on a violation so an out-of-range
|
|
77
|
+
* port can't be silently masked into a different (and mis-claimed) one.
|
|
78
|
+
*
|
|
79
|
+
* Keys present in `config` but absent from the schema are ignored (the schema
|
|
80
|
+
* is the contract) — a typo'd key silently takes its default.
|
|
81
|
+
*/
|
|
82
|
+
export declare function withDefaults(manifest: CardManifest, config?: Record<string, unknown>): Record<string, unknown>;
|
|
83
|
+
//# sourceMappingURL=CardBundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardBundle.d.ts","sourceRoot":"","sources":["../../src/bundles/CardBundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAExF;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACtC,WAAW,CAAC,EAAE,M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AAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,YAAY,EACtB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACnC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQzB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Thrown when a card config violates its manifest's Config Schema. */
|
|
2
|
+
export class CardConfigError extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = 'CardConfigError';
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Merge a resolved config over the manifest's schema defaults, validating each
|
|
10
|
+
* value against its ConfigParamSpec (range for `u8`/`u16`, membership for
|
|
11
|
+
* `enum`). Throws {@link CardConfigError} on a violation so an out-of-range
|
|
12
|
+
* port can't be silently masked into a different (and mis-claimed) one.
|
|
13
|
+
*
|
|
14
|
+
* Keys present in `config` but absent from the schema are ignored (the schema
|
|
15
|
+
* is the contract) — a typo'd key silently takes its default.
|
|
16
|
+
*/
|
|
17
|
+
export function withDefaults(manifest, config = {}) {
|
|
18
|
+
const out = {};
|
|
19
|
+
for (const [key, spec] of Object.entries(manifest.configSchema)) {
|
|
20
|
+
const value = key in config ? config[key] : spec.default;
|
|
21
|
+
validateParam(manifest.name, key, spec, value);
|
|
22
|
+
out[key] = value;
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
function validateParam(card, key, spec, value) {
|
|
27
|
+
const where = `card "${card}" config "${key}"`;
|
|
28
|
+
if (spec.type === 'enum') {
|
|
29
|
+
if (!spec.enum || !spec.enum.includes(value)) {
|
|
30
|
+
throw new CardConfigError(`${where}: ${JSON.stringify(value)} is not one of ${JSON.stringify(spec.enum ?? [])}`);
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
// u8 / u16 numeric range.
|
|
35
|
+
const hi = spec.max ?? (spec.type === 'u16' ? 0xffff : 0xff);
|
|
36
|
+
const lo = spec.min ?? 0;
|
|
37
|
+
if (typeof value !== 'number' || !Number.isInteger(value) || value < lo || value > hi) {
|
|
38
|
+
throw new CardConfigError(`${where}: ${JSON.stringify(value)} must be an integer in ${lo}..${hi}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=CardBundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardBundle.js","sourceRoot":"","sources":["../../src/bundles/CardBundle.ts"],"names":[],"mappings":"AA6EA,uEAAuE;AACvE,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAC1B,QAAsB,EACtB,SAAkC,EAAE;IAEpC,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAChE,MAAM,KAAK,GAAG,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;QACzD,aAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAC/C,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,GAAW,EAAE,IAAqB,EAAE,KAAc;IACrF,MAAM,KAAK,GAAG,SAAS,IAAI,aAAa,GAAG,GAAG,CAAC;IAC/C,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAwB,CAAC,EAAE,CAAC;YAChE,MAAM,IAAI,eAAe,CAAC,GAAG,KAAK,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;QACnH,CAAC;QACD,OAAO;IACT,CAAC;IACD,0BAA0B;IAC1B,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC7D,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACzB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,IAAI,KAAK,GAAG,EAAE,EAAE,CAAC;QACtF,MAAM,IAAI,eAAe,CAAC,GAAG,KAAK,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;IACrG,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CardFactory, MemoryRegionSpec } from '../machine/MachineSpec.js';
|
|
2
|
+
import type { ConfigParamSpec, ClaimsFn } from './CardBundle.js';
|
|
3
|
+
/**
|
|
4
|
+
* Card behavior kernels (Bitsby8 Story 5.7).
|
|
5
|
+
*
|
|
6
|
+
* A kernel is a trusted, parameterized device state machine the host can build
|
|
7
|
+
* an authored I/O card from — WITHOUT any user code. The host (fdcplus-web)
|
|
8
|
+
* references a kernel by `id` in an authored card's declarative behavior, and
|
|
9
|
+
* synthesizes a bundle from `create` + `claims`, exposing `configSchema` to its
|
|
10
|
+
* settings UI. `binding` names the peripheral endpoint the card's far side
|
|
11
|
+
* attaches to. This is the "behavior-kernel library" from the card taxonomy.
|
|
12
|
+
*/
|
|
13
|
+
export interface CardKernel {
|
|
14
|
+
/** Kernel id referenced by an authored card's `behavior.kernel`. */
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
/** 8sim-native card type (serial | other | …). */
|
|
18
|
+
type: string;
|
|
19
|
+
/** Peripheral endpoint this kernel's card binds to (e.g. 'terminal'). */
|
|
20
|
+
binding?: string;
|
|
21
|
+
/** Config surface the authored card inherits. */
|
|
22
|
+
configSchema: Record<string, ConfigParamSpec>;
|
|
23
|
+
/** Build the card's device (the same shape as a bundle's cardFactory). */
|
|
24
|
+
create: CardFactory;
|
|
25
|
+
/** Declared bus resources for define-time collision checks. */
|
|
26
|
+
claims: ClaimsFn;
|
|
27
|
+
/** Memory region(s) this kernel's card maps — e.g. a video card's RAM. Hoisted
|
|
28
|
+
* into MachineSpec.memory so it's overlap-validated and shows on the ribbon. */
|
|
29
|
+
memory?: (config: Record<string, unknown>) => MemoryRegionSpec[];
|
|
30
|
+
}
|
|
31
|
+
/** A serial (UART) console card: a data + status/control port, bound to a terminal. */
|
|
32
|
+
export declare const serialKernel: CardKernel;
|
|
33
|
+
/** A parallel I/O port: a single 8-bit latched port bound to GPIO (LEDs, switches, printer). */
|
|
34
|
+
export declare const parallelKernel: CardKernel;
|
|
35
|
+
/** An ASCII keyboard input port: a data + status port bound to the operator's keyboard. */
|
|
36
|
+
export declare const keyboardKernel: CardKernel;
|
|
37
|
+
/** Processor Technology VDM-1: a memory-mapped 64×16 character display, bound to a monitor. */
|
|
38
|
+
export declare const vdmKernel: CardKernel;
|
|
39
|
+
/** Cromemco Dazzler: a DMA colour-graphics card driven by two I/O ports, bound to a monitor. */
|
|
40
|
+
export declare const dazzlerKernel: CardKernel;
|
|
41
|
+
/** National MM58167 real-time clock: BCD time registers on an I/O window, bound to the host clock. */
|
|
42
|
+
export declare const rtcKernel: CardKernel;
|
|
43
|
+
/** Bank-switching RAM: N banks of RAM behind a fixed window, selected by an I/O port (>64K). */
|
|
44
|
+
export declare const bankRamKernel: CardKernel;
|
|
45
|
+
/** All built-in behavior kernels, keyed by id. */
|
|
46
|
+
export declare const kernels: ReadonlyArray<CardKernel>;
|
|
47
|
+
export declare const kernelById: (id: string) => CardKernel | undefined;
|
|
48
|
+
//# sourceMappingURL=kernels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kernels.d.ts","sourceRoot":"","sources":["../../src/bundles/kernels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAYjE;;;;;;;;;GASG;AACH,MAAM,WAAW,UAAU;IACzB,oEAAoE;IACpE,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC9C,0EAA0E;IAC1E,MAAM,EAAE,WAAW,CAAC;IACpB,+DAA+D;IAC/D,MAAM,EAAE,QAAQ,CAAC;IACjB;oFACgF;IAChF,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,gBAAgB,EAAE,CAAC;CAClE;AAED,uFAAuF;AACvF,eAAO,MAAM,YAAY,EAAE,UAiB1B,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,cAAc,EAAE,UAY5B,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,cAAc,EAAE,UAiB5B,CAAC;AAEF,+FAA+F;AAC/F,eAAO,MAAM,SAAS,EAAE,UAWvB,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,aAAa,EAAE,UAa3B,CAAC;AAEF,sGAAsG;AACtG,eAAO,MAAM,SAAS,EAAE,UAevB,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,aAAa,EAAE,UAkB3B,CAAC;AAEF,kDAAkD;AAClD,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,UAAU,CAQ7C,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,IAAI,MAAM,KAAG,UAAU,GAAG,SAA6C,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { SerialCard } from '../cards/SerialCard.js';
|
|
2
|
+
import { ParallelCard } from '../cards/ParallelCard.js';
|
|
3
|
+
import { KeyboardCard } from '../cards/KeyboardCard.js';
|
|
4
|
+
import { VdmCard } from '../cards/VdmCard.js';
|
|
5
|
+
import { DazzlerCard } from '../cards/DazzlerCard.js';
|
|
6
|
+
import { RtcCard } from '../cards/RtcCard.js';
|
|
7
|
+
import { BankRamCard } from '../cards/BankRamCard.js';
|
|
8
|
+
const u8 = (v, fallback) => (typeof v === 'number' ? v & 0xff : fallback);
|
|
9
|
+
const u16 = (v, fallback) => (typeof v === 'number' ? v & 0xffff : fallback);
|
|
10
|
+
/** A serial (UART) console card: a data + status/control port, bound to a terminal. */
|
|
11
|
+
export const serialKernel = {
|
|
12
|
+
id: 'serial',
|
|
13
|
+
label: 'Serial UART (console)',
|
|
14
|
+
type: 'serial',
|
|
15
|
+
binding: 'terminal',
|
|
16
|
+
configSchema: {
|
|
17
|
+
dataPort: { type: 'u8', default: 0x10, min: 0, max: 0xff, description: 'Data register port' },
|
|
18
|
+
ctrlPort: { type: 'u8', default: 0x11, min: 0, max: 0xff, description: 'Status/control port' },
|
|
19
|
+
chip: { type: 'enum', default: 'i8251', enum: ['i8251', 'm6850'], description: 'UART chip' },
|
|
20
|
+
},
|
|
21
|
+
create: (id, cfg) => new SerialCard(id, {
|
|
22
|
+
dataPort: u8(cfg.dataPort, 0x10),
|
|
23
|
+
ctrlPort: u8(cfg.ctrlPort, 0x11),
|
|
24
|
+
chip: cfg.chip ?? 'i8251',
|
|
25
|
+
}),
|
|
26
|
+
claims: (cfg) => ({ ports: [u8(cfg.dataPort, 0x10), u8(cfg.ctrlPort, 0x11)] }),
|
|
27
|
+
};
|
|
28
|
+
/** A parallel I/O port: a single 8-bit latched port bound to GPIO (LEDs, switches, printer). */
|
|
29
|
+
export const parallelKernel = {
|
|
30
|
+
id: 'parallel',
|
|
31
|
+
label: 'Parallel I/O port',
|
|
32
|
+
type: 'parallel',
|
|
33
|
+
binding: 'gpio',
|
|
34
|
+
configSchema: {
|
|
35
|
+
port: { type: 'u8', default: 0x00, min: 0, max: 0xff, description: 'I/O port' },
|
|
36
|
+
direction: { type: 'enum', default: 'out', enum: ['out', 'in', 'inout'], description: 'Data direction' },
|
|
37
|
+
},
|
|
38
|
+
create: (id, cfg) => new ParallelCard(id, { port: u8(cfg.port, 0x00), direction: cfg.direction ?? 'out' }),
|
|
39
|
+
claims: (cfg) => ({ ports: [u8(cfg.port, 0x00)] }),
|
|
40
|
+
};
|
|
41
|
+
/** An ASCII keyboard input port: a data + status port bound to the operator's keyboard. */
|
|
42
|
+
export const keyboardKernel = {
|
|
43
|
+
id: 'keyboard',
|
|
44
|
+
label: 'Keyboard input port (ASCII)',
|
|
45
|
+
type: 'keyboard',
|
|
46
|
+
binding: 'keyboard',
|
|
47
|
+
configSchema: {
|
|
48
|
+
dataPort: { type: 'u8', default: 0x01, min: 0, max: 0xff, description: 'Key data register port' },
|
|
49
|
+
statusPort: { type: 'u8', default: 0x00, min: 0, max: 0xff, description: 'Key-ready status port' },
|
|
50
|
+
readyMask: { type: 'u8', default: 0x01, min: 0, max: 0xff, description: 'Status bits set while a key waits' },
|
|
51
|
+
},
|
|
52
|
+
create: (id, cfg) => new KeyboardCard(id, {
|
|
53
|
+
dataPort: u8(cfg.dataPort, 0x01),
|
|
54
|
+
statusPort: u8(cfg.statusPort, 0x00),
|
|
55
|
+
readyMask: u8(cfg.readyMask, 0x01),
|
|
56
|
+
}),
|
|
57
|
+
claims: (cfg) => ({ ports: [u8(cfg.dataPort, 0x01), u8(cfg.statusPort, 0x00)] }),
|
|
58
|
+
};
|
|
59
|
+
/** Processor Technology VDM-1: a memory-mapped 64×16 character display, bound to a monitor. */
|
|
60
|
+
export const vdmKernel = {
|
|
61
|
+
id: 'vdm-video',
|
|
62
|
+
label: 'VDM-1 video (64×16 characters)',
|
|
63
|
+
type: 'video',
|
|
64
|
+
binding: 'display',
|
|
65
|
+
configSchema: {
|
|
66
|
+
base: { type: 'u16', default: 0xcc00, min: 0, max: 0xffff, description: 'Video RAM base' },
|
|
67
|
+
},
|
|
68
|
+
create: (id, cfg) => new VdmCard(id, { base: u16(cfg.base, 0xcc00) }),
|
|
69
|
+
claims: () => ({ ports: [] }),
|
|
70
|
+
memory: (cfg) => [{ id: 'vram', base: u16(cfg.base, 0xcc00), size: 0x400, kind: 'ram' }],
|
|
71
|
+
};
|
|
72
|
+
/** Cromemco Dazzler: a DMA colour-graphics card driven by two I/O ports, bound to a monitor. */
|
|
73
|
+
export const dazzlerKernel = {
|
|
74
|
+
id: 'dazzler-video',
|
|
75
|
+
label: 'Cromemco Dazzler (colour graphics)',
|
|
76
|
+
type: 'video',
|
|
77
|
+
binding: 'display',
|
|
78
|
+
configSchema: {
|
|
79
|
+
controlPort: { type: 'u8', default: 0x0e, min: 0, max: 0xff, description: 'Control port (picture on + buffer page)' },
|
|
80
|
+
formatPort: { type: 'u8', default: 0x0f, min: 0, max: 0xff, description: 'Format port (resolution / colour)' },
|
|
81
|
+
},
|
|
82
|
+
create: (id, cfg) => new DazzlerCard(id, { controlPort: u8(cfg.controlPort, 0x0e), formatPort: u8(cfg.formatPort, 0x0f) }),
|
|
83
|
+
claims: (cfg) => ({ ports: [u8(cfg.controlPort, 0x0e), u8(cfg.formatPort, 0x0f)] }),
|
|
84
|
+
// No `memory`: the Dazzler DMAs ordinary system RAM, so it declares no region.
|
|
85
|
+
};
|
|
86
|
+
/** National MM58167 real-time clock: BCD time registers on an I/O window, bound to the host clock. */
|
|
87
|
+
export const rtcKernel = {
|
|
88
|
+
id: 'mm58167-rtc',
|
|
89
|
+
label: 'MM58167 real-time clock',
|
|
90
|
+
type: 'rtc',
|
|
91
|
+
binding: 'clock',
|
|
92
|
+
configSchema: {
|
|
93
|
+
base: { type: 'u8', default: 0x40, min: 0, max: 0xe0, description: 'Base I/O port (occupies base..base+0x1F)' },
|
|
94
|
+
},
|
|
95
|
+
create: (id, cfg, ctx) => new RtcCard(id, { base: u8(cfg.base, 0x40) }, ctx.services.clock),
|
|
96
|
+
// 32 consecutive registers.
|
|
97
|
+
claims: (cfg) => {
|
|
98
|
+
const b = u8(cfg.base, 0x40);
|
|
99
|
+
return { ports: Array.from({ length: 0x20 }, (_v, i) => (b + i) & 0xff) };
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
/** Bank-switching RAM: N banks of RAM behind a fixed window, selected by an I/O port (>64K). */
|
|
103
|
+
export const bankRamKernel = {
|
|
104
|
+
id: 'bank-ram',
|
|
105
|
+
label: 'Bank-switching RAM (MMU)',
|
|
106
|
+
type: 'memory',
|
|
107
|
+
configSchema: {
|
|
108
|
+
window: { type: 'u16', default: 0xc000, min: 0, max: 0xffff, description: 'Switched window base address' },
|
|
109
|
+
size: { type: 'u16', default: 0x4000, min: 1, max: 0xffff, description: 'Bytes visible per bank' },
|
|
110
|
+
banks: { type: 'u8', default: 4, min: 1, max: 0xff, description: 'Number of RAM banks' },
|
|
111
|
+
selectPort: { type: 'u8', default: 0x40, min: 0, max: 0xff, description: 'Bank-select I/O port' },
|
|
112
|
+
},
|
|
113
|
+
create: (id, cfg) => new BankRamCard(id, {
|
|
114
|
+
window: u16(cfg.window, 0xc000),
|
|
115
|
+
size: u16(cfg.size, 0x4000),
|
|
116
|
+
banks: u8(cfg.banks, 4),
|
|
117
|
+
selectPort: u8(cfg.selectPort, 0x40),
|
|
118
|
+
}),
|
|
119
|
+
claims: (cfg) => ({ ports: [u8(cfg.selectPort, 0x40)] }),
|
|
120
|
+
};
|
|
121
|
+
/** All built-in behavior kernels, keyed by id. */
|
|
122
|
+
export const kernels = [
|
|
123
|
+
serialKernel,
|
|
124
|
+
parallelKernel,
|
|
125
|
+
keyboardKernel,
|
|
126
|
+
vdmKernel,
|
|
127
|
+
dazzlerKernel,
|
|
128
|
+
rtcKernel,
|
|
129
|
+
bankRamKernel,
|
|
130
|
+
];
|
|
131
|
+
export const kernelById = (id) => kernels.find((k) => k.id === id);
|
|
132
|
+
//# sourceMappingURL=kernels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kernels.js","sourceRoot":"","sources":["../../src/bundles/kernels.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAmB,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAsB,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAiB,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,EAAE,GAAG,CAAC,CAAU,EAAE,QAAgB,EAAU,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AACnG,MAAM,GAAG,GAAG,CAAC,CAAU,EAAE,QAAgB,EAAU,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAA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
2
|
+
export declare const mits2SioBundle: CardBundle;
|
|
3
|
+
export declare const imsaiSioBundle: CardBundle;
|
|
4
|
+
export declare const imsaiMioBundle: CardBundle;
|
|
5
|
+
export declare const mitsDcddBundle: CardBundle;
|
|
6
|
+
export declare const usart8251Bundle: CardBundle;
|
|
7
|
+
export declare const mc6850Bundle: CardBundle;
|
|
8
|
+
export declare const port8212Bundle: CardBundle;
|
|
9
|
+
export declare const tr1602Bundle: CardBundle;
|
|
10
|
+
/** Static RAM card — maps RAM at a base address for a size. A memory card:
|
|
11
|
+
* contributes no I/O device, only a RAM region hoisted into the memory map. */
|
|
12
|
+
export declare const ramCardBundle: CardBundle;
|
|
13
|
+
/** EPROM card — maps a ROM at a base address. The chip ships empty (zero-filled);
|
|
14
|
+
* an image is burned in later. A memory card: no I/O, just a ROM region. */
|
|
15
|
+
export declare const epromCardBundle: CardBundle;
|
|
16
|
+
/** Intel 8080 CPU card — the processor board. Declares the CPU family and the
|
|
17
|
+
* power-on jump (resetVector), authentically a CPU-card feature. No bus I/O. */
|
|
18
|
+
export declare const i8080CpuBundle: CardBundle;
|
|
19
|
+
/** Zilog Z80 CPU card — 8080-compatible bus master with the Z80 instruction set. */
|
|
20
|
+
export declare const z80CpuBundle: CardBundle;
|
|
21
|
+
/** All built-in seed bundles, keyed by manifest name. */
|
|
22
|
+
export declare const seedBundles: ReadonlyArray<CardBundle>;
|
|
23
|
+
export declare const seedBundleByName: (name: string) => CardBundle | undefined;
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bundles/seed/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAyCnD,eAAO,MAAM,cAAc,EAAE,UAY5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,UA0B5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,UAa5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,UAoB5B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,UAgB7B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,UAgB1B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,UAY5B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,UAgB1B,CAAC;AAEF;+EAC+E;AAC/E,eAAO,MAAM,aAAa,EAAE,UAgB3B,CAAC;AAEF;4EAC4E;AAC5E,eAAO,MAAM,eAAe,EAAE,UAoB7B,CAAC;AAEF;gFACgF;AAChF,eAAO,MAAM,cAAc,EAAE,UAe5B,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,YAAY,EAAE,UAe1B,CAAC;AAEF,yDAAyD;AACzD,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,UAAU,CAajD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,UAAU,GAAG,SACV,CAAC"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { ImsaiSioCard } from '../../cards/ImsaiSioCard.js';
|
|
2
|
+
import { Mits2SioCard } from '../../cards/Mits2SioCard.js';
|
|
3
|
+
import { ImsaiMioCard } from '../../cards/ImsaiMioCard.js';
|
|
4
|
+
import { MitsDcddCard } from '../../cards/MitsDcddCard.js';
|
|
5
|
+
import { Usart8251 } from '../../cards/Usart8251.js';
|
|
6
|
+
import { Mc6850Acia } from '../../cards/Mc6850Acia.js';
|
|
7
|
+
import { Port8212 } from '../../cards/Port8212.js';
|
|
8
|
+
import { Tr1602Uart } from '../../cards/Tr1602Uart.js';
|
|
9
|
+
import { MachineSpecError } from '../../machine/MachineSpec.js';
|
|
10
|
+
/**
|
|
11
|
+
* Seed Card Bundles (Story 1.2 / FR-4): the built-in 8sim cards packaged as
|
|
12
|
+
* self-contained bundles with a uniform `cardFactory(id, config, ctx)` and an
|
|
13
|
+
* in-bundle adapter to the underlying class (AR-5). fdcplus-web's Catalog
|
|
14
|
+
* registers these on startup.
|
|
15
|
+
*/
|
|
16
|
+
const u8 = (v, fallback) => typeof v === 'number' ? v & 0xff : fallback;
|
|
17
|
+
const u16 = (v, fallback) => typeof v === 'number' ? v & 0xffff : fallback;
|
|
18
|
+
/** Wrap a bare IIODevice as an IS100Card (attach → attachIODevice). */
|
|
19
|
+
const deviceCard = (id, dev) => ({
|
|
20
|
+
id,
|
|
21
|
+
reset: () => dev.reset(),
|
|
22
|
+
attach: (bus) => bus.attachIODevice(dev),
|
|
23
|
+
});
|
|
24
|
+
/** A memory card contributes no I/O device — its region is hoisted into the
|
|
25
|
+
* machine's memory map and attached there, so the card itself is a no-op on the bus. */
|
|
26
|
+
const memoryCard = (id) => ({
|
|
27
|
+
id,
|
|
28
|
+
reset: () => { },
|
|
29
|
+
attach: () => { },
|
|
30
|
+
});
|
|
31
|
+
/** A CPU card is the bus master, not a bus device — buildMachine instantiates the
|
|
32
|
+
* processor from the resolved MachineSpec.cpuKind. On the bus the card is a no-op;
|
|
33
|
+
* its real output is the `cpu()` resolution. (Its front-panel control lines, which
|
|
34
|
+
* bypass the S-100 bus, are a future concern — not modeled here.) */
|
|
35
|
+
const cpuCard = (id) => ({
|
|
36
|
+
id,
|
|
37
|
+
reset: () => { },
|
|
38
|
+
attach: () => { },
|
|
39
|
+
});
|
|
40
|
+
export const mits2SioBundle = {
|
|
41
|
+
manifest: {
|
|
42
|
+
name: 'mits-88-2sio',
|
|
43
|
+
version: '1.0.0',
|
|
44
|
+
type: 'serial',
|
|
45
|
+
kind: 'card',
|
|
46
|
+
maker: 'MITS',
|
|
47
|
+
summary: 'MITS 88-2SIO dual serial interface (2× 6850 ACIA).',
|
|
48
|
+
configSchema: { basePort: { type: 'u8', default: 0x10, min: 0, max: 0xfc, description: 'Base I/O port (claims base..base+3)' } },
|
|
49
|
+
},
|
|
50
|
+
cardFactory: (id, cfg) => new Mits2SioCard(id, { basePort: u8(cfg.basePort, 0x10) }),
|
|
51
|
+
claims: (cfg) => { const b = u8(cfg.basePort, 0x10); return { ports: [b, b + 1, b + 2, b + 3] }; },
|
|
52
|
+
};
|
|
53
|
+
export const imsaiSioBundle = {
|
|
54
|
+
manifest: {
|
|
55
|
+
name: 'imsai-sio2',
|
|
56
|
+
version: '1.0.0',
|
|
57
|
+
type: 'serial',
|
|
58
|
+
kind: 'card',
|
|
59
|
+
maker: 'IMSAI',
|
|
60
|
+
summary: 'IMSAI SIO-2 dual 8251 serial card with a board-control port.',
|
|
61
|
+
configSchema: {
|
|
62
|
+
basePortA: { type: 'u8', default: 0x02, min: 0, max: 0xfe },
|
|
63
|
+
basePortB: { type: 'u8', default: 0x04, min: 0, max: 0xfe },
|
|
64
|
+
boardCtrlPort: { type: 'u8', default: 0x08, min: 0, max: 0xff },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
cardFactory: (id, cfg) => new ImsaiSioCard(id, {
|
|
68
|
+
basePortA: u8(cfg.basePortA, 0x02),
|
|
69
|
+
basePortB: u8(cfg.basePortB, 0x04),
|
|
70
|
+
boardCtrlPort: u8(cfg.boardCtrlPort, 0x08),
|
|
71
|
+
}),
|
|
72
|
+
claims: (cfg) => {
|
|
73
|
+
const a = u8(cfg.basePortA, 0x02);
|
|
74
|
+
const b = u8(cfg.basePortB, 0x04);
|
|
75
|
+
const c = u8(cfg.boardCtrlPort, 0x08);
|
|
76
|
+
return { ports: [a, a + 1, b, b + 1, c] };
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
export const imsaiMioBundle = {
|
|
80
|
+
manifest: {
|
|
81
|
+
name: 'imsai-mio',
|
|
82
|
+
version: '1.0.0',
|
|
83
|
+
type: 'serial',
|
|
84
|
+
kind: 'card',
|
|
85
|
+
maker: 'IMSAI',
|
|
86
|
+
summary: 'IMSAI MIO multi-I/O card: two 8212 parallel ports (base+0/+1) and a TR1602 UART (base+2/+3).',
|
|
87
|
+
configSchema: { basePort: { type: 'u8', default: 0x10, min: 0, max: 0xfc } },
|
|
88
|
+
},
|
|
89
|
+
cardFactory: (id, cfg) => new ImsaiMioCard(id, { basePort: u8(cfg.basePort, 0x10) }),
|
|
90
|
+
// Registers 4 consecutive ports: portA(base), portB(base+1), UART(base+2/+3).
|
|
91
|
+
claims: (cfg) => { const b = u8(cfg.basePort, 0x10); return { ports: [b, b + 1, b + 2, b + 3] }; },
|
|
92
|
+
};
|
|
93
|
+
export const mitsDcddBundle = {
|
|
94
|
+
manifest: {
|
|
95
|
+
name: 'mits-88-dcdd',
|
|
96
|
+
version: '1.0.0',
|
|
97
|
+
type: 'floppy',
|
|
98
|
+
kind: 'card',
|
|
99
|
+
maker: 'MITS',
|
|
100
|
+
summary: 'MITS 88-DCDD 8-inch floppy controller; disk I/O over the FDC channel.',
|
|
101
|
+
configSchema: { basePort: { type: 'u8', default: 0x08, min: 0, max: 0xfd } },
|
|
102
|
+
},
|
|
103
|
+
cardFactory: (id, cfg, ctx) => {
|
|
104
|
+
const ws = ctx.services.fdc;
|
|
105
|
+
if (!ws) {
|
|
106
|
+
throw new MachineSpecError(`card "${id}" (mits-88-dcdd) requires an FDC channel in ctx.services.fdc`);
|
|
107
|
+
}
|
|
108
|
+
return new MitsDcddCard(id, ws, { basePort: u8(cfg.basePort, 0x08) });
|
|
109
|
+
},
|
|
110
|
+
claims: (cfg) => { const b = u8(cfg.basePort, 0x08); return { ports: [b, b + 1, b + 2] }; },
|
|
111
|
+
};
|
|
112
|
+
export const usart8251Bundle = {
|
|
113
|
+
manifest: {
|
|
114
|
+
name: 'intel-8251',
|
|
115
|
+
version: '1.0.0',
|
|
116
|
+
type: 'serial',
|
|
117
|
+
kind: 'chip',
|
|
118
|
+
maker: 'Intel',
|
|
119
|
+
summary: 'Intel 8251 USART (data + control port).',
|
|
120
|
+
configSchema: {
|
|
121
|
+
dataPort: { type: 'u8', default: 0x10, min: 0, max: 0xff },
|
|
122
|
+
ctrlPort: { type: 'u8', default: 0x11, min: 0, max: 0xff },
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
cardFactory: (id, cfg) => deviceCard(id, new Usart8251(id, u8(cfg.dataPort, 0x10), u8(cfg.ctrlPort, 0x11))),
|
|
126
|
+
claims: (cfg) => ({ ports: [u8(cfg.dataPort, 0x10), u8(cfg.ctrlPort, 0x11)] }),
|
|
127
|
+
};
|
|
128
|
+
export const mc6850Bundle = {
|
|
129
|
+
manifest: {
|
|
130
|
+
name: 'motorola-6850',
|
|
131
|
+
version: '1.0.0',
|
|
132
|
+
type: 'serial',
|
|
133
|
+
kind: 'chip',
|
|
134
|
+
maker: 'Motorola',
|
|
135
|
+
summary: 'Motorola 6850 ACIA (status + data port).',
|
|
136
|
+
configSchema: {
|
|
137
|
+
statusPort: { type: 'u8', default: 0x10, min: 0, max: 0xff },
|
|
138
|
+
dataPort: { type: 'u8', default: 0x11, min: 0, max: 0xff },
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
cardFactory: (id, cfg) => deviceCard(id, new Mc6850Acia(id, u8(cfg.statusPort, 0x10), u8(cfg.dataPort, 0x11))),
|
|
142
|
+
claims: (cfg) => ({ ports: [u8(cfg.statusPort, 0x10), u8(cfg.dataPort, 0x11)] }),
|
|
143
|
+
};
|
|
144
|
+
export const port8212Bundle = {
|
|
145
|
+
manifest: {
|
|
146
|
+
name: 'intel-8212',
|
|
147
|
+
version: '1.0.0',
|
|
148
|
+
type: 'other',
|
|
149
|
+
kind: 'chip',
|
|
150
|
+
maker: 'Intel',
|
|
151
|
+
summary: 'Intel 8212 8-bit I/O port.',
|
|
152
|
+
configSchema: { port: { type: 'u8', default: 0xff, min: 0, max: 0xff } },
|
|
153
|
+
},
|
|
154
|
+
cardFactory: (id, cfg) => deviceCard(id, new Port8212(id, u8(cfg.port, 0xff))),
|
|
155
|
+
claims: (cfg) => ({ ports: [u8(cfg.port, 0xff)] }),
|
|
156
|
+
};
|
|
157
|
+
export const tr1602Bundle = {
|
|
158
|
+
manifest: {
|
|
159
|
+
name: 'tr1602-uart',
|
|
160
|
+
version: '1.0.0',
|
|
161
|
+
type: 'serial',
|
|
162
|
+
kind: 'chip',
|
|
163
|
+
maker: 'Western Digital',
|
|
164
|
+
summary: 'TR1602 UART (data + status port).',
|
|
165
|
+
configSchema: {
|
|
166
|
+
dataPort: { type: 'u8', default: 0x00, min: 0, max: 0xff },
|
|
167
|
+
statusPort: { type: 'u8', default: 0x01, min: 0, max: 0xff },
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
cardFactory: (id, cfg) => deviceCard(id, new Tr1602Uart(id, u8(cfg.dataPort, 0x00), u8(cfg.statusPort, 0x01))),
|
|
171
|
+
claims: (cfg) => ({ ports: [u8(cfg.dataPort, 0x00), u8(cfg.statusPort, 0x01)] }),
|
|
172
|
+
};
|
|
173
|
+
/** Static RAM card — maps RAM at a base address for a size. A memory card:
|
|
174
|
+
* contributes no I/O device, only a RAM region hoisted into the memory map. */
|
|
175
|
+
export const ramCardBundle = {
|
|
176
|
+
manifest: {
|
|
177
|
+
name: 'ram-card',
|
|
178
|
+
version: '1.0.0',
|
|
179
|
+
type: 'memory',
|
|
180
|
+
kind: 'card',
|
|
181
|
+
maker: 'generic',
|
|
182
|
+
summary: 'Static RAM board — maps read/write RAM at a configurable base address.',
|
|
183
|
+
configSchema: {
|
|
184
|
+
base: { type: 'u16', default: 0x0000, min: 0, max: 0xffff, description: 'Start address' },
|
|
185
|
+
size: { type: 'u16', default: 0x4000, min: 1, max: 0xffff, description: 'Bytes of RAM' },
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
cardFactory: (id) => memoryCard(id),
|
|
189
|
+
claims: () => ({ ports: [] }),
|
|
190
|
+
memory: (cfg) => [{ id: 'ram', base: u16(cfg.base, 0x0000), size: u16(cfg.size, 0x4000), kind: 'ram' }],
|
|
191
|
+
};
|
|
192
|
+
/** EPROM card — maps a ROM at a base address. The chip ships empty (zero-filled);
|
|
193
|
+
* an image is burned in later. A memory card: no I/O, just a ROM region. */
|
|
194
|
+
export const epromCardBundle = {
|
|
195
|
+
manifest: {
|
|
196
|
+
name: 'eprom-card',
|
|
197
|
+
version: '1.0.0',
|
|
198
|
+
type: 'memory',
|
|
199
|
+
kind: 'card',
|
|
200
|
+
maker: 'generic',
|
|
201
|
+
summary: 'EPROM board — maps a read-only region at a base address; burn a .bin/Intel-HEX image into it.',
|
|
202
|
+
configSchema: {
|
|
203
|
+
base: { type: 'u16', default: 0xf000, min: 0, max: 0xffff, description: 'Start address' },
|
|
204
|
+
size: { type: 'u16', default: 0x0800, min: 1, max: 0xffff, description: 'EPROM size in bytes' },
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
cardFactory: (id) => memoryCard(id),
|
|
208
|
+
claims: () => ({ ports: [] }),
|
|
209
|
+
memory: (cfg) => {
|
|
210
|
+
const base = u16(cfg.base, 0xf000);
|
|
211
|
+
const size = u16(cfg.size, 0x0800);
|
|
212
|
+
return [{ id: 'rom', base, size, kind: 'rom', image: new Uint8Array(size) }];
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
/** Intel 8080 CPU card — the processor board. Declares the CPU family and the
|
|
216
|
+
* power-on jump (resetVector), authentically a CPU-card feature. No bus I/O. */
|
|
217
|
+
export const i8080CpuBundle = {
|
|
218
|
+
manifest: {
|
|
219
|
+
name: 'i8080-cpu',
|
|
220
|
+
version: '1.0.0',
|
|
221
|
+
type: 'cpu',
|
|
222
|
+
kind: 'card',
|
|
223
|
+
maker: 'Intel',
|
|
224
|
+
summary: 'Intel 8080 CPU board — the bus master; sets the power-on jump address.',
|
|
225
|
+
configSchema: {
|
|
226
|
+
resetVector: { type: 'u16', default: 0x0000, min: 0, max: 0xffff, description: 'Power-on jump (program counter at reset)' },
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
cardFactory: (id) => cpuCard(id),
|
|
230
|
+
claims: () => ({ ports: [] }),
|
|
231
|
+
cpu: (cfg) => ({ kind: 'i8080', resetVector: u16(cfg.resetVector, 0x0000) }),
|
|
232
|
+
};
|
|
233
|
+
/** Zilog Z80 CPU card — 8080-compatible bus master with the Z80 instruction set. */
|
|
234
|
+
export const z80CpuBundle = {
|
|
235
|
+
manifest: {
|
|
236
|
+
name: 'z80-cpu',
|
|
237
|
+
version: '1.0.0',
|
|
238
|
+
type: 'cpu',
|
|
239
|
+
kind: 'card',
|
|
240
|
+
maker: 'Zilog',
|
|
241
|
+
summary: 'Zilog Z80 CPU board — the bus master; sets the power-on jump address.',
|
|
242
|
+
configSchema: {
|
|
243
|
+
resetVector: { type: 'u16', default: 0x0000, min: 0, max: 0xffff, description: 'Power-on jump (program counter at reset)' },
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
cardFactory: (id) => cpuCard(id),
|
|
247
|
+
claims: () => ({ ports: [] }),
|
|
248
|
+
cpu: (cfg) => ({ kind: 'z80', resetVector: u16(cfg.resetVector, 0x0000) }),
|
|
249
|
+
};
|
|
250
|
+
/** All built-in seed bundles, keyed by manifest name. */
|
|
251
|
+
export const seedBundles = [
|
|
252
|
+
i8080CpuBundle,
|
|
253
|
+
z80CpuBundle,
|
|
254
|
+
mits2SioBundle,
|
|
255
|
+
imsaiSioBundle,
|
|
256
|
+
imsaiMioBundle,
|
|
257
|
+
mitsDcddBundle,
|
|
258
|
+
usart8251Bundle,
|
|
259
|
+
mc6850Bundle,
|
|
260
|
+
port8212Bundle,
|
|
261
|
+
tr1602Bundle,
|
|
262
|
+
ramCardBundle,
|
|
263
|
+
epromCardBundle,
|
|
264
|
+
];
|
|
265
|
+
export const seedBundleByName = (name) => seedBundles.find((b) => b.manifest.name === name);
|
|
266
|
+
//# sourceMappingURL=index.js.map
|