Friday, January 11, 2013

Z80 Mini System

Now to the stuff that really made me thinking about blogging in the first place. First something about the story.

Around 2008 while having a "school type education" for an "it assistant" I suddenly got interested into the Z80 and used some simulators to learn assembler. In fact it was the "ZEMU - Z80 Emulator by Joe Moore" I got from Thomas Scherrer's website. I don't remember the motivation any more. But I guess it had something to do with "real IT science" and algorithms in assembler. Also I don't remember why I decided to use the Z80. Maybe it was Phil, the guy from Retroleum which at this time has presented the CPLD based Z80 computer V3Z80P on his blog. I was fascinated and his "Z80 Boing Demo" with music from the game Hawkeye was immediately burned (or flashed) in my mind as it also was a very famous demo on the Amiga. This was the first time I read about CPLDs.

After developing some programs for testing my theoretical assembler skills I looked into the catalogue of the retailer reichelt and found actual Z80s I could buy. With the help of the datasheets I learnt about the bus interface of the Z80 and the peripherals that are also available by the vendor Zilog. These were the "Z80 PIO", a parallel port I/O chip and the "Z80 SIO", some small UART. Put that together with some glue logic and EPROM and SRAM and there you have it. Luckily I also got a very cheap EPROM Burner and some EPROM Eraser donated by a workmate. The result was created on breadboard.

Top view (Feb 2009)

SIO and PIO (Feb 2009)

Side view on glue logic and max232 (Feb 2009)
It's a nightmare isn't it ? I LOVE it !!! After I got that working I created a stripboard with the same parts and added a "dot matrix character lcd" and some other stuff to it.

The Z80 Minisystem from the top. There is paper on the EPROM to keep the uv light away. The Z80 is to the lower left. PIO and SIO are in the middle clearly visible.
The view from below. The nightmare continues. Try to repair a mess like this!
And from the side.
Yay for cheap operation system. Also I was lucky for having the assemble time printed as I wasn't sure about the photo time tag.
So what could this system do ? The Z80 is clocked with 4 MHz and had a DS1307 RTC connected via I2C whose value can also be seen on the picture above. The system has 32k EPROM and 64k RAM as two 32k SRAMs. The EPROM and one of the SRAMs can be bank switched to get all the RAM available. The LCD is connected to the PIO.
So... where do the programs come from. The operation system can bootload software using the serial port and the tape port !! :-D
I've found a circuit that was used to get clean digital levels from an audio cassette. I got it from some C64 website as it was intended for a "CDROM datasette". Sadly this website doesn't exists anymore. I've written myself a C program to convert binary data to an audiofile with pulsedata and some header to recognize the begin of data. If you play this it sounds a little bit like a ZX Spectrum program. This "music" was put on my Playstation Portable which is connected via cable for playback as I hadn't a good tape drive around.

Then I've programmed a tetris for it which definitely needs a video to show. Of course there is a atari type joystick port for this purpose that is read using a busdriver. The game uses the feature of the lcd to display 8 user characters. This way I got big pixels.

After a while I got rid of the nest below the board and replaced it with enameled copper wire. Wow, the board can finally touch the ground it's lying on!
These enameled copper wires are sure a clean solution.
So, this was my first touch with the Z80. The system helped me to understand the internal workings inside a computer system with "hardcore bare metal assembly development". I remember that in time this system was finished Phil from retroleum has developed his V4Z80P. I've read his article and was hyped like a little child. The first time reading about the magical wonderchips known as FPGAs and what they could do.

Stay tuned for the stuff I've built in 2010!