Calc-U 1600Pocket computer emulator Play in browser

Calc-U-1600 Help 9 Product topics Module definitions

Chapter 9 · Product topics

Module definitions

Every memory module of Calc-U-1600 is described by a module definition, a .module.yaml file: which connector pins enable it, what memory sits behind them, and optionally what it starts with. The bundled modules (CE-151, CE-155, CE-161, CE-1638, CE-163F, CE-1600M, CE-1601M, 256K custom, superRAM r4, and the CE-502B of the ROM set) are module definitions, and you can write your own. This page first shows how, then explains what a definition must express and why. Every key of the file is in The module definition format.

Making your own module

A module with content already on it

  1. Prepare it with a preset (see examples/setup/).
  2. Click Module YAML in the INSPECTOR (Debugger).
  3. Paste the printed block into the module definition.

If you only want to reuse one prepared module, Name & Save it instead and choose it by name.

What a module definition expresses

The rest of this page is the content model: what a module definition must express and why. The YAML spelling of it is in The module definition format, with worked examples among the examples. Every field exists because some documented mechanism of the PC-1500/PC-1600 expansion connector or bank switching needs it to be expressible; §9 cross-checks that row by row against the Technical Reference Manual and the project's own ROM traces.

1. Design principle: the loader connects pins; terminology is an authoring convenience with no other meaning

The loader operates on physical pin numbers, full stop. Every signal a region's addressing/latch fields reference is, underneath, one of the 40 physical pins on the expansion connector — the loader's actual job at run time is entirely expressible in terms of "pin N asserted," never in terms of a name like S1 or Y0. A definition file could be written directly in pin numbers and nothing about how the loader behaves would change; the file format would just be less pleasant to read and write.

