Friday, July 01, 2016

Z80 Reloaded - Extending the RC2014 Retro Computer

In the first part of this series, I looked at the construction of Spencer Owen's RC2014 - a Z80 retro computer kit. In the is post I look at some of the ways of extending the basic 5 board system.

One of the key advantages of using the backplane method of construction, is that it is very simple to extend the system with additional cards, and the user can choose which cards best suits their overall application. The system can be extended as and when time and budget permits. This was a major consideration with the early homebrew computers  - where memory was expensive and each additional kilobyte represented a substantial investment!

Digital Input and Output.

One of the primary requirements of any computer is the means to connect to other systems and exchange digital data.  This can be readily done with digital input and output ports, which are usually multiple 8-bit wide ports, each with a unique I/O address.

Whilst this can be done using the Z80 series peripheral ICs - generally DIP 40 LSI devices, the more traditional method of interfacing to a microcontroller was to use standard 7400 series TTL chips (TTL is Transistor, transistor logic). These operate with a 5V power supply and with logic levels and drive capabilities that were a good match to those of the early microprocessor ICs.

For digital input, the requirement was to capture the state of the digital input lines and transfer this captured byte onto the Z80 data bus at the right time for the input (IN) instruction. This is best done using an 8-bit tristate buffer - and the 74HC245 meets the requirements perfectly.

For digital output, the normal method is to use an 8-bit latch, such as a 74HC374, or 74HC574 (which has a more bus-friendly pinout).

Conveniently Spencer has put both of the '245 and '374 devices onto his Digital I/O card - and this is the subject of this blog post.

The Digital I/O board is a simple through hole kit
The kit is supplied with all components and all ICs are socketed - handy as it is these that form the first line of defence against the harsh realities of the real physical world.

Construction was simple, and I chose to add the sockets and switches to the board first. Unfortunately the footprint used for the switches is not quite right - and it was a bit of a fiddle to get them all neat and level.

Next I added the LEDs and the resistors....

and finally the 40 pin right angled SIL pin header strip - which is common to all boards that fit into Spencer's Z80 backplane.

To use the GPIO board we use the INP and OUT command provided in the ROM BASIC.

10 OUT 0,INP(0)
20 GOTO 10
This simply reads the input port at Port 0 and sends that byte out to the output port also located at Port 0.

For a more sophisticated demonstration - Spencer offers this Cylon programme:

10 FOR F=0 TO 7
20 OUT 0,2^F
30 GOSUB 100
50 FOR F=7 TO 0 STEP -1
60 OUT 0,2^F
70 GOSUB 100
90 GOTO 10
100 FOR X = 1 TO 150 : NEXT X : RETURN

Here the individual LEDs are lit by using increasing powers of 2 to access them one at a time.

The GPIO board is self contained and good for demonstration or simple interaction with the application using either BASIC or Z80 assembly language.

For more sophisticated control and monitoring applications - Spencer has created another couple of pcb modules  - that provide 24 lines of input, and 24 lines of output - using the same ICs as used in the GPIO demo board. These will be a useful addition to this growing Z80 system.

Input module provides 24 lines of input using three 74HC245

Output module gives 24 lines of output using three 74HC374

Spencer has now standardised on a board outline which has a sloping front corner - which makes inserting it into the blackplane the right way around - foolproof. There is also a hole that can be used to connect all of the boards together using a bolt or length of threaded studding.

The backplane connector has been shrunk to 39 pins - which allows it to fit on a 10cm wide pcb. This makes it useful for those who may wish to design additional boards or modify these - using KiCAD or EagleCAD - and take advantage of the low cost 10x10 cm board offers from certain Far East pcb manufacturers.

In the next Part we look at the Composite Video Terminal board  - which recreates a serial terminal using a Raspberry Pi Zero, - as soon as my Pi Zero arrives!

Saturday, June 18, 2016

Z80 Reloaded - The RC2014 Retro Computer

In June - a series of posts about Retro Computing - in particular the venerable Z80.

First Impressions.
The contents of the "Full Monty" RC2014 Z80 Retro Computer Kit

This is a neat little kit from Spencer Owen, which allows you to build up a complete Z80 Microcomputer, from scratch, in 2 to 3 hours.

