Calc-U 1600Pocket computer emulator Play in browser

Calc-U-1600 Help 10 Reference Module definition format

Chapter 10 · Reference

Module definition format

A module definition (.module.yaml) describes one memory module: its memory, how it is addressed and the hosts it fits. The bundled memory modules are module definitions, and so is a battery-backed module you saved with Name & Save. Module definitions describes what a definition expresses and why; this page is how it is written, in its current version, format-version: 1.

0. The file


1. Top-level keys

Key Required Value
format no memory-module. Calc-U-1600 writes it into every module it saves; a file without it is read too, one with another value is refused.
format-version yes Integer; this document is version 1.
module-name yes Short identifier for the module (e.g. CE-155, CE-1600M). Shown as it is in the module picker, and what a preset's slot-N: { name: … } resolves against (§8). Unique within a folder of modules.
description no One line about the module (e.g. "8 KB static RAM"), the picker's tooltip for it. A saved instance keeps its template's.
insert-notice no One line shown when you plug the template in by hand (Media); the superRAM r4 names the program it needs. A saved instance keeps it and shows nothing.
compatible-hosts yes List, non-empty, drawn from PC-1500, PC-1500A, PC-1600-Slot-1, PC-1600-Slot-2. The loader's only compatibility check: a host not on this list is declined; a host on it gets no further test.
definition-terminology yes Exactly one of the same four identifiers. Names the pin-name vocabulary every chip-select / signal / line field in the file is resolved against, once, at parse time. Must appear in compatible-hosts.
regions yes List of one or more region maps (§2).
battery no true for battery-backed hardware. A battery-backed template offers Name & Save, which makes the module a medium (Media files). A file without it, a ROM module for one, goes into its slot as it is and is never written; a ROM keeps its bytes without a battery.
template no true marks a read-only template (§8): the product never writes the file, wherever it lies. Absent or false = an instance, autosaved in place. Name & Save and autosave never write it; a preset's saveas: { as: template } writes template: true.
saved no The time of the last write (UTC, ISO 8601), written into every saved instance; for information.
notes no Free text; ignored by the loader.

The reset-on-load behaviour is a loader invariant, not a field — no key can opt out of it.

Versioning. A reader rejects a file without format-version, or with a version it does not know, rather than guess; the version is checked before the other keys. Any change a version-1 reader would misread requires a new version number. A saved instance keeps the line of the file it was saved from.

Terminology → signal names

The name in a chip-select / signal / line field must be legal for the declared definition-terminology:

Terminology Legal signal names (besides A0… address / D0… data lines)
PC-1500 Y0, Y2, S1, S2, S3, S4, PU, PV
PC-1500A Y0, Y2, S3, S4, S5, PU, PV
PC-1600-Slot-1 RAM2, PVOUT, S1, S2, S3, PU, PT
PC-1600-Slot-2 RAM1, PVOUT, K0, K1, K2, PU, PT

Each name resolves, once at parse time, to one physical 40-pin contact (Y0/RAM2/RAM1 → pin 4, S4/PVOUT → pin 5, S1/S3/K0 → pin 16, S2/S4/K1 → pin 17, S3/S5/K2 → pin 18, Y2/PT → pin 19; PU → pin 2 and PV → pin 3 on the PC-1500/1500A, as measured on a real unit (the TRM prints them swapped), PU → pin 3 on the PC-1600 slots).

Whether a name resolves to a live pin or a dormant one on a particular compatible host is not checked here — that is the author's dormant sub-region judgement.


2. Region map

Key Required Value
name yes Identifier, unique within the file.
addressing yes Addressing spec (§3) — dimension D1.
content yes Content spec (§4) — dimension D2.
banking yes none, or a banking map (§5) — dimensions D3/D4.
capacity unbanked only Backing-store size in bytes for the one copy of the region. Required when banking: none; omitted when banked (there it is bank-count * bank-size).
initial-content ROM: yes (must cover every byte) · Flash/Regular: optional Byte content carried in the file (§6). Allowed for any content kind, no restriction — a Regular (RAM) range can power up pre-loaded exactly like a Flash range's initial image.
pc1600-module-class PC-1600 regions only program | system | ram-disk | plain-ram-no-header — authoring cross-check against the header bytes in initial-content. Omit on PC-1500/1500A regions.