Signal-name terminology exists purely so the file's author can think and write in signals instead of bare pin numbers — nothing more. The connector reuses the same physical pins for different signals across PC-1500 vs PC-1500A vs PC-1600 Slot 1 vs PC-1600 Slot 2, so "S1" only resolves to a pin once you say whose vocabulary it's drawn from; that's why a file declares one terminology and every signal name in it is looked up against that one table, once, at load/parse time, into a plain pin number. After that lookup, terminology has done its entire job — it carries no further semantic weight, is not consulted again, and has no bearing on anything the loader decides afterward (including compatibility, below). Supporting more than one terminology is a convenience for authors who think in a specific host's own signal names (most naturally, whichever host the real module they're modeling shipped for); the file format would be fully expressible with a single, pin- numbered terminology instead, at the cost of being harder for a person to write and review.

Every host's expansion connector is physically the same 40-pin port (Ref/Expansion/Software-Defined-Memory-Extension.md §4) — a module built for one model physically fits the slot of every other model listed here. Nothing about the file format needs to model a plug that won't fit; the load-time gate is not a connector/electrical simulation, it's a much simpler thing.

Compatibility is an author-declared list, and the loader's job is exactly one check: is the host being loaded into on that list? If yes, load; if no, decline. The loader does not independently derive, validate, or second-guess that list against pin tables, NC pins, or per-host signal roles — that judgment belongs to whoever authors the definition file, the same way it belonged to whoever wired a real hardware module and decided which hosts to sell it for.

A pin the file references that happens to be NC on one of its declared- compatible hosts is not an error and not a reason to decline loading — it is simply a sub-region of the module that never asserts on that host, the same way a real hardware module would behave if plugged into a slot missing one of the traces it expects. Two concrete cases:

An author who wants a module's behavior to be uniform (never dormant) on every host it declares compatible can still choose to write it that way — by simply never referencing a pin that's NC anywhere on that list — but nothing about the file format or the loader forces that choice; a partially-dormant module on some of its declared hosts is equally valid.

This also settles what "the module never knows which host it's plugged into" means in practice: the loaded region's addressing/latch configuration is fixed at authoring time and never branches on detected host identity — but that's a property of a single file's own logic, not a reason it needs a separate file per host. One file, with one fixed addressing spec and one compatible-host list, is the whole story; a dormant NC-backed sub-region on one of its declared hosts is an expected, acceptable outcome of that one file, not evidence it should be split.

Where the author's judgment call matters most is a region using direct memory-range match (§4), which decodes a raw address window with no host-provided chip-select at all: the same numeric address range can mean something different (or already be claimed by other hardware) on different hosts, with no pin on the module to point to either way. The mechanism for declaring compatibility is identical to the chip-select case above — the author lists the hosts, the loader checks the host being loaded is on that list — but getting the list right for this kind of region depends entirely on the author's own knowledge of each host's address map, since there's no signal name to anchor the decision to.


2. Required top-level identity


3. Dimension model

A module is a list of one or more memory regions. Every region is fully described by four independent dimensions. Independent means: each is specified once, in its own place, and none of the other three can be inferred from it — a region's addressing doesn't tell you its content type, its content type doesn't tell you whether it's banked, and so on.

# Dimension Values Specified
D1 Addressing chip-select set (with AND/OR combination) · address-line qualifier (specific lines at specific levels, not a bus-window compare) · direct memory-range match — see §4 Once per region. If the region is banked, a second addressing spec of the same shape nests inside it as the bank window's own sub-range (needed for the PVOUT of the CE-1601M, 256K custom and superRAM r4 — see §6/§9)
D2 Content Regular (CPU-read/writable) · ROM (bytes carried inline in the definition file, never CPU-writable) · Flash (optional initial content carried inline in the definition file, CPU-rewritable at runtime via a command-sequence protocol) — see §5 Once per region if unbanked. If banked, once per bank-range (not necessarily once per region) — see §5's split-bank note
D3 Banking presence Unbanked · Banked Once per region — see §6
D4 Bank latch mechanism (only if D3 = Banked) Trigger-based (a strobe — a pin, or an OUT to a port — whose assertion is the instant the module samples a bank-data source and latches it internally: CE-163 samples the address bus, CE-1601M the data bus) · Line-based (an always-visible signal group read live, no internal latch — expressible but unexercised) — plus which signal(s)/pin(s) and which bus domain Once per region — see §6

There is deliberately no separate "orientation" field. Every value a Vertical/Horizontal label could take is fully determined by which signal(s) and which mechanism D4 already names — a trigger-based latch on pin 18 sampling A0 (CE-163) or on OUT (28H) sampling D0–D2 (CE-1601M) is what "Vertical" means; a line-based latch read live off K0–K2 is what "Horizontal" means. Asking the file to state both would just be asking the same fact twice. Vertical/Horizontal remain in this document as descriptive terminology — they're the words this project's other docs and Sharp's own manuals use, and they're useful shorthand when talking about a module's mechanism — but they are not fields a definition file needs to fill in; the file only ever needs to say Trigger-based or Line-based, plus the signal(s) and domain. §6 below covers both confirmed banked families (both trigger-based, differing only in the sampled bus), for readers translating between the two vocabularies.

Addressing (D1) is genuinely orthogonal to everything else and is specified once, as a single reusable sub-model that other dimensions reference rather than redefine — not a separate "enable condition" field repeated once per content kind and once per banking kind. §4 below is that single addressing sub-model; §5–6 all use it rather than defining their own version of it.


4. D1 — Addressing (shared, specified once)

Every kind of memory needs to be addressed — this is common to all regions regardless of where they sit on D2–D4, so it's specified exactly once as a sub-model that other dimensions reference rather than repeat.

An addressing specification is one or more enable groups, OR'd together; each group is one or more signals/qualifiers, AND'd together:

This same sub-model is reused, unmodified, in two other places:


5. D2 — Content: Regular vs. ROM vs. Flash

ROM and Flash share the same D1 addressing sub-model as Regular — content kind is purely a question of where the bytes come from and whether/how the CPU can change them, never a question of how the region is addressed.

Split content within one banked region. D2 is specified per bank-range, not necessarily once for the whole region, because a real banking scheme can mix kinds behind the same bank-select mechanism — CE-163F above is exactly this: 8 Regular banks followed by 8 Flash banks, all selected the same way. The definition file records this as a list of {bank range → content kind} entries (e.g. banks 0–7: Regular, banks 8–15: Flash) rather than one kind per region — a single-kind region is just the degenerate case of one entry covering every bank (or, if D3 = Unbanked, the only entry, implicitly covering the region's one and only "bank"). A ROM/Flash mix behind one bank-select, or any other combination of the three kinds, is equally expressible even though no module in §9 happens to need it today.

5a. Where ROM, Flash, and Regular bytes are specified

Any content this spec pins down at authoring time lives inside the definition file itself, never in an external preload/image file. That covers all of ROM's bytes (mandatory — ROM is nothing without them) and, when one is declared at all (optional, §5), a Flash range's initial array or a Regular (RAM) range's own pre-loaded content — there is no content-kind restriction on carrying one. All three are expressed through the same byte-content section, which every ROM region must (it is incomplete without one) and any other region or bank-range may carry regardless of its D2 kind. It expresses:

A file that marks a region or bank-range D2 = ROM without supplying its bytes is incomplete and should be rejected at load time, the same way a header/content pairing that contradicts itself is (§7). A Flash range with no byte-content block is complete — it just starts erased.

This section is only about content fixed by the definition. A separate preload file that runs BASIC or machine code which then drives the Flash write protocol (§5) at runtime is an ordinary use of the running machine, outside this spec's scope, and changes nothing here.


6. D3/D4 — Banking presence and latch mechanism

Naming trap: Sharp's own TRM calls the CE-1601M mechanism the "vertical bank register" (Port 28H). It is tempting to read "register" as "the host holds it, so the module just reads a live line" — i.e. Line-based. But Port 28H is decoded on the module: the OUT (28H) is a strobe, and the module samples the data bus and latches the result. By the test that matters (does the module have to remember something), that is Trigger-based, the same family as CE-163 — the two just sample different buses (CE-163 the address bus off a pin strobe, CE-1601M the data bus off an I/O-port strobe). Neither a definition file author nor the loader ever has to write "Vertical" or "Horizontal": naming the trigger, the sampled lines, and the domain says everything the file needs to.


7. PC-1600 module header

The PC-1600 firmware identifies a ROM/RAM-disk module by an 8-byte header physically present at the start of the module's own address space (8000H, A000H, or B000H depending on which page the module occupies) — Ref/Firmware/PC-1600-Transparent-Banking.md's "ROM Module Detection and Headers": ID bytes 43H 16H, reset-jump/checksum, start/boot fields, module length/boot address, BASIC address, end address, and a type byte (80H/FFH = RAM-Disk, F0H = Program, F2H = System, 01H = write-protected), followed by a jump table (reset, interrupt, important routines, AUTORUN.BAS search, device-name pointer, token-table pointer, file-processing jump) at a fixed offset. Boot-time presence is additionally tracked host-side via bitmaps at F0AEH/F0AFH (by start address and bank position) and probed per-slot via the SLOTST firmware call, which reads the type byte directly out of the header.

This has two consequences for the definition file, not one:


8. Initial content / power-up state

Distinct from D1 (addressing) and D2 (content kind) is what's inside a region or bank-range at load time:


9. Coverage check against the source module table

Every row of Ref/Expansion/Software-Defined-Memory-Extension.md §2–3 must be expressible as one or more regions, each fully placed on D1–D4. Working through them:

Module D1 Addressing D2 Content D3 Banking D4 Latch mechanism Compatible hosts
CE-151 S1 OR S2 — two bare mainboard strobes, one per 2 KB chip, no on-module decode and no Y0 path (Service Manual schematic 5-3) Regular Unbanked — PC-1500, PC-1500A (pins 16, 17 keep the same role on both), PC-1600 Slot 1 (B000–BFFF, Port 3CH = 1AH) — expressed as the bundled ce151.module.yaml
CE-155 (Y0 AND AD11–AD13 = 111) OR S1 OR S2 OR S3 — the three S groups are bare mainboard strobes, one per dedicated 2KB chip, no on-module decode Regular Unbanked — PC-1500, PC-1500A (pins 4, 16, 17, 18 keep the same role on both — §1)
CE-157 RAM: same shape as CE-151/155 area. ROM: likely Y2 sub-range, PV-selected RAM: Regular. ROM: ROM RAM: Unbanked. ROM: unconfirmed — possibly banked if PV is a live line ROM: unconfirmed — flagged in the source doc itself; this spec's job is only to be capable of expressing it once confirmed PC-1500, PC-1500A
CE-159 Same as CE-155 Regular, write-protect switch Unbanked — PC-1500, PC-1500A
CE-160 Same territory class as CE-159 (read-only) ROM Unbanked — PC-1500, PC-1500A
CE-161 Y0 alone, full 16KB Regular Unbanked — PC-1500, PC-1500A, PC-1600 Slot 1, PC-1600 Slot 2 — expressed as the bundled ce161.module.yaml
CE-163 Y0, 16KB window Regular, all banks Banked Trigger-based: pin 18 write pulse; source A0 (address domain) PC-1500, PC-1500A
16-bank CE-163-alike Same as CE-163 Regular, all banks Banked Trigger-based: pin 18; source A0–A3 PC-1500, PC-1500A
CE-1638 Y0, 16KB window Regular, all banks Banked, 8 banks Trigger-based: pin 18 write pulse; source A0–A2 (address domain) PC-1500, PC-1500A, PC-1600 Slot 1, PC-1600 Slot 2 — expressed as the bundled ce1638.module.yaml
CE-163F Y0, 16KB window Banks 0–7: Regular. Banks 8–F: Flash (bank 8 firmware-reserved, 9–F user-writable) — see §5 Banked, 16 banks Trigger-based: pin 18 write pulse; source A0–A3 (address domain, same mechanism as the 16-bank CE-163-alike above) PC-1500, PC-1500A, PC-1600 Slot 1, PC-1600 Slot 2 — expressed as the bundled ce163f.module.yaml (Flash content + by-bank split, §5)
"maxed out," PC-1500/1500A Y0 full window OR S1 OR S2 OR S3 OR S4 (pin 5 included) — again bare per-strobe groups, OR'd Regular Unbanked — PC-1500 (full 24KB, all four S-pins live), PC-1500A (author's choice — the pin-5-driven 2KB slice stays dormant there since pin 5 is NC, leaving the same 22KB a PC-1500A-only variant would offer; declaring PC-1500A compatible is optional but not incorrect, §1)
CE-1600M RAM1/RAM2 Regular Unbanked (native host bank selection, invisible on the connector) — PC-1600 Slot 1, PC-1600 Slot 2
CE-1601M RAM1 (Slot 2) Regular, both banks Banked Trigger-based: OUT (28H) write; source D0–D2 (data domain — the module decodes/latches Port 28H itself); bank window nests a PVOUT half-select (D1, one level deeper — see §4) PC-1600 Slot 2 only (the Port 28H strobe doesn't reach Slot 1)
CE-1620M Same as CE-1600M ROM Unbanked — PC-1600 Slot 1, PC-1600 Slot 2
256K custom (PC-1600 Slot 2 "maxed out") RAM1 Regular, all 8 banks (256 KB) Banked Trigger-based: OUT (28H) write; source D0–D2, as CE-1601M with every bank fitted; same PVOUT nesting PC-1600 Slot 2 only — expressed as the bundled 256k-custom.module.yaml
superRAM r4 RAM1 Regular, all 32 banks (1 MB) Banked Trigger-based: OUT (28H) write; source D0–D4 (5-bit register latched on the module); same PVOUT nesting as CE-1601M PC-1600 Slot 2 only — expressed as the bundled superRAMr4.module.yaml

Three structural points this table confirms rather than just illustrates:

  1. D1's nesting requirement is real, not hypothetical — the CE-1601M, 256K custom and superRAM r4 all need a bank-select condition combined with an independent PVOUT half-select inside whichever bank is currently active; the bank window (§6) carries its own full D1 spec rather than a bare address range specifically because of these rows.
  2. CE-163F confirms the split-content case is real, not hypothetical either (§5) — its 8 Regular banks followed by 8 Flash banks, one D2 value changing partway through an otherwise-uniform bank range, is exactly what §5's {bank range → content kind} list form exists for. No confirmed module mixes ROM with either of the other two kinds within one banked region, or nests Flash inside CE-1601M-style sub-banked territory — those remain unexercised but expressible, because D2/D3/D4 being genuinely independent dimensions is what makes future hypothetical or modern-recreation modules (an R/W-plus-ROM-bank cartridge, say) expressible without a spec change.
  3. The PC-1500/1500A "maxed out" row is one definition covering both hosts, with one host running it partially dormant — compatibility is an author choice, not a pin-derived pass/fail (§1), so a single file using pin 5 can declare both PC-1500 and PC-1500A compatible: it reaches the true 24KB ceiling on PC-1500, and on PC-1500A the pin-5-driven 2KB slice simply never asserts (pin 5 is NC there), leaving the same 22KB a PC-1500A-targeted module would offer on its own. An author who instead wants a module that behaves identically (no dormant slice) on every host it declares compatible can still write one that never references pin 5 at all — nothing in the mechanism forces either choice, both are valid (§1).


Which further modules ship as bundled definitions is open; CE-157's ROM half and CE-160's exact 7.8 KB reserved layout are unconfirmed in the research, and this model is written so that they are expressible once confirmed.

Help built from Calc-U-1600-help.zip 0.9.1, the help of the Calc-U-1600 0.9.1 release.