Hi,
we've been trying to connect a F18A (FPGA replacement of the TMS9918) to a 1MHz 6502 Apple 1 clone board. All the chip select signals (/CSW and /CSR) have been "phi2-qualified" but we still have troubles writing to the video chip.
After some troubleshooting (which included reading lot of posts on this forum
), we think we have identified the issue, namely the FPGA being too quick to read the data during the 6502 write cycle. There is a small delay ("tMDS" in the 6502 data sheet) after the rising edge of phi2 when the address is ready but the data is not. So we think the FPGA is sampling the bus too early.
Indeed if we repeat
Code:
sta $C000 ; memory mapped address of the F18A
the VRAM in the F18A doesn't get the accumulator's value, but $C0 gets written instead, which is the value that is present on the data bus just before the data byte because of opcode fetching of "sta $c000" ($C0 is the high byte of $C000).
We then tried to delay the phi2 signal (by adding chain of gates or by RC circuit), making some values being written but still all is very unreliable.
So my questions are:
1) why does the 6502 sets the R/W signal BEFORE the data is ready?
2) what is the "standard" way to write to a fast and asynchronous peripheral like the F18A? is some extra circuitry needed?
Any suggestion is appreciated as we are stuck on this project, thanks!