3. Addressing spec

An addressing spec is enable groups OR'd together; each group is terms AND'd together. It appears in three places, all the same shape: a region's addressing, a banked region's bank-window, and (in principle) deeper nestings.

addressing:
  any-of:                      # OR across groups
    - all-of:                  # AND within a group
        - chip-select: Y0
        - address-bits: { A13: 1, A12: 1, A11: 1 }   # the on-module decoder's select inputs
      span: 0x0800             # 2 KB — served via the low 11 address lines (A0 to A10)
      maps-to: 0x0000          # where this slice lands in the backing store
    - chip-select: S1          # bare dedicated strobe, no address decode on this path
      span: 0x0800
      maps-to: 0x0800
    - chip-select: S2
      span: 0x0800
      maps-to: 0x1000

Shorthand: a single-group spec may drop any-of and give all-of directly; a single-term group may drop all-of and give the bare term.

Group terms

Term Meaning
chip-select: NAME Named line asserted. Friendly alias for signal. The common case: one dedicated strobe standing for one slice of storage, with no address decode on that path. Several such strobes for one region are separate OR'd groups (one per - entry under any-of), not a list.
chip-select: [A, B, C] All listed lines asserted at the same access (an AND). Uncommon — the host's 2 KB strobes are mutually exclusive, so this is only for a strobe that is qualified by another live signal.
signal: NAME / signal: [..] Same as chip-select; use when the line isn't a decode strobe (e.g. PVOUT).
signal-negated: NAME Line explicitly not asserted. Needed to split a window by a half-select line (PVOUT low vs. high).
address-bits: { An: 0|1, … } Specific address lines required at specific levels, AND'd into the group. Models an on-module decoder that gates on a few address lines alongside a chip select — not a full address-bus comparison. CE-155's Y0 chip: { A13: 1, A12: 1, A11: 1 } (the "AD11–AD13 = 111" of PC-1500 address decoding §3.2). Lines not listed are not tested. Does not set span — the low, un-listed lines are the offset.
memory-range: { from, to } A raw address window the module decodes itself, with no chip select in the group. Fixes span from to − from + 1; the offset within the slice is address − from, so the window need be neither a power of two nor aligned. Flagged distinctly because the author's host-compatibility judgement has no pin to anchor to.

Group keys

Key Default Meaning
span required unless the group has a memory-range Size in bytes of the storage slice behind this group. The module serves it using the low log2(span) address lines as the offset (a memory-range group uses address − from instead) (0x0800 ⇒ A0 to A10); it does not decode any higher line except those an address-bits term names.
maps-to groups packed in declaration order, each starting where the previous ended Byte offset in the region's backing store (or, inside bank-window, the current bank's slice) that the low end of this group's slice maps to.

The groups' slices must tile capacity (unbanked) or bank-size (banked) exactly — no gap, no overlap.


4. Content spec

Whole-region, one kind

content: rom            # bare string form: regular | rom | flash (defaults for each kind)
content:
  kind: regular
  writable: true              # false = wired read-only (not a togglable switch)
  power-up-fill: 0x00         # per-range power-up byte; default 0x00 (CMOS RAM after a power loss)
  write-protect: unprotected  # optional: the module has a write-protect switch (CE-161); omit if not.
                              # protected | unprotected = the switch position, part of the module's file.
                              # Protected refuses every write, host pokes included. Name & Save with
                              # "Write-protect" / `saveas: { …, protected: true }` saves it as `protected`.