Spencer sells this kit through Tindie, and the service was exceptional - I ordered the kit on Thursday morning and it arrived in the post on Friday morning. Fortunately Spencer had what I needed in stock, and it caught the early post.

There are several variants of the kit, tailored to suit your time, expertise and budget. I chose the comprehensive "Full Monty" kit - mainly for expedience.

1. Bare Bones - just the 5 pcbs - to be used with stripboard backplane. You need to source all the components, ICs, sockets, connectors and be able to obtain a suitable ROM image. An economical approach - if you have plenty of time. Cricklewood Electronics is a good source of the rarer ICs.

"Bare Bones"  Photo: Spencer Owen

2. Starter Kit - pcbs, connectors, BASIC ROM, stripboard for backpane. Contains the harder to find connectors and the BASIC ROM.

"Starter Kit"  Photo: Spencer Owen

3. Full Monty - all components, ICs, 5 pcbs + backplane. The easiest and quickest option. You can be up and running with a full Z80 BASIC computer in 2- 3 hours.

"The Full Monty"  Photo: Spencer Owen

For more information - have a look at Spencer's RC2014 site - which describes the development of the product, offers useful information and blogs some of the high and low points of the project.

There is also a recently formed GoogleGroup devoted to the RC2014.

The Design

The Z80 microcomputer is based around 5 modules:  CPU, ROM, RAM, Clock/Reset and Serial I/O.

With these 5 modules you are able to build up a fully functioning computer that runs Microsoft BASIC and communicates wit a terminal program on your PC via a serial UART and FTDI lead.

The modules are 100% through hole components, and all ICs are socketed. Provided that you can identify pin 1 of an IC socket and be able to solder approaching 600 soldered joints - reliably - then this kit provides suitable distraction/entertainment for a wet June afternoon or evening.


Note the 4 jump straps on left. Your CPU will not be an old 4MHz Zilog Z80A from 1984!

This is a socketed 40 pin Z80 (10MHz) on a slender board, with a 34 way right angle header and a 3K3 resistor.  The whole of the design of this machine and the backplane are based on the efficient means of getting the Z80 memory bus (address lines, data, control) down onto the backplane. The arrangement is not only logical but closely follows the pin-out of the Z80 40 pin DIL package.


Note the position of the jumper links on the left - all connected between A and 0

This module provides address decoding, and segment selection for up to a 64Kx8 EPROM or FLASH equivalent, in a 28 pin socket, with address and data lines broken out to the standard 34 way bus conector.

A single 74HC32 quad OR gate, provides an output enable signal for the ROM chip by OR-ing /MREQ and /RD and a /ROM_CS chip select signal by OR-ing together A13, A14 and A15.  This forces the ROM selection to the part of the address map where these three address signals are all low, which is essentially addresses 0000 to 8192 - which is the bottom 8K of the memory map.

Three additional jumper inks allow selection of the Address line or logic 1 to force even more constraint on the ROM selection.  This caters for alternative ROM sizes.


62256 32K RAM Module with Read/Write selection logic

This board is similar to the ROM module but allows a RAM device to be fitted into the 28 pin socket and provides chip read and write controls by decoding /RD, /WR ORed with /MREQ. Again this is done in a 74HC32 quad OR gate, and a single 74HC04 inverter is used to negate address line A15, and use it to enable the /RAM_CE.  This makes the RAM active whenever A15 is high - thus forcing it into the upper 32K of the address space.

There are many ways to approach address ROM and RAM decoding, and if the ROM and RAM were on the same pcb, some savings could be made.

Clock / Reset.

Component placement on clock - reset module

This is the smallest board of the set and contains the clock and reset circuit.  The clock is generated using the standard method using a hex inverter to for an oscillator with a 7.3728MHz crystal, and an inverter as the clock driver.

Three resistors (1M, 1K and 2K2) and 2 x 22pF capacitors need to be fitted.  A conventional power up reset switch circuit using a 2K2 pull-up resistor is also implemented.

The board only requires to pick up +5V, 0V CLK and /RESET from the bus - so is only fitted with a 5 way bus pin-header.  Users should be careful to get this located properly in the right position.

Serial I/O

