Hello Roger,
If there is any potential for code to hang during normal operation, perhaps this needs to be specifically handled, in a more general sense, prior to COP timeout occurring. For the case if the IIC, this would involve an error exit condition should the flag not become set within a few microseconds.
For example, the instruction -
BRCLR IICIF,IICS,* ; Wait until flag is set
might be replaced by the following code -
JSR WAIT_IICIF ; Wait for IICF flag
BCC TIMEOUT ; Error exit if timeout occurred
...
; WAIT FOR IICIF FLAG OR TIMEOUT
; On exit CF = 0 if timeout occurred
WAIT_IICF:
LDA #20 ; Timeout 180 cycles
WLOOP1:
BRSET IICIF,IICS,WEXIT ; Branch if flag is set (CF = 1)
DBNZA WLOOP1 ; 9-cycle loop
WEXIT:
RTS
You might do a similar sub-routine for the RXACK flag, if necessary, and the result would probably be quite similar to the acknowledge polling process.
Regards,
Mac