An Arduino Mega sketch that turns a $15 board into an EEPROM programmer, bus sniffer, and clock generator for a 6502 breadboard build. No commercial programmer, no logic analyzer — just a Mega wired straight onto the address bus, data bus, and control lines.
This started as a piece of the 6502 Breadboard Computer project and grew enough to deserve its own home. 🧠
Ben Eater's build uses a Nano with 74HC595 shift registers to get enough I/O. The Mega skips that entirely — 54 digital pins is enough to hook directly into the 16-bit address bus, 8-bit data bus, and control lines all at once. No bit-banging, no shifting data in and out, just wires.
The sketch boots into SNIFF mode and switches to PROG mode on command:
- SNIFF mode — watches the address/data bus and control lines while the 6502 runs, single-steps the clock, or resets the CPU
- PROG mode — takes over the bus to write, dump, or erase the AT28C256 EEPROM directly
Talk to it over the Serial Monitor at 115200 baud:
| Command | Does what |
|---|---|
mode sniff / mode prog |
Switch between sniffing the live bus and driving the EEPROM |
pulse N |
Single-step the clock N times (SNIFF mode) |
clock <hz> |
Free-run the clock at 1–1000 Hz, or clock 0 to stop (SNIFF mode) |
reset |
Run the 6502's reset sequence (SNIFF mode) |
wr <addr> <byte> |
Write a byte to the EEPROM (PROG mode) |
dump <base> [count] |
Read back bytes starting at an address (PROG mode) |
erase |
Page-erase the whole EEPROM (PROG mode) |
The block diagram in diagrams/ shows how the Mega's pins map onto the 6502's address bus (A0–A15), data bus (D0–D7), and control lines (clock, reset, R/W̅). Pin assignments live at the top of eeprom_programmer/EEPROM_PROGRAMMER.ino if you want to rewire it for your own layout.
eeprom_programmer/ — the Arduino sketch (plus a small fast digital I/O helper)
diagrams/ — wiring/block diagram
MIT. Use it, fork it, wire it up differently — see LICENSE.