saturnus docs
Open the app

Memory

The Saturn addresses 1 M nibbles, 512 KB. Nothing in that space is fixed: at start-up the ROM tells each memory controller where its chip goes and how big it is. The 48G series and the 49G have more memory than fits, so they switch banks.

The bus and the controllers

The CPU sends a 20-bit nibble address and reads or writes one nibble at a time. Which chip answers is decided by six memory controllers, inside the Clarke chip of the 48SX and the Yorke chip of the G series and the 49G. Each controller drives the chip-select line of one device:

Controller48SX48G, 48GX49G
NCE1ROMROMflash
HDWthe hardware registersthe hardware registersthe hardware registers
NCE2RAMRAMRAM, 256 KB
CE1card port 1the bank switcherthe bank switcher
CE2card port 2card port 1RAM, 128 KB
NCE3not usedcard port 2RAM, 128 KB, and the flash's write path

The ROM controller needs no configuration and answers any address no other device claims. The hardware registers are a block of 64 nibbles, which the ROM places at address 00100 on every model.

Configuring the controllers

Four instructions talk to the controllers:

The controllers form a daisy chain: a CONFIG goes to the first one in the chain that is not fully configured. The order of the chain is HDW, NCE2, CE1, CE2, NCE3, and the ROM last. Every controller must be configured, whether its device is fitted or not; the ROM parks the unused ones at a small window of 2 KB.

A size is a mask, not a length. Each controller only sees the top eight address lines, so sizes and addresses come in steps of 2 KB, and a window always starts on a multiple of its size. A chip that is smaller than its window repeats in it: a 32 KB card declared as 128 KB shows up four times.

When two windows overlap, one device wins. The hardware registers come first, then the RAM, the cards and the ROM last. Sources disagree on whether CE1 or CE2 wins when those two overlap; the stock ROMs never let them overlap.

It also means that a program can move memory around: copy RAM to address 0 and map it there, and the CPU runs its own interrupt handler instead of the ROM's. A few programs do this, so an emulator cannot hard-wire the map.

The maps

What the ROM sets up after a start, by model. Addresses here are nibble addresses in hexadecimal, as HP's documents write them; sizes are in bytes.

ModelROMRAMCard ports
48SX256 KB from 00000, its top 32 KB covered by RAM32 KB at 70000slot 1 at 80000, slot 2 at C0000
48G512 KB, the whole space, where nothing covers it32 KB at 80000none
48GX512 KB, as the 48G128 KB at 80000slot 1 at C0000, slot 2 behind it in banks of 128 KB
38G512 KB, as the 48G32 KB at F0000none
39G, 40G1 MB, in banks256 KB at 80000none
49G2 MB of flash, in banks256 KB at 80000, 256 KB more as port 1none

The hardware registers sit at 00100 to 0013F on all of them, over the ROM. The 42S and the other Lewis models have a fixed map without controllers.

Bank switching on the 48GX

The G series has 512 KB of ROM, as much as the whole address space. HP solved it with one more address line and a bank switcher.

Since every access to the upper ROM or to port 2 may need a bank switch first, the G series runs more slowly than its clock suggests (see The CPU). The 48GX page tells how the ports appear to the user.

Flash banking on the 49G

The 49G has 2 MB of flash, an Intel 28F160S5, and 512 KB of RAM. It uses the same latch as the 48GX to choose flash banks of 128 KB, with two windows:

The pin the 48GX shares between ROM and port 2 is always NCE3 on the 49G, so no device can be bigger than 256 KB. CE2 and NCE3 each select 128 KB of the second 256 KB of RAM, which the 49G calls port 1. Unlike the 48GX, the latch can also be written, and the 49G configures CE1 only while it switches a bank.

The flash holds the operating system and port 2, the user's flash memory. The first 64 KB of bank 0 are a boot sector, write-protected in hardware. To write the flash, the system maps NCE3 over the flash window and sets the bit that drives the infrared LED on the 48, which the 49G, having no infrared, uses as the flash's write enable. Then it programs the chip with Intel's command set. Because the system is in flash, the 49G's ROM can be updated.

The 39G and 40G come from the 49G's design, with 1 MB of ROM and 256 KB of RAM.

Sources