Note the 5V strap in the centre next to "FTDI" and the 3 x 2K2 resistors. Other components not fitted.

This module uses the 68B50 UART IC - my example was produced by Hitachi - but there used to be several manufacturers including Motorola and ST.

It requires a single inverter (74HC04) to invert the /IORQ signal - as this IC was originally intended for 6800 systems - not Z80.

It is supplied with the 7.3728MHz clock, which it divides down by 64 to produce serial at 115200 baud. The kit supplies a 6 pin header to allow direct connection of a 5V FTDI lead - A jumper link allows the 5V supply from the FTDI cable to be used to power the computer.

Don't forget to fit the three 2K2 resistors, which link the 68B50 Rx, Tx and CTS lines to the FTDI header!

There is provision to fit a traditional MAX232 RS232 level converter IC, 4 x 1uF capacitors and a 9 pin D-type connector (cleverly fitted to the edge and picking signals up from each side of the pcb), if standard RS232 com port is needed. These RS232 option parts are not supplied in the Full Monty Kit, but may easily be purchased elsewhere.


Fit the 8 blue 100nF decoupling capacitors first - before soldering the 40 way headers into the 5 central positions.
I have addedd an extra 7805 regulator and 10uF filter/decoupling capacitors which are not included in the "Full Monty" kit.

Building the Kit

The build process was fairly straight forwards and quick, but I did have to consult other online documentation in order to clarify some points. That documentation has been included here.

The first stage was to fit all the IC sockets. First identify the mark on the socket that signifies the "Pin 1 " end and make sure that is aligned with the "notch" on the screen print legend.

I always tack the socket in place by soldering two or four diagonal pins - ensuring that the socket is flat and level, correctly orientated and has no bent or damaged pins.  Once tacked in place, the remainder of the pins can be soldered quickly and reliably with the full confidence that the socket is correctly placed.

The 5 boards with most of the sockets soldered in. Time 15 minutes.
Next we begin to fit the through hole components - consisting of resistors, capacitors and jumpers. It was at this stage that I had to refer to other documentation to ensure that I had the correct values of resistors - fitted to the right boards.  The graphic below from Spencer helped greatly in this respect.

Component Placement Guide (Spencer Owen)
The three resistors, two 22pF capacitors and 7.3728MHz crystal were fitted to the clock module.  The reset switch was not quite the correct fit for the holes in the pcb - but easily stretched to fit. The 8 pin right angle header will not fit if the crystal is fitted too close to the board, but can be truncated to a 5 pin header if necessary.

The wire ended components supplied in the kit

All modules soldered, 34/26 right angled pin headers fitted and ready for IC insertion.
One slight area of confusion was which side do I fit the right angled header - on the component side or on the reverse side? I opted to fit them all from the component side and solder on the underside. However the CPU board may be an exception to this rule - it does not really matter.

This photo from Spencer's Tindie site provides some clarification of the order of the boards and direction of pin headers.

This photo from Spencer Owen  indicates the intended order of the pcb modules in the backplane.
As the pin header strips are long - and have a tendency to move - make sure they are correctly tacked in position before committing to soldering a long run of pins.

Only 200 joints to solder on the backplane!
At one hour into the build I started to solder the female connectors into the backplane.

Note - it is best to solder the 8, blue 100nF decoupling capacitors in place before fitting the 40 way female header strips! Just a lot less fiddly.

Make sure that the female headers are tacked in place so that they lie flat, level and perpendicular to the backplane. There are 200 soldered joints to do here - so a little extra time spent here could save you a lot of time looking for unsoldered or defective joints later.

Again there was some question to as which of the eight backplane slots should have the five connectors fitted.  I looked at an image on Spencer's Tindie site - and this suggested that I should be soldering the central 5 blackplane connectors.

The outside backplane connectors are separated in both the address and data lines - so that series termination resistors could be fitted.  Again - a webpage or a Wiki with this information on, step by step - would have been useful - perhaps that guide is what I am writing here now?

Stop the Clock - We have a completed computer!

The UART board was the last to be completed.  There were no notes on what resistors to fit - so I had to refer back to the schematic on the modules section of the RC2014 site. From here I was able to confirm that they were 2K2 and also note the orientation. it's easy to get the one on the left of the FTDI header in the wrong orientation.

