I was pretty ignorant about the 6502, so I started to study this microprocessor a bit, with the (great) help of 6502.org, and I was amazed by its simplicity and efficiency, so my future system will use a 6502 instead of a Z80.
I got interested in two pieces of software :
- Lee Davison's EhBasic, a free Basic interpreter for the 6502. It could be a nice feature of my future system :) Forth might come later...
- Michal Kowalski's 6502 simulator, a very nice IDE for 6502 assembly language development. Very good, and EhBasic provided a startup source code for use with this simulator.
It became obvious that a 16-bytes ROM couldn't be used anymore, so I started to connect an EEPROM to the FPGA. I had a 5V parallel EEPROM large enough for this purpose, that I connected to the FPGA I/Os using a 74AHC245 on the data bus to protect the FPGA. But then I encountered many issues : even if my first attempts (a simple ROM reader) seemed OK, I didn't manage to get reliable results from it.
Struggling with this EEPROM was quite boring. Maybe its data were incorrect, but I had no easy way to check them, as my EEPROM programmer is unable to read what it has written. The 74AHC245 is 5V tolerant, with a 3.3V supply, but it isn't a true level converter. Even if according to the datasheets, everything seems OK (the 3.3V FPGA outputs should be able to control the address bus), the results were awful.
So I went to the conclusion that in order to have something reliable, I should either get a 3.3V EEPROM or a real level transciever, and get a real EEPROM programmer (able to program 3V EEPROMs), but I was disappointed because all this stuff would cost some money (especially the programmer)... Another issue is the programming/placing/testing/removing EEPROM chip cycle that is quite painful. The EEPROM programmer is slow as hell, and placing/removing chip is quite boring, even with a ZIF socket.
Then I had a better idea ! I remembered that I had some USB FIFOs chips, so another solution was to design a bootstrap sequence that would download the contents of the "EEPROM" through USB, and write it to RAM (RAM protection being ensured by the design).
So I wrote the design, and a piece of software for this purpose, and it worked ! ROM contents is now downloaded in a few seconds, and I have been able to check that the startup sequence of EhBasic executed well. Good. I used the same startup code that the one used within the 6502 emulator and adapted my design to its architecture (it simulates an ACIA for I/O purposes). Then I had another idea : instead of designing a RS232 interface to communicate with the Basic interpreter, I will use the USB FIFO for this purpose.
Next step : have EhBasic fully up and running, then start to design some video chip for instance.
I already have some ideas about it, but let's focus on the Basic before :)