This microprocessor only wants one thing and it's 0xEA


A couple of weeks ago I had a idea of running a 6502 directly off the pins of the Dazzler's FPGA. The Dazzler has 27 completely uncommitted IOs, so it should be straightforward to run the 8-bit microprocessor as a "brain in a vat" -- the CPU is real but the rest of the system is being simulated by the FPGA. Hookup is very straightforward -- 27 signals from the 65C02 go straight into the FPGA.
The boards came back about a week later. There's a socket for the Dazzler, and a socket for the 65C02.  UART and power connections are on the left.
Here's everything plugged in: power, Sparkfun UART, Dazzler, HDMI cable and finally the 65C02. All is ready!


But what to run as a first test? Surely I don't have to write a 6502 program, write the RAM simulator, and debug it? Of course not - this article explains that if you place 0xEA on the 6502's data bus, it will handily loop forever around memory. It's quite simple. 0xEA is the opcode for NOP, so CPU sees all of memory filled with NOP instructions. It cycles around all of its 64 Kbyte address space executing the NOPs. When the program counter reaches address 0xFFFF, it wraps around to 0x0000 ... infinite loop.

What does all this look like? It was the work of a few minutes to hack up a waveform display on the Dazzler itself, showing all the connected 6502 signals:


This is the first few clocks after reset. First the 6502 fetches the boot address from addresses 0xFFFC and 0xFFFD. This 16-bit address is 0xEAEA, of course, so it jumps to address 0xEAEA and finds... opcode 0xEA (NOP). That takes two clocks to execute, and the address bus increments to 0xEAEB. And so on. You can see the address bus starting to increment at the bottom-right of the screen, once every two clocks because NOP is a 2-cycle instruction on the 6502.

That's a good start -- looks like the 65C02 is happily executing code. The next step is to hook up a small RAM with a tiny program. More on this in coming weeks, subscribe to follow the progress.

Thanks for reading. Dazzler is coming into its last week on Crowd Supply. Thanks very much if you already backed it.