Atom Cyborg Project

discussion of games, software, hardware & emulators relating to the Acorn Atom
Post Reply
acory
Posts: 20
Joined: Thu Feb 26, 2015 9:47 pm
Location: Cambridge, England
Contact:

Atom Cyborg Project

Post by acory » Tue Apr 24, 2018 10:39 pm

I posted in a Papilio FPGA forum a question concerning an Atom project I am working on. Dave (hoglet) suggested that I should post some details in this forum...

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.
Atom Cyborg 6502 + FPGA.JPG
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).

--Gary

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...
  

User avatar
Elminster
Posts: 2323
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: Atom Cyborg Project

Post by Elminster » Wed Apr 25, 2018 8:50 am

Good project, I have start similar thing severals time but never get very far, too many distraction and other stuff to look at.

Very interested in any project that may rekindle my fire and take projects back to the top of my todo list :)

Kep the reports coming.

User avatar
hoglet
Posts: 7216
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Atom Cyborg Project

Post by hoglet » Wed Apr 25, 2018 9:25 am

A very interesting project Acory.

For debugging, you might want to take a look at the "6502 decoder" project we have been developing.

This minimally just needs the value of the 6502 data bus in each clock cycle, and you get a trace like this:

Code: Select all

cut -c8-9 acory.log | xxd -r -p | ./decode6502 --byte --vecrst=ff3f -s
???? : RESET !!       : A=?? X=?? Y=?? SP=?? N=? V=? D=? I=1 Z=? C=?
FF3F : LDX #17        : A=?? X=17 Y=?? SP=?? N=0 V=? D=? I=1 Z=0 C=?
FF41 : LDA FF9A,X     : A=C2 X=17 Y=?? SP=?? N=1 V=? D=? I=1 Z=0 C=?
FF44 : STA 0204,X     : A=C2 X=17 Y=?? SP=?? N=1 V=? D=? I=1 Z=0 C=?
FF47 : DEX            : A=C2 X=16 Y=?? SP=?? N=0 V=? D=? I=1 Z=0 C=?
FF48 : BPL FF41       : A=C2 X=16 Y=?? SP=?? N=0 V=? D=? I=1 Z=0 C=?
FF41 : LDA FF9A,X     : A=78 X=16 Y=?? SP=?? N=0 V=? D=? I=1 Z=0 C=?
FF44 : STA 0204,X     : A=78 X=16 Y=?? SP=?? N=0 V=? D=? I=1 Z=0 C=?
FF47 : DEX            : A=78 X=15 Y=?? SP=?? N=0 V=? D=? I=1 Z=0 C=?
The above was generated directly from your log file.

Alternatively, with a cheap (<£20) 16-bit logic analyzer you can capture in real time.

You can find the code in github:
https://github.com/hoglet67/6502Decoder

Dave

acory
Posts: 20
Joined: Thu Feb 26, 2015 9:47 pm
Location: Cambridge, England
Contact:

Re: Atom Cyborg Project

Post by acory » Wed May 09, 2018 11:37 pm

Just a very quick request. The project is progressing and I will post an update very soon. I need a copy of the SYSTEM and BASIC ROMs. I took a copy of the SYSTEM ROM from hoglets VHDL code, and re-jigged the hex values into the Xilinx COE format. After some debugging, and thanks to the built in trace, I found that the code jumped to E000 due to a patch, presumably to the special ROM to support the MMC card. I was able to re-patch the ROM to get into BASIC. Currently I am having problems with key mapping and I wondered if hoglets ROM might have other patches. I have googled, found a ZIP of ROMs, but it didn't appear to contain the SYSTEM ROM. If anyone can help, that would be most appreciated.

--Gary

User avatar
hoglet
Posts: 7216
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Atom Cyborg Project

Post by hoglet » Thu May 10, 2018 5:47 am

acory wrote:Just a very quick request. The project is progressing and I will post an update very soon. I need a copy of the SYSTEM and BASIC ROMs. I took a copy of the SYSTEM ROM from hoglets VHDL code, and re-jigged the hex values into the Xilinx COE format. After some debugging, and thanks to the built in trace, I found that the code jumped to E000 due to a patch, presumably to the special ROM to support the MMC card. I was able to re-patch the ROM to get into BASIC. Currently I am having problems with key mapping and I wondered if hoglets ROM might have other patches. I have googled, found a ZIP of ROMs, but it didn't appear to contain the SYSTEM ROM. If anyone can help, that would be most appreciated.
Take a look at this thread: Acorn System ROMS

And also Jonathan's site: http://mdfs.net/System/ROMs/AcornMOS/System/

Post Reply