SSC.I.DRV.S.txt : problems with IRQ in Applewin (see #308 issue in Applewin)

This commit is contained in:
Rémy GIBERT 2015-12-13 13:51:05 +01:00
parent eccd903539
commit 4b10684611
3 changed files with 69 additions and 72 deletions

Binary file not shown.

Binary file not shown.

View File

@ -54,8 +54,8 @@ SSC.REG.CTL.8D .EQ %00000000
SSC.REG.CTL.7D .EQ %00100000 SSC.REG.CTL.7D .EQ %00100000
SSC.REG.CTL.6D .EQ %01000000 SSC.REG.CTL.6D .EQ %01000000
SSC.REG.CTL.5D .EQ %01100000 SSC.REG.CTL.5D .EQ %01100000
SSC.REG.CTL.CEXT .EQ %00000000 SSC.REG.CTL.CLKEXT .EQ %00000000
SSC.REG.CTL.CINT .EQ %00010000 SSC.REG.CTL.CLKINT .EQ %00010000
SSC.REG.CTL.B16EXT .EQ %00000000 SSC.REG.CTL.B16EXT .EQ %00000000
SSC.REG.CTL.B50 .EQ %00000001 SSC.REG.CTL.B50 .EQ %00000001
SSC.REG.CTL.B75 .EQ %00000010 SSC.REG.CTL.B75 .EQ %00000010
@ -176,34 +176,34 @@ DRV.CS.START .DA OPEN
L.DEVINFO .DA DEVINFO L.DEVINFO .DA DEVINFO
.DA 0 end or relocation .DA 0 end or relocation
*-------------------------------------- *--------------------------------------
OPEN ldx DEVSLOTn0 OPEN php
sei
ldx DEVSLOTn0
stz SSC.REG.RESET,x stz SSC.REG.RESET,x
lda #SSC.REG.CTL.CINT+SSC.REG.CTL.B9600
sta SSC.REG.CTL,x
stz INBUF.PTR stz INBUF.PTR
stz INBUF.CNT stz INBUF.CNT
stz OUTBUF.PTR stz OUTBUF.PTR
stz OUTBUF.CNT stz OUTBUF.CNT
stz IDX
php lda #SSC.REG.CTL.CLKINT+SSC.REG.CTL.B9600
sei sta SSC.REG.CTL,x
lda #SSC.REG.CMD.TEIRQ+SSC.REG.CMD.DTR
lda #SSC.REG.CMD.TE+SSC.REG.CMD.DTR
sta SSC.REG.CMD,x sta SSC.REG.CMD,x
lda SSC.REG.STATUS,x clear any IRQ pending
lda SSC.REG.DATA,x discard any garbage byte lda SSC.REG.DATA,x discard any garbage byte
lda SSC.REG.STATUS,x clear any IRQ pending
bmi *
plp plp
clc clc
rts rts
*-------------------------------------- *--------------------------------------
GETEVENT php GETEVENT php
sei sei
lda INBUF.CNT lda INBUF.CNT
beq .9 beq .9
ldx INBUF.PTR ldx INBUF.PTR
@ -219,12 +219,10 @@ GETEVENT php
lda #S.EVT.F.KEY lda #S.EVT.F.KEY
sta (pEvent) sta (pEvent)
inx txa
cpx #BUF.SIZE inc
bne .1 and #BUF.MASK
ldx #0 sta INBUF.PTR
.1 stx INBUF.PTR
dec INBUF.CNT dec INBUF.CNT
plp plp
@ -240,20 +238,20 @@ COUT php
sei sei
tay save char in Y tay save char in Y
* ldx DEVSLOTn0 ldx DEVSLOTn0
* lda SSC.REG.STATUS,x lda SSC.REG.STATUS,x
* bit #SSC.REG.STATUS.DCD+SSC.REG.STATUS.DSR bit #SSC.REG.STATUS.DCD+SSC.REG.STATUS.DSR true when 0
* beq .9 bne .9
ldx OUTBUF.CNT Buffer Empty? ldx OUTBUF.CNT Buffer Empty?
bne .10 bne .10 not empty, queue char
bit #SSC.REG.STATUS.TDRE Register Empty ? and #SSC.REG.STATUS.TDRE Register Empty ?
beq .10 not empty, queue char beq .10 not empty, queue char
tya yes, write directly to ACIA tya yes, write directly to ACIA
ldx DEVSLOTn0 ldx DEV.DATA.BFFF
sta SSC.REG.DATA,x sta $BFFF,x
plp plp
clc clc
@ -262,18 +260,20 @@ COUT php
.10 cpx #BUF.SIZE .10 cpx #BUF.SIZE
beq .9 Buffer Full!! beq .9 Buffer Full!!
ldx OUTBUF.PTR lda OUTBUF.PTR
clc
adc OUTBUF.CNT
and #BUF.MASK
tax
tya tya
sta OUTBUF,x sta OUTBUF,x
inx
cpx #BUF.SIZE
bne .1
ldx #0
.1 stx OUTBUF.PTR
inc OUTBUF.CNT inc OUTBUF.CNT
ldx DEVSLOTn0
lda #SSC.REG.CMD.TEIRQ+SSC.REG.CMD.DTR
sta SSC.REG.CMD,x
plp plp
clc clc
rts rts
@ -299,60 +299,58 @@ GETINFO >LDYA L.DEVINFO
*-------------------------------------- *--------------------------------------
IRQ ldx DEVSLOTn0 IRQ ldx DEVSLOTn0
lda SSC.REG.STATUS,x IRQ from this device ? lda SSC.REG.STATUS,x IRQ from this device ?
* bpl .9 no, exit bpl .9 no, exit
pha save status ... bit #SSC.REG.STATUS.RDRF incoming char?
and #SSC.REG.STATUS.RDRF incoming char?
beq .1 beq .1
*------------ IRQ In
ldy SSC.REG.DATA,x read data to clear IRQ ldy SSC.REG.DATA,x read data to clear IRQ
phx
ldx IDX
tya
cmp #$20
bcc .10
ora #$80
.10 sta $402,x
inx
txa
and #$1F
sta IDX
plx
lda INBUF.CNT lda INBUF.CNT
cmp #BUF.SIZE cmp #BUF.SIZE
beq .1 buffer full, discard beq .8 buffer full, discard
phy
clc clc
adc INBUF.PTR adc INBUF.PTR
and #BUF.MASK and #BUF.MASK
tay tax
pla get back data tya get back data
sta INBUF,y sta INBUF,x
inc INBUF.CNT inc INBUF.CNT
clc
rts
.1 pla get back status *------------ IRQ Out
and #SSC.REG.STATUS.TDRE
beq .8 .1 bit #SSC.REG.STATUS.TDRE
beq .2 no transmit, no recieve, CTS changed!
lda OUTBUF.CNT something to transmit ? lda OUTBUF.CNT something to transmit ?
beq .8 no, exit beq .11 no, disable IRQ and exit
clc ldx OUTBUF.PTR
adc OUTBUF.PTR lda OUTBUF,x
ldy DEV.DATA.BFFF
sta $BFFF,y
dec OUTBUF.CNT
txa get back OUTBUF.PTR
inc
and #BUF.MASK and #BUF.MASK
tay sta OUTBUF.PTR
clc
rts
ldx DEV.DATA.BFFF .11 lda #SSC.REG.CMD.TE+SSC.REG.CMD.DTR
lda OUTBUF,Y sta SSC.REG.CMD,x
sta $BFFF,x clc
rts
ora #$80 *------------ IRQ CTS High
sta $401
dec INBUF.CNT .2
.8 clc .8 clc
rts rts
@ -361,7 +359,6 @@ IRQ ldx DEVSLOTn0
rts rts
*-------------------------------------- *--------------------------------------
DRV.CS.END DRV.CS.END
IDX .BS 1
DEVSLOT0n .BS 1 DEVSLOT0n .BS 1
*DEVSLOTCn .BS 1 *DEVSLOTCn .BS 1
DEV.DATA.BFFF .BS 1 DEV.DATA.BFFF .BS 1