ROMBox ====== The ROMBox provides an expandable method of adding ROMs to the Spectrum, mapped in at &0000 to &3FFF, giving the following memory map: FFFFh +-------+ | | | RAM | | | 4000h +-------+-------+-------+------- - - -----+ | | | | | | ROM 0 | ROM 1 | ROM 2 | ROM 3 ... ROM 7 | | | | | | 0000h +-------+-------+-------+------- - - -----+ ROM 0 is always present on Reset. ROM 1 contains the standard Spectrum ROM, usually provided by releasing ~ROMCS paging in the internal ROM. A minimum ROMBox has one 16K ROM socket for ROM 0 and can page in ROM 0 or ROM 1. The ROM selection is controlled by writing to I/O port &FD: Bit 7 6 5 4 3 2 1 0 +---------------+---------------+ | ROM Bank | RAM Bank | External Memory Select +---------------+---------------+ ROM Bank: Memory paged in at &0000 RAM Bank: Memory paged in at &C000 Bits 0 to 3 of the memory select latch are reserved for selecting banks of RAM at &C000-&FFFF. With a single-socket ROMBox, the following ROM bank values are available: %x0xx - Internal ROM(s) %0100 - External ROM %0101 - Internal ROM The memory select latch is at almost the same address as the memory select latch on a Spectrum 128. The ROMBox responds to I/O address &xxFD and the Spectrum 128 responds to I/O address %01xxxxxx:&FD. The ROMBox is designed to be selected using OUT (&FD),A instructions. Selecting ROM %x0xx unpages ROMBox ROMs by releasing ~ROMCS and allows internal ROMs to be accessed. On the Spectrum 128 this will result in the ROM selected by writing to &7FFD being accessed. Selecting ROM %x1xx pages in ROMBox ROMs by asserting ~ROMCS. Selecting ROM %0101 is defined as selecting the internal 48K Spectrum ROM. On the Spectrum 128 this results in port &7FFD being written to, selecting the internal 48K Spectrum ROM. Notes on OUT (&FD),A -------------------- The OUT (nn),A instructions puts the value nn on the low byte of the address bus and the contents of the A register on the high byte of the address bus, and then writes the contents of the A register to the data bus. This effectively does OUT 256*A+nn,A. The Spectrum 128 only decodes A15, A14 and Ax when decoding address &7FFD, so executing an OUT (&FD),A instruction with A holding a value with b7=0 and b6=1 (ie &40 to &7F) will address the memory select latch. The ROMBox takes advantage of this. A program can write to both the ROMBox select latch and the Spectrum 128 select latch by writing a value in the range &40 to &7F to port &FD. The ROMBox select latch can be written to on its own by writing a value in the range &00 to &3F. Of course, it is entirely possible to write to the ROMBox using BC register OUT instructions. The ROMBox is designed to allow fast single-register OUT instructions to access it.