Skip to main content

Crate saturnus_core

Crate saturnus_core 

Source
Expand description

Core library of the Saturnus emulator: Saturn CPU, bus, modules and per-model machine wiring. No I/O and no threads: this crate must build for wasm32.

The public API is the Machine and what it takes and returns: Model, io::Key, Port, the display (Lcd, Framebuffer, Annunciators), Error and Halt, and a disassembler for traces (disasm). The CPU, the bus and the I/O chips are internal; the internals feature exposes them, without any stability promise, for this crate’s own ROM-gated tests and its boot example.

Hardware facts are cited as wiki: <page> referring to the calculator wiki (see kb/docs/knowledge-sources.md).

Modules§

disasm
Disassembly for traces and listings: decode the instruction at an address and render it in HP SASM syntax (see the CPU’s disassembler for the conventions). The instruction set itself stays internal; an Instruction is only its length and its text.
io
Memory-mapped I/O of the HP48: the 64-nibble HDW register window, the two hardware timers, the UART and the keyboard matrix; and the 42S’s Lewis display and register block.

Structs§

Annunciators
The annunciators above the pixel area: six on the 48-family models (wiki: hardware/display, bit names after Giesselink: #10B LA1-LA4, #10C LA5-LA6), seven on the 42S (wiki: hardware/lewis “Annunciators”) and seven on the 28S (wiki: hardware/hp28s “Annunciators”). The Lewis models’ shift, print and run (busy) annunciators are reported as left_shift, transmitting and busy; updown, g exist only on the 42S, battery and rad on the 42S and 28S, suspended on the 28S.
Framebuffer
Everything the display shows: pixels, annunciators and contrast.
Lcd
A snapshot of the LCD pixels.
Machine
A complete calculator: CPU, hardware and the clock that ties them.

Enums§

Error
Something the caller handed the library was unusable.
Halt
Why a run stopped before its cycle budget was used up.
Model
A supported calculator model.
Port
A card port of the HP48 (wiki: hardware/card-ports). Which chip select serves it depends on the model: CE1 and CE2 on the 48SX, CE2 and NCE3 (banked) on the 48GX.

Constants§

ADDR_MASK
Mask for 20-bit addresses (D0, D1, PC, RSTK entries). wiki: hardware/saturn-cpu (20-bit address space).
CARD_MAX_BYTES
Largest card image any port of any model takes: 4 MB, 48GX port 2 (wiki: hardware/card-ports). Per port and model see Model::card_max_bytes.
CARD_MIN_BYTES
Smallest card image in bytes (1 KB).
INTL_17B_BYTES
The international 17B and 17BII ROM image: 64 KB plus a 32 KB language ROM.
LCD_HEIGHT
LCD height in pixels of the 48-family models.
LCD_HEIGHT_28S
LCD height in pixels of the 28S: four lines of 8 rows.
LCD_HEIGHT_42S
LCD height in pixels of the 42S: two lines of 8 rows.
LCD_WIDTH
LCD width in pixels of every model but the 28S.
LCD_WIDTH_28S
LCD width in pixels of the 28S.
NEW_CARD_BYTES
Size of a new, empty RAM card: 128 KB, the largest card every port of every model with slots takes.
STATE_FORMAT
The format version this library writes and reads (the u16 after the magic): a host that keeps states tells a newer one from a broken one.

Functions§

pioneer_address_order
image in address order: reordered when it is in dump order, as it is otherwise.