This is a step by step guide to build a modular Z80 computer using my modules and my OS.

First of all you will need a power supply, i use a 12 volt transformer connected to a step-down converter module, so it produces 5v. The 7805 on my mainboard does not provide enough amperes so it is not used.

Mainboard

The mainboard must be on FR4 PCB otherwise there will be many problems because of the flexibility the FR2 pcbs have. You can download the PCB design and the bill of materials here. You will need 40 pin and 6 pin female SILs to populate the pcb. As i said there is no need for the 12v to 5v converter and if you don’t plan to use 3.3v device you can skip the 3.3v converter as well. So only the Reset circuit at the far left is needed.

Clock Module

There are 2 clock modules that connect to the mainboard. One is for Crystal Oscillator (Full or Half Size) and the other for simple Crystal. The module provides the main frequency and 8 derivatives. Here for the necassary gerber Files.

CPU Module

All computers need a CPU so you can choose a CPU module either the one with the 40pin Z80 socket or the one with the PLCC. All the necessary files can be downloaded here. The gerber files are all on a zip that you can send to a factory, like JLCPCB that i am using, to get manufactured.

Memory Module

There are several memory modules that provide 32kb EEProm and 32KB SRAM. The fast ones use SMD memory chips at 45ns access time and are used along with a fast cpu (20Mhz). Of course you can use them with a slowest one as well. If you plan to use more memory than this then you will need the MMU module and special memory modules (not yet available coming soon). Check them here and here.

Device Select Module

Every computer must communicate with “world outside” meaning other devices. This device makes this easier by providing 16 ports you can use to select up to 16 devices. Some devices need more ports to communicate and usually these devices have their own decoding circuit to further decode A0-A2 signals providing 8 consecutive ports. The 16 main ports are 00h,08h,10h,18h,20h,28h,30h,38h,40h,48h,50h,58h,60h,68h.70h,78h. Using jumper cables you can connect these either on spare pins 0-5 or the extended ones 1-6 on either side of the bus, so they can be used from the corresponding devices. Download here.

Serial Comms Module (RS232)

This is the first device you should build as this is the main way of communicating with the computer. All the neccessary info can be found here. You can choose the communication port by connecting with a jumper cable J6 to one of the spare pins 0-5 or the extended 1-6 on the top of the bus. So if you have port 18h on the device module connected to Spare 3 then you must connect J6 to spare 3 on this module as well to be able to communicate with the serial port using port 18h. The software driver for this module can be found here on github. Just declare the port DEVSER EQU $18 and call the RS_INI initialization with the appropriate value on register A (LD A,12=9600BPS, LD A,6 =19200BPS, LD A,3 ;38400BPS, etc).

Commands

RS_TX transmits a byte on Reg A , RS_RX waits for a byte and receives it on REG A, RS_RXNW returns 0 if nothing received, RS_TXT sends a zero terminated string pointed by HL.

Interrupt Module

I am using Interrupt Mode 1 so any device that wants to communicate with the CPU just sends a logical ‘0’ to the INT Z80 signal. It’s up to the cpu to know which device is that and this device makes this very easy. It provides a way to know which device made the interrupt and also prioritise them in case two or more made the INT signal low. Here for the necessary files. There are two jacks that need jumper cables to connect them to a port just as explained previously on the Serial module. You need two ports one for reading a byte corresponding to the interrupt that wants to communicate and one to clear this interrupt. I will make use of the RD and WR signals so that it will be possible to use the same port but for now you need two ports (J_EN_INP for reading and J_CLR_INT for clearing).

You connect the devices on J_INTERRUPTS, pin 8 has the highest priority, pin1 the lowest.

In software you will need an Interrupt Service routine like the one i have here. I clear the interrupt as soon as i read it. DEVINP is the port i use to read the interrupts (0..7) and DEVINT is the port to clear one of them.

PS/2 Keyboard Module (or USB with PS/2 support)

This module makes it possible to connect a PS/2 Keyboard to Z80. PS/2 keyboard uses two signals Data and Clock and these are connected to the databus. Connect D0-D7 to J_INPUT_BIT (i use D6,D7) to read the signals and also J_DEVSEL_IN to a port on Spare or Extended pins. You also need to connect D0-D7 to J_OUT_CLK_DAT (i use d1,d2) in order to control the keyboard. A port is needed also so connect J_DEV_SEL_OUT on Spare or Extended. So 2 data bits for reading and 2 data bits for writing to control Data and Clock signals on keyboard.

The software driver is here . The necessary files to build the PCB is HERE. I ll make a new PCB with a PS/2 connector since there are cheap USB to PS/2 connectors after all.

Three routines are needed: PS2ISK returns 0 on reg A if there is a key to be read, PS2KEY gets a byte from the keyboard. READCHAR gets an ASCII keycode.

So call READCHAR to get a char from the keyboard(CAPS, SHIFT, CONTROL and ALT are handled). Zero is returned if no key was pressed.

I2C Module

This module supports up to four i2c devices. The Pinout on the connectors are VCC,GND,SDA,SCL. Connect J_DEV_SEL (CE) on a SPARE or EXTENDED PIN to have a port to control the i2c devices. You will need a PCA9665D SMD I.C. that handles the I2C protocol signals. Also an LM3940 to convert from 5v to 3.3v that this I.C. needs. The necessary driver source code can be found here. There are drivers also for DS1307 RTC and LCD 16×2 attached to an I2C module that converts the default parallel interface of the LCD. Gerber Files for the pcb manufacturer here.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *