Good to hear it is fixed and it is not a reset issue.
8BIT wrote:
Hi Klaus,
I tested your code and it indeed works. One issue that many cause a problem is the possibility of a misguided write to the VIA SR or to the V_idle byte will get the handshake bit out of sync. If that happens, the video output will lock up. If adding the delay in the reset fixes the problem, I think its best to keep the handshaking the way it is. If not, then we may need to explore this option further.
Thanks again for your contribution!
Daryl
You are welcome! I need to make you aware of
one of my earlier posts:
Klaus2m5 wrote:
...The 8 µs minimum duration of pb7-hs=1 after a write to the AVR internal shifter may still not be enough, if an interrupt delays the loop after label VOutput1...
...waiting for the AVR to signal busy.
This was not an issue in Martin's case, but when users start to experiment with interrupts it may cause the video driver to miss the busy window of the AVR and lock up, unless it is only called with interrupts disabled. That was another reason for the proposed change, but of course there are other ways to fix it.
The possibility of a misguided write to the VIA SR or to the V_idle byte getting the handshake bit out of sync is of course a valid concern. It would take a timeout detection in the video driver to detect and cure such problems.
The minimum fix for the video driver to prevent it from missing the busy window if interrupted by IRQ:
Code:
;----------------------------------------------------------------------
; Output contents of A to the Video Display
; A & Flags are preserved.
;----------------------------------------------------------------------
VOutput
php ;* save flags including IRQ disable
VOutput2
bit Via2PRB ; read handshake byte (pb7)
bmi VOutput2 ; if pb7=1, wait for AVR to be ready
sta Via2SR ; send to display via shift register
sei ;* disable IRQ during wait for busy
VOutput1
bit Via2PRB ; read handshake byte
bpl VOutput1 ; if pb7=0, wait for AVR to ack
plp ;* restore IRQ disable state
rts
;* = hotfix to prevent video driver to
; miss the busy window when IRQed
An NMI could still cause the video driver to hang.