More than four years ago I bought Ben's 6502 kit and built it on breadboards, like a lot of you. That kit grew into my own family of 6502 computers. In 2022 I drew and made the first boards for what is now the COB, a card-based backplane machine, and one of the first cards was the Memory Card.
I honestly can't remember why I drew the RAM's read and write strobes the way I did. It differs from Ben's circuit: I gated both with PHI2, so the RAM's /OE is RB, the NAND of RWB and PHI2. I probably thought it would be fine for both to be gated by the clock. What's the harm, right?
The harm was a hardware bug that sat quietly for four years. Everything worked, so the same gate went onto every main board I drew after that card. It only showed itself when the machines got bigger and the bus got busier.
The symptom
Recently I was bringing up a 1 MB flash cartridge on my single-board machine, the ACE. About one read in 10,000 came back wrong, so of course I blamed the cart. I reflowed it, cleaned it, gave it an ultrasonic bath, tapped on it and left it outside in the cold. The failure count swung with every power cycle, so each test looked like it meant something. None of them did.
At 2 MHz it got stranger. With no cart at all, both of my machines now and then read a 0 bit from RAM as a 1. A 74HCT00 in the gate made 2 MHz behave, and I thought I was done. The cart still failed.
The hero
This is where I need to thank Ben. I'm fairly certain the Hitachi HM62256 in my parts drawer came with my original kit. Swapped in for the Alliance AS6C62256 my boards use, it made the errors stop, every time, on both machines. Put the Alliance back and they returned. That old Hitachi, which lets go of the bus more slowly, became my reference part for the rest of the testing, and it kept pointing at the RAM, not the cart.
What was going on
The 65C02 latches the data bus as PHI2 falls and needs the byte held 10 ns after that. With /OE gated by PHI2, my RAM stopped driving one gate delay after PHI2 fell, plus however long the RAM takes to let go. No datasheet gives a minimum for either. The old Hitachi lets go slowly, so the byte survived; the modern Alliance lets go fast, and sometimes the CPU latched the bus after it was gone. (I never put a scope on it: the parts that cured it, and the fix, are the evidence.)
Anything that sped that release up made it worse: a faster batch of 74HC00, a heavier bus, 2 MHz, even the supply voltage. At 2 MHz, one board read clean at 5.00 V and failed thousands of times a run at 5.12 V. A 5 V supply is allowed to be 5.25 V.
The fix is one wire
The write strobe needs PHI2. The read doesn't, at least on my boards, where nothing else can drive the bus while PHI2 is low. The gate already makes an inverted RWB for the write strobe, so the RAM's /OE pin now takes that instead. The RAM keeps driving until the address changes, which the datasheets do guarantee: at least 20 ns, against the 10 ns the CPU needs.
With the RAM's /OE pin bent out of its socket and clipped to the new signal, the setup that gave 2,271 errors as built gave zero. It ran clean at 1 and 2 MHz, up to 5.24 V, and through about 20 million writes that were each followed at once by a read from RAM, the one case where the new wiring could cause trouble. It's drawn into the next revision of every board that had the old gate.
What about Ben's circuit?
I went back to Ben's schematic, and it has the same race through a different pin. His RAM's /OE is A14 and its /WE is the CPU's , so the clock goes into /CS instead: the NAND of the clock and NOT A15. That's there for a good reason, because a write must never happen while the clock is low, and Garth Wilson's 6502 primer does it the same way. But on a read it means the RAM is deselected one gate delay after the clock falls, and the datasheet gives only a maximum for how fast its outputs shut off. It plainly works for most people who have built Ben's circuit at 1 MHz on a breadboard. With a fast modern RAM, a heavier bus or a faster clock, though, the hold time isn't guaranteed, just as mine wasn't. And since his /WE isn't gated, it isn't a one-wire fix there. Does anyone know which 62256 the kit ships with these days? Mine had a Hitachi; if new kits ship a fast modern part like the Alliance, they have less margin than mine did.
The lesson
"It works on my bench" isn't the same as "it has margin." A design that relies on how slow one particular chip happens to be has a bug in it, even if it takes four years and a heavier bus to show. When a datasheet gives only a maximum for a delay, assume the minimum is zero. And keep an old slow part in your drawer! Mine saved me.
I hope this post saves others from the two weeks of troubleshooting I just went through! Thanks, Ben, for the kit, and for the RAM. :)