How it works

SpeccyBoot is a device for booting a ZX Spectrum over an Ethernet network. Network booting was widely used with diskless workstation a few years back, and is still useful for configuring and booting embedded devices such as VoIP phones or embedded development boards.

Contents


How network booting works

In general, network booting works as follows:

The process is automatic (assuming BOOTP and TFTP servers have been configured correctly).

SpeccyBoot is a device to do this with a Spectrum. The device connects to the Spectrum's expansion port, and to your local network using standard Ethernet. It is based entirely on standard IP-based protocols, so it works with standard software.

This allows us to load virtually any program onto the Spectrum in a matter of seconds. Programs are packaged as .z80 snapshots, which can be created from any modern Spectrum emulator.

Network booting with SpeccyBoot

When you switch on a SpeccyBoot-equipped Spectrum, it will do the following:

  1. If Caps Shift is being pressed when the machine starts, SpeccyBoot is bypassed: the machine will then boot into the regular Spectrum ROM, and not continue with the steps below.
  2. Otherwise, an IP address is obtained using BOOTP. SpeccyBoot broadcasts a BOOTP request, and expects a BOOTP reply from the BOOTP server.

    While SpeccyBoot is waiting for the BOOTP reply, a flashing digit on the screen indicates the current firmware version.

    When a BOOTP reply is received, the local IP address and the TFTP server address are set accordingly, and displayed on the screen.

    By default, the machine that responded to BOOTP will be contacted for TFTP too. If the BOOTP reply includes a TFTP server address (field sname), then that address is used for TFTP instead. Note, however, that the TFTP server address must then be specified as a quad-dotted decimal address, such as 192.168.48.103.

  3. A file is then loaded over TFTP, from the server selected in step 1. Which file to load, and how to interpret it, depends on whether the BOOTP reply specifies a file value.

    (Refer to your BOOTP server's documentation on how to configure this. You can safely leave file unset for default behaviour. Example configurations for dnsmasq are available here.)

    • By default (no file specified), a list of snapshots, menu.dat, is loaded. (This is the file generated by the speccyboot-update script.)

      A snapshot menu is presented, and the user selects a snapshot to load.

    • If a file is specified in the BOOTP reply, it is assumed to refer to a .z80 snapshot. This snapshot is then automatically selected for the next step, without user intervention.
  4. The selected snapshot is loaded over TFTP, into the Spectrum, and executed.

SpeccyBoot internals

The picture below gives a conceptual overview of SpeccyBoot's internals. The device connects to the Spectrum's expansion bus connector, and uses the MicroChip ENC28J60 Ethernet Controller to connect to Ethernet. The Ethernet controller is connected to the Spectrum using a simple SPI host.

The device also contains a 2kB ROM for firmware, with a dedicated stack for the protocols involved.

Hardware/software interface

The SpeccyBoot hardware is controlled by writing to and reading from a single 8-bit control register, located at address 0x9F in the Z80 I/O address space. Data from SpeccyBoot is read back from the same address. The individual bits have different have the following meaning:

BitMeaning when writtenMeaning when read
0SPI SCK: SPI clock signal (strobe).SPI MISO: SPI data from ENC28J60.
1-2, 4Unused: the SpeccyBoot stack will write 0 to these bits.Unused: ignore
3ETH CS: Chip select signal for ENC28J60 (active low).
5EEPROM CS: Chip select signal for EEPROM. When this signal is asserted (low), the ROMCS signal (for the Spectrum's internal ROM) will automatically be deasserted (forced high).
6ETH RESET: Reset signal for the ENC28J60 Ethernet controller (active low).
7SPI MOSI: SPI data to ENC28J60.

SpeccyBoot firmware

The firmware implements (needed parts of) the following standard IETF network protocols:

RFC 768UDP (User Datagram Protocol)August 1980
RFC 791IP (Internet Protocol)September 1981
RFC 826ARP (Address Resolution Protocol)November 1982
RFC 906Bootstrap Loading using TFTPJune 1984
RFC 951BOOTP (Bootstrap Protocol)September 1985
RFC 1350TFTP (Trivial File Transfer Protocol)July 1992

The SpeccyBoot firmware also includes an SPI stack (with a transfer bandwidth of about 60 kbit/s) and support for loading and executing .z80 snapshots.

The code is on GitHub.


Compatibility

I'm using the SpeccyBoot with a Spectrum 128 (the "toastrack"). It should work equally well with a 48k machine, and probably with a 16k machine too. Tests with Fuse emulation confirm this.

The later Amstrad Spectrum machines (+2A/+2B/+3) have different expansion connectors, and will not work directly with the SpeccyBoot as described here. I'm sure it's possible to design a slightly modified SpeccyBoot board to connect to one of these machines, but I haven't had the opportunity to do so myself.