content:
  kind: flash
  power-up-fill: 0xFF         # default 0xFF (erased); applies only where `initial-content` leaves gaps
  protocol:                   # chip/firmware properties, not inferred
    unlock-sequence:
      - { address: 0x5555, data: 0xAA }
      - { address: 0x2AAA, data: 0x55 }
    byte-program-command: 0xA0
    erase-setup-command:  0x80
    sector-erase-command: 0x30
    chip-erase-command:   0x10
    sector-size: 0x1000
    reset-command: 0xF0
    command-address-mask: 0x7FF   # optional; default = full address, no masking.
                                   # How many low address bits the command
                                   # decoder actually looks at before comparing
                                   # against an unlock-sequence/command address --
                                   # some flash chips (recovered from a real
                                   # CE-163F firmware disassembly) decode fewer
                                   # bits than the full bus, so an unlock write's
                                   # upper address bits don't have to match.

Every field above is required except command-address-mask — there is no sensible default for a chip/firmware property, so content: flash as a bare string (no protocol:) is a load error, not a "use the defaults" shorthand.

rom takes no options beyond the implicit read-only-forever rule; its bytes come from initial-content (§6), which is mandatory for ROM.

Split content in a banked region

content:
  by-bank:
    - { banks: "0-7",  kind: regular, power-up-fill: 0x00 }
    - { banks: "8-15", kind: flash, protocol: { ... } }

banks is a "lo-hi" string or a single integer. Ranges must partition 0 .. bank-count-1 with no gap or overlap. A single-kind banked region just uses the whole-region form above.


5. Banking map

banking:
  latch:
    type: trigger-based            # trigger-based | line-based
    # --- trigger-based ---
    trigger: { pin: 18 }           # a memory-write strobe pin (CE-163: S3),
                                   # OR { io-port: 0x28 } for an OUT (n) write (CE-1601M)
    sampled-lines: [A0, A1, A2, A3]  # bits latched on the trigger; sampled-lines[0] is the LSB
    source-domain: address         # address → bits of the address bus (CE-163)
                                   # data    → bits of the written byte (CE-1601M's OUT (28H))
    # --- line-based (instead of trigger/sampled-lines) ---
    # lines: [K0, K1, K2]          # the bank number read live off these lines
    # source-domain: address-select
  bank-count: 2                    # live banks (may be < what the latch width allows)
  bank-size: 0x8000               # bytes per bank
  bank-window:                     # addressing spec (§3), nested one level
    any-of: [ ... ]

A banked region's top-level addressing (§2) is a pure gate — "is this access one my banking applies to at all" — so it carries only terms, no span / maps-to. All slice mapping happens in bank-window, which carries its own full addressing spec so a second, independent sub-range (the PVOUT of the CE-1601M, 256K custom and superRAM r4) can be expressed as "selected-bank AND half-select line", one level deeper. Inside bank-window, span / maps-to offsets are into the current bank's bank-size slice.

Both confirmed banked modules are trigger-based and differ only in source-domain: CE-163's { pin: 18 } strobe samples the address bus; CE-1601M's { io-port: 0x28 } write samples the data bus. Both latch the decoded bank internally until the next trigger.

Descriptive "Vertical / Horizontal" is not a field: line-based = Horizontal, trigger-based = Vertical.


6. initial-content

Bytes fixed by the definition — all of ROM's content (required), or a Flash or Regular (RAM) range's initial array (optional; absent ⇒ the range powers up as its power-up-fill byte). There is no content-kind restriction: a Regular range takes initial-content exactly like a Flash range does — CE-163F's RAM banks and Flash banks are both populated this way when dumped and pasted back in (§9). Never an external file: a ROM under development comes in through the preset instead (§8, slot-N-rom:).

initial-content:
  fill: 0xFF                 # bytes no block covers; default is the bank's
                              # own power-up-fill (content §4), not always 0xFF
  blocks:
    - bank: 0                # omit entirely for an unbanked region
      offset: 0x0000         # start offset within the region / bank slice
      encoding: hex          # hex | base64 | addressed-hex
      bytes: |
        43 16 00 00 ...       # whitespace/newlines ignored for hex
    - bank: 1
      offset: 0x0000
      encoding: addressed-hex
      bytes: |
        $0000: FF...          # the whole bank slice, one byte value

encoding: addressed-hex

