The Designing and Building of an 8-Bit Computer:
A Personal Story
Written by Mark Balch
Copyright 1990 by Mark Balch,
All Rights Reserved.
You may freely copy and distribute this text file provided that:
it is not sold for profit nor used in a commercial environment; that it
is distributed in its absolutely original, unmodified form; and that it
bears the original copyright notice seen above.
These past few weeks have been very exciting for me because I have
been working with and programming my first home-brew 8-bit computer.
This article is not, by far, the last word on building computers but is
intended to serve as an eye-opener for those interested in the inner
workings of computers. I am not going to explain every facet about 8-
bit computers because such a project could easily fill several
reference volumes and would require the authorship of a true
professional. I am simply going to describe my own little creation:
the preparation leading to its design and construction, the actual
processes of designing and building my computer, the long process of
finding and correcting my initial hardware problems ("bugs") and my
current, on-going exploration of the computer's capabilities from the
programming side of things.
I first started researching the low level intricacies of 8-bit
computers about three years ago by reading Steve Ciarcia's monthly
column in BYTE magazine called "The Circuit Cellar." (I had first seen
this column as early as 1985 when I glanced through old issues of Byte
out of curiosity. Unfortunately, Steve no longer writes for Byte
magazine due to what are, in my opinion, questionable attitudes of the
management. But, lucky for his readers, Steve founded an excellent
magazine along with fellow electrical engineers devoted to hardware
"hacking" called Circuit Cellar INK. In addition to this, beginners
like myself and industry pro's can communicate with each other by
calling the CCI BBS which will be mentioned later in more detail.) In
this monthly column, Steve would present working projects along with
schematics and thorough explanations (schematic diagrams are the
detailed plans or blue-prints for an electronic circuit). These
projects included 8-bit multi-purpose control computers called micro-
controllers, a "smart" printer spooler, a logic IC (Integrated Circuit)
tester and many other interesting topics. His last three articles even
detailed a multi-processing super computer! I never built any of these
projects, but each month they taught me more and more about computer
design and gave me ideas for my own projects.
At around the same time, I purchased a book dealing with the
Motorola 6800 microprocessor family which explained, in great detail,
the workings of 8-bit microprocessor systems. I also sent letters to
semiconductor companies such as Motorola, Rockwell and Texas
Instruments asking for information on their microprocessor, memory and
peripheral products. These companies were wonderful with the myriad of
free reference manuals that they sent me. Over a one year period of
time, I probably mailed more than 20 letters, mostly to Motorola and a
good deal to Texas Instruments, and in reply received at least 2
bookshelves worth of valuable information in the form of their product
fliers, reference manuals and application notes (application notes are
usually sample designs incorporating a certain product for a specific
task). These companies were so obliging because the more engineers
that use their semiconductor products, the more chips they sell and the
more money they make. Nevertheless, all of this free information
supplied me with weeks worth of reading material from which I learned a
great deal.
About a year later, I decided to design a robot based on an
article that I found in a 1986 issue of Byte. I carefully drew the
schematic diagrams for my simple circuit by hand on three sheets of
graph paper. The microprocessor that I chose for the robot was the
6808 which I had learned about from that book. Anyway, this was my
first attempt and to say "things got messed up" is an understatement.
I ordered parts, some expensive pieces of equipment to "burn" EPROM
chips (more on this later) and realized that I didn't know how to
begin. Worse yet, the science fair was about a month away. The
details are very cloudy in my head for some reason, probably because I
had no idea about what I was doing. The project was scrapped and I
think I continued to read more about electronics.
The year after (two years ago) I decided to go ahead and build a
normal computer board, no wheels and no robot. I was able to get my
parents to buy me an expensive schematic drawing program called Schema
for my IBM clone computer to enable me to draw better diagrams. I
designed the computer around the 6808 microprocessor (MPU) again and
ordered some parts. But wouldn't ya know it...my social life got in
the way when I joined my school's production of the musical Cabaret. I
didn't start building the project till February 1st and with the
science fair a month away things went hay wire. I cut corners to build
it quickly and made a mess for the second year in a row. Thinking back
on that project, the design was a pretty good one with only a few
flaws. Had I given myself enough time I might have gotten it to work,
but who knows.
Okay. I had enough. This was crazy. I made up my mind to build
a computer, and really build one this time. Summer vacation was over
and school had started. (We're back in September of 1989 in case you
lost track of my excellent time-keeping!) I went back to my computer
and spent some time with Schema. What a terrific program: expensive
but definitely worth ever penny to an electrical engineer. I came up
with a straight forward design for an 8-bit computer. It was again
built around the 1 MHz 6808 MPU and was to have an expansion bus
capable of addressing 32K of off-board input/output or memory, 2K or
RAM, 8K of EPROM, an LCD, a serial port capable of operation up to
19.2K baud, 8 LEDs, 4 push buttons and an 8 position DIP switch.
Now let me do some explaining in case some of the above terms
aren't too clear to you. The 6808 that I used has an operating or
clock frequency of 1 megahertz (MHz). All computers have a certain
clock frequency which dictates how fast instructions are fetched from
memory and executed. Everything that the MPU does is synchronized by a
constant pulse train called the clock. A 1 megahertz clock speed means
that the MPU receives 1 million clock cycles per second (mega meaning
million and hertz meaning a cycle of repetition. You have probably
seen clock speeds of 10, 12, 16, 20 MHz and higher in computer
catalogs. Yes, a 30 MHz 80386 MPU receives 30 million clock pulses per
second!). Each instruction that the MPU performs is broken down into
parts and each part is executed in one clock cycle. Different
instructions have different execution times. On the 6808, the average
instruction execution time is about 4 or 5 clock cycles, ranging from 2
cycles all the way up to 12 cycles. The faster the clock frequency,
the faster an MPU can execute instructions. Why didn't I use a 20 MHz
clock frequency? Well first of all, the highest possible operating
frequency of the 6800 family is 2 MHz. Second, the faster your MPU
operates, the more expensive and harder to build your computer gets.
At 20 MHz, you need very fast memory which ain't cheap, and you have to
be careful about other technical problems arising from radio
interference in the computer's signal lines.
The 2K of RAM means 2 kilobytes of Random Access Memory. Thinking
back on things, I should have designed 8K of RAM...oh well. Random
Access Memory is the term given to memory that can be written to and
read from. RAM is known as volatile memory because it cannot retain
its information when power is removed from the chip. Here's something
that most people don't realize about memory quantities: the 2 kilobyte
number is a round number. The RAM chip actually has 2,048 bytes of RAM
but 2,000 is selected because it is easier to keep track of. If you're
wondering why the RAM chip is made to hold 2,048 bytes (2,048 isn't
exactly a round number), it's because computers operate on the binary,
or base 2, number system at their lowest level. All numbers in
computers are powers of 2. This is because a signal wire can either be
ON or OFF. So you have two possible numbers: 1 and 0. 2,048 is 2
raised to the 11th power. This means that 11 address signal lines
(numbers) are needed to access all of the 2K of RAM.
The 8K of EPROM means 8 kilobytes of Erasable Programmable Read
Only Memory. This memory is non-volatile, meaning that it retains its
information even while the power is off. Under normal operation, this
memory cannot be written to, so it is called Read Only Memory. But as
the name implies, under certain conditions the chip can be programmed
and also erased. A special device known as an EPROM programmer is
needed to "burn" the information into the chip with high voltage
electrical pulses. Another device known as an EPROM eraser is needed
to erase the information in the chip before it can be re-programmed.
This erasure process is accomplished by a high powered ultra-violet
light source. Now here's the question: why use an EPROM if you have
RAM? Well, the MPU by itself is a dumb piece of silicon wafer.
Without a program it won't do a thing so you must always have some
program immediately available for it when the computer is powered on.
The EPROM retains its data almost indefinitely, so even after power has
been turned off, it can supply the MPU with instructions as soon as the
computer is turned on. Okay great, but why do you have to make it
erasable? Once you have a perfect program developed, you don't have to
make an erasable PROM chip, but during the initial stages of
development, you must be able to correct your mistakes. If the EPROM
was not erasable, an engineer would waste dozens or even hundreds of
PROM chips before he got his program or design correct. And believe
me, no matter how perfect you think your program is the first time,
it's bound to be buggy. As you gain experience, the number of bugs of
course decreases, but they are always popping up when you least expect
it.
The LCD is an acronym for Liquid Crystal Display. You've seen
them lots of times on calculators, watches and maybe some machines.
They can be used to display letters, numbers and graphics. The one
that I used is a 16 character display. They're not cheap though.
Buying them from retailers can set you back about $30 for the one I
used and up to $80 for a 40 character 2 line display. The best place
to buy them is from odd-lot clearing houses who buy over-stocked items
from manufacturers and sell them at great prices. I got three of them
for $30, a pretty good deal.
The serial port is actually composed of two chips, a connector and
some assorted electronic components. The first chip is known as either
a UART (Universal Asynchronus Receiver/Transmitter) or an ACIA
(Asynchronus Communications Interface Adapter). I prefer UART because
it has only two syllables! This chip is the heart of the serial port.
It receives data from the MPU and converts it into a serial format and
then sends it to the second chip. In reverse, it takes serial data
from the other chip and converts it into 8-bit bytes for use by the
MPU. I used the Rockwell 6551 which is a very easy to use but complete
chip. Many engineers had recommended it to me. Motorola makes the
6850 which is also a UART, but I don't like it. It requires an
external clock source and is not as flexible. Heck, they made a great
MPU, so who am I to complain!?! The second chip is known as a level
converter. Standard logic levels are from 0 to +5 volts. This is
known as TTL logic (TTL means Transistor-Transistor Logic. They are
the low level basic logic circuits from which all other circuits are
built). But the RS-232 serial communications standard uses -12 to +12
volt logic levels. Somehow, the computer industry got stuck with this
"great" idea, so we all have to design around it. The level converter
simply converts the RS-232 signals to TTL logic signals and vice-versa.
The chip I used is the MAX232 which is a great product from Maxim
Semiconductor. Unlike the standard chips used for signal conversion,
the 1488 and 1489 which require external +12 and -12 voltage sources,
the MAX232 converts +5V to +10V and -10V without any external hardware.
This minimizes circuit complexity, but increases the cost a little.
If you've forgotten by now, I am explaining all of the parts of my
computer design! Last but certainly not least is some input/output
(I/O) circuitry that I incorporated into my design to allow status
signaling to the user through 8 LEDs and user input through a keyboard
consisting of 4 buttons and 8 switches. By the way, LED is an acronym
for Light Emitting Diode. These guys are available in several colors
and they do what their name implies: light up! All of this
miscellaneous I/O hardware is tied together for easy communication with
the MPU by the 6821 PIA. This is another Motorola product designed to
complement its 6800 family of MPUs. PIA stands for Peripheral
Interface Adapter. It has 2 8 bit I/O ports and 4 controllable signal
lines. I connected the 8 LEDs to one port, the DIP switch to the other
and the four buttons to the signal lines. Once I figured out how to
work it, the PIA performed very nicely and allowed very flexible
control of my I/O devices.
I now take you back to the story of building the beast. We were
up to the point where I designed the computer with Schema. Okay.
During the design process, I communicated with engineers on the CCI BBS
and asked little questions here and there. They offered much help and
I soon had three nice looking pages of schematics printed out. I was
ready to build the computer, so I ordered all of the parts from mail-
order houses in silicon valley. The technique that I used is called
wire wrapping. There are two basic methods for prototyping circuits
(prototyping being the first time you are building the circuit) along
with some others: soldering and wire wrapping. Some people like
soldering. Steve Ciarcia solders all of his projects, but as someone
said on the CCI BBS, Steve was destined to be a brain surgeon. The
underside of his boards really look like art. Most of us are not so
talented and soldering can become a great mess. Melting through
insulation, twisting, turning, burning! Eech. For my previous project
(the one that I built, but didn't work) I had called the CCI BBS and
asked about prototyping methods. The general consensus was to wire
wrap. So, I bought some tools and went ahead with it. The wire
wrapping part of my previous project was certainly a success. The
process is very easy to learn.
This year, I ordered some more wire and assorted materials
necessary to build the project. It was a hefty bill, but I paid some
and my parents paid some. I started building it, I think, in October
or November. In any case, I finished in a few weeks and was ready for
the initial test by December. Everything looked great, but I was
scared as hell to try the thing out. I soon got up the nerve to
program an EPROM with a simple program and plugged it into its socket.
I turned the power on with a rapid heart beat and relaxed. The damn
thing didn't even cough! It just sat there with the power on. No
smoking, no explosions, no LEDs going on, no words on the LCD. I was
disappointed, but did I really expect it to work? No, I really looked
at it as something that I couldn't possibly get to work. I mean...me
build a computer? Come on, a computer is a computer, not some lego set
or something like that. I gave it a few more tries and still nothing
happened. I checked my design and everything seemed okay. I checked
the wiring and everything seemed okay.
Okay. I decided to check the power rails. I took out my multi-
meter which I bought at Radio Shack on sale for $9.95. A multi-meter
is an instrument that can measure several electrical characteristics of
wires. The most basic multi-meter (what I had) can measure voltage and
resistance. I selected voltage mode and put the probes to my power
rails. Hey! I found something. The voltage read almost 0 which meant
that either my power supply was not functioning or there was a short.
I checked the power supply and it was fine, so there must be a short...
but where? I called the CCI BBS once again and asked for some help.
About two weeks later, I found the short with a technique that an
engineer had explained to me. Okay. I'm ready. Again I plugged in
the EPROM and again nothing happened. After a few more desperate
tries, I gave up. It was now the beginning of January. I decided to
stop work until February.
About two weeks later, I logged onto the CCI BBS as I always did
weekly and found a message waiting for me. It was from an engineer in
silicon valley who had started working with 8-bit MPUs when he too was
a sophomore in high school. I was then a Junior, but that's beside the
point. He gave me encouragement and some hints on how to find my
short. I wrote back thanking him for the encouragement but telling him
that I found my short and that the computer still didn't work. I was
confident of my design because of those I had seen in Steve's column
and in the new magazine Circuit Cellar INK. He soon replied with some
trouble-shooting techniques. The first one was a simple test to
determine if the MPU was actually executing instructions. It consisted
of a single jump command that keep jumping back to itself. I tried it
and it worked. This was amazing. For the first time, I actually had
some assurance that my design had some life in it. Knowing this, I
decided to scrap the fancy demo program I wrote and go for a simple LED
flasher. I wrote the program and burned it into an EPROM. But it
didn't work. This was very disappointing, but I didn't give up this
time, because the first test had worked.
After a few hours of playing around, I found the problem! Three
address lines were wired backwards to the address decoder chip. Time
for some background: most 8 bit microprocessors can address 64
kilobytes. This actually equals 65,536 bytes because there are 16
address lines. Since the computer does not consist of one big 64K RAM
or EPROM chip but rather several smaller (smaller in terms of the
number of bytes they occupy in the address space) peripherals, this
large address space must be divided. A common denominator is 8 8K
chunks of memory. The top three address lines (A15 through A13) are
connected to an address decoder which determines which memory block is
currently active according to these three address lines. Because we're
working with the binary number system, three binary digits can
represent 8 combinations. The decoder chip, in this case a 74LS138
decoder chip, activates one of eight enable signals depending on the
content of the three address signals that it receives. Now, how does
this represent a problem to me if the three lines are wired backwards?
Well let's take the example that I had. My LED flasher program needed
to address the 6821 PIA so that it could turn the LEDs on and off.
This PIA is connected to the second 8K memory block enable line coming
from the 74LS138 decoder. To select this second memory block, the MPU
had to place the digits 001 on the lines A15-A13. But if the three
address lines were wired backwards, the decoder would see 100 instead
of 001 and would select the wrong memory chunk. I discovered this
problem by monitoring the decoder's memory enable lines with a logic
probe. The logic probe simply tells me whether the signal line is high
(1) or low (0). For some strange reason, the second memory block was
never being accessed, but the fourth was. After some thought, I
realized that the binary number representation for 4 was the exact
opposite for that of 2. I ran upstairs to get my reference book and
sure enough, the decoder was getting the signals in reverse order.
I went back upstairs and fixed the problem. One very big
advantage of wire wrapping is that mistakes can easily be fixed. All I
did was unwrap the wire from the three signal lines and I rewrapped
them. It took about 5 minutes to do. I plugged the EPROM back into
its socket and poof! My LEDs were flashing! True, my complicated
computer didn't look like much more than a christmas tree, but I knew
that it was working. The LEDs were not flashing on their own: the MPU
was telling them to flash. Now this was a victory!
Once I got to this point, things started falling into place.
Within a week and a half I got everything working perfectly. Sure,
there were troubles but I got them resolved. The only modification I
still have to make is an enable circuit for my expansion bus. I forgot
to design one in and because of that the bus cannot be used. But
that's okay for now because I am not yet building peripheral cards for
my computer. I am now working on a terminal program that will enable
me to download programs to the computer's RAM from my communications
program on my IBM clone. It should be working within a week.
Some miscellaneous problems that I encountered and fixed include:
two signals on the serial port were wired backwards, one wire on my LCD
was broken, the expansion bus mystery mentioned above, some pull-down
resistors that should have originally been pull-up resistors and
connecting the LEDs to the other I/O port instead of the one it was
originally connected to. It was like unravelling a mystery plot,
almost every day after I got the LEDs flashing, something new fell into
place and started working. From here on in, its just a matter of
software. The hardware is all done (whew!) and now I just have to deal
with it from the programmer's point of view.
The programming isn't bad, but now and then you get a little bug
that drives you crazy until its found and eliminated. The entire
project was and continues to be a great learning experience and usually
alot of fun. Maybe one day, you'll see my name on a super computer?!
Who knows. I got the baby purring and from here the sky's the limit.
My next project is going to be a faster computer with a monitor, full
keyboard and disk drives. I probably won't get it right on the first
power up, but now that I know my computer works, every other problem
will be a minor inconvenience!
X-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-X
Another file downloaded from: NIRVANAnet(tm)
& the Temple of the Screaming Electron Jeff Hunter 510-935-5845
Rat Head Ratsnatcher 510-524-3649
Burn This Flag Zardoz 408-363-9766
realitycheck Poindexter Fortran 415-567-7043
Lies Unlimited Mick Freen 415-583-4102
Specializing in conversations, obscure information, high explosives,
arcane knowledge, political extremism, diversive sexuality,
insane speculation, and wild rumours. ALL-TEXT BBS SYSTEMS.
Full access for first-time callers. We don't want to know who you are,
where you live, or what your phone number is. We are not Big Brother.
"Raw Data for Raw Nerves"
X-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-X

The views and opinions stated within this web page are those of the
author or authors which wrote them and may not reflect the views and
opinions of the ISP or account user which hosts the web page. The
opinions may or may not be those of the Chairman of The Skeptic Tank.