Close

Another approach

A project log for Bootstrapping a ROMless Z80 using RS-232

Is it possible to bootstrap a simple ROMless Z80 system using only two wires - e.g. from an RS232 interface? This project explores this.

willstevenswill.stevens 01/21/2024 at 09:050 Comments

Here is another approach that is based on using HL to point to locations in RAM, and then using opcodes that increment or set the location that HL points to. This approach doesn’t need a separate ‘initialisation’ step, but can only write 256 bytes to RAM. The page to which these bytes get written is undefined - that doesn’t matter because we first fill all of RAM with ‘harmless’ LD H,E opcodes and these get executed until the PC reaches the 256 byte page.

The data bits are set as follows, we need an inverter for A0, one NAND gate and one OR gate.

D7=0
D6=A1
D5=1
D4=A0
D3=0
D2=/A0 nand RTS
D1=A1 or RTS
D0=/A0

This gives the following instruction sequences when RTS=1 and 0 respectively

00100011 INC HL
00110110 LD (HL),n
01100011 63h
01110110 HALT

00100101 DEC H
00110100 INC (HL)
01100111 LD H,A
01110110 HALT

First we execute the first (RTS=1) sequence to fill RAM with 63h (LD H,E). Then we execute the second sequence (RTS=0) enough times  to set one byte in RAM (we don’t know which) to 2Eh (LD L,n). When we run the contents of RAM this has the effect of setting L to a known value. We can then use the two sequences above to increment HL until L=0, and then fill 256 bytes with any desired contents. The details of the method for doing this will be described in a future edit to this log entry.

Discussions