This schematic shows the 3 series 2K2 resistors and the 5V jumper link needed on the UART board

I learned some years ago with this type of soldered through hole kit is that it is best to use entirely horizontally inserted components, and to put the value in ohms, nF or uF directly on the pcb screenprint.  R1,R2,R3 is fairly meaningless unless you have the schematic at hand.

Note also that you have to fit a jumper link on the UART board to allow the FTDI cable to supply the 5V to the computer.

First Breath of Life

First test of the Micro$oft BASIC - which is supplied on ROM

My machine did not work first time.  It produced a garbled start up message, which led me to think that there might be a baud rate problem.  I tried a few options but with no avail.

So I then individually inspected the 600 soldered joints using a x10 mangnifying lens - and traced my problems down to a badly soldered address line on the underside of the backplane.

Stuff like this can easily happen with systems that have high numbers of signal connections like this.  Check you work before final assembly - particularly the larger ICs and connectors.  It took me 90 minutes to solder this kit - and a further 90 minutes to find the one badly soldered joint that was the cause of it not working.

A great little project for a wet Friday evening in June!
Even 30 years on from the British Home Computer Revolution of the early 1980's - there is still considerable interest in these mid-1970's microprocessors.

Z80 Enthusiast, Grant Searle has done a lot to maintain interest, and has recreated several simple microprocessor systems - including Z80, 6502 and 6809. Recently he has moved across to emulation of these three classic microprocessors on a low cost FPGA board.

It was Grant's 7 chip, minimum Z80 system of 2007 that appears to have provided the inspiration for the RC2014. Here is the complete schematic which makes it easier to understand how the read/write control signals are generated.

The minimal Z80 circuit that provided the inspiration for the RC2014

If you like the minimalist Z80 design, have a look at the "Z80 Membership Card" - a minimal Z80 handheld "Terminal" packaged into an Altoids tin.

The neat thing about the Membership Card is that it has a useful serial monitor program - allowing file saving and loading,  hex dumping and other editing features, which make low level operations a lot easier.

The Membership Card uses a "bit banged" I/O pin to provide a serial terminal interface - something that could easily be added to the RC2014 - as a 2nd UART or a replacement for the 68B50 serial output card if the full 115200 baud UART features were not needed.

In the next part I look at extending the system, with digital I/O, serial interface by bit-banging pins and hopefully a vintage 7-segment LED numerical display.

Wednesday, June 15, 2016

Z80 Reloaded Ingenuity and Elegance

The 8080 (Z80) Instruction Set.

Federico Faggin worked at first at Fairchild and then Intel in the late 1960s and early 1970s. He was central to the microprocessor design work there  - including the 4004, 8008 and later was instrumental in devising the 8080 instruction set.

He left Intel in 1974, founded Zilog, and created the Z80 processor, who's design was clearly influenced by the 8080, and had a compatible instruction set - so that the new Z80 immediately had access to the large library of software already available for the 8080.

Expressed in Octal - The 8080/Z80 Instruction Set takes on a new clarity

The 8080 was developed at a time when the PDP-8, PDP-11 and DG Nova were the popular mini computers of the age - and so the 8080 was developed - influenced by the techniques and methods that were commonplace within those minicomputers.

So it was natural to use the then familiar octal representation of the instruction set - and when you use octal for the 8080 rather than hexadecimal - it becomes immediately clear, what a clever piece of design logic was involved.  The spreadsheet above places the 8080/Z80 common instructions in numerical order - but on an Octal grid and adds a little colour to distinguish the various classes of instruction.

The load instructions are in pale blue and occupy all the instructions in the 1xx band - except for 166 which would have been load (hl),(hl) which would be quite pointless - and thus replaced by HALT.

The register - accumulator arithmetical and logical instructions occupy all of the 2xx band.

The 8080 had 8 source and 8 destination registers - and these could be represented by a single octal digit - and thus a 3 bit wide bit field in the instruction.

B    0
C    1
D    2
E    3   
H    4 
L    5
M    6     M stands for Memory and is (HL)
A    7

