# Toshiba T100 exhibit: the saved state's schema (`snapshot.format` 2) The T100 keeps the whole machine as a `.calcstate` (docs/framework/SETTINGS-SNAPSHOTS.md §4.1). `simulators/t100/rsl.yaml` declares `snapshot: { support: full, format: 2 }`. The code is `t100/src/machine/state/t100State.ts` and `T100Control.saveState`/`loadState` (`t100/src/machine/ui/control.ts`); the gate is `t100/src/machine/state/t100State.test.ts`. The Pasopia, built from the same package, has the same format. ## Where it is kept - **Save State, Snapshots and autosaves** (every 120 s, three kept, and on hiding the page or a power cycle): the browser's file area `/t100/t100/states`. - **Export and the handle's `snapshot()`:** the same bytes as one file, with the diskettes inside. - **`restore(bytes)`** and Snapshots resume them; a state is refused when its ROM or character generator is another one than the running machine's (the header pins both by sha256). ## The header `{ machine: "t100", rsl, model: "t100", format: 2, roms: [the system ROM's and the character generator's sha256], slots, overlays: [], settings, saved, label }` and the machine's own head (`format`, `build`, `tree`, `sizes`, `tape`): `build` is `rom |cg |drives `, what a state's machine must be built as. ## The sections | Section | Content | |---|---| | `machine` | The machine as data, written by core's reflection (`core/src/state/reflect.ts`) from the live objects in the order their constructors assign their fields: the Z80 (`chip.z80`), the CTC (`chip.z80-ctc`), the PIO (`chip.z80-pio`), the three 8255s (`chip.i8255`), the HD46505S (`chip.mc6845`: `regs`, `addr`, `anchor`, `lpenFull`, `variant`) and the video circuit with the picture being drawn, the key matrix, the speaker's flip-flop, the µPD765 (`chip.upd765`) and the drives' heads (`periph.floppy-drive`), the printer port's latch and queue, the cassette deck's motor, position and recording, the RAM PACK in slot 2 and a ROM PACK in slot 1. JSON. | | `blobs` | The typed arrays those objects hold (64 KB RAM, the VRAM, a pack's bytes), in the order the tree names them. | | `disks` | The diskettes in the drives, every track as the controller sees it: per sector its ID field, density, address mark, CRC flag and data. A resume puts them back into the visitor's copy. | ## What is not in a state The system ROM and the character generator (pinned in the header), the tape in the deck (a wallet medium: the state names it and keeps the deck's position), the printer on the cable and its paper, the speaker's tone list, the diagnostics. ## When a state is taken Between instructions, while the floppy controller has no command step waiting (`Upd765.idle`): its next step would be a closure, which a state cannot carry. `settleForState` runs the machine on to that point (a command ends in well under a second of machine time). Seeks are data and may still run. ## What makes a new format A saved field's name, its place in its object and its meaning are the format. The components' saved fields are their API (`components/*/rpk.yaml` `snapshot`; `chip.upd765` pins its list by a test); a change to one is a major version of that component and a new `snapshot.format` here, with a migration on load. The extraction of the components on 14 Nov 2026 changed none: the drive's one renamed field (`disk`, now `medium`) was never saved, and states made before it resume (the state gate). ## The formats | Format | Written by | What changed | |---|---|---| | 1 | up to 0.2.0 (and the earlier site's T100 and Pasopia pages) | the HD46505S as the package's own register file: `crtc: { regs, index }` | | 2 | 0.2.2 on | the HD46505S as `chip.mc6845` 1.1.0 (#1199): `crtc: { regs, addr, anchor, lpenFull, variant }` | **Format 1 still resumes.** The page tells the shell which older formats it reads (`reads` of core's `Snapshots`, from `T100_STATE_READS`), and `loadT100` migrates the tree before it is restored: the CRTC's address register `index` becomes `addr`; the chip's three other fields were not in a format 1 state and keep the values of the machine the state is restored into (the T100's board uses neither the chip's own timing nor its light pen, so they never differ from a fresh chip's). The gate is `t100/src/machine/state/stateFormats.test.ts`: a Pasopia's and a T100's state written by 0.2.0 (`t100/fixtures/states/`, made by `t100/tools/make-state-fixture.ts` in that checkout) resume, show their screens, and then run field for field as a machine of this version that did the same from power-on. A state of format 2 is refused by 0.2.0 ("T100 state format 2, this version reads 1").