mirror of
https://github.com/cc65/cc65.git
synced 2025-08-13 08:25:28 +00:00
Fix ACIA check so we don't enable RX/TX with IRQs on
This commit is contained in:
committed by
Oliver Schmidt
parent
3107f34ec9
commit
882f6fd103
@@ -252,32 +252,23 @@ NotIIgs:ldx #<$C000
|
|||||||
lda ACIA_CMD,x ; and command register. So we can restore them
|
lda ACIA_CMD,x ; and command register. So we can restore them
|
||||||
sta tmp2 ; if this isn't a 6551.
|
sta tmp2 ; if this isn't a 6551.
|
||||||
|
|
||||||
and #%11111110
|
ldy #%00000010 ; Disable TX/RX, disable IRQ
|
||||||
sta ACIA_CMD,x ; Disable receiver/transmitter
|
: tya
|
||||||
|
|
||||||
lda ACIA_CMD,x ; Reload register
|
|
||||||
and #%00000001
|
|
||||||
bne NotAcia ; We expect command register bit 0 to be 0
|
|
||||||
|
|
||||||
lda tmp2
|
|
||||||
ora #%00000001 ; Enable receiver/transmitter
|
|
||||||
sta ACIA_CMD,x
|
sta ACIA_CMD,x
|
||||||
sta tmp3 ; Store it for comparison
|
cmp ACIA_CMD,x ; Verify what we stored is there
|
||||||
|
|
||||||
lda ACIA_CMD,x ; Is command register what we wrote?
|
|
||||||
cmp tmp3
|
|
||||||
bne NotAcia
|
bne NotAcia
|
||||||
|
iny ; Enable TX/RX, disable IRQ
|
||||||
|
cpy #%00000100
|
||||||
|
bne :-
|
||||||
|
sta ACIA_STATUS,x ; Reset ACIA
|
||||||
|
lda ACIA_CMD,x ; Check that RX/TX is disabled
|
||||||
|
lsr
|
||||||
|
bcc AciaOK
|
||||||
|
|
||||||
sta ACIA_STATUS,x ; Reset Acia (value written is not important)
|
NotAcia:lda tmp2 ; Restore original values
|
||||||
|
sta ACIA_CMD,x
|
||||||
lda ACIA_CMD,x ; Is the Acia disabled now?
|
lda tmp1
|
||||||
and #%00000001
|
sta ACIA_STATUS,x
|
||||||
beq AciaOK
|
|
||||||
|
|
||||||
NotAcia:lda tmp2 ; Restore original values
|
|
||||||
sta ACIA_CMD,x
|
|
||||||
lda tmp1
|
|
||||||
sta ACIA_STATUS,x
|
|
||||||
|
|
||||||
NoDev: lda #SER_ERR_NO_DEVICE
|
NoDev: lda #SER_ERR_NO_DEVICE
|
||||||
bne Out
|
bne Out
|
||||||
|
Reference in New Issue
Block a user