So you've decided to build a 6502 computer—or maybe you're still deciding. You've been looking at the 6502 instruction set and some other materials on it. Go ahead and build. You'll enjoy it and learn a lot. My own first creation (in 1985), although it worked, was a lot of work to build, and was not very useful, but it was the beginning of learning what would be easier and more useful. This set of articles will give you helps and shortcuts I didn't have back then.
On the 6502.org forum, billylegota said, "I love the 6502 for its simplicity. It is probably the best microprocessor for beginners who want to be able to build their own microcomputer and understand how the entire thing works;" and further down, Ed replied, "I second this - and it's more or the less the reason most of us are here." commodorejohn added, "The 6502 is the most comfortable, usable minimalistic design I've ever encountered - just enough features and functionality to do pretty much anything you need, and simple enough that it's easy to learn how to put the individual puzzle pieces together to accomplish what you want. Plus, being as cycle-efficient as it is certainly doesn't hurt."
The 6502 has several attractions over other processors:
Among the reasons companies find it attractive for new embedded controller designs are the small number of gates, small licensing fee, and according to Windbond, easy development. As a result, the 6502 is being made today in huge volumes (over a hundred million units per year). They're rather invisible though, controlling processes in automotive, industrial, toy, appliance, and even life-support equipment, inside custom ICs.
The podcast here is an Aug 2015 interview with Bill Mensch, pres. of WDC who holds the IP for the 65c02 and 65816, regarding these processors and comparing them to ARM, 68000, x86, 6800, 6501, etc., and his business model and his goals. He plans to keep the 6502 available "forever." He obviously has a very clear vision, and he is accomplishing what he wants. Still. Today. In the March 2015 podcast interview with WDC's David Cramer, WDC's VP of business development, he says there are hundreds of different products being made today with 65xx processors in them.
See also Embedded Advisor magazine's Nov 2017 issue's article about Western Design Center starting on page 10, and the subsequent article starting on page 14 that ranks WDC in the top 20 IP and design solution providers. Bill Mensch is on the cover.
Nostalgia might be a reason for some to use the 6502; but for me it's not. Even 30 years ago however a Z80 had to run at 4MHz to keep up with a 1MHz 6502; and Jack Crenshaw, an embedded-systems engineer who wrote regularly in Embedded Systems Programming magazine said in the 9/98 issue that he still couldn't figure out why, in BASIC benchmark after benchmark, the 6502 could outperform the Z80 which had more and bigger registers, a seemingly more powerful instruction set, and ran at higher clock rates. (The 6502's zero page and improved indexed and indirect addressing modes no doubt helped.)
On the forum, sark02 said, "My next computer was an Atari 800XL. [...] Coming from the Z80 I was initially dumbfounded by the criminal lack of registers, but BY GOD was it FAST! I spent hundreds of hours and wrote 1000s of lines of 6502 code over the following couple of years, diving deeper into the 800XL hardware and capabilities, and really came to enjoy the 6502." (See also this post.)
Sophie Wilson, chief architect of the ARM processor, said, "an 8MHz 32016 was completely trounced in performance terms by a 4MHz 6502." (The 32016 was National's 32-bit processor, having 15 registers, including 8 general-purpose 32-bit registers, and a 16-bit external data bus.)
The 65816 even outperformed the 68000 and 8086 in the Sieve of Eratosthenes benchmark.
Since that time, the 6502's clock speed has increased by an order of magnitude (actually the fastest ones run over 200MHz; the ones available to the hobbyist are generally considered to be limited to about 20MHz, but 6502.org forum member "Plasmo" got one running at 40MHz @ 5.3V) and the instruction set has improved (especially on the 65816). Assemblers and compilers have improved, making software development and maintenance easier.
6502 forum posts as well as projects and other things posted on the web showed the need for a 6502 primer, mostly for hardware. We won't totally ignore software here, but there are already a lot of resources available for getting started in 6502 software. I can't pass up the opportunity to recommend the excellent programming manual, "Programming the 65816 including the 6502, 65C02, and 65802" by David Eyes and Ron Lichty. This is a .pdf file of a rather large book that is well laid out and is much better than the description there lets on. Note: There were many problems with the earlier .pdf version that were not in the original paper manual; but in late March 2015, WDC scanned and OCR'ed the paper manual and posted the new, repaired .pdf.
"So why not use a microcontroller like Microchip PIC instead?" you might ask. Microcontrollers (µCs) are great for tiny jobs where you develop the code once and it stays in the µC's read-only memory rather permanently. A small µC like a PIC16 however does not have much RAM, which prevents large data arrays, and neither can it run programs from RAM, or compile or assemble code and program the result into its own limited ROM, let alone with instant turn-around, let alone while doing something else at the same time. I've designed PICs into many commercial products, but it is out of the question for a workbench computer that may be doing a different job every day and where I want faster code development. It has too many limitations.
And comparing 6502 programming to PIC programming, someone on the forum said, "65x02 is wonderful. Programming 65x02 feels like vacation; you cannot get tired doing that. It is natural, logical, it doesn't give you a headache." The microcontroller has its place; but it is usually not a full computer. New forum member "ThisWayUp" wrote about his 6502 experience, "I am definitely getting a crash course in how the real hardware works. I feel like I've learned more about how computers and electronics in general work in the last month than I ever did messing around with Arduino or tinkering in Python or C++."
In 2021 I had to re-develop something to work on a PIC16 after I had done it a couple of years earlier on my workbench computer with the 65c02. Even though I had the previous work to go on, doing it again for the PIC16 was much, much harder.
"Or why not use one of the hobbyist boards on the market that already have everything done for you?" you might ask. There are many, and although they have their place, many will have the same limitations mentioned above for the microcontrollers. Others, with all their gee-whiz features (USB, Bluetooth, VGA, multitasking OS, etc.), add software layers to insulate you from the heart of the machine. These are supposedly to make it easier; but you won't be learning the innards or have complete control of every I/O bit with microsecond resolution like you will want for various industrial, workbench, or hobby applications. Our schools' "computer education" is guilty of this too; so my big concern is, "Where are our engineers going to come from in 20 years when the current crop is retired?" "enso" on the 6502.org forum has a great post about the value in a system where you can truly understand and control its hardware, its software, and its updates, here. "cr1901" on the forum wrote, "creating a 65xx computer can give someone a fundamental look at how CPUs get their information to and from the outside world, and that it does not require 500+MHz to do useful work, such as a text editor, I/O device manipulation, and basic math calculations/text manipulation."
For any new projects, let me recommend the CMOS version (65c02), not the old original NMOS version. It's not just about
power consumption. The CMOS version fixed all the bugs of the NMOS one, added a few nice hardware features, added more instructions
and addressing modes, and is available in much higher speeds. I have a comparison here.
Expectations and nonExpectations
This primer is to give a good grasp of computer design basics, so that with good construction, you can make a computer that works on first try, with no hardware troubleshooting. (There are troubleshooting helps in case it doesn't though.)
Intended for newcomers to the 6502 and hobbyists building their own computers, this primer is rather rudimentary, but assumes that the reader is acquainted with a few things like
If you're totally new to digital electronics, the book "Understanding Digital Electronics" by Gene McWhorter appears to be a good a intro. It's old; but most of these basics still apply—it's just that in modern digital electronics, these same building blocks have gotten a lot denser and faster.
If you're totally new to electronics in general, the book "Understanding Solid State Electronics" from the Texas Instruments Learning Center is a good introduction, simple, with almost no math. It includes some digital, but not like the "Understanding Digital Electronics" book above.
A book I read decades ago that seemed quite good is Adam Osborne's "An Introduction to Microcomputers, Volume 1, Basic Concepts." I have the 2nd Edition on paper, ©Nov 1980, ISBN 0-931988-34-9.
These books used to be available for free download, but they've been removed; so watch for them on eBay or Amazon.
Negative logic is marked by a bar over the signal name like CS, or, in the case of writing text, commonly an asterisk or a back slash following the name, like CS* or CS\ for "chip select not", meaning the chip is selected to read from or write to when this line is at a low voltage, not high. WDC's data sheets use a "B" (for "bar") after the signal name to mean negative logic, as in NMIB in place of NMI. This came from the fact that the equipment they used to write the first data sheets decades ago did not provide for the overbar possibility.
There are loads of things we won't get into here, as they are not necessary for basic computer design and construction, including, but not limited to:
There's very little about video here but you can find a lot of material about video on the
Next--> address decoding
last updated Nov 19, 2022