Kernel 0.9.1 : SSC, irq & various bugfix

This commit is contained in:
Rémy GIBERT 2018-04-14 13:44:24 +01:00
parent 3973ebbbed
commit 842ea803de

View File

@ -100,11 +100,17 @@ CS.END
DEVSIG.Offset .HS 05070B0C DEVSIG.Offset .HS 05070B0C
DEVSIG.Value .HS 38180131 DEVSIG.Value .HS 38180131
DEVSIG.Length .EQ DEVSIG.Value-DEVSIG.Offset DEVSIG.Length .EQ DEVSIG.Value-DEVSIG.Offset
MSG.DETECT .DO SSCIRQ=1 MSG.DETECT .DO SSCIRQ=1
.AZ "Apple SSC (Super Serial Card,//c Serial Port) Driver (IRQ Enabled).\r\n" .AZ "Apple SSC (Super Serial Card,//c Serial Port) Driver (IRQ Enabled).\r\n"
.ELSE .ELSE
.AZ "Apple SSC (Super Serial Card,//c Serial Port) Driver.\r\n" .AZ "Apple SSC (Super Serial Card,//c Serial Port) Driver.\r\n"
.FIN .FIN
MSG.DETECT.OK .AZ "SSC Installed As Device : %s\r\n" MSG.DETECT.OK .AZ "SSC Installed As Device : %s\r\n"
MSG.DETECT.KO .AZ "No SSC Found.\r\n" MSG.DETECT.KO .AZ "No SSC Found.\r\n"
ARGS .BS 2 ARGS .BS 2
@ -113,11 +119,17 @@ ARGS .BS 2
*-------------------------------------- *--------------------------------------
DEV.HEADER cld DEV.HEADER cld
jmp (DRV.CS.START,x) jmp (DRV.CS.START,x)
.DO SSCIRQ=1 .DO SSCIRQ=1
.DA #S.DEV.S.WRITE+S.DEV.S.READ+S.DEV.S.IRQ .DA #S.DEV.S.WRITE+S.DEV.S.READ+S.DEV.S.IRQ
.ELSE .ELSE
.DA #S.DEV.S.WRITE+S.DEV.S.READ .DA #S.DEV.S.WRITE+S.DEV.S.READ
.FIN .FIN
.BS 6 .BS 6
DEV.HEADER.NAME .AZ "COM1" NAME DEV.HEADER.NAME .AZ "COM1" NAME
*-------------------------------------- *--------------------------------------
@ -133,9 +145,13 @@ DRV.CS.START .DA STATUS
.DA CLOSE .DA CLOSE
.DA READ .DA READ
.DA WRITE .DA WRITE
.DO SSCIRQ=1 .DO SSCIRQ=1
.DA IRQ .DA IRQ
.FIN .FIN
L.STAT .DA STAT L.STAT .DA STAT
.DA 0 end or relocation .DA 0 end or relocation
*-------------------------------------- *--------------------------------------
@ -152,24 +168,21 @@ OPEN php
stz SSC.RESET-$8F,x stz SSC.RESET-$8F,x
lda #SSC.CTL.CLKINT+SSC.CTL.B9600+SSC.CTL.8D+SSC.CTL.1S+SSC.CMD.NOP
sta SSC.CTL-$8F,x
.DO SSCIRQ=1 .DO SSCIRQ=1
lda #SSC.CMD.TEIRQ+SSC.CMD.TE+SSC.CMD.DTR
sta SSC.CMD-$8F,x
stz INBUF.HEAD stz INBUF.HEAD
stz INBUF.TAIL stz INBUF.TAIL
stz OUTBUF.HEAD stz OUTBUF.HEAD
stz OUTBUF.TAIL stz OUTBUF.TAIL
lda #SSC.CTL.CLKINT+SSC.CTL.B9600+SSC.CTL.8D+SSC.CTL.1S+SSC.CMD.NOP
sta SSC.CTL-$8F,x
lda #SSC.CMD.TEIRQ+SSC.CMD.TE+SSC.CMD.DTR
sta SSC.CMD-$8F,x
.ELSE .ELSE
lda #SSC.CTL.CLKINT+SSC.CTL.B9600+SSC.CTL.8D+SSC.CTL.1S+SSC.CMD.NOP
sta SSC.CTL-$8F,x
lda #SSC.CMD.RIRQDIS+SSC.CMD.TE+SSC.CMD.DTR lda #SSC.CMD.RIRQDIS+SSC.CMD.TE+SSC.CMD.DTR
sta SSC.CMD-$8F,x sta SSC.CMD-$8F,x
@ -196,7 +209,7 @@ READ .DO SSCIRQ=1
sei sei
ldx INBUF.TAIL ldx INBUF.TAIL
cpx INBUF.HEAD cpx INBUF.HEAD
beq .9 beq .2
lda INBUF,x lda INBUF,x
inx inx
@ -211,8 +224,14 @@ READ .DO SSCIRQ=1
clc clc
rts rts
.9 plp .2 ldx DEVSLOTn08F
lda #0 lda SSC.STATUS-$8F,x
and #SSC.STATUS.nDSR true when 0
beq .90
lda #26 EOF
.90 plp
sec sec
rts rts
@ -220,7 +239,6 @@ READ .DO SSCIRQ=1
ldx DEVSLOTn08F ldx DEVSLOTn08F
lda SSC.STATUS-$8F,x lda SSC.STATUS-$8F,x
bmi *
and #SSC.STATUS.RDRF incoming char? and #SSC.STATUS.RDRF incoming char?
beq .9 beq .9
@ -243,9 +261,9 @@ WRITE .DO SSCIRQ=1
ldx DEVSLOTn08F ldx DEVSLOTn08F
* lda SSC.STATUS-$8F,x lda SSC.STATUS-$8F,x
* bit #SSC.STATUS.DCD+SSC.STATUS.DSR true when 0 bit #SSC.STATUS.nDSR true when 0
* bne .9 bne .90
lda OUTBUF.HEAD lda OUTBUF.HEAD
cmp OUTBUF.TAIL Buffer Empty? cmp OUTBUF.TAIL Buffer Empty?
@ -276,13 +294,11 @@ WRITE .DO SSCIRQ=1
tya tya
sta OUTBUF,x sta OUTBUF,x
* ldx DEVSLOTn08F
* lda #SSC.CMD.TEIRQ+SSC.CMD.DTR
* sta SSC.CMD-$8F,x
plp plp
clc clc
rts rts
.90 lda #26 EOF
.9 plp .9 plp
sec sec
rts rts
@ -325,36 +341,33 @@ IRQ ldx DEVSLOTn08F
bpl .9 IRQ from this device ? no, exit !!!!Applewin bug #308!!!! bpl .9 IRQ from this device ? no, exit !!!!Applewin bug #308!!!!
bit #SSC.STATUS.RDRF incoming char? bit #SSC.STATUS.RDRF incoming char?
beq .3 beq .2
*------------ IRQ In *------------ IRQ In
pha pha
.1 lda INBUF.HEAD lda INBUF.HEAD
tay save actual head for later tay save actual head for later
inc inc
and #BUF.MASK and #BUF.MASK
cmp INBUF.TAIL cmp INBUF.TAIL
beq .2 buffer full, discard and exit beq .1 buffer full, discard and exit
sta INBUF.HEAD sta INBUF.HEAD
lda SSC.DATA-$8F,x read data to clear IRQ lda SSC.DATA-$8F,x read data to clear IRQ
sta INBUF,y sta INBUF,y
.2 pla .1 pla
* lda SSC.STATUS-$8F,x
* bit #SSC.STATUS.RDRF incoming char?
* bne .1
*------------ IRQ Out *------------ IRQ Out
.3 bit #SSC.STATUS.TDRE .2 bit #SSC.STATUS.TDRE
beq .8 no transmition possible.... beq .8 no transmition possible....
.4 ldy OUTBUF.TAIL something to transmit ? ldy OUTBUF.TAIL something to transmit ?
cpy OUTBUF.HEAD cpy OUTBUF.HEAD
beq .8 in that case, HOW TO CLEAR IRQ ???? beq .8 in that case, HOW TO CLEAR IRQ ????
@ -367,10 +380,6 @@ IRQ ldx DEVSLOTn08F
sta OUTBUF.TAIL sta OUTBUF.TAIL
* lda SSC.STATUS-$8F,x
* bit #SSC.STATUS.TDRE
* bne .4
.8 clc .8 clc
rts rts