One quarter of the available instructions are use for moving data between registers - and these take the form of the MOV instruction (later load LD on Z80) :

MOV  r1,r2         move the contents of register r2 into r1

01  xxx   yyy        yyy = source register    xxx = destination register

for example   MOV  A,L       where A  =  r7  and  L  = r5

01  111  101

Expressing in octal  -

1    7      5

Any instruction in octal starting with a 1 is MOV.

For instructions beginning with 2, the first two octal digits are used to decode the instruction operation, with  the 3rd octal digit supplying the operand. These are the ALU arithmetical and logical operations - where a register supplies one operand, the other being provided by the Accumulator A, and the result being placed in the accumulator. These all take the form 2xy

20     ADD  -  Add
21     ADC   - Add with Carry
22     SUB   -  Subtract
23     SBB    -  Subtract with Borrow
24     ANA    - AND with Accumulator
25     XRA    - XOR with Accumulator
26     ORA    - OR with Accumulator
27     CMP    - Complement

For instructions beginning with 0, it is the middle digit that defines the register operand, and the last digit defines the operation.

This is perhaps best depicted in the colour coded spreadsheet above.

Wednesday, June 08, 2016

Z80 Reloaded - The EZ80190 ControlStick

New Arrivals

EZ80190 50MHz and Z80 20MHz
A package arrived in the mail today with some 20MHz Z80 and 50MHz EZ80 samples - shown above.  I decided that having a high speed Z80 based retro computer would be a neat project - so took the plunge and bought some ICs from Mouser.

The EZ80 is almost a Complete System on a Chip - requiring only external memory
New Kid on the Block - the EZ80190

It's the EZ80190 that has caught my attention most of all.  A 100 pin LQFP which creates an almost complete Z80 computer on a single IC. All we need is a suitable break-out board.

The EZ80190 is a remarkable device - as it has the fully pipelined 50MHz EZ80 core - which runs 50 times faster than the old 4MHz Z80A. Additionally, it has a really rich peripheral set, consisting of UARTs, SPI, I2C, DMA, GPIO. 

The external memory bus a 24 bit addressing range (16MB) - and uses cheap byte wide devices. It also has 8K bytes of internal RAM, with the expectation that external SRAM and ROM will be added.  

It has a high speed multiplier-accumulator - accumulating 16x16 multiplies to 40 bits - with it's own 1K dual port feeder RAM, which can be used for DSP operations such as FFT, digital filtering and additive (phase accumulated) musical synthesis.

What I like about the EZ80 is that it represents a level of integration just not possible when using separate Z80 peripherals in 40 pin DIL packages. 

I was torn between a "purist" all - Z80 system  - using the genuine Z80 peripheral ICS, but then I estimated the board area and the work involved  - plus the fact that the peripherals are getting rare and more expensive.  

By contrast - the EZ80190 is an $11 part in 1 off - with some of the EZ80 family starting at $4.20 (Mouser).  Suitably broken-out on a small pcb with RAM, ROM and USB - UART connectivity - it should be very cost effective.

The EZ80 ControlStick - A 100 x 25mm Breadboard Friendly Computer 
So I have decided to spend my time putting an EZ80190 device onto a small, breadboard friendly, carrier board - pictured above. 

The ControlStick offers a complete integrated Z80 computer that can be used in its own right as a stand alone controller - or incorporated as part of a larger system - the choice is yours.

It accepts up to 1MByte of 10nS SRAM, and a 32 pin socket to take a traditional boot-ROM. USB VCP connectivity is provided by a CH340 USB to UART adaptor.

Some Details of Prototype

ControlStick is currently going through pcb layout, and as such some specifics are likely to change.

It has USB connectivity on the right, a 3V3 power supply and the EZ80190 broken out to provide access to about 80% of its 100 pins conneting to a memory sub-system.

The choice of memory caused the biggest headache with the design - as the 80190 is capable of running in Z80 mode within a 64K address space, or in EZ80 mode - with a full 16MB address space.

I needed a solution that would cater for both, plus the fact that some people will want to install a boot ROM.

The compromise was to include a 32 pin 0.6" DIL socket - that will accept Flash or Eprom up to 512K x 8, and a second surface mount RAM chip - that can be up to 1M x 8.

