Dr Jefyll wrote:
If I understand you, the LCD
is being read, even though the action is unintended and the data it places on its data bus pins is ignored. And, a read alters the state of the device (by incrementing the counter). This makes your LCD different from most I/O registers (and from memory), which can tolerate unplanned reads and suffer no effect. The LCD is a
read sensitive device, and unwanted aka spurious reads are sometimes called destructive reads.
Genuine 65xx CPU's do in some cases generate spurious reads that can affect read sensitive devices, although newer chips such as the the CMOS version (65C02) and the 65C816 have features that help reduce the problem. For example, on the 'C02, unplanned read cycles of the addressed device are in almost all cases replaced by reads of some other location which can safely be assumed
not to be read sensitive. The address held in PC is an example of this.
In a moment I'll link to further information.
Precisely that
. I thought about changing the microcode so after reading or writing it would clear the High address register (so spurious reads would land in RAM), but certain instructions store the data straight into that same register, so that wouldn't work.
Or I could bring out separate Read and Write lines (which I have available), but it would no longer be a 6502 (As if it was one now...)
Other solutions that I can think of are putting some buffers or latches after the address registers so they go to 0 when not reading or writing. But I have no space left for that on the corresponding card.
Or even gating PHI2 so it remains high unless reading or writing...
Driving the LCD with a 6522 VIA would work as well. (I have some fake ones laying around, not sure if I want to even know if they work)
A quick and dirty solution is gating the enable pin of the LCD with the inverse of the R/W line. That way the LCD can only be written to (may limit certain functionality, mainly reading the "busy" flag, so I would have to use some sort of delay loop to meet timing requirements at higher clock speeds), but there are no spurious reads to worry about. (I've tried it and it works).
Attached is a screenshot from a logic analyzer just to clarify. A0 is a register select for the LCD. Four pulses can be seen on the enable line (output from the address decoder anded with PHI2) Writes are performed on the second falling edge.
Just some thoughts.
Juan