This chapter is hands-on hardware. You are going to build a working 6502 computer on a breadboard, wire it piece by piece, and watch it execute code you wrote. Before touching a chip, you need the right parts, a couple of tools, and two pieces of software installed on your machine.
Bill of materials
Everything below is widely available from online electronics retailers. The chips are in-stock commodities — if one supplier is out of stock, another will have it.
The core chips:
- 1× WDC W65C02S DIP-40 — the CPU. The W65C02S is the modern, CMOS version of the original 6502, still in production. Do not substitute with a NMOS 6502 from a recycled console; they behave differently under certain conditions and are not worth the hassle.
- 1× AT28C256 DIP-28 — the EEPROM (32KB). This is the ROM. The AT28C256 can be erased and reprogrammed electrically, so you can burn new code without an ultraviolet eraser.
- 1× 62256 DIP-28 — the SRAM (32KB). Any manufacturer works; the pinout is an industry standard.
- 1× 74HC00 DIP-14 — the quad NAND gate. This is the entire address decode logic. One chip, four gates, two of them used.
The support components:
- 1× 1 MHz DIP-4 crystal oscillator module — the clock. It looks like a small metal can with four pins. Do not substitute with a raw crystal and a 555 timer; the oscillator module is self-contained and far more reliable.
- 1× 10kΩ resistor — pull-up for the reset line.
- Several 1kΩ resistors — LED current limiters. Eight minimum.
- 1× 10µF electrolytic capacitor — the reset timing circuit. Buy the polarised version; polarity matters here.
- Several 100nF (0.1µF) ceramic capacitors — one per IC for power decoupling. Buy ten; you will use them everywhere.
- 8× LEDs — any colour, any forward voltage around 2V. These go on the address lines for verification.
The platform:
- 3× half-size breadboards — one for the CPU and support circuitry, one for the ROM and RAM, one for the decode logic and LEDs. Solderless, 400-tie or larger.
- 1× jumper wire kit — mixed lengths, male-to-male. A kit with solid-core pre-cut wires works better than stranded leads on a breadboard; they seat firmly and do not pull out when touched.
- 1× 5V power supply — a phone charger plus a USB breakout board with screw terminals is the cheapest option. A bench supply with a current limit is safer: set the limit to 200mA and any wiring mistake will fold the supply rather than cook a chip.
The programmer:
- 1× TL866II Plus EEPROM programmer — widely available online.
This is what burns your assembled binary onto the AT28C256. The
TL866II Plus works on Linux with
minipro.
Tools
You need a multimeter — this is non-negotiable. Every voltage measurement in the verification steps assumes you have one. An inexpensive basic unit is sufficient.
A logic probe is helpful but not required. It lights green for high, red for low, and can detect pulses too fast for a multimeter to track. Useful for confirming the clock is running before adding more chips.
Installing vasm
vasm is the assembler for the test programs. There is no apt
package; you build it from source. The archive is small and the
build takes seconds:
cd ~
wget https://sun.hasenbraten.de/vasm/release/vasm.tar.gz
tar -xzf vasm.tar.gz
cd vasm
make CPU=6502 SYNTAX=oldstyle
sudo cp vasm6502_oldstyle /usr/local/bin/Verify the install:
vasm6502_oldstyle --versionIt should print a version line. If the command is not found, check
that /usr/local/bin is in your PATH.
Working directory
Create a directory for this chapter's work:
mkdir ~/f03b-practice
cd ~/f03b-practiceAll assembly sources and binaries in the following pages live here.
Installing minipro
minipro is the open-source CLI for the TL866II Plus programmer.
Install it from the apt repository:
sudo apt install miniproPlug in your TL866II Plus over USB before running any minipro
command. On first use, Linux may require a udev rule to grant
non-root access to the USB device; the minipro package on Debian
and Ubuntu installs this rule automatically.
The TL866II Plus reads and writes the AT28C256 in about ten seconds. You will use it to burn each new version of the test ROM as the circuit grows.