Hi All,
I've decided to go ahead a share a project I've been working on for the last year or so...
This is really just a personal project to get myself back up to speed on where the current "state of the art" is for hobby electronics. I've been doing enterprise programming for the last couple decades, and the last hardware I designed (professionally) was an AMD29000 based graphics processor. I've been pretty out of the loop on what's available to the hobbiest, but of course I've been seeing cheap PCBs, all the Arduino uController stuff, etc - just wanted to get a feel for what's available now...
So I decided to clone the first computer I owned the Radio Shack TRS-80 Model 1.
I know, I know, it's been done - there are plenty of software emulators available that run faster than the original did, etc, etc... For me, this wasn't about the end goal, but more about the journey. I figured this should be an achievable goal, it has a defined 'growth path' (expansion interfaces, disks, etc) and should let me start exploring several different technologies (KiCad, SMD, FPGA) right from the start.
I started by playing with a Cyclone-IV development board like this one:
It has VGA output, and a PS/2 input so that pretty-much covers the original Model-1 user interface: Monitor and Keyboard. So step one began as figure out how use FPGAs. I found a Z80 CPU implemented in VHDL and have used that, but everything else in the FPGA has been written from scratch using VHDL in Quartus-II. Obviously I've looked at example designs for the various features I've eventually added, but other than the base CPU, pretty much everything else was a learning experience with VHDL.
One of my (self imposed) design constraints is that I wanted all original software to run without any modifications. My goal is to end up with a hardware re-implementation of the original TRS-80 design. The lines get really blurry when I start dealing with the disk controller, but even there I've tried to stick with my original goal as much as possible. So, for example, the keyboard implementation needed to take the PS/2 keyboard events and translate them into the memory-mapped switch array of the original keyboard. Also, since the original video was 384x192 pixels as composite video I've transmuted that to 800x600 VGA signal.
Looking through my phone it appears I didn't take any pics of the early iterations, so let's just say - the first iteration of my TRS80 lived almost entirely on that demo board, had 48K of RAM, 12K of ROM (both implemented inside the FPGA) and ran Level II BASIC. I did cobble up the original cassette interface on a breadboard connected to that dev board and was able to CSAVE and CLOAD from a little hand-held audio recorder. Since I had simply copied the orignal design, it was plagued by sensitivity to the audio level, just like the original!
The next evolutionary step was to begin development of the "expansion interface" and to introduce floppy drives to the mix. Little did I know at the time how long that was going to take me, but (spoiler alert) I eventually got there. My approach was to use an Arduino Mega board to emulate the original floppy disk controller (WD FD1771) hardware, but instead of read/writing 5-1/4 floppy drives, it would support virtual floppies on an SD card in any of the common diskette formats supported by the SW emulators (DMK, JV1 and JV3 formats). I started with a custom serial interface between the Arduino and the FPGA board, controlled by the Arduino. The FPGA would provide the register set supported by the original FD1771 and the arduino could read and write them via the serial interface under software control from it's end. Pretty quickly I had to learn how to access SD cards on the Arduino, how to talk to displays (an LCD display in this revision), etc. I also quickly learned that the Arduino development environment *just sucks*! I looked at alternatives and have settled on using the Eclipse Arduino plugin for CDT - it has a couple wrinkles, but overall it's certainly head-and-shoulders above the native arduino gui. I also quickly learned that having all these bits cobbled together with jumper wires wasn't a very stable dev platform. I don't have any pics of the actual setup at the time, but let's just say this is a fairly accurate representation:
Once I was fairly confident that I had basic communication between the FPGA and the Arduino, plus I knew I could talk to both the SD card and the LCD display I decided it was time to take the plunge and commit my prototype to a PCB. This was another new learning curve for me (which is good, as that was the whole point of this exercise). I did a little research and pretty quickly settled on using KiCad for the schema capture and PCB layout. When I was last doing hardware design we were using Apollo workstations and we sent all our boards out for layout... I've found KiCad to be reasonably good for the schema capture and so far I've been pretty impressed with it's PCB layout capabilities. Of course the fact they're available for free to hobbiests is just mind-boggling to me...
Anyway, here's the board I ended up laying out:
Here's a pic of it populated (with some areas reworked for lack of pullup resistors, bungled PS/2 Keyboard connector footprint, etc):
You may notice a distinct lack of actual chips on that board? To reduce my initial costs for the putting this together I decided to go with a Cyclone-II instead of a Cyclone-IV (verified the design would fit, except for RAM, before making that change), and also to stick with an actual Arduino Mega board as a subassembly that plugs into this board (so I suppose technically my board can be thought of as an arduino shield). I also decided to use one of these:
to host the Cyclone-II instead of trying to deal with hand-soldering a 200-some pin smd package... So my lash-up now looks like this:
With the Cyclone-II board plugged in below my board, the Arduino Mega on extension headers below that (but plugged into my board), then the LCD panel (with SD slot) plugged into the top of my board. It's quite a random stackup - but it worked, so I was actually pretty happy with how it turned out. Actually since this was my very first PCB layout (in a non-professional setting) and my first attempt at using SMD components and hand soldering them (I did get and do a few of those SMD soldering practice boards), I was actually pretty tickled with it...
This seems like a reasonable place to take a break... I've done one more evolution of this design that I plan to document in the next post, and I'm getting ready to begin the third version which I'll start documenting in real-time after that...
If you've read this far and are bored to tears - I appologize. I know I enjoy reading and following along with the journey others go through with their development. Two great examples are GK's posts:
Cloning a Commodore PET-2001 -
https://www.eevblog.com/forum/projects/otp-eprom-programmer/msg1224259Cloning a Tandy TRS-80 Model 1 -
https://www.eevblog.com/forum/projects/cloning-a-tandy-trs-80-model-1/msg2084683So I'm just trying to contribute back in a little way, and hope someone finds this stuff interesting.