Author Topic: Z80 or similar bare bone computer.  (Read 6949 times)

0 Members and 1 Guest are viewing this topic.

Offline mrpsychoticTopic starter

  • Contributor
  • Posts: 34
Z80 or similar bare bone computer.
« on: October 07, 2010, 05:55:24 am »
I am interested in building a small computer and had previously opted to build a very minimal computer out of discrete components (think 4- bit). Due to cost constraints and my skill level in electronics I don't think I can do this at the current time. So, I have opted to try building a small computer with a pre-built retro cpu.

First, my two goals:
<>I do not want a computer with extra capabilities like serial output or the ability to drive a display. I want a "bare bone" computer. This entails a dip switch input and led indicating output. I would also like the option to switch to some sort of latching system for the inputs and outputs so my computer can control and be controlled by peripherals as my skill level increases.

<>Ideally I would like to have as few chips as possible.

I was initially planning to use a Z80 as the cpu because wikipedia says it had the need for less supporting ic's than its predecessors. Also, there is a lot of documentation out there on the cpu. Yo may be asking why I am asking for advice then but the truth is because the Z80 computer building tutorials I have found all involve a screen and are more complex than I can manage. If there is another processor that is easier to work with, please tell me!

As best I can figure, for my basic computer I would need: the processor, a ram chip, a rom chip, 8 latches for the input and for the output (for an 8 bit processor), an 8 switch dip switch, a clock, and an 8 led display. Are there any other chips I am missing (buffers or the like)?

Also, how can a program be written to the cpu? My thoughts on this were that the very first address of the rom section would have instructions to read say bit 1 and bit 2 of the input.

It would keep doing this if both were low and when bit 1 goes high it triggers the cpu to jump to a section of rom which performs a loop where it reads the input->stores it in a certain memory address allocated to storing programs-> increments this memory address by 1->reads and stores the next input.

If it read a bit 2 initially it would jump to the memory address where program starts.

All in all this seems like a very bad way to program, what is the best way to program. I am farely certain that some startup program will need to be written to the first address of memory in the rom.

Thanks for your help.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17890
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Z80 or similar bare bone computer.
« Reply #1 on: October 07, 2010, 06:32:02 am »
you might want to play with microcontreollers first ? I've never played with "neat" processors as yes there is more than meets the eye in making a computer from scratch as you also have to look at how your going to have the software and hardware interact, we take this for granted in modern computers but the fundamentals of the x86 platform were laid down years ago and have no changed much since
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 38137
  • Country: au
    • EEVblog
Re: Z80 or similar bare bone computer.
« Reply #2 on: October 07, 2010, 06:58:14 am »
My first thought was the old Talking Electronics TEC-1D computer:
http://talkingelectronics.com/kits/Kits_Computer.html
Looks like you can still buy the kit, and there is plenty of documentation to go along with it.

Dave.

 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11699
  • Country: my
  • reassessing directives...
Re: Z80 or similar bare bone computer.
« Reply #3 on: October 07, 2010, 07:36:36 am »
this was my first idea in building a discreet components computer. just to share the thought, might be a good project for my students. one batch of them did this years ago ;)
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline joelby

  • Frequent Contributor
  • **
  • Posts: 634
Re: Z80 or similar bare bone computer.
« Reply #4 on: October 07, 2010, 07:46:29 am »
My first thought was the old Talking Electronics TEC-1D computer:

Great computers. I learned to program Z80s in hex with them, and still have mine gathering dust in the shed. 3E 00 D3 03 76. Talking Electronics also sold a stripped down version with just I/O and an EPROM (ie, without the keypad and LEDs) for use in embedded controllers. It'd be worth looking at the schematics for this one, as it was pretty minimalistic, but the TEC-1 wasn't a lot more complicated.
 

Offline Feanor

  • Regular Contributor
  • *
  • Posts: 56
Re: Z80 or similar bare bone computer.
« Reply #5 on: October 07, 2010, 10:28:18 pm »
Have you considered getting into FPGA programing? You could build a computer easily into one of these and you would not have to stick to 4 bits. Something like this

http://cgi.ebay.com.au/Altera-CycloneII-EP2C5T144-FPGA-Mini-Development-Board-/190445344302?pt=BI_Electrical_Equipment_Tools&hash=item2c576d562e

The great thing with these FPGA's is you can build any kind of logic you want into it. If you like you can do it in block diagram mode where it is just like building a circuit on a bread board. They even have libraries of things like the 74 series logic chips available for you to simply drag'n'drop and connect into your design. If you want a piece of logic that is unique you can describe it in a programing language and stick it in. So you can build thousands of unique chips into your design without spending more than the initial cost of the FPGA.

Oh and you will need one of these too for programing your FPGA.

http://cgi.ebay.com.au/Altera-USB-Blaster-Programmer-CPLD-FPGA-JTAG-/200528337440?pt=LH_DefaultDomain_0&hash=item2eb06b9a20

Some people sell them together. Shop around. Online resources are pretty good and books are available to get you started. Checkout the actual manufacturers website too and check out their development kits which come with LED's and I/O connectors. Have an open mind about which one you want to start with. Altera, Xilinx, Lattice, there are more.

Building things for real though does give a bit of extra satisfaction that the old Block Diagram File never can. It can also teach you a lot more about things like cold solder joints, noise, switch bounce, short circuits and all the other nastiness that will try to stop your project from working. The FPGA protects you from a lot of this stuff.
 

Offline TechGuy

  • Regular Contributor
  • *
  • Posts: 79
Re: Z80 or similar bare bone computer.
« Reply #6 on: October 08, 2010, 07:03:33 pm »
8-Bit Micros will likeing be more costly to work with than Microcontrollers because:

