I bought a Papilio FPGA (well both the One and the Pro) with the intention of improving my RTL skills. I was already aware of Hoglets Atom emulator on the Papilio, and I was able to get this working. I later modifed the code to add the ability to read some of my old tapes (at least to allow *CAT in order to see what was there). I posted about it but have yet to make audio recordings. Encouraged I went through my junk box and found all the necessary ICs to make an Atom, with the exception of the MC6847P video chip. My intention was to put together a real Atom. Anyway I changed my mind quite regularly as to what the project would be. I liked the idea of a 6502 with 64k byte SRAM which would be connected to an Arduino, where the Arduino would access the SRAM and "load" the ROMs. The video was still an issue. Annoyingly the 6502 doesn't have a tristate enable pin, which would mean wiring up more ICs (yuk!). Seaching on Ebay I found a seller of the Western Digital version of the 6502. It was CMOS, ran on either 5V or 3.3V, and had a tristate enable pin (BE). Finally I made up my mind as to what the "Atom" would be.
I started by writing my own Verilog code to emulate the text display of the 6847. I added a switch to double the number of vertical lines and horizontal characters. I used a cheap Chinese Ebay board, based on the Cyclone IV, because it integrated the VGA connector. Unfortunately the expansion port was shared with the VGA and other functions. So I ported the code to the Papilio One. I had a VGA "wing" which plugs into the connectors (see picture). It was pretty simple to port the code. I then wired up the W65C02 to the papilio connectors. Since the Papilio is 3.3V, the W65C02 is compatible. I was going to wire up a 64K byte 3.3V CMOS RAM, but decided to use the FPGA RAM and implement a minimal Atom.
The Papilio FPGA can speak via USB to the PC using the FDTI chip. For debug purposes I implemented a scheme whereby for every access the RDY was asserted, the address, data and status pins (SYNC and RWB) were read (like a logic analyser) and output serially in ASCII for display using Tera Term. Once the serial data was transmitted, RDY was de-asserted to allow the next access. Of course the system runs really slow as a result, nevertheless I was able to use the captured full boot trace and compare it against a disassembly of the Atom system ROM. The stupid mistake I made, was that I didn't give the RAMs a chip enable, and so any write to any address wrote to all RAMs. I found this out when I saw the screen being cleared (writing to many locations) which I eventually figured out that it overwrote the stack in page 01. That was easily fixed. The video display still doesn't have a chip select, so displays a sort of memory map of writes. I have recorded a video and will try to upload it to YouTube and post the link. Due to the serial I/O you can see the screen being cleared and the "ACORN ATOM" being printed, while seeing stack activity at the bottom of the screen.
I will post more as the project progresses. Currently I have run out of pins on the Papilio. I have a keyboard from some old VDU with the keys based on a 8 by 8 grid, sort of like the Atoms keyboard grid. I intend to hook this up to the FPGA to implement the keyboard scan code. I will have to move to a new FPGA, and found a cheap Chinese knock-off of the Mojo FPGA board (it only cost £40), which uses the more powerful Spartan 6 FPGA. The important thing is that it has lots of I/O. It also has serial I/O so I get to keep my trace debug code (which later will allow the range to be programmed, allowing full speed except when debugging).
Example trace. First two reads are the reset vector. "i" means instrucion fetch, "w" indicates a write. Follow the code and you find a lot of unnecessary reads (I believe a well know feature of the 6502).
Code: Select all
FFFC 3F FFFD FF i FF3F A2 FF40 17 i FF41 BD FF42 9A FF43 FF FFB1 C2 i FF44 9D FF45 04 FF46 02 021B 00 w 021B C2 i FF47 CA FF48 10 i FF48 10 FF49 F7 FF4A 9A i FF41 BD FF42 9A FF43 FF FFB0 78 i FF44 9D FF45 04 FF46 02 021A 00 w 021A 78 i FF47 CA FF48 10 i FF48 10 FF49 F7 FF4A 9A ...etc...