A project-specific dialect designed so a memory dump can be pasted straight into a bytes: | block with no reformatting — the INSPECTOR's Module YAML button (Debugger) writes exactly this. Lines are either an explicit row or a same-byte run:

bytes: |
  $0000: 00...
  $0050: 00 00 00 00 00 00 11 F1  8A 26 45 33 2C 58 40 12
  $0060: F0 97 22 42 41 4E 4B 20  22 3B F1 6F 26 45 32 40
  $0070: 13 F0 97 22 56 32 30 22  40 FF FF FF FF FF FF FF
  $0080: FF...
  $3FF0: AA...

Encodings

addressed-hex, hex and base64; any other encoding is an error.


7. Worked examples

File Module Shows
ce151.module.yaml CE-151, 4 KB Two bare-strobe span groups (S1, S2), one 2 KB chip each, no on-module decode (Service Manual schematic 5-3); PC-1500/1500A and PC-1600 Slot 1.
ce161.module.yaml CE-161, 16 KB One bare Y0 group spanning the whole 16 KB window; battery-backed with a write-protect: switch (CE-161 program module); PC-1500/1500A and both PC-1600 slots.
ce155.module.yaml CE-155, 8 KB one address-bits group (the on-module AD11–AD13 decoder) OR'd with three bare-strobe span groups; an author-declared host list covering PC-1500 and PC-1600 Slot 1.
ce1600m.module.yaml CE-1600M, 32 KB PVOUT folded into addressing as a half-select line — unbanked despite two physical halves; one Slot-1-terminology file declared for both PC-1600 slots (RAM2 resolves to the pin-4 enable on both).
ce1601m.module.yaml CE-1601M, 64 KB Trigger-based vertical banking — trigger: { io-port: 0x28 }, source-domain: data (the byte written by OUT (28H)); bank-window nesting the PVOUT half-select.
256k-custom.module.yaml 256K custom, 256 KB The CE-1601M mechanism with all 8 × 32 KB vertical banks of its 3-bit (D0–D2) latch fitted; initialised (addressed-hex blocks as INIT"S2:","F" then "M" leave it); PC-1600 Slot 2 only.
superRAMr4.module.yaml superRAM r4, 1 MB The CE-1601M mechanism with a 5-bit (D0–D4) OUT (28H) latch and 32 × 32 KB vertical banks; blank; PC-1600 Slot 2 only.
ce1638.module.yaml CE-1638, 128 KB A single-kind banked region — trigger-based, address-domain, 8 banks sampling A0-A2.
CE-502B.module.yaml (comes with the ROMs) CE-502B, 16 KB ROM content: rom with one addressed-hex block covering the whole region: a Sharp program module (ROM header at &0000, BASIC program from &00C5) on Y0.
ce163f.module.yaml CE-163F, 256 KB content: by-bank: (§4) splitting one 16-bank region into Regular (0-7) and Flash (8-15) content, and a flash protocol: block including command-address-mask for its real low-11-bit command decode quirk.

8. Plugging a module in: slot-1:, slot-2: and slot-N-rom: in a preset

A preset plugs a module into a slot by name or by file (the preset's other keys: Preset sections):

# PC-1500 / PC-1500A: one slot
slot-1: { name: CE-155 }

# PC-1600: two slots
slot-1: { name: CE-1600M }
slot-2: { file: cards/prototype.module.yaml }   # relative to the preset

A ROM from a file: slot-N-rom:. While a ROM module is being developed, its bytes come from the build, not from the module definition:

slot-1: { file: module.module.yaml }      # decode, banking, the ROM's size
slot-1-rom: { file: build/module.bin }  # what the ROM holds

The module definition stays complete: its ROM region holds a placeholder ($0000: FF..., §6) and loads on its own. slot-N-rom: replaces those bytes, and only those:

Templates and instances. What happens to a module's file is decided by the file itself, not by where it lies:

Either way the host (the model, or the PC-1600's slot) must be in compatible-hosts, or the module is refused. The slot pickers list the modules whose compatible-hosts cover the model and slot, by module-name.

9. What is supported

The parser reads the whole format and validates it; the product supports:

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