The intention is that the 16MB address space can be carved up into 64K byte pages - of which the first megabyte,  pages 0 to 15  (address range 0x00000 to 0xFFFFF)  is present on the ControlStick itself, and all subsequent pages are assumed to reside off the card on some memory expansion board.  It is highly unlikely that anyoe would ever want the full 16MB  - so only address lines A16 to A19 are made available on the expansion connector.

The RC2014 bus is along the lower edge and the full EZ80190 I/O is brought out along the top edge. We do try to make things easy around here.....

So the complete Z80 system is reduced to just 4 ICs on a 100mm x 25.4mm pcb with a 0.9" DIL spacing. 

The board is specifically designed to fit onto a full size breadboard, or stripboard - for easy prototyping.

In addition, the pcb will make use of Spencer Owen's RC2014 40 pin Z80 bus - so that it is fully compatible with the RC2014.  It is possible to use extended female headers - so that one of Spencer's RC2014 boards could be stacked on top.  

How far you might wish to expand the system, remains entirely up to the individual. ControlStick is just a starter board to allow easier working with the EZ80190.

With an ARM  (such as STM32F746) or FT812 embedded video engine on a separate card to provide LCD or video output - you could have a supercharged 1980s style retro-computer with 2Mbyte of RAM in about 4 ICs! With the display controller on the STM32F746 - you can have LCD screen or a large screen monitor.

Software and Applications

Whilst many retro-computers are created for replaying vintage video games, the possibility of a high speed machine with modern peripherals,  16MB of memory addressing space and the ability to run native legacy Z80 code at 50X original speed - could open a whole set of applications. 

Even BASIC at Warp Factor 50 would be capable of real computing work.  There are several sources of BASIC vailable, but a good choice might be the Z80 version of BBC BASIC  - written and maintained by Richard Russell.  Richard states on his site: 

"BBC BASIC (Z80) incorporates a full Z80 assembler, which allows you to include assembly-language code within a BASIC program. This is a very powerful feature: it enables speed-critical operations to be carried out much more quickly than would otherwise be possible in BASIC, and provides access to machine and operating-system features that would otherwise not be available. Example programs are supplied with BBC BASIC (Z80) which illustrate the use of embedded assembler to implement fast string and numeric array sorting."

Forth, also might be an attractive option for the old-skool 8-bit programmer, who wants to really get inside the workings of a timeless machine - in just the ways that modern operating systems seek to prevent!  There are many Z80 Forths available, and these offer the unique programming and development environment, including Z80 assembler.  Forth might not be to everyone's liking, but perhaps if hosted by a familiar processor, there may be some looking for a new coding experience.

The EZ80 provides a familiar set of modern peripherals - that take all the hard work out of the design.  If you want a minimum system - you can have a megabyte, 50MHz class machine, with GPIO ports and peripherals on 

This simplification of hardware, and the adoption of the latest technology to constantly improve upon a basic design is something that has been central to the computing industry for 70 years. As technology moves on - there will always be simpler, faster and cheaper ways of achieving the same end game.  

For example, the PDP-8 between it's launch in 1965 evolved from a fridge sized cabinet to an LSI chip - in just 10 years, and now recreated as an attractive product based around the Raspberry Pi. Whilst few of us could ever own or maintain an original 50 year old PDP-8, we may still get a lot of retro-computing experience and enjoyment from a recreation based around a $35 R-Pi.

The hardware will always be changing and improving. We have probably passed the point where virtually any computing process of the last 50 years can be effectively simulated on very low cost mobile computing hardware - on an ARM chip costing under $10. 

There are so many great ways of achieving wonderful things in readily available hardware these days. There has never been a better time for creative hardware engineers. Making cool stuff from low cost electronics, has really blossomed as a hobby, and become fashionable - after decades in the doldrums. 

When once we used 7 segment LEDs - we now have RGB matrix displays.  CRT monitors have given way to LCD  screens of all sizes and resolutions - and rotating magnetic storage media is rapidly being replaced with high density solid state, Flash and Ferroelectric non-volatile memory solutions.  LSI chips - such as the CH376 allow a small DIY computer to host microSD cards and USB Flash drives - with minimum intefacing  - with FAT16/32 handled by the IC.