1. You need to add external RAM and ROM to work with. You will also need to add logic to assign address space to the CPU. Usually the ROM is at the high address from FFFF and down, and RAM is at the low addresses 0000 and UP (assuming a 16 Bit address bus)

2. If you use EPROMs to store your program code, you will need to buy a EPROM programmer and EPROM eraser. You can use EEPROMs (but they can be a lot slower), You will likely need to add Wait states when addressing\accessing EPROM and EEPROMs since they may not be fast enough to operating at full processor speed. FLASH devices are better option, but you need a FLASH Programmer.

3. CPU tools for assemblers and compilers for 8 bit processors such as the Z80 may be hard to find. I purchased a x86 compiler\IDE more than two decades ago and it wasn't cheap.

Microcontrollers usually have built in FLASH and RAM, so you saving you the cost and design time. FLASH Memory size is rarely a problem, but RAM size in MCU's tend to be very limited, usually in the 2K to 4K range. You can find MCU's with larger memory, but these are usually in Surface mount packages. I assume your looking for DIP components so you can either make use a Bread board or Wirewrap board.

I have successfully built many CPU and MCU circuits using both breadboards and wirewrap. I still use breadboards for testing some designed, since its fast and easy to test designs, although I rarely use wirewrap.  You can build simple MCU circuiton a breadboard  in less than 30 minutes, but a CPU with RAM and ROM will take several hours since you have to connect the RAM and ROM to both the data bus (8 parallel connections) and the database (16 parallel connections) and add logic gates to handle the address space for the RAM and ROM. A 8 Bit MCU using a 16 pin dip will take a very small workspace on a breadboard, but a 8-Bit CPU will take up most of the board space.

Most of the MCU manufacturers offer low cost IDEs and compilers for there products, They usually have free student versions, but are limited in the number of lines of code you can compile. Assemblers for any size code are usually free. The only issue is that you need a MCU programmer, but this is far easier and cheaper to use than a Flash\EPROM\EEPROM programmer. MCU are programmed using a serial I/O to limit the number of pins used on the MCU, and they allow in-circuit programming so you don't have to remove the MCU from the circuit to reprogram it when you want to make a change. The two most common are the JTAG and the MicroChip (PIC) ICD. these programming interfaces usually also provide debugging access to the MCU that interfaces into the IDE so you can debug your code easier. Debugging with CPUs is usually much harder. The only commerical option for debugging embedded CPU code are expensive CPU software simulators, or hardware CPU emulators that are plugged into your circut board. The software simulators lack access to the physical hardware, which make have a design flaw and don't necessary help that much.

For a Beginneer I would recommend the Microchip since they are very easy to get up and running. You can download the IDE and student version of thier C compiler for free and run simulations in the IDE simulator without spending a dime on hardware or software. To move to real hardware, you will just need to buy a ICD (about $150 USD) and MCU (from 0.99 USD to $20 USD) depending on size, speed and features, and a breadboard. I would start off with the PIC-18F2525 which comes in a 28 Pin Dip and has 25 I/O pins. it has 16K to 48K or flash and just under 5K of RAM. It also has a built in SPI port, ADCs, PWMs, Timers, Interrupts, etc. You will be able to do a lot with this MCU and I think its only about $5 USD. I think as a beginner you could have a simple system running in less than 8 hours using the PIC 18F MCU. if you go with the Z80 your learning curve and wiring time is substantially larger. I would estimate it will take you 40 to 100 hours.

Concerning your question on how a CPU (or MCU) starts. It uses the reset vector. Every CPU/MCU has a set of vectors, or fixed addresses in the address range that is used to handle special events, such as a reset or an interrupt. When you turn on a CPU, a softstart circuit is used to the Reset pin that triggers it when the power is turned on This is usually a simple RC circuit that holds the Reset pin momentarly low or high so that if forces the CPU/MCU to reset it self upon power on. The Cap takes time to charge and it takes a bit of time for the cap to reach full charge. During this time the RESET pin is held until the cap charges enough to flip the logic state from 0 to 1 or 1 to 0, depending on how you wire the RC to Vcc and gnd.

Most modern CPUs/MCUs have a builtin softstart reset, but CPUs like the Z80 do not. When the RESET signal is triggered the CPU/MCU will load into the Address register the value stored in the Reset vector and start executing the code at that location. The reset vector is usually located in the FLASH\ROM space of the system so that it remains hardcoded. Most CPUs place the reset vector in the high most address space (for typical 8-bit CPUS it in addresses FFFE and FFFF) You have to read the CPU/MCU datasheet to find out where the reset vector is located. FWIW: MCU IDE usually handle the bootstrap code for you, You just specify the start of the program and it set the reset vector for you when you assemble/compile your code in the IDE.

Since your a beginner, I would avoid anything like FPGA devices. Keep it simple! I would recommend a breadboard over a prebuilt learner kit, since you'll quickly want to experiment with devices that aren't built into the kit, Perhaps it will be an SPI temperature sensor, or a ADC converter. You can also add LCDs, 8-Segment LEDs, Serial I/O, varies sensors (temp, voltage, light), Audio, relay, MOSFET switches, etc. A breadboard offers you much more flexiblity than a prefab PCB learning kit.

If you decide to go with a breadboard I would recommend buying the PB-105 from global specialities. I have two of these boards I bought in the late 1980's and still use today. Not cheap but considering that I still use them after more than twenty years, worth the investment
http://www.globalspecialties.com/categories.php?category=2&ct=Premium%20Prototyping%20Breadboards
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf