That aside, I'm quite interested in kernels (as indicated by QOS) so it makes sense that I'll be attempting to write a simple one for it. Ideally, my vision is to interface with a terminal (with UART through a SIO) and create a binary loader (through a DMA). From there, new software can be serialised into SRAM and ran immediately, without having to write to an EEPROM.
As frontend to this operating system, I'm going to attempt to recreate Wozmon (Apple I software for the 6502) on the Z80.
Part list
I'm using the 6 MHz specs of all the Z84Cxx components, except for the CTC (which is an NMOS spec):
- Z84C00 (CMOS, 6 MHz) 'Z80 CPU'
- Z84C20 (CMOS, 6 MHz) 'PIO' (Parallel Input/Output)
- Z84C30 (NMOS, 6 MHz) 'CTC' (Counter/Timer Circuit)
- Z84C40 (CMOS, 6 MHz) 'SIO/0' (Serial Input/Output)
- W27C020 (256 KiB) EEPROM
- AS6C1008 (128 KiB) SRAM
- SN74LS32N ORs
- SN74HC14N Hex Inverters
- SN74HC238N 3-to-8 Line Decoder
Now, I'm running this system on a 4 MHz crystal oscillator. I also have a 1.8432 MHz crystal oscillator tied to the trigger inputs of the CTC for the first three channels. The fourth channel trigger input is tied to the trigger output of the third channel. The trigger inputs are used whilst in counter mode, and allow me to use them for flexible baudrate generation. Channels 0 and 1 of the CTC are tied to the clocks of SIO channels A and B, respectively.
Memory map
For those who are unfamiliar with the Z80 address space, and unlike
most other CPUs around that time, the Z80 has separate memory and I/O
spaces. This is indicated by the MREQ and
IOREQ control lines from the CPU.
In the memory range, I set up the memory map so writable RAM takes up the majority of space. This is for the reason I stated before, as I'd like to upload programs through a loader into RAM. So:
0000 - 3FFF :EEPROM (16k)4000 - FFFF :SRAM (48k)
Conversely, the I/O space is only 8 bit, rather than the full memory
address range of 16 bits. The Z80 implemented it like this essentially
due to the OTIR-like instructions, which use register
B for byte countdown, and register C for the
I/O address. In any case, the upper 3 bits of the address are decoded:
0b101xxxxx :PIO0b110xxxxx :SIO0b111xxxxx :CTC