Equally, a SPI based Ethernet controller - such as Wiznet or even the venerable ENC28J60, will make the internet and web-connectivity available to a Z80 system - and with 50MHz operation, and a 16MB address space - even a Z80 can handle the volumes of throughput that a browser or micro-webserver application requires.  The EZ80190 - is even billed as "Webserver" - hinting at Zilog's intentions for this much rejuvenated old timer.

The 1MHz clock frequencies, I started with - in the early 1980s, have risen an order of magnitude every decade, to the point where you can but a 200MHz + ARM chip for $10, solder it onto a breakout board and have a very powerful, self contained computing & DSP platform.

My first computer was a ZX81 kit shipped with a pair of 2114  1K x 4bit static RAMs. 75% of this RAM was used by the screen buffer, leaving just 256 bytes for program storage. My first act of defiance, was to fit a socket for a 2K SRAM - by that time affordable, and instantaneously I had 5 times the available RAM space. 

As a hardware engineer, it is important to understand and embrace this continual birth and re-birth of better ways of doing the same old thing, and not get unnecessarily hung up on insisting that every last detail of the hardware is correct - as per the original. 

At the end of the day, we are merely creating a platform, a stage or stadium - whatever, on which to "put on a show". 

There are so many possibilities - "If we build it - they will come......"

Tuesday, June 07, 2016

Z80 Reloaded - A-Z Future Thoughts

ARM to Z80 - and Everything In Between!

Building the ROMulator over the weekend was a fun and worthwhile experience - and it has opened up an number of avenues for future work.

It appears that others have done a similar thing - a search on "Arduino Z80" will reveal quite a few interesting projects - all of which show great promise.

One I liked was the in-depth project by @Domipheus and a nice multi-part blog describing his work. Here, he has used a Teensy 3.2 - which has 64K of SRAM on chip - to act as the Z80 RAM. Of course, this is perfetly possible - as a modern ARM Cortex processor is perfectly capable of sampling an address on its input port pins - and returning a byte of data from RAM to a set of output pins.  Here the Teensy can act both as RAM but also it's rich set of memory mapped peripherals are accessible to the Z80.

So this got me thinking that using a low cost ARM to act as the Z80 system RAM plus peripherals for a vintage cpu seems like a neat idea.  It may seem a bit like a sledgehammer to crack a nut - as the ARM can probably emulate a Z80A in better than realtime - and has full GCC support. However to have a real Z80 executing Z80 code is perhaps sufficient to keep the purists happy.

If you use something like the ST range of Nucleo boards - such as the Nucleo 446 RE - you get a 180MHz ARM Cortex M4, 128Kbytes of SRAM,  about 50 usable I/O lines and USB interface on a small but manageable board for around $12. It can be programmed using mbed - which would allow a repository of vintage cpu code to be held withing one's mbed account.

The ARM becomes not only the RAM for the Z80 but provides a set of modern peripherals, and supports the development system - in whatever language you choose - BASIC, Forth, C etc, plus access to old CP/M software packages.

The ARM connects to the full Z80 memory and data bus and spits out the byte from RAM according to the address requested. The Z80 can communicate with the ARM via a mailbox set up in RAM.

This method is not limited to the Z80 - strapping an ARM to a 6502 memory bus will certainly give it the ride of its life!  The Western Desgn Centre WDC - who created the venerable 6502 - more than 40 years ago, are still supplying them in 40 pin DIL packages - because there is still a demand for these devices - notably from the hobby community.  The WD65C02 is now available as a 14MHz part. 

For $12, some stripboard and half a day spent wiring up 40 pins - it's definitely worth a punt!  

The Kim-Uno - From Obsolescence Guaranteed


Last week I blogged about my old friend  - the MPF-1B - a Z80 trainer system from 1981. Well, to keep the 6502 affectionados happy - I found this neat little project - and an excellent example of minimum low cost retro-design.  Using an Arduino emulating a 6502 and providing a cute little retro-trainer based on the KIM 1 - start here and follow the links.
Also on the Obsolescence Guaranteed site you will find the PiDP-8 and the PiDP-11 retro-computers - certainly a labour of love and attention to detail.