phvic wrote:
I think the design could be somewhat simplified. At least the BE pin of a WDC 6502 would help in getting rid of the two buffer chips on the address lines.
Nice! Did you see my project at
http://www.propeddle.com? It uses some of the same ideas as you had, but uses a Parallax Propeller to bitbang the 6502. I have some buffers in my project, but those are used to multiplex the address bus to the Propeller (I used other pins to generate video and connect to a PS/2 keyboard so I multiplex 16 pins between data bus, address bus and signals such as !NMI/!IRQ/RDY/!SO). I think for your design you could get rid of the buffers if you are willing to do some programming on the microcontroller to let the 6502 provide addresses (i.e. on the microcontroller, the address bus is always an input).
In my design(*), the Propeller doesn't have direct control over the address bus, but it does control the enable-lines on the memory chip and it can take control of the data bus. If I want to use the RAM chip as ROM, all I need is to keep the !WE (Write-Enable-Not) line high on the RAM chip. If I want to simulate an I/O device, I keep both !WE and !RD (ReaD-Not) high. In other cases, the !WE and !RD lines are activated during the second half of the clock cycle, depending on the R/!W line from the 6502.
To download data from the Propeller into the RAM (or to read data back from the RAM into the Propeller), the Propeller generates an NMI, to which the 6502 answers by reading the NMI vector at $FFFA/$FFFB. Instead of enabling the RAM chip for those addresses, I let the Propeller put the two bytes of a memory area on the data bus. The 6502 jumps to that address and starts executing, so it starts by putting the first address on the data bus, in read mode. During the first half cycle of CLK0, the 6502 never uses the data bus, so the Propeller can switch its data bus pins to OUTPUT mode and put some data on there, and enable the Write-Enable line on the memory chip to store that data into memory at the current address bus location. Then the Propeller disables the !WE pin again, takes the memory data off the data bus, puts a dummy instruction (I think it's CMP immediate) on the data bus, and makes the clock high so the 6502 reads the dummy instruction and executes it. Then the Program Counter in the 6502 increases by one, and the whole cycle repeats itself for the next memory byte. This continues until the Propeller feeds an RTI instruction to the 6502, and the 6502 restores the flags and continues where it left off. No registers (except the flags) are modified during the fake interrupt, and the 6502 is none the wiser: it just thinks it executed a lot of identical instructions, and doesn't realize that those instructions came from the Propeller, not from memory. And because the Propeller holds !NMI low the entire time, it's impossible for another NMI from another source to interrupt the process. And you can use the same process to read data from memory too.
Maybe this gives you some good ideas
===Jac
(*) The idea to generate a fake interrupt and let the 6502 generate the addresses was originally by Dennis Ferron; I made some improvements, for example he used RESET and NOP. Others may also have thought about similar schemes so I don't think it's original in any way. Feel free to use it in your design, or not.