A2osX/SHARED/X.SSC.DRV.S.txt

878 lines
14 KiB
Plaintext
Raw Normal View History

NEW
2019-05-15 15:30:46 +00:00
AUTO 3,1
.OP 65C02
.OR $2000
*--------------------------------------
.DO SSCIRQ=1
2020-08-25 14:54:30 +00:00
.TF drv/ssc.i.drv
.ELSE
2020-08-25 14:54:30 +00:00
.TF drv/ssc.drv
.FIN
*--------------------------------------
2021-03-11 21:40:55 +00:00
.DUMMY
.OR ZPBIN
ZS.START
ZPArgPtr .BS 2
ZPSlotPtr .BS 2
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp Dev.Detect cld,jmp abs=DRV
.DA #$61 6502,Level 1 (65c02)
.DA #1 DRV Layout Version 1
.DA 0
2021-03-11 21:40:55 +00:00
.DA CS.END-CS.START Code Length
.DA 0
2018-08-30 15:18:27 +00:00
.DA 0
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
L.MSG.DETECT .DA MSG.DETECT
L.MSG.DETECT.OK .DA MSG.DETECT.OK
L.MSG.DETECT.KO .DA MSG.DETECT.KO
2018-08-30 15:18:27 +00:00
L.DRV.CS.START .DA DRV.CS.START
L.FD.DEV .DA FD.DEV
L.FD.DEV.NAME .DA FD.DEV.NAME
.DA 0 End Of Reloc Table
*--------------------------------------
2021-03-11 21:40:55 +00:00
Dev.Detect >STYA ZPArgPtr
>LDYA L.MSG.DETECT
2020-02-28 07:21:46 +00:00
>SYSCALL PutS
2021-03-11 21:40:55 +00:00
stz ZPSlotPtr
2020-05-19 13:00:17 +00:00
lda #$C1
2021-03-11 21:40:55 +00:00
sta ZPSlotPtr+1
2020-05-19 13:00:17 +00:00
.1 and #$0f
tay
lda A2osX.S,y
bne .3
ldx #DEVSIG.Length-1
.2 ldy DEVSIG.Offset,x
2021-03-11 21:40:55 +00:00
lda (ZPSlotPtr),y
cmp DEVSIG.Value,x
bne .3
2020-05-19 13:00:17 +00:00
dex
bpl .2
2020-05-19 13:00:17 +00:00
bra .4
2020-05-19 13:00:17 +00:00
2018-08-30 15:18:27 +00:00
.3 inc FD.DEV.NAME+3
2021-03-11 21:40:55 +00:00
inc ZPSlotPtr+1 no match, try next slot....
lda ZPSlotPtr+1
cmp #$C8
2021-02-27 14:54:51 +00:00
bne .1
2021-03-11 21:40:55 +00:00
>LDYA L.MSG.DETECT.KO
2020-02-28 07:21:46 +00:00
>SYSCALL PutS
lda #MLI.E.NODEV Not Found in any slot, exiting
sec
2021-03-11 21:40:55 +00:00
.99 rts
2021-03-11 21:40:55 +00:00
.4 lda ZPSlotPtr+1
asl
asl
asl
asl
clc
adc #$8F
sta DEVSLOTn08F
2021-03-11 21:40:55 +00:00
2018-08-30 15:18:27 +00:00
jsr Dev.ParseArgs
2021-03-11 21:40:55 +00:00
bcs .99
2021-02-27 14:54:51 +00:00
2020-02-14 07:21:56 +00:00
.8 >PUSHW L.MSG.DETECT.OK
>PUSHW L.FD.DEV.NAME
2018-08-30 15:18:27 +00:00
>PUSHBI 2
2020-02-28 07:21:46 +00:00
>SYSCALL PrintF
2020-02-14 07:21:56 +00:00
2018-08-30 15:18:27 +00:00
>PUSHWI DRV.END
2019-07-22 06:31:01 +00:00
>PUSHWI DRV.CS.END-DRV.CS.START
2018-08-30 15:18:27 +00:00
>PUSHWI DRV.CS.START
>LDYA L.DRV.CS.START
>SYSCALL InsDrv
bcs .9
2020-03-16 06:50:15 +00:00
2018-08-30 15:18:27 +00:00
>STYA FD.DEV+S.FD.DEV.DRVPTR
2020-03-16 06:50:15 +00:00
>PUSHW L.FD.DEV
2018-12-11 16:41:25 +00:00
>PUSHW L.FD.DEV.NAME
2020-08-25 14:54:30 +00:00
>SYSCALL MKDev
2021-03-11 21:40:55 +00:00
bcs .9
lda ZPSlotPtr+1
and #$0F
tay
lda #A2osX.S.COM
sta A2osX.S,y
* clc
2018-08-30 15:18:27 +00:00
.9 rts
*--------------------------------------
2021-03-11 21:40:55 +00:00
Dev.ParseArgs lda (ZPArgPtr)
2018-09-07 14:12:42 +00:00
bne .1
2020-05-19 13:00:17 +00:00
2018-09-07 14:12:42 +00:00
clc
rts
2020-05-19 13:00:17 +00:00
2021-03-11 21:40:55 +00:00
.1 stz DCB+S.DCB.COM.BAUD
stz DCB+S.DCB.COM.BAUD+1
stz DCB+S.DCB.COM.BAUD+2
stz DCB+S.DCB.COM.BAUD+3
.2 jsr DevNextChar
beq .90
cmp #','
beq .3
jsr Dev.IsDigit
bcs .90
jsr Dev.BaudT10pA
bra .2
.3 jsr Dev.CheckBaud
bcs .99
2020-05-19 13:00:17 +00:00
2021-03-11 21:40:55 +00:00
jsr DevNextChar
beq .99
ldx #P2.Cnt-1
.4 cmp P2,x
beq .5
dex
bpl .4
.90 bra .99
.5 lda #%11100000
trb DEVCMD
txa
asl
asl
asl
asl
asl
tsb DEVCMD
jsr DevCheckSep
bcs .99
ldx #P3.Cnt-1
.6 cmp P3,x
beq .7
dex
bpl .6
bra .99
2020-05-19 13:00:17 +00:00
2021-03-11 21:40:55 +00:00
.7 lda #%01100000
trb DEVCTL
txa
asl
asl
asl
asl
asl
tsb DEVCTL
jsr DevCheckSep
bcs .99
2020-05-19 13:00:17 +00:00
2021-03-11 21:40:55 +00:00
ldx #P4.Cnt-1
.8 cmp P4,x
beq .9
dex
bpl .8
bra .99
2020-05-19 13:00:17 +00:00
2021-03-11 21:40:55 +00:00
.9 lda #%10000000
trb DEVCTL
txa
rol
rol
tsb DEVCTL
jsr DevCheckSep
bcs .99
2020-05-19 13:00:17 +00:00
2021-03-11 21:40:55 +00:00
ldx #P5.Cnt-1
.10 cmp P5,x
beq .11
dex
bpl .10
bra .99
2021-02-27 14:54:51 +00:00
2021-03-11 21:40:55 +00:00
.11 stx DEVFLOWCTRL
2021-02-27 14:54:51 +00:00
2021-03-11 21:40:55 +00:00
clc
rts
2020-05-19 13:00:17 +00:00
2021-03-11 21:40:55 +00:00
.99 lda #E.SYN
sec
rts
*--------------------------------------
DevCheckSep jsr DevNextChar
beq .9
cmp #','
bne .9
jsr DevNextChar
beq .9
clc
rts
.9 sec
rts
*--------------------------------------
DevNextChar lda (ZPArgPtr)
beq .9
inc ZPArgPtr
bne .9
inc ZPArgPtr+1
.9 rts
*--------------------------------------
Dev.IsDigit cmp #'0'
bcc .9
cmp #'9'+1
bcs .99
and #$0F
rts
.9 sec
.99 rts
*--------------------------------------
Dev.BaudT10pA pha
>PUSHL DCB+S.DCB.COM.BAUD
>PUSHBI 0
>PUSHBI 0
>PUSHBI 0
>PUSHBI 10
>FPU uMUL
2021-03-11 21:40:55 +00:00
>PUSHBI 0
>PUSHBI 0
>PUSHBI 0
pla
>PUSHA
>FPU uADD
2021-03-11 21:40:55 +00:00
>PULLL DCB+S.DCB.COM.BAUD
rts
*--------------------------------------
Dev.CheckBaud ldx #0
.1 txa
asl
asl
tay
2020-05-19 13:00:17 +00:00
2021-03-11 21:40:55 +00:00
lda DCB+S.DCB.COM.BAUD
cmp P1,y
bne .7
lda DCB+S.DCB.COM.BAUD+1
cmp P1+1,y
bne .7
lda DCB+S.DCB.COM.BAUD+2
cmp P1+2,y
bne .7
2018-09-07 14:12:42 +00:00
2021-03-11 21:40:55 +00:00
lda DCB+S.DCB.COM.BAUD+3
cmp P1+3,y
bne .7
2020-05-19 13:00:17 +00:00
2021-03-11 21:40:55 +00:00
lda #$F
trb DEVCTL
2018-09-07 14:12:42 +00:00
2021-03-11 21:40:55 +00:00
txa
tsb DEVCTL
clc
rts
.7 inx
cpx #P1.Cnt
bcc .1
rts
*--------------------------------------
CS.END
DEVSIG.Offset .HS 05070B0C
DEVSIG.Value .HS 38180131
DEVSIG.Length .EQ DEVSIG.Value-DEVSIG.Offset
2018-09-19 15:25:42 +00:00
MSG.DETECT .AS "Apple SSC (Super Serial Card,//c Serial Port) Driver"
.DO SSCIRQ=1
.AS " (IRQ Enabled)"
.FIN
2019-10-03 06:25:27 +00:00
.AZ "."
MSG.DETECT.OK .AZ "SSC Installed As Device : %s\r\n"
2018-08-30 15:18:27 +00:00
MSG.DETECT.KO .AZ "No SSC Found."
2021-03-11 21:40:55 +00:00
*--------------------------------------
P1 .DA >115200 Baud
.DA >50
.DA >75
.DA >110
.DA >135
.DA >150
.DA >300
.DA >600
.DA >1200
.DA >1800
.DA >2400
.DA >3600
.DA >4800
.DA >7200
.DA >9600
.DA >19200
P1.Cnt .EQ 16
*--------------------------------------
P2 .AS "NOEMS" Parity
P2.Cnt .EQ *-P2
*--------------------------------------
P3 .AS "8765" Data
P3.Cnt .EQ *-P3
*--------------------------------------
P4 .AS "12" Stop
P4.Cnt .EQ *-P4
*--------------------------------------
P5 .AS "NHX" flow Control
P5.Cnt .EQ *-P5
*--------------------------------------
2018-08-30 15:18:27 +00:00
FD.DEV .DA #S.FD.T.CDEV
.DA #0 HANDLER
.DA #0 BUSID
.DA #0 DEVID
.DA 0 BUSPTR
.BS 2 DRVPTR
2018-12-13 16:39:24 +00:00
.DA 0 DCBPTR
2018-12-11 16:41:25 +00:00
.DA 0 BUFPTR
2019-12-03 15:42:17 +00:00
FD.DEV.NAME .AZ "com1"
*--------------------------------------
* Driver Code
*--------------------------------------
2018-08-30 15:18:27 +00:00
ZPIOCTL .EQ ZPDRV
2018-08-31 15:35:08 +00:00
ZPBufPtr .EQ ZPDRV+2
ZPCount .EQ ZPDRV+4
ZPCount2 .EQ ZPDRV+6
2018-08-30 15:18:27 +00:00
*--------------------------------------
DRV.CS.START cld
jmp (.1,x)
.1 .DA STATUS
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA CONTROL
.DA A2osX.BADCALL
.DA OPEN
.DA CLOSE
.DA READ
.DA WRITE
.DO SSCIRQ=1
.DA IRQ
.FIN
.DA 0 end or relocation
*--------------------------------------
2018-09-19 15:25:42 +00:00
STATUS jsr STATUS.CONTROL.Init
2021-05-04 17:31:21 +00:00
ldy #S.IOCTL.S
2018-08-30 15:18:27 +00:00
lda (ZPIOCTL),y
beq .1
2021-02-27 14:54:51 +00:00
2021-05-04 17:31:21 +00:00
cmp #S.IOCTL.S.GETDIB
2018-08-30 15:18:27 +00:00
bne STATUS.DCB
2021-02-27 14:54:51 +00:00
2018-09-19 15:25:42 +00:00
ldy #S.DIB-1
2018-08-30 15:18:27 +00:00
.HS 2C bit abs
2018-09-19 15:25:42 +00:00
.1 ldy #3
2018-08-30 15:18:27 +00:00
2018-09-19 15:25:42 +00:00
.2 lda DIB,y
2018-10-08 05:55:28 +00:00
sta (ZPBufPtr),y
2018-09-19 15:25:42 +00:00
dey
2018-08-30 15:18:27 +00:00
bpl .2
2021-02-11 22:08:22 +00:00
clc
rts
2018-08-30 15:18:27 +00:00
2021-05-04 17:31:21 +00:00
STATUS.DCB cmp #S.IOCTL.S.GETDCB
2019-05-15 15:30:46 +00:00
bne .3
2018-08-30 15:18:27 +00:00
2018-09-19 15:25:42 +00:00
ldy #S.DCB.COM-1
2021-03-11 21:40:55 +00:00
2018-09-19 15:25:42 +00:00
.2 lda DCB,y
2018-10-08 05:55:28 +00:00
sta (ZPBufPtr),y
2018-09-19 15:25:42 +00:00
dey
2018-08-30 15:18:27 +00:00
bpl .2
clc
rts
2021-02-11 22:08:22 +00:00
2021-05-04 17:31:21 +00:00
.3 cmp #S.IOCTL.S.EOF
2019-05-15 15:30:46 +00:00
bne STATUS.9
lda DIB+S.DIB.S
and #S.DIB.S.OPENED
2019-05-16 15:51:19 +00:00
beq OPEN.E
2021-02-27 14:54:51 +00:00
2019-05-15 15:30:46 +00:00
.DO SSCIRQ=1
lda INBUF.TAIL
eor INBUF.HEAD
2019-05-16 15:51:19 +00:00
beq .4 NO DATA? eof = TRUE
2021-02-11 22:08:22 +00:00
2019-05-15 15:30:46 +00:00
lda #1
2021-02-11 22:08:22 +00:00
2019-05-15 15:30:46 +00:00
.4 dec
clc
rts
.ELSE
2021-03-11 21:40:55 +00:00
ldx DEVSLOTn08F
lda SSC.STATUS-$8F,x
and #SSC.STATUS.RDRF
beq .4
lda #1
.4 dec
2019-05-15 15:30:46 +00:00
.FIN
.8 clc
rts
2021-02-11 22:08:22 +00:00
2018-08-30 15:18:27 +00:00
STATUS.9 lda #MLI.E.BADCTL
sec
2019-10-03 06:25:27 +00:00
rts
2018-08-30 15:18:27 +00:00
*--------------------------------------
2018-09-19 15:25:42 +00:00
CONTROL jsr STATUS.CONTROL.Init
2018-08-30 15:18:27 +00:00
2021-05-04 17:31:21 +00:00
ldy #S.IOCTL.C
2018-08-30 15:18:27 +00:00
lda (ZPIOCTL),y
2021-05-04 17:31:21 +00:00
cmp #S.IOCTL.C.SETDCB
2018-08-30 15:18:27 +00:00
bne STATUS.9
2021-02-11 22:08:22 +00:00
2018-09-19 15:25:42 +00:00
ldy #S.DCB.COM-1
2021-02-11 22:08:22 +00:00
2018-10-08 05:55:28 +00:00
.2 lda (ZPBufPtr),y
2018-09-19 15:25:42 +00:00
sta DCB,y
dey
2018-08-30 15:18:27 +00:00
bpl .2
*--------------------------------------
2019-05-15 15:30:46 +00:00
OPEN lda DIB+S.DIB.S
bit #S.DIB.S.OPENED
2019-05-16 15:51:19 +00:00
beq OPEN.1
2021-02-11 22:08:22 +00:00
2019-05-16 15:51:19 +00:00
OPEN.E lda #MLI.E.OPEN
2019-05-15 15:30:46 +00:00
sec
rts
2021-02-11 22:08:22 +00:00
2019-05-16 15:51:19 +00:00
OPEN.1 php
sei
2021-02-11 22:08:22 +00:00
.DO SSCIRQ=1
2021-02-27 14:54:51 +00:00
>LDYAI 256
>SYSCALL2 NewStkObj
bcs .99
stx hINBUF
>STYA READ.INBUF+1
>STYA IRQ.INBUF+1
>LDYAI 256
>SYSCALL2 NewStkObj
bcs .90
stx hOUTBUF
>STYA WRITE.OUTBUF+1
>STYA IRQ.OUTBUF+1
stz INBUF.HEAD
stz INBUF.TAIL
stz OUTBUF.HEAD
stz OUTBUF.TAIL
2021-02-27 14:54:51 +00:00
2021-03-11 21:40:55 +00:00
.FIN
2021-02-27 14:54:51 +00:00
ldx DEVSLOTn08F
stz SSC.RESET-$8F,x
2021-03-11 21:40:55 +00:00
lda DEVCTL
2021-02-11 22:08:22 +00:00
sta SSC.CTL-$8F,x
2021-02-27 14:54:51 +00:00
2021-03-11 21:40:55 +00:00
lda DEVCMD
sta SSC.CMD-$8F,x
2021-02-27 14:54:51 +00:00
lda SSC.DATA-$8F,x discard any garbage byte
lda SSC.STATUS-$8F,x clear any IRQ pending
2018-09-12 15:27:00 +00:00
lda #S.DIB.S.OPENED
tsb DIB+S.DIB.S
plp
clc
rts
2021-02-27 14:54:51 +00:00
.DO SSCIRQ=1
.90 pha
lda hINBUF
>SYSCALL FreeStkObj
pla
.99 plp
sec
rts
.FIN
*--------------------------------------
2021-02-27 14:54:51 +00:00
CLOSE lda DIB+S.DIB.S
bit #S.DIB.S.OPENED
2021-03-11 21:40:55 +00:00
beq OPEN.E
2021-02-27 14:54:51 +00:00
php
sei
ldx DEVSLOTn08F
2021-02-27 14:54:51 +00:00
stz SSC.RESET-$8F,x
.DO SSCIRQ=1
lda hINBUF
>SYSCALL FreeStkObj
lda hOUTBUF
>SYSCALL FreeStkObj
.FIN
2018-09-12 15:27:00 +00:00
lda #S.DIB.S.OPENED
trb DIB+S.DIB.S
plp
clc
rts
*--------------------------------------
2018-09-19 15:25:42 +00:00
READ php
sei
2018-09-19 15:25:42 +00:00
jsr READ.WRITE.Init
2018-08-31 15:35:08 +00:00
stz ZPCount2
stz ZPCount2+1
2021-02-26 20:13:48 +00:00
2021-02-27 14:54:51 +00:00
.DO SSCIRQ=1
sta SETREADAUX
.FIN
READ.10 inc ZPCount
bne READ.11
2021-02-11 22:08:22 +00:00
2018-08-31 15:35:08 +00:00
inc ZPCount+1
2021-02-27 14:54:51 +00:00
beq READ.8
2021-02-11 22:08:22 +00:00
2021-02-27 14:54:51 +00:00
READ.11 .DO SSCIRQ=1
2018-08-31 15:35:08 +00:00
ldy INBUF.TAIL
cpy INBUF.HEAD
2021-02-27 14:54:51 +00:00
beq READ.2
2021-02-11 22:08:22 +00:00
2021-02-27 14:54:51 +00:00
READ.INBUF lda $FFFF,y SELF MODIFIED
inc INBUF.TAIL
2018-08-31 15:35:08 +00:00
sta (ZPBufPtr)
inc ZPBufPtr
2021-02-27 14:54:51 +00:00
bne READ.12
2021-02-11 22:08:22 +00:00
2018-08-31 15:35:08 +00:00
inc ZPBufPtr+1
2021-02-11 22:08:22 +00:00
2021-02-27 14:54:51 +00:00
READ.12 inc ZPCount2
bne READ.10
2021-02-11 22:08:22 +00:00
2018-08-31 15:35:08 +00:00
inc ZPCount2+1
2021-02-27 14:54:51 +00:00
bra READ.10
2018-08-31 15:35:08 +00:00
.FIN
2021-02-27 14:54:51 +00:00
READ.2 lda SSC.STATUS-$8F,x
2021-02-22 20:43:53 +00:00
bit #SSC.STATUS.nDCD true when 0
2021-02-27 14:54:51 +00:00
bne READ.9
2018-09-19 15:25:42 +00:00
bit #SSC.STATUS.RDRF incoming char?
2021-02-27 14:54:51 +00:00
beq READ.8
2021-02-11 22:08:22 +00:00
2018-09-19 15:25:42 +00:00
lda SSC.DATA-$8F,x
2018-08-31 15:35:08 +00:00
sta (ZPBufPtr)
inc ZPBufPtr
2021-02-27 14:54:51 +00:00
bne READ.13
2021-02-11 22:08:22 +00:00
2018-08-31 15:35:08 +00:00
inc ZPBufPtr+1
2021-02-11 22:08:22 +00:00
2021-02-27 14:54:51 +00:00
READ.13 inc ZPCount2
bne READ.2
2021-02-11 22:08:22 +00:00
2018-08-31 15:35:08 +00:00
inc ZPCount2+1
2021-02-27 14:54:51 +00:00
bra READ.2
2021-02-11 22:08:22 +00:00
2021-02-27 14:54:51 +00:00
READ.8 lda ZPCount2
bne READ.81
2021-02-11 22:08:22 +00:00
2018-09-19 15:25:42 +00:00
ora ZPCount2+1
2021-02-27 14:54:51 +00:00
beq READ.99
2021-02-11 22:08:22 +00:00
2018-09-19 15:25:42 +00:00
lda ZPCount2
2021-02-11 22:08:22 +00:00
2021-02-27 14:54:51 +00:00
READ.81 ldy #S.IOCTL.BYTECNT
2018-08-31 15:35:08 +00:00
sta (ZPIOCTL),y
iny
2018-09-19 15:25:42 +00:00
lda ZPCount2+1
2018-08-31 15:35:08 +00:00
sta (ZPIOCTL),y
2021-02-27 14:54:51 +00:00
.DO SSCIRQ=1
sta CLRREADAUX
.FIN
2018-08-31 15:35:08 +00:00
plp
clc
2019-10-03 06:25:27 +00:00
rts
2021-02-11 22:08:22 +00:00
2021-02-27 14:54:51 +00:00
READ.9 lda #MLI.E.IO
2019-05-15 15:30:46 +00:00
.HS 2C BIT ABS
2018-09-19 15:25:42 +00:00
2021-02-27 14:54:51 +00:00
READ.99 lda #E.NODATA
.DO SSCIRQ=1
sta CLRREADAUX
.FIN
2019-05-16 15:51:19 +00:00
plp
sec
2019-10-03 06:25:27 +00:00
rts
*--------------------------------------
2018-09-19 15:25:42 +00:00
WRITE php
sei
2018-09-19 15:25:42 +00:00
jsr READ.WRITE.Init
2021-02-11 22:08:22 +00:00
2021-02-27 14:54:51 +00:00
.DO SSCIRQ=1
sta SETWRITEAUX
.FIN
WRITE.2 inc ZPCount
bne WRITE.3
2021-02-11 22:08:22 +00:00
2018-08-31 15:35:08 +00:00
inc ZPCount+1
2021-02-27 14:54:51 +00:00
beq WRITE.8
2021-02-11 22:08:22 +00:00
2021-02-27 14:54:51 +00:00
WRITE.3 .DO SSCIRQ=1
lda SSC.STATUS-$8F,x
2021-02-22 20:43:53 +00:00
bit #SSC.STATUS.nDCD true when 0
2021-02-27 14:54:51 +00:00
bne WRITE.9
2021-02-11 22:08:22 +00:00
lda OUTBUF.HEAD
cmp OUTBUF.TAIL Buffer Empty?
2021-02-27 14:54:51 +00:00
bne WRITE.6 not empty, queue char
lda SSC.STATUS-$8F,x
and #SSC.STATUS.TDRE Register Empty ?
2021-02-27 14:54:51 +00:00
beq WRITE.5 not empty, queue char
2021-02-11 22:08:22 +00:00
2018-08-31 15:35:08 +00:00
lda (ZPBufPtr) yes, write directly to ACIA
2021-02-26 20:13:48 +00:00
sta SSC.DATA-$8F,x
2018-08-31 15:35:08 +00:00
inc ZPBufPtr
2021-02-27 14:54:51 +00:00
bne WRITE.2
2021-02-11 22:08:22 +00:00
2018-08-31 15:35:08 +00:00
inc ZPBufPtr+1
2021-02-27 14:54:51 +00:00
bra WRITE.2
WRITE.5 lda OUTBUF.HEAD
WRITE.6 tay
inc
2021-02-27 14:54:51 +00:00
cmp OUTBUF.TAIL
beq WRITE.99 Buffer Full!!
sta OUTBUF.HEAD
2018-08-31 15:35:08 +00:00
lda (ZPBufPtr)
2021-02-27 14:54:51 +00:00
WRITE.OUTBUF sta $FFFF,y SELF MODIFIED
2018-08-31 15:35:08 +00:00
inc ZPBufPtr
2021-02-27 14:54:51 +00:00
bne WRITE.2
2021-02-11 22:08:22 +00:00
2018-08-31 15:35:08 +00:00
inc ZPBufPtr+1
2021-02-27 14:54:51 +00:00
bra WRITE.2
2021-02-11 22:08:22 +00:00
2019-10-03 06:25:27 +00:00
.ELSE
2021-02-27 14:54:51 +00:00
WRITE.4 lda SSC.STATUS-$8F,x
2021-02-22 20:43:53 +00:00
bit #SSC.STATUS.nDCD true when 0
2021-02-27 14:54:51 +00:00
bne WRITE.9
2021-02-11 22:08:22 +00:00
2018-09-19 15:25:42 +00:00
bit #SSC.STATUS.TDRE Outgoing char?
2021-02-27 14:54:51 +00:00
beq WRITE.4
2021-02-11 22:08:22 +00:00
2018-08-31 15:35:08 +00:00
lda (ZPBufPtr)
2021-02-26 20:13:48 +00:00
sta SSC.DATA-$8F,x
2018-08-31 15:35:08 +00:00
inc ZPBufPtr
2021-02-27 14:54:51 +00:00
bne WRITE.2
2021-02-11 22:08:22 +00:00
2018-08-31 15:35:08 +00:00
inc ZPBufPtr+1
2021-02-27 14:54:51 +00:00
bra WRITE.2
2018-08-31 15:35:08 +00:00
.FIN
2021-02-11 22:08:22 +00:00
2021-02-27 14:54:51 +00:00
WRITE.8 .DO SSCIRQ=1
sta CLRWRITEAUX
.FIN
plp
clc
2019-10-03 06:25:27 +00:00
rts
2021-02-11 22:08:22 +00:00
2021-02-27 14:54:51 +00:00
WRITE.9 lda #MLI.E.IO
2018-08-31 15:35:08 +00:00
.HS 2C BIT ABS
2021-02-27 14:54:51 +00:00
WRITE.99 lda #E.NODATA
.DO SSCIRQ=1
sta CLRWRITEAUX
.FIN
2018-08-31 15:35:08 +00:00
plp
sec
rts
*--------------------------------------
2018-09-19 15:25:42 +00:00
READ.WRITE.Init ldx DEVSLOTn08F
STATUS.CONTROL.Init
>STYA ZPIOCTL
ldy #S.IOCTL.BUFPTR
lda (ZPIOCTL),y
sta ZPBufPtr
2019-05-16 15:51:19 +00:00
2021-02-27 14:54:51 +00:00
iny
2019-05-16 15:51:19 +00:00
2018-09-19 15:25:42 +00:00
lda (ZPIOCTL),y
sta ZPBufPtr+1
2019-05-16 15:51:19 +00:00
iny #S.IOCTL.BYTECNT
2018-09-19 15:25:42 +00:00
lda (ZPIOCTL),y
eor #$ff
sta ZPCount
2019-05-16 15:51:19 +00:00
2018-09-19 15:25:42 +00:00
iny
2019-05-16 15:51:19 +00:00
2018-09-19 15:25:42 +00:00
lda (ZPIOCTL),y
eor #$ff
sta ZPCount+1
rts
*--------------------------------------
* IRQ Handler
* on exit, CC if handled
*--------------------------------------
.DO SSCIRQ=1
IRQ ldx DEVSLOTn08F
lda SSC.STATUS-$8F,x
* and #SSC.STATUS.IRQ Useless
2021-02-27 14:54:51 +00:00
bpl IRQ.9 IRQ from this device ? no, exit !!!!Applewin bug #308!!!!
sta SETREADAUX
sta SETWRITEAUX
bit #SSC.STATUS.RDRF incoming char?
2021-02-27 14:54:51 +00:00
beq IRQ.2
*------------ IRQ In
pha
lda INBUF.HEAD
tay save actual head for later
inc
2019-10-03 06:25:27 +00:00
cmp INBUF.TAIL
2021-02-27 14:54:51 +00:00
beq IRQ.1 buffer full, discard and exit
2021-02-11 22:08:22 +00:00
sta INBUF.HEAD
2021-02-27 14:54:51 +00:00
lda SSC.DATA-$8F,x read data to clear IRQ
IRQ.INBUF sta $FFFF,y SELF MODIFIED
2021-02-27 14:54:51 +00:00
IRQ.1 pla
*------------ IRQ Out
2021-02-27 14:54:51 +00:00
IRQ.2 bit #SSC.STATUS.TDRE
2021-03-11 21:40:55 +00:00
beq IRQ.8 no transmission possible....
ldy OUTBUF.TAIL something to transmit ?
cpy OUTBUF.HEAD
2021-02-27 14:54:51 +00:00
beq IRQ.8 in that case, HOW TO CLEAR IRQ ????
2021-02-11 22:08:22 +00:00
2021-02-27 14:54:51 +00:00
IRQ.OUTBUF lda $FFFF,y SELF MODIFIED
sta SSC.DATA-$8F,x write data to clear IRQ
inc OUTBUF.TAIL
2021-02-11 22:08:22 +00:00
2021-02-27 14:54:51 +00:00
IRQ.8 sta CLRREADAUX
sta CLRWRITEAUX
clc
rts
2021-02-11 22:08:22 +00:00
2021-02-27 14:54:51 +00:00
IRQ.9 sec
rts
.FIN
*--------------------------------------
DRV.CS.END
DEVSLOTn08F .BS 1
.DO SSCIRQ=1
2021-03-11 21:40:55 +00:00
DEVCMD .DA #SSC.CMD.NOP+SSC.CMD.TEIRQ+SSC.CMD.DTR
DEVCTL .DA #SSC.CTL.1S+SSC.CTL.8D+SSC.CTL.CLKINT+SSC.CTL.B9600
.ELSE
DEVCMD .DA #SSC.CMD.NOP+SSC.CMD.TE+SSC.CMD.RIRQDIS+SSC.CMD.DTR
DEVCTL .DA #SSC.CTL.1S+SSC.CTL.8D+SSC.CTL.CLKINT+SSC.CTL.B115200
.FIN
DEVFLOWCTRL .BS 1
.DO SSCIRQ=1
INBUF.TAIL .BS 1
INBUF.HEAD .BS 1
OUTBUF.TAIL .BS 1
OUTBUF.HEAD .BS 1
2021-02-27 14:54:51 +00:00
hINBUF .BS 1
hOUTBUF .BS 1
.FIN
*--------------------------------------
2018-08-30 15:18:27 +00:00
DIB .DO SSCIRQ=1
.DA #S.DIB.S.WRITE+S.DIB.S.READ+S.DIB.S.IRQ
.ELSE
2018-07-19 15:33:55 +00:00
.DA #S.DIB.S.WRITE+S.DIB.S.READ
.FIN
.DA #0,#0,#0
>PSTR "Serial Card/Port"
2018-07-19 15:33:55 +00:00
.DA #S.DIB.T.CHAR
.DA #0
2018-08-30 15:18:27 +00:00
.DA K.VER
*--------------------------------------
DCB .DA #S.DCB.T.COM
.DA #0 FLAGS
2018-09-07 14:12:42 +00:00
.DO SSCIRQ=1
2018-08-30 15:18:27 +00:00
.DA >9600 BAUD (DWORD)
2018-09-07 14:12:42 +00:00
.ELSE
.DA >115200
.FIN
2018-08-30 15:18:27 +00:00
.DA #8 DATA
.DA #1 STOP
2021-03-11 21:40:55 +00:00
.DA #'N' PARITY
.DA #'N' FLOW
*--------------------------------------
2018-08-30 15:18:27 +00:00
DRV.END
MAN
2020-10-06 06:27:35 +00:00
SAVE usr/src/shared/x.ssc.drv.s
LOAD usr/src/drv/ssc.i.drv.s
ASM