Homebrew Microcomputer Design
Homebrew Microcomputer Design
Homebrew Microcomputer Design
Contents:
Choosing components:.......................................................................xx Sourcing affordable parts (ICs)..........................................................xx Design methods..................................................................................xx Using programmable logic (PLDs Vs TTL) ..................................xx A basic Generic design......................................................................xx A More advanced generic design.......................................................xx An ideal generic design .................................................................xx An Example Z80 Design ...............................................................xx
Choosing components.
Choosing components is an important part of any microcomputer design. For the amateur, non commercial enthusiast this normally means low cost modern or legacy ICs. Keeping costs down while still making the system being designed reasonably powerful. What tends to happen is a design will evolve that will use a combination of both legacy and modern ICs. Making a bit of a mongrel, however that is not a bad thing as this approach can prove to be both the most cost affective and efficient. As all homebrew microcomputer designers know you need a minimal of components, namely, CPU (central processing unit), RAM (random access memory), ROM/EEPROM (Read only memory), Output device/ devices ( Video TV, LCD, Sound, Printer port etc), Input devices ( Keyboard, Joystick etc) Input/Ouput (Serial I/O, Parallel I/O), plus not forgetting 'GLUE LOGIC' the stuff that connects everything together. Selecting a CPU: How you select a CPU is entirely up to your personnel preference and requirements, whether this be a legacy CPU or a Modern type. Examples are : ( 65C02, 6809, Z80, 8 bit : 68000/68008 16 bit legacy ICs) or Modern RISC types like ATMEL etc... The choice is yours ! 65C02 : 8 bit, dates from 70/80s used in Acorn BBC B/Electron, ORIC-1 & Apple II to name a few Retro machines. Still made as W65C02P. Z80 : Probably the most common 8 bit CPU from the 70/80s. Used in Amstrad CPC/PCW, MSX I & II, Memotech MTX, Tatung Einstein, SORD M5, ZX Spectrum etc. MC68008: 32 bit internally with 8 bit databus. Used in the Sinclair QL. MC68000: 32 bit internally with 16 bit databus, used in Atari ST & Commodore Amiga from the 80s Selecting RAM : In an 8 bit system 32K or 128K will be enough for most purposes. Using 32K obviously makes memory decoding easier. In a 16 bit system (68008/68000 etc) then a minimal of 128K or 512K would be advised. As these SRAMs are now cheap and readily available this would
be a better option than using DRAMs Examples of SRAM (static RAM) : W24257,UM62256 (both 32k x 8),UM62512 (64K x 8), TC551000,KM681000,HM628128 (128k x 8), KM684000,K6T4000 (512K x 8 bit). Selecting ROM/EEPROM: as with RAM the size of ROM normally depends on whether your using an 8 bit CPU or 16/32 Bit CPU. For an 8 bit system then 32K or 64K would suffice though you could utilise a larger FLASH eeprom for larger ROM storage. 512K Flash ROMs are cheap and easily sourced. Examples of EEPROM: AT28C256 (32K x 8), W27C512 (64k x 8) Input Devices : Connecting things like Joysticks, Keyboards etc can be done in a variety of ways, you could use a microcontroller like the 8051 to read the keyboard/joysticks etc. Or you could use a CPLD (complex programmable device) though you'd need to be able to program it using a boolean logic , ( VHDL or Verilog ). Output Devices : This normally covers things like Video/TV or LCD display. This can be done using a low cost legacy Video processor IC, like the V9958 or V6366. Input/Output devices: These normally mean serial and parallel I/O. This can be done using a dedicated I/O controller IC or utilising spare logic on the CPLD to perform both serial and parallel I/O. This could also produce the signal to drive a legacy (LPT) printer,. Sound Generation: Sound is an audible output and again there is numerous legacy chips to choose from that are as cheap as chips. Things like SN76489,SAA1099,AY-3-8910 etc Glue Logic: On older designs you see a lot of TTL/CMOS 7400/4000 series ICs NAND,AND,NOR gates etc. I fell it is much better to put this logic onto a CPLD or PLD (programmable logic) chip and reduce cost and chip count. It is also a much more elegant approach to use a CPLD as Glue Logic, giving greater flexibility (these can be reprogrammed) and reduce the overall PCB size of your final design. Common CPLDs include Altera MAX series (EPM7128SLC84 etc), Xilinx, Atmel and many other manufacturers.
Design Methods
Keep it simple !
Simple designs are more likely to work and cheaper to build!
When designing an electronics circuit you should always try to design the most simple and hopefully elegant design. Thus reducing the amount of work ( Man Hours) needed and the overall cost of the design. Using discrete components : One method of designing a homebrew microcomputer is to use a lot of old TTL/CMOS discrete logic. This method has advantages and disadvantages. Advantages : There are lots of old schematics and drawing to copy and use, which some people like. Disadvantages: More ICs means more complexity, larger PCB more time needed to design and produce a PCB layout, may even be more costly. Can if not designed well look messy. May need multilayer PCB . 4 layers or more ! Using PLD/CPLDs: This in my opinion is the most elegant and cost effective method. The CPLD is the one Chip GLUE logic that holds the whole design together. One CPLD can contain the logic for dozen or even hundreds or thousands of discrete TTL logic ICs. Advantages: Can be cheaper to buy one CPLD or PLD as opposed to dozens of TTL ICs. Reduces the chip count significantly to a fraction of what might otherwise be needed. Can be Cheaper. Easier and less time consuming to design the Schematic and PCB layout. The final PCB can be significantly smaller.
Disadvantages: The PLD/CPLDs need to be programmed, so some knowledge of logic programming in VHDL,Verilog or boolean equations is needed
Advantages : many discrete ICs can be put on one CPLD, more cost effective, Smaller board size (PCB) hopefully easier to design reducing overall manhours. Disadvantages: No need to be able to program the CPLD or know someone that can.
Programming is normally done in VHDL or Verilog which are programming languages design for boolean equations and electronics.
Block Diagram
Serial RS232
functionality description: 5V regulator.. a 7805 regulator turns 9V DC input into a fixed and stable 5V level for the design. The Generic CPU/Microprocessor could be a 6502/6809/Z80. The data and address bus are fed to the SRAM, and EPROM as expected. A15 of address bus selects ROM/RAM
Chip (RAM/ROM) select is done by the CPLD, A15,The microprocessor is interfaced to the CPLD. MREQ, IOREQ and other control signals can be fed into the CPLD. The CPLD then outputs.... select ROM, RAM, I/O. Since this system uses 32K RAM, 32K ROM this should be relatively straight forward. One lines selects ROM,one RAM, one I/O etc. Glue Logic, EPM7128. The MAX CPLD control the I/O functions. A0..A7 , D0...D7, MREQ,IOREQ and other control signals from the CPU. The CPLD is programmed to map I/O to select ROM/RAM/Video (V9958), and serail RS232 as well as keyboard/mouse functions. The design is simple as most of the logic design is in the EPM7128 CPLD, probably in a PLCC84 package giving 68 I/O lines to interface too. Serial RS232 is done by the EPM7128 CPLD and the MAX232 voltage converter. The CPLD hold the logic for the serial comms circuitry and the MAX232 generators RS232 compatible signal generates the serial . EPM7128 will need to be programmed as it is blank by default. So some knowledge of VHDL, PLD logic programming is needed. GAL/PLD/CPLDs programmers can be obtained quite easily, some cheap/inexpensive examples are : TOP853,G540 and a USB blaster cable for programming the EPM7128 CPLD. These can found on ebay. Video processor : V9958 this is used as an output device, giving both TEXT and GRAPHICS functions. Other output devices could be used: LCD driver, LEDs etc. However using a legacy Video Processor allows for greater flexibility and are relatively cheap. The V9958 can be used with 4 or 6 DRAMs (D41464 or similar 64K x 4 bit) or one single 128K SRAM. Sound Generator: This is not really needed, but for producing audible tones and music one can be added. The simplest and cheapest are ones like the SN76489, SAA1066 & AY-3-8910. Note the AY-3-8910 has two parallel ports ideal for connecting joysticks.
QTY
Item / Package
Description Jack conn. Mini Din TV output RS232 CPU CLK VDP CLK
QTY 1 2 1 2 1 1
1 1 1 1 1 1
DC input Jack PS/2 6pin RCA phono DB9 male xxMhz Xtal 21.447MHz Xtal
D41464
DIP18
4 1 1
? ? ?
? ? ?
CPU/MPU. Central processor 16/32bit can address several Meg of RAM/ROM. 2 RAM +2 ROM, with Cartridge and I/O selection is done by the 16V8 PLD. Each ROM/RAM could be from 128K to 512K ideally SRAM, eliminating the Refresh circuitry needed for DRAMs. Two CPLDs are used both PLCC84 through hole, one is used for video, and Serial/Parallel I/O. The other for sound and keyboard, spare logic could be used for CTC,WDT, Clock etc Keyboard/Mouse is done via a microcontroller such as a 8051 or ATMEL type this takes some of the work load from the CPU. Video is done via the CPLD generating video out which is fed (Genlocked) into the V9958 giving two effective video processors. This should allow good quality graphics/text for a homebrew design. Sound is done using the AY-3-8910 which has two parallel ports ideal for connecting joystick ports.
You could alternatively use a different sound chip (PSG) like the SAA1099 or SN76489. A Cartridge port is added for connecting external ROM/RAM. Also an expansion bus is shown which could be used to attach a daughter board.
How to design a minimal high performance Z80 based microcomputer with high quality graphics. Using less than 15 ICs !
Part 1
Preparation. Board Layout and components selection: I've decided to use a board layout of 220 x 160 mm to give plenty of space for each component. I've also decided to use two EPM7128 CPLD. One as a memory decoder and one as an I/O decoder/ interface. Though it would be better to use one EPM7256 144pin SMD (124 I/O lines). You don't have to lay your board out the same way or use two EPM7128s. I'm using FreePCB to do the board layout and am not going to bother with a schematic as there's only a dozen ICs or so. But if you want to do a schematic I'd recommend using Eagle as it's cheap (Free) and easy to use. So lets start: Drag and drop your components from the parts library onto your virtual board. This should take you a quite a few minutes. Some parts you'll probably have to use generic devices, such as a DIP64 for the V9958 IC. Now lets do the power supply. Connect the 9V DC input to the 7805, voltage regulator you could pop a fuse in series with this if you want as a safeguard, also popping in some smoothing capacitors between 0V and 9V input will help. I will also be putting in a LED to show that the board is ON or OFF.
9V in Switch
5V Out
FUSE 7805 Regulator
LED
Now we have 5 Volts and ground (0V) ! These need to go to every IC, Z80, EPM7128s, V9958, SRAM, EEPROM, FLASH, MAX232 , 41464 DRAMs. They'll also have to be connected to very connector, printer DB25 (or Centronics ), PS/2 , Com2,Com2 DB9, Scart (TV) etc... This will take some time as you'll have to look at every connectors datasheet/pinouts to see which pins are ground and Vcc 5V ! This is a time consuming part of the build. Use your logbook to make notes and jot things down. I tend to cut-out the pin-outs and glue them into my logbook to save drawing them! A bit like Blue Peter. It's very important to note things down and keep an accurate log otherwise you'll get in a muddle later !
We can also connect a RESET button placed at the front of the board, this is a SPST momentary switch. It simply momentarily pulls the CPU Z80 Bus RESET to zero . The exact wiring for this can be found in the Z80 Data-sheet with pull-up resistor values etc. It should go to the CPLD that connects to the Z80 Bus (and reset) which will buffer it and stop de-bounce, it will then feed to the external Z80 Bus and thus to every IC with a Reset. Now you know why you printed out all those datasheet IC pinout diagrams !! By now ( several hours later) your ready for a cup of tea. ** See Datasheets at end for 7805 pinouts etc.
Z80 CPU
Z80 BUS
CPLD PLCC84
CPLD PLCC84
Now you can go and have a cup of tea ....you've earned it ! * Don't forget to save your work *
Part4
Connecting Printer,Expansion port,Keyboard & Joysticks
Now lets connect the printer, Connect it to spare I/O lines on the CPLD for I/O . I believe 13 I/ O lines are needed these include D0...D7 plus control signals for handshaking and stuff.. 5V and Gnd should already be connected. You can either use a DB25 and configure it like a PC LPT port or a Centronics ports as in the original Einstein. The pinouts for an LPT1 port can be found on Wikipedia and a Centronics from the Einstein manual. Remember to make notes of what goes where in your logbook! The Expansion port is normally just the Z80 BUS, but sometimes it is the Z80 BUS plus extra control signals.. it's up to you how you wire it. I wouldn't worry about the original Einstein's connectors and expansion ports.. as most of the stuff it was connected to is completely obsolete! Think of how it can be connected to modern equipment not old ! The PS/2 keyboard and mouse.. they have DATA and CLK that need to be connected to available I/O lines. It might be worth just connecting these to the nearest CPLD for convenience. Again making notes in your logbook! The two joystick ports can be connected like Atari ones, I believe that gives 5 data-lines each , so giving 10 I/O lines to the CPLD. Of course you could miss them off. Or if your short of I/O lines use another CPLD like a ATF1502 or micro-controller to connect them. The Joystick port could also be connected to the PSG via it's two I/O ports as these are no longer needed to scan the keyboard matrix ! This is probably the best option !
Printer
Com1
Com2
Auxiliary
Joysticks
Keyboard / Mouse
Data Bus
Control Signals
Mode/Register Select
Video Out
through the CPLD rather than straight onto the Address Bus. External video could be connected via DACs to one of the CPLDs allowing external video / Superposition to be used. This would allow ZX Spectrum or Amstrad CPC graphics modes to be used. The V9958 graphics being superimposed or overlaid on top. Use your datasheets and service manuals to help. The MSX turbo R manuals are online, the text is in Japanese, but this does not affect the schematics.
Full Software Control of Sound Generation Interface to Most 8-bit and 16-bit Microprocessors Three independently Programmed Analogue Outputs Two 8-bit General Purpose I/O ports (AY-3-8910) One 8-bit General Purpose I/O port (AY-3-8912) Single +5 Volt Supply
DESCRIPTION The AY-3-8910/8912/8913 Programmable Sound Generator (PSG) is a LSI Circuit which can produce a wide variety of complex sounds under software control. The AY-3-8910/8912/8913 is manufactured in the General Instrument N-Channel Ion Implant Process. Operation requires a single +5V power supply, a TTL compatible clock, and a microprocessor controller such as the General Instrument 16-bit CP1610 or one of the PIC1650 series of 8-bit microcomputers.
The PSG is easily interfaced to any bus orientation system, its flexibility makes it useful in applications such as music synthesis, sound effects generation, audible alarms, tone signalling and FSK modems. The analogue sound outputs can each provide 4bits of logarithmic digital to analogue conversion greatly enhancing the dynamic range of the sounds produced. In order to perform sound effects while allowing the processor to continue its other tasks, the PSG can continue to produce sound after the initial commands have been given by the control processor. The fact that realistic sound production often involves more than one effect is satisfied by the three independently controllable channels available in the PSG . All of the circuit control signals are digital in nature and intended to be provided directly by a microprocessor/ microcomputer. This means that one PSG can produce the full range of required sounds with no change in external circuitry. Since the frequency response of the PSG ranges from sub-audible at its lowest frequency to post-audible at its highest frequency, there are few sounds which are beyond reproduction ith only the simplest electrical connections. Since most applications of a microprocessor/PSG system would also require interfacing between the outside world and the microprocessor, this facility has been designed into the PSG. The AY-3-8910 has two general purpose 8-bit I/O ports and is supplied in a 40 lead package; the AY-3-8912 has one port and 28 leads; the AY-3-8913 has no ports and 24-leads.
PIN CONFIGURATIONS
PIN FUNCTIONS
DA7--DA0 (input/output/high impedance) pins 30--37 (AY-3-8910) pins 21--28 (AY-3-8912) pins 4--11 (AY-38913) Data/Address 7--0: These 8 lines comprise the 8-bit bidirectional bus used by the microprocessor to send both data and addresses to the PSG and to receive data from the PSG. In the data mode, DA7--DA0 correspond to Register Array bits B7--B0. In the address mode, DA3--DA0 select the register number (0--17 8) and a DA7-DA4 in conjunction with address inputs /A9 and A8 for the high order address (chip select). A8 (input): pin 25 (AY-3-8910) pin 17 (AY-3-8912) pin 23 (AY-3-8913) /A9 (input): pin 24 (AY-3-8910) pin 28 (AY-3-8912) (not provided on AY-3-8913) /Address 9,Address 8 These "extra" address bits are made available to enable the positioning of the PSG (assigning a 16 word memory space) in a total 1,024 word memory area rather than in a 256 word memory area as defined by address bits DA7--DA0 alone. If the memory size does not require the use of these extra address lines they may be left unconnected as each is provided with either an on-chip pull down (/A9) or pull-up (A8) resistor. In "noisy" environments, however, it is recommended that /A9 and A8 be tied to an external ground and +5V, respectively, if they are not to be used. /RESET (input): pin 23 (AY-3-8910) pin 21 (AY-3-8913) pin 16 (AY-3-8912) For initialization/power on purposes, applying a logic "0" (ground) to the /Reset pin will reset all registers to "0". The /Reset pin is provided with an on-chip pull-up resistor. CLOCK (signal): pin 22 (AY-3-8910) pin 20 (AY-3-8913) pin 15 (AY-3-8912) This TTL-compatible input supplies the timing reference for the Tone, Noise and Envelope Generators. BDIR,BC2,BC1 (inputs): pins 27,28,29 (AY-3-8910) pins 18,19,20 (AY-3-8912) pins 2,3 (No BC2 on AY-38913 see below) I/O PORTS Two additional blocks are shown in the PSG Block Diagram which have nothing directly to do with the production of
sound -- these are the two I/O ports (A and B). Since virtually all uses of microprocessor-based sound would require interfacing between the outside world and the processor, this facility has been included in the PSG. Data to/from the CPU bus may be read/written to either of two 8-bit I/O Ports without affecting any other function of the PSG. The I/O Ports are TTL-compatible and are provided with internal pull-ups on each pin. Both Ports are available on the AY-38910; only I/O Port A is available on the AY-3-8912; no ports are available on the AY-3-8913.
Joysticks
PSG BLOCK DIAGRAM
There are a handful of ways available to the hobbyist to turn your own designs into PCBs. They yield results of different qualities. Homemade board tend to be of a much lower quality than professionally manufactured ones. Any process that involves making your own board will have a number of steps in common. At a high level, here's what you're doing: 1. Procure a bare copper coated board. These can be bare copper or photosensitive types. 2. There are loads of excellent videos on YouTube showing you how to design a homebrew PCB. I recommend you spent a couple of hours researching this online. I prefer the laser jet method and a hot iron. Where the design is printed off using a laser jet printer and then the ink from the paper is Ironed onto the copper board.. Again theres You tube videos showing this very well ! 3. There are various methods for using an expensive UV box to a simple water resistant maker pen and even transfers. If you have a plain board, 4. All homemade boards are prone to going wrong, lining up both sides on a double sided board can also pose problems and in general Id only recommend doing it yourself if your experience and confident to do it or the board design is very simple! 5. Cost: the cost of buying all the materials, Ferric Chloride, gloves, goggles, copper board etc can be quite expensive and sometimes it works out cheaper just to send your design off and get one made from a budget no frills PCB manufacturer.
DB9
Pinouts
The following table lists commonly-used RS-232 signals and pin assignments.
Signal Origin
8P8C ("RJ45")
10P10C ("RJ50")
Name
Abbreviation
DTE DCE
2 3 3 2
TIA561
6 5
Yost
MMJ
2 5
Cyclades
[4]
National Instruments
Cyclades
[5]
[4
]
4 7
Digi[6]
5 6
Transmitted Data Received Data Data Terminal Ready Carrier Detect Data Set Ready Ring Indicator Request To Send Clear To Send Common Ground Protective Ground
TxD RxD
3 6
3 6
8 9
DTR
20
8 6 22 4
1 6
2 7
7 8 1 5 4
10 5 2 4 3 6
8 9 10 2 6 5
1 9 7 8 5 8 7 4 1 8 4,5 3,4
5 7
PG
common
SCART TV Connector
Atari joystick
Computer port view of the Atari standard connector: 1. up, 2. down, 3. left, 4. right, 5. (pot y), 6. fire button, 7. +5 V DC, 8. ground, 9. (pot x). 7805 Voltage Regulator
Connectors
Item LPT1 DB25 Code DB25 female Qty 1 Price each 0.45 Total 0.45
PS2 DIN 6 pin Joystick Scart TV DC power Switch On/Off Expansion connector Auxiliary Connector Reset Button
DIN 6 pin female DB9 male SCART DC Jack socket SWITCH Double SIL DB15 ? Single Momentary
2 2 1 1 1 1 Optional 1
Miscellaneous
Item Crystal 20MHz Crystal Socket 84 LCC Socket 32 LCC Socket 40 Socket 32 Socket 28 Socket 64 Socket 16 Code XTAL 20 XTAL 21.4772 PLCC84 PLCC32 DIP 40 DIP 32 DIP 28 DIP 64 DIP 16 Qty 1 1 2 1 1 1 1 1 7 (Max) Price each 0.30 0.35 0.70 0.25 0.25 0.15 0.15 0.15 0.10 Total 0.30 0.35 1.40 0.25 0.25 0.15 0.15 0.15 0.70
Approx 220mm
DC 9V IN
DB25 LPT1
Expansion connector
Com_1
Com_2
Scart connector
VDP DRAMs
EMP7128
I/O CPLD
EMP7128
Memory Decoder CPLD
160mm
PSG AY-3-8912 J1 DB9 J2 DB9 Joystick Ports 128K SRAM 32 Pin DIP 64K EPROM 28 Pin DIP 512K Flash PLCC32 Optional
RESET
Keyboard PS/2
Mouse PS/2
LED
Joysticks
RAM
ROM
Keyboard / Mouse
Approx 220mm
DC 9V IN 7805
Expansion connector
Com_1
Com_2
Or Equivalent CPLD
PSG AY-3-8912