Wait for IRQ to clear

This commit is contained in:
David Schmenk 2023-04-02 15:16:47 -07:00
parent 92909f2bb7
commit 01bd0d884d
3 changed files with 22 additions and 14 deletions

View File

@ -262,18 +262,22 @@ SENDACC PHP
SEI ; Disable interrupts SEI ; Disable interrupts
PHA PHA
LDA SSCSLOT LDA SSCSLOT
ORA #$88+1 ORA #$89+1
TAY TAY
LDA #$07 LDA #$07
STA $C002-1,Y ; Enable transmit IRQ STA $C002-2,Y ; Enable transmit IRQ
LDA $C001-1,Y ; Clear any oustanding interrupts LDA $C001-2,Y ; Clear any oustanding interrupts
PLA PLA
STA $C000-1,Y ; AVOID PHANTOM READ FROM $C0XX STA $C000-2,Y ; AVOID PHANTOM READ FROM $C0XX
SENDWT LDA $C001-1,Y PHA
SENDWT LDA $C001-2,Y
; AND #$80 ; Check IRQ status ; AND #$80 ; Check IRQ status
BPL SENDWT BPL SENDWT
LDA #$0B ; Disable transmit IRQ LDA #$0B ; Disable transmit IRQ
STA $C002-1,Y STA $C002-2,Y
IRQWT LDA $C001-2,Y ; Wait for IRQ to clear
BMI IRQWT
PLA
PLP ; Restore interrupts PLP ; Restore interrupts
RTS RTS
* *
@ -282,7 +286,7 @@ SENDWT LDA $C001-1,Y
RECVACC LDA SSCSLOT RECVACC LDA SSCSLOT
ORA #$89+1 ORA #$89+1
TAY TAY
RECVWT LDA $C000-1,Y RECVWT LDA $C001-2,Y
AND #$08 AND #$08
BEQ RECVWT BEQ RECVWT
LDA $C000-2,Y LDA $C000-2,Y

View File

@ -231,18 +231,22 @@ SENDACC PHP
SEI ; Disable interrupts SEI ; Disable interrupts
PHA PHA
LDA SSCSLOT LDA SSCSLOT
ORA #$88+1 ORA #$89+1
TAY TAY
LDA #$07 LDA #$07
STA $C002-1,Y ; Enable transmit IRQ STA $C002-2,Y ; Enable transmit IRQ
LDA $C001-1,Y ; Clear any oustanding interrupts LDA $C001-2,Y ; Clear any oustanding interrupts
PLA PLA
STA $C000-1,Y ; AVOID PHANTOM READ FROM $C0XX STA $C000-2,Y ; AVOID PHANTOM READ FROM $C0XX
SENDWT LDA $C001-1,Y PHA
SENDWT LDA $C001-2,Y
; AND #$80 ; Check IRQ status ; AND #$80 ; Check IRQ status
BPL SENDWT BPL SENDWT
LDA #$0B ; Disable transmit IRQ LDA #$0B ; Disable transmit IRQ
STA $C002-1,Y STA $C002-2,Y
IRQWT LDA $C001-2,Y ; Wait for IRQ to clear
BMI IRQWT
PLA
PLP ; Restore interrupts PLP ; Restore interrupts
RTS RTS
* *
@ -251,7 +255,7 @@ SENDWT LDA $C001-1,Y
RECVACC LDA SSCSLOT RECVACC LDA SSCSLOT
ORA #$89+1 ORA #$89+1
TAY TAY
RECVWT LDA $C000-1,Y RECVWT LDA $C001-2,Y
AND #$08 AND #$08
BEQ RECVWT BEQ RECVWT
LDA $C000-2,Y LDA $C000-2,Y

Binary file not shown.