Electronics > Projects, Designs, and Technical Stuff

A retrocomputing project, details of the journey

(1/8) > >>


I'm going to post the details of a retrocomputing project I'm working on.
It would be ideal for a blog, except I don't have a blog and probably won't
start one anytime soon :-)

If you're not interesting in retrocomputing, Z80s, FPGAs, or just listening to
me mumble about why I'm doing things the way I am, you may want to skip this

Part 1 - Background

When I was a teenager, my father bought an Altair 8800b kit for me to put
together.  I had built Heathkits before, but nothing like a computer.  If you
need some background on the Altair, check out:


My kit had an optional 16K dynamic memory board.  This board was much
cheaper than the standard static memory board available at the time.
However, I had tons of problems getting it to run reliably.  I tried adding
extra capacitors but that rarely helped.  Eventually, I put a sheet of plastic
on both sides of the board, then covered front and back with aluminum foil
and grounded the foil.  Voila, most problems magically went away!

I also had a Microterm ACT-IV serial terminal, a huge beast at the time:


Unfortunately, I didn't have the costly serial I/O board to drive it.  I did have
an LED on the front panel that I could turn on and off under program control,
the "Interupts Enabled" LED.  So by enabling and disabling interrupts at the
proper rate, and building a little transistor circuit to make that output into
+-12V RS232 levels, I could send data to the serial terminal, woohoo!

But the only input I had was an interrupt signal.  I thought I could get
have the input from the terminal go to the interrupt line, and by timing
the interrupts I could figure out in software what character was sent.
But the interrupt line was *level sensitive* not edge sensitive.  So when
the interrupt was triggered, I had to disable interrupts for a while to
prevent being interrupted again.  But this turned off the LED I was using
for transmit.  You can see where this is going.  Never got it to work right.

Eventually, I wire wrapped a serial board using some funky UART chip,
a TR1602B from Western Digital I think (back when they used to make
chips instead of disk drives).  It required +5 and -12volts, yikes!

Next came a long series of attempts to build a cassette tape interface.
I no longer remember whose design I used, but I got it to work about
60% of the time, not bad for those days.

Then I got the big toy, two 8" floppy disk drives and a floppy controller
from Thinker Toys.  That controller caused no end of problems.  To
save money, it didn't have a DMA circuit to move data to/from the
floppy to memory.  Instead, it forced the processor to move the data
itself.  When the processor tried to read a byte from the controller, if
the byte was not ready yet because not all the bits had been read from
the floppy, the controller simply halted the processor until the byte
was available.  Brilliant!  Except that I had dynamic memory and
halting the processor also halted the refresh of the RAM.  So whenever
I accessed the floppy drive, my memory would randomly lose bits, bah!
A tech note got published on how to modify your controller to allow
refresh to continue, and that fixed that.

Eventually, I got CP/M running, as well as a word processor (Wordstar)
and a compiler (Pascal/MT+).

Sadly, I did not realize at the time that I had so much history of the
early computing era, and junked most of this -- I still have the Altair's
front panel though.

I was recently playing with SIMH (http://simh.trailing-edge.com/)
running CP/M on a simulated Z80 computer.  While that works, it seems
like an awful lot of computing power to throw at the problem.

So I decided I wanted to build some sort of Z80 based computer
just for fun and relive the CP/M days.  While it would be tempting
to build a replica Altair (http://www.altairkit.com/) I wanted something
more compact.

In another post, I'll move on to part 2, requirements.


Awesome, keep posting.
I didn't know there was an Altair kit available!


Part 2 - requirements

First up,  I need to make the big decision, do I use a Z80 CPU chip
or do I put this in an FPGA?  Well, I have the Z80 CPU, SIO, PIO, DMA,
and CTC chips in my junkbox, so I could just go build a real Z80 computer.
But I want to be able to display register and memory contents on
some sort of virtual front panel, maybe single step through a program,
etc, just like the old Altair used to do.  The Altair accomplished this
through some extreme ugliness involving forcing instructions onto the
data bus and putting the results in latches to light LEDs.  Probably don't
want to recreate that mess.

Also, I just don't want to be limited to 4Mhz.  I'd like to do at least 20Mhz.
There are 8Mhz Z80 chips, but no support chips for that speed that I can
find.  And you know, I wirewrapped several Z80 computers in the 80's, so
I've been there and done that....

So we're going to use an FPGA with a soft Z80 core in it, the T80 from
OpenCores: http://opencores.org/project,t80

Using a soft core will let use do many things we can't easily do with a
real Z80 CPU chip.

OK, decision 1 down.  Uh, but what FPGA chip?  My current favorite chip
is the Xilinx Spartan 3A series, partly because they can boot from serial
flash, and partly because they only require 2 voltages, 3.3v and 1.2v.
The T80 core won't fit in the smallest FPGA (50K gates), so the next one
up is a 200K gate part, the XC3S200A.  This comes in only one hobbyist
friendly (non-BGA) package, the 100pin VQFP, so that's what we'll target.

Decision 2, what kind of memory do we use?

The Spartan chip comes with internal block RAM, but I want the Z80 computer
to have the full 64K of memory, and maybe more through bank switching
in case I want to run MP/M.  Well, there's not enough internal block RAM to
handle this.  So we'll need to connect external memory to our FPGA.

OK, dynamic RAM or static RAM?  I don't really want to deal with
the refresh issues of dynamic RAM, and 12ns static RAM is easy to come by,
so I'll use static RAM unless I hit a wall in the design.

Decision 3, how do I talk to this thing?

Traditionally, you connected a serial console off your Z80 computer.
But how many people have serial terminals these days?  Few, I think.
Sure, you could wire it up to a serial port on your computer, but then
that kinda goes against the grain of this exercise, which is to not use
a huge amount of computing power just to get this system running.

So what I think I will do is provide a VGA output to connect to a monitor,
and PS/2 style keyboard and mouse inputs.  The VGA output will have
a serial window emulating some kind of serial terminal (VT100 maybe),
and windows with other displays, perhaps the CPU registers, memory dump,
or the like?  Have to work out the design of this in more detail, but
this will do for now.  Hmm, maybe should accept USB keyboard and mouse?
That's harder....

Decision 4, storage

This is easy, no floppies, no spining disks, solid state storage only. 
Probably looking at a small SD card here.   This would let me write
boot images from another system, such as a pre-built CP/M system.
I want to have several system images on the SD card, so I could boot
a CP/M 2.2 system, or boot an MP/M system, or something else.
These partitions should be invisible to the Z80, so the FPGA hardware
will have to vitualize the storage somehow - to be determined.

Speaking of booting, how will this system boot?  Z80's don't have
flash, they require an external boot ROM.  Have some ideas here, but
will save this for another post.

Decision 5, other stuff

I think we'll include a serial port and/or USB port for connectivity.
Probably also need to throw on an EEPROM to save configuration
information (such as which system to boot).  Hmm, maybe I'll use
an Atmel serial dataflash to boot the FPGA, and use the leftover
storage for configuration.  Yeah, that's the ticket.

Part 3 in another post.



--- Quote from: EEVblog on September 07, 2010, 03:51:54 am ---Awesome, keep posting.
I didn't know there was an Altair kit available!

--- End quote ---
The site doesn't seem to have been updated since 2007, so I'm not sure if
the kit is still available or not.

I saw an original Altair 8800 (not b) at Maker Faire in San Mateo this year.
Sadly I didn't get a chance to talk to the owner.  Maybe next year.
Funny thing about Maker Faire -- I had to drag my wife reluctantly to it
and she found so many things she's interested in that she wants to
go back next year! 


I hope you're enjoying this view into the twisty way my mind works
on designing a new project.

Rarely do my designs go linearly from an idea to requirements to design to
prototype.  I usually bounce back and forth quite a bit between
the early stages and eventually hope to get something that works
at the end of it.

Presumably the professionals have a better plan for their projects,
at least until the requirements get changed half-way through, but I
never seem to be able to work that way.

Anyway, onto part 3.

Part 3 - thoughts about power supplies

Since I envision this to end up as a small PCB, I think I'll just go with
the usual wall wart, center positive.  I want to take any reasonable
voltage, up to 18v or so.

Why? Well I had a board from a company I won't name, which took
5v only as input.  Eventually I made a mistake and connected one
of my 9v unregulated adapters instead of the 5v regulated one designed
for this board.

What happened?  Well there was a bang, followed by some smoke, and
then active flame!  Ah, so yes, tantalum capacitors *do* burst into flame
when they are overvolted, just as I have read!

I think that the worst that should happen if you use the wrong adapter
is that the board doesn't work -- not catch on fire!

While I think anything but center positive adapters are evil, if you connect
a center negative to my board, I want it to quietly not work, so
first up we're going to put a diode in series with what we think is the
positive supply.  Maybe we'll use a Schottky rectifier so we have a low
voltage drop.

Oh, and I hate fuses, but there should be some overcurrent protection, so
we'll throw in a polyfuse of some kind.

For center positive supplies I want to just run with anything from +5v to
+18v or so, if the adapter can supply adequate current.  This suggests
using a switcher.  I've used National's Simple Switcher series on other designs
to handle up to about 42v, so I'll probably do some variant of that.

But what voltages do we need?  Well, the FPGA requires 3.3v and 1.2v.
I don't *think* anything will require 5v, unless maybe the USB stuff does.
Hmm, I want to have both host and device USB ports, so I can connect
a keyboard and mouse, and also plug into another computer.

How to do that?  I could put USB phy chips on the board, and do the USB
protocol either in the Z80 (yuck!) or FPGA hardware, or a second embedded
processor on the FPGA.  Or toss one of those Cypress USB chips on the board
and wash my hands of it.  Can the Cypress chip look like both a host and device
port?  And I need a USB hub chip so I can connect both the keyboard and mouse.
Does any of this require +5v?  Don't know, have to go off and try to nail
down how the USB is going to work.

And how much current do we need for the +3.3 and +1.2 rails?  Well, funny
thing about FPGAs is that it's really hard to know what their power
consumption needs are until the design is finallized, because the power draw
differs depending on the design put into them. 

This is where "hobby engineering" comes in.  How about I just provide circuitry that
can provide between 0.5 and 1amp on each rail and just hope for the best?  Yeah,
let's do that.

So assuming I don't need to +5v for now, I've got four basic choices.

1) Generate 3.3v from the input using a switcher.  Then generate 1.2v using
an LDO on the 3.3v line.

2) Generate 3.3v using a switcher.  Separately, generate 1.2v using a second switcher,
also from the main input.

3) Generate 3.3v using a switcher, then run a second switcher off the 3.3v supply.
This means the second switcher doesn't have to have the same wide input range
as the first switcher.

4) Get a two output switcher chip, and generate both 3.3v and 1.2v

What kind of switcher chips?  Well, I like the ones with integrated MOSFETs, because
then the chips can do thermal shutdown if I screw up and they get too hot.
That's harder to provide for if I use an external MOSFET, plus it's another component.
It would be nice if the chip did synchronous rectification, so then I don't have to have
a Schottky catch diode, but it's not a big deal.

OK, so my head already hurts from all the choices.

Now if some part of the circuit requires +5v, then I can generate +5v and use that
as the input rail for the +3.3 and +1.2v needs.

Looks like I'm going to have to go play with National's WEBBench software and try
out some scenarios once I figure out if I need +5v.

Then I have to check if all of the parts pass the Digikey test.  What's the Digikey test?
Well, I have to find the parts *in stock* at either Digikey or Mouser, because life is
too short to have to go try to source hard to find parts for a power supply.
Plus as a hobbyist, I have no clout whatsoever in trying to get rare parts.
Usually, for switchers, that hard part is the inductor.  It's easy to get low ESR
tantalums or ceramics, and pretty much any Schottky diode with the right voltage
and current specs generally work.

Choices choices.....

Part 4 will be next.



[0] Message Index

[#] Next page

There was an error while thanking
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod