Skip to main content

Memory

Source

Adapted from Memory.

The Spectrum has no standard sideways-memory scheme. Spectranet therefore maps its own memory into the lower 16K of the Z80 address space and uses the CPLD to decide when that mapping is visible.

Overview

Spectranet memory is arranged as 4K pages. The design supports up to four 256K chips, for a 1MB address space. Classic hardware uses:

  • chip 0: 128K flash ROM
  • chip 1: W5100 buffer/register area
  • chip 2: unused
  • chip 3: 128K static RAM

Two 4K pages are fixed whenever Spectranet memory is paged in:

  • 0x0000 to 0x0FFF: flash page 0, containing initialization code, socket library code, interrupt handlers, and utility routines
  • 0x3000 to 0x3FFF: SRAM page 0, containing workspace, buffers, system variables, and the jump table

The middle 8K is paged:

  • area A: 0x1000 to 0x1FFF
  • area B: 0x2000 to 0x2FFF

Any page from any supported chip can be selected into either area.

Selecting pages

The hardware has two page registers:

  • port 0x003B: page for area A
  • port 0x013B: page for area B

The high two bits of the page number select the chip. In the classic layout:

  • flash ROM pages are 0x00 to 0x1F
  • W5100 pages are 0x40 to 0x48
  • SRAM pages are 0xC0 to 0xDF

Programs should normally use the ROM paging routines rather than writing the ports directly. The ROM routines keep Spectranet system variables in sync with the hardware, and some variants push the old page onto the stack so it can be restored later.

ROM memory map

The flash chip has 32 pages of 4K each. The Spectranet reserves:

  • page 0x00: fixed library and utility call page
  • page 0x01: Spectranet data
  • page 0x02: utility programs, including configuration and DHCP
  • page 0x03: reserved for future use
  • last 256 bytes of page 0x1F: Spectranet configuration storage

The remaining flash pages are available for user ROM modules and data.

RAM memory map

Most SRAM is available to developers, but some pages are reserved:

  • page 0x00: fixed page at 0x3000 to 0x3FFF, containing temporary workspace, buffers, system variables, and some free space
  • pages 0x01 and 0x02: screen copy storage for NMI-style events
  • pages 0x1C to 0x1F: temporary workspace used while rewriting the last flash erase sector during configuration updates