Your Guide To Building A Homebrew 6502 Computer

If you’ve ever thought about getting down to bare metal and building a homebrew computer from scratch [Garth Wilson] put up a great primer to the 6502, the same CPU found in Apple ][ computers, BBC Micros, Vic-20s, and the venerable Commodore 64 (a 6510 in the C64, but it’s close enough).

In his guide to building a 6502 computer, [Garth] goes over all the basics – what you want the computer to do, how to decode addresses, and other important technical requirements for getting a homebrew project running.

If that’s not enough, [Garth] directs his readers to the fabulous 6502.org forums  where just about every topic is discussed. The guys on the forum have a standardized I2C pinout for the 6502, allowing noobs to easily connect pre-designed keyboards, displays, and storage devices to their projects. There are a ton of tutorials on the 6502.org site, more than enough to get a homebrew project off the ground.

If you’d like to see what you can do with a homebrew 6502, check out the homebrew projects page featuring a 6502 Nixie clock and CLPD-based 65816 single board computer. There’s a treasure trove of information here, just waiting to be pulled from the vine.

22 thoughts on “Your Guide To Building A Homebrew 6502 Computer

  1. “anything you could do with a 6502 could be done better with a 6809” — as long as it’ll fit in 64K and you don’t mind 1980s clock rates. I like the 6809, but among other perks the 65c816 (latest-gen 6502) features a linear, 16MB address space. The Programming Model is a major step up from the 6502 — with a full 16-bit ALU for starters, and you can do 6809-ish tricks such as indexing into the stack to reference an indirect pointer to an operand in memory. Best of all there’s current production silicon available (65c02 and 65c816) which is *conservatively* rated at 14 MHz.

    1. He didn’t say the 6809 is better than the 65816. I might as well say a 64-bit CPU is better than the 6809. Comparing an 8-bit 6809 to a 16-bit 65816 is apples and oranges. The 6809 is the best 8-bit CPU.

  2. If the 6502/6809 architecture isn’t your cup of tea (or, you like to build many different types), there is the Build Your Own Z80 Computer.

    I haven’t actually ever built my own computer, but I think I might start with the Z80. It has been a couple of decades since I even looked at the different types of computer architectures. (My first introduction to computers was the AN/UYK-7 (yuck seven) in the US Navy. Those things were WIERD, and the moniker is very apt.) I don’t have any real reason to choose the Z80, but I think I would like to at least play around with a couple different architectoures before building my very own computer. Does anyone have any advice in choosing an architecture?

    1. Dabble in as many of them as possible, and then realize there’s only so many ways to AND, OR, NOT, and jump on carry.

      It just depends on what you grew up on, really. This includes not just the CPU architecture, but memory, graphics, sound, storage (mmm, cassettes!), I/O, and ROM monitors/OSen.

      Anyone happen to know where I might get hardware or technical/schematic information on a NCR 8100 minicomputer? This was my first machine and I’d love to get one working again, or build a replica.

    2. Thanks so much for reminding me :) ….. I did a fair amount of programming on the AN/UYK-7 for use in subs back in the day at the Naval Underwater Systems Center in R.I. We used to tell noobies to be careful not to accidentally have the “prince valiant” instruction show up in your code. The instruction was a security feature that would send the AN/UYK-7 into meltdown mode in case you were in danger of the vessel being seized by hostile combatants.

  3. Remember kids, anything you could do with a 6502 could be done better with a 6809 ;-)

    couldn’t prove it by me. My MPU of choice is the much more versatile 65C816. No way the 6809 is going to compete with the ‘816 at any level.

    1. Is it really fair to compare the 8-bit 6809 (1977) to the 16-bit 65816 (1984)? If you think it is, then it is fair to say any 32-bit or 64-bit CPU beats the 65816.

      The 6809 is the best 8-bit CPU.

  4. There is another page added to the primer, the circuit potpourri page, at http://wilsonminesco.com/6502primer/potpourri.html, with a lot of interfacing ideas, including shift registers to expand I/O almost infinitely for things that don’t need the greatest speed, interfacting with higher-voltage (e.g., 12V) logic and relay coils, I2C, keypads & keyboards, displays, printers, A/D & D/A converters, digital pots, and there’s more coming. Next will probably be SPI, using standard I/O ICs to produce high voltages for biasing MOSFETs for controlling things far outside the 5V range, and power-supply circuits. Several of the circuits have accompanying example code. If it’s more than a few lines, there are links to separate files for the code.

    A couple more major features have been added to the site since the 6502 primer was posted. One is: Large look-up tables for hyperfast, accurate 16-Bit scaled-integer math, including trig & log functions. You can probably implement them even if your computer is already built up, the address space is full, and your I/O is almost all taken. See how. It’s at http://wilsonminesco.com/16bitMathTables/index.html. The other is on program structures in 65c02 assembly, through macros, enabling you to more quickly write clearer, more bug-free and maintainable code and get rid of most of the labels, in most cases with absolutely zero penalty in memory usage or execution speed. It’s at http://wilsonminesco.com/StructureMacros/index.html. I should be adding more to the looping controls there soon. The next major feature will probably be a primer on stacks (plural, ie, not just the native hardware stack and the non-obvious things that can be done with it, but also auxiliary stacks), again with a focus on 65c02– so stay tuned.

    1. The 6502 stacks treatise mentioned above was posted in 2015, at http://wilsonminesco.com/stacks/ . Also added since the above post are an article on simple methods for multitasking without a multitasking OS,
      for systems that lack the resources to implement a multitasking OS, or where hard realtime requirements would rule one out anyway, at http://wilsonminesco.com/multitask/, and one on the many differences between the NMOS 6502 and the CMOS 65c02, at http://wilsonminesco.com/NMOS-CMOSdif/, and one on the relevance of assembly language today (particularly for small processors like the 6502), at http://wilsonminesco.com/AssyDefense/ . I add things to the site every few days. Most additions are minor, as I am taking some time off from writing to work on hardware; but I have a few more major features in mind to add in the future, including one on self-modifying code. I think there’s a substantial amount of extra computing power available there which most of us have not been taking advantage of. If you have things you would like to see make it into that one, please email them to me, at wilsonmines@dslextreme.com . I will give you credit.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.