I created a circuit that attaches to the GPIO/I2C bus of my Raspberry Pi that probes the bus of the 65816, making sure to switch bus direction between PHI2 low and PHI2 high. There IS bus contention in my circuit for a short period when the bus switches from read data back to write bank, but so far I haven't had any issues doing probing with my setup.
Control signals PHI2, RDY, RWB, VDA, VPA, and RESB are attached to the Raspberry Pi GPIO port.
The bank/data bus is connected to
PCF8574 I2C I/O expander. It has push-pull output (whatever that means), and output is as simple as writing the required value to the device. Input is implemented by writing a logic 1 to each pin for the I/O device. It's up to other devices, in this case the Bank/Data bus, to drive the bus when the I/O expander is in input mode. I only switch the I/O expander's direction to output (CPU read) when PHI2==1 and RWB==1, and switch it back to input when PHI2==0.
I wrote a program on my Raspberry Pi to monitor the data bus and control signals, toggling the PHI2 GPIO to simulate single-stepping to probe the bus. My Pi runs NetBSD (that's a discussion for another time), so unless some of you use that instead of Linux, my program isn't exactly ready to be used by others who want to experiment
. Therefore, I'll hold off on the circuit diagram/source code for now.
The answer to my question conclusively:
The 65816 does NOT drive the bank address while RDY is low. Therefore, there must be some means to prevent a new garbage bank address from accidentally being latched. The big hint for me is that the I/O expander sees the value 0xFF when RDY==0 and PHI2==0. This indicates the bus is not being driven, so the I/O expander goes into pullup mode (or whatever the equivalent is for push-pull).
If RDY is driven low during PHI2 high, the '816 will NOT drive a bank address onto the bus during the next PHI2 low.
If RDY is driven low during PHI2 low, a read during PHI2 high will occur as normal, and during the same situation as above applies. Have not tested writes yet.
If RDY is driven high during PHI2 high, the '816 WILL drive a new address onto the bank bus during the next cycle. Obviously, the I/O device better in fact be ready, and have some breathing room to satisfy setup time. Otherwise it is probably best to drive RDY high while PHI2 is low.
If RDY is driven high during PHI2 low, a read during PHI2 high will occur as normal, and the '816 WILL drive a new address onto the bank bus during the next cycle.
Here is some sample output. RDY changes directions before PHI2 is toggled on any line with an 'r':
Code:
PHI2 0, RESB 1, RWB 1, VDA 1, VPA 1, RDY: 1, Bank/Data bus: 0
PHI2 1, RESB 1, RWB 1, VDA 1, VPA 1, RDY: 1, Bank/Data bus: E8
PHI2 0, RESB 1, RWB 1, VDA 0, VPA 0, RDY: 1, Bank/Data bus: 0
PHI2 1, RESB 1, RWB 1, VDA 0, VPA 0, RDY: 1, Bank/Data bus: E8
PHI2 0, RESB 1, RWB 1, VDA 1, VPA 1, RDY: 1, Bank/Data bus: 0
PHI2 1, RESB 1, RWB 1, VDA 1, VPA 1, RDY: 1, Bank/Data bus: E8
PHI2 0, RESB 1, RWB 1, VDA 0, VPA 0, RDY: 1, Bank/Data bus: 0
PHI2 1, RESB 1, RWB 1, VDA 0, VPA 0, RDY: 1, Bank/Data bus: E8
r
PHI2 0, RESB 1, RWB 1, VDA 0, VPA 0, RDY: 0, Bank/Data bus: FF
PHI2 1, RESB 1, RWB 1, VDA 0, VPA 0, RDY: 0, Bank/Data bus: E8
r
PHI2 0, RESB 1, RWB 1, VDA 1, VPA 1, RDY: 1, Bank/Data bus: 0
PHI2 1, RESB 1, RWB 1, VDA 1, VPA 1, RDY: 1, Bank/Data bus: E8
PHI2 0, RESB 1, RWB 1, VDA 0, VPA 0, RDY: 1, Bank/Data bus: 0
r
PHI2 1, RESB 1, RWB 1, VDA 0, VPA 0, RDY: 0, Bank/Data bus: E8
PHI2 0, RESB 1, RWB 1, VDA 0, VPA 0, RDY: 0, Bank/Data bus: FF
r
PHI2 1, RESB 1, RWB 1, VDA 0, VPA 0, RDY: 1, Bank/Data bus: E8
PHI2 0, RESB 1, RWB 1, VDA 1, VPA 1, RDY: 1, Bank/Data bus: 0
Something else is bothering me about my setup however... according to what I'm seeing from my program, NOP is in fact 4 cycles on the '816, not 2! o.0; And I don't think it's an error either, b/c other Implied address mode instructions, such as INX (see above- 0xE8), are 2 cycles in length. Something's very wrong... or something very interesting is happening.
EDIT: Ignore the above paragraph- I miswired/swapped D2 and D1... so 0xEA (NOP) was in fact 0xEC (CPX absolute) XD. Taking that into account, the behavior I saw (4 cycles, emulation mode) makes sense. Above results are not affected since D2==D1==0 in 0xE8.