2018-04-10 14:46:10 +00:00
|
|
|
|
NEW
|
2019-05-15 15:30:46 +00:00
|
|
|
|
AUTO 3,1
|
2018-04-10 14:46:10 +00:00
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DO SSCIRQ=1
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.TF DRV/SSC.I.DRV
|
2018-04-10 14:46:10 +00:00
|
|
|
|
.ELSE
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.TF DRV/SSC.DRV
|
2018-04-10 14:46:10 +00:00
|
|
|
|
.FIN
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DO SSCIRQ=1
|
|
|
|
|
BUF.SIZE .EQ $40
|
|
|
|
|
BUF.MASK .EQ $3F
|
|
|
|
|
.FIN
|
|
|
|
|
*--------------------------------------
|
2018-09-07 14:12:42 +00:00
|
|
|
|
ZPArgPtr .EQ ZPBIN
|
|
|
|
|
ZPParityPtr .EQ ZPBIN+2
|
|
|
|
|
ZPControlPtr .EQ ZPBIN+4
|
|
|
|
|
ZPhParity .EQ ZPBIN+6
|
|
|
|
|
ZPhControl .EQ ZPBIN+7
|
2018-04-10 14:46:10 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 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
|
|
|
|
|
.DA CS.END-CS.START Code Length
|
2018-08-30 15:18:27 +00:00
|
|
|
|
.DA 0
|
2018-09-07 14:12:42 +00:00
|
|
|
|
.DA #32 SS
|
|
|
|
|
.DA #8 ZP
|
2018-08-30 15:18:27 +00:00
|
|
|
|
.DA 0
|
2018-04-10 14:46:10 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 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
|
2018-09-07 14:12:42 +00:00
|
|
|
|
L.SSCANF.ARGS .DA SSCANF.ARGS
|
|
|
|
|
L.DCB.BAUD .DA DCB+S.DCB.COM.BAUD
|
|
|
|
|
L.DCB.DATA .DA DCB+S.DCB.COM.DATA
|
|
|
|
|
L.DCB.STOP .DA DCB+S.DCB.COM.STOP
|
2018-04-10 14:46:10 +00:00
|
|
|
|
.DA 0 End Of Reloc Table
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Dev.Detect >STYA ARGS
|
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.DETECT
|
2018-08-30 15:18:27 +00:00
|
|
|
|
>SYSCALL puts
|
|
|
|
|
stz ZPArgPtr
|
2018-04-10 14:46:10 +00:00
|
|
|
|
lda #$C1
|
2018-08-30 15:18:27 +00:00
|
|
|
|
sta ZPArgPtr+1
|
2018-04-10 14:46:10 +00:00
|
|
|
|
.1 and #$0f
|
|
|
|
|
tay
|
|
|
|
|
lda A2osX.S,y
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
ldx #DEVSIG.Length-1
|
|
|
|
|
|
|
|
|
|
.2 ldy DEVSIG.Offset,x
|
2018-08-30 15:18:27 +00:00
|
|
|
|
lda (ZPArgPtr),y
|
2018-04-10 14:46:10 +00:00
|
|
|
|
cmp DEVSIG.Value,x
|
|
|
|
|
bne .3
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
bra .4
|
2018-08-30 15:18:27 +00:00
|
|
|
|
.3 inc FD.DEV.NAME+3
|
|
|
|
|
inc ZPArgPtr+1 no match, try next slot....
|
|
|
|
|
lda ZPArgPtr+1
|
2018-04-10 14:46:10 +00:00
|
|
|
|
cmp #$C8
|
|
|
|
|
bne .1
|
|
|
|
|
>LDYA L.MSG.DETECT.KO
|
2018-08-30 15:18:27 +00:00
|
|
|
|
>SYSCALL puts
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
|
|
|
|
lda #MLI.E.NODEV Not Found in any slot, exiting
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2018-08-30 15:18:27 +00:00
|
|
|
|
.4 lda ZPArgPtr+1
|
2018-04-10 14:46:10 +00:00
|
|
|
|
and #$0F
|
|
|
|
|
pha
|
|
|
|
|
tay
|
|
|
|
|
lda #A2osX.S.COM
|
|
|
|
|
sta A2osX.S,y
|
|
|
|
|
pla
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
clc
|
|
|
|
|
adc #$8F
|
|
|
|
|
sta DEVSLOTn08F
|
2018-08-30 15:18:27 +00:00
|
|
|
|
jsr Dev.ParseArgs
|
|
|
|
|
bcs .9
|
|
|
|
|
.8 >PUSHW L.FD.DEV.NAME
|
|
|
|
|
>PUSHBI 2
|
2018-04-10 14:46:10 +00:00
|
|
|
|
>LDYA L.MSG.DETECT.OK
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
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
|
|
|
|
|
>STYA FD.DEV+S.FD.DEV.DRVPTR
|
2018-12-11 16:41:25 +00:00
|
|
|
|
>PUSHW L.FD.DEV.NAME
|
2018-08-30 15:18:27 +00:00
|
|
|
|
>LDYA L.FD.DEV
|
|
|
|
|
>SYSCALL MKDEV
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Dev.ParseArgs >LDYA ARGS
|
|
|
|
|
>STYA ZPArgPTR
|
|
|
|
|
lda (ZPArgPTR)
|
2018-09-07 14:12:42 +00:00
|
|
|
|
bne .1
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
.1 stz ZPhParity
|
|
|
|
|
stz ZPhControl
|
|
|
|
|
>LDYAI 256
|
|
|
|
|
>SYSCALL getmem
|
|
|
|
|
bcs .2
|
|
|
|
|
>STYA ZPParityPtr
|
|
|
|
|
stx ZPhParity
|
|
|
|
|
>LDYAI 256
|
|
|
|
|
>SYSCALL getmem
|
|
|
|
|
.2 bcs .90
|
|
|
|
|
>STYA ZPControlPtr
|
|
|
|
|
stx ZPhControl
|
|
|
|
|
>PUSHW ZPControlPtr
|
|
|
|
|
>PUSHW ZPParityPtr
|
|
|
|
|
>PUSHW L.DCB.STOP
|
|
|
|
|
>PUSHW L.DCB.DATA
|
|
|
|
|
>PUSHW L.DCB.BAUD
|
|
|
|
|
>PUSHBI 10 5 x byte PTRs
|
|
|
|
|
>PUSHW L.SSCANF.ARGS
|
|
|
|
|
>LDYA ZPArgPtr
|
|
|
|
|
>SYSCALL sscanf
|
|
|
|
|
|
|
|
|
|
bcs .90
|
|
|
|
|
.90 lda ZPhControl
|
|
|
|
|
beq .91
|
|
|
|
|
>SYSCALL freemem
|
|
|
|
|
|
|
|
|
|
.91 lda ZPhParity
|
|
|
|
|
beq .92
|
|
|
|
|
>SYSCALL freemem
|
|
|
|
|
|
2018-10-21 20:54:07 +00:00
|
|
|
|
.92 lda #E.SYN
|
2018-09-07 14:12:42 +00:00
|
|
|
|
sec
|
2018-04-10 14:46:10 +00:00
|
|
|
|
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)"
|
2018-04-10 14:46:10 +00:00
|
|
|
|
.FIN
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.AZ "."
|
2018-04-10 14:46:10 +00:00
|
|
|
|
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."
|
2018-09-07 14:12:42 +00:00
|
|
|
|
SSCANF.ARGS .AZ "%u,%d,%d,%s,%s"
|
2018-04-10 14:46:10 +00:00
|
|
|
|
ARGS .BS 2
|
|
|
|
|
*--------------------------------------
|
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"
|
2018-04-10 14:46:10 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 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
|
2018-04-10 14:46:10 +00:00
|
|
|
|
.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
|
2018-08-30 15:18:27 +00:00
|
|
|
|
ldy #S.IOCTL.STATCODE
|
|
|
|
|
lda (ZPIOCTL),y
|
|
|
|
|
beq .1
|
|
|
|
|
cmp #S.IOCTL.STATCODE.GETDIB
|
|
|
|
|
bne STATUS.DCB
|
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
|
2018-04-10 14:46:10 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2018-08-30 15:18:27 +00:00
|
|
|
|
|
|
|
|
|
STATUS.DCB cmp #S.IOCTL.STATCODE.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
|
|
|
|
|
.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
|
2018-04-10 14:46:10 +00:00
|
|
|
|
rts
|
2019-05-16 15:51:19 +00:00
|
|
|
|
.3 cmp #S.IOCTL.STATCODE.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
|
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
|
2019-05-15 15:30:46 +00:00
|
|
|
|
lda #1
|
|
|
|
|
.4 dec
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
.ELSE
|
|
|
|
|
.FIN
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
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
|
|
|
|
|
|
|
|
|
ldy #S.IOCTL.CTRLCODE
|
|
|
|
|
lda (ZPIOCTL),y
|
|
|
|
|
cmp #S.IOCTL.CTRLCODE.SETDCB
|
|
|
|
|
bne STATUS.9
|
2018-09-19 15:25:42 +00:00
|
|
|
|
ldy #S.DCB.COM-1
|
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
|
2018-04-10 14:46:10 +00:00
|
|
|
|
*--------------------------------------
|
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
|
|
|
|
|
OPEN.E lda #MLI.E.OPEN
|
2019-05-15 15:30:46 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2019-05-16 15:51:19 +00:00
|
|
|
|
OPEN.1 php
|
2018-04-10 14:46:10 +00:00
|
|
|
|
sei
|
|
|
|
|
ldx DEVSLOTn08F
|
|
|
|
|
stz SSC.RESET-$8F,x
|
|
|
|
|
|
2018-04-14 12:44:24 +00:00
|
|
|
|
lda #SSC.CTL.CLKINT+SSC.CTL.B9600+SSC.CTL.8D+SSC.CTL.1S+SSC.CMD.NOP
|
|
|
|
|
sta SSC.CTL-$8F,x
|
2018-04-10 14:46:10 +00:00
|
|
|
|
.DO SSCIRQ=1
|
2018-04-14 12:44:24 +00:00
|
|
|
|
lda #SSC.CMD.TEIRQ+SSC.CMD.TE+SSC.CMD.DTR
|
|
|
|
|
sta SSC.CMD-$8F,x
|
|
|
|
|
|
2018-04-10 14:46:10 +00:00
|
|
|
|
stz INBUF.HEAD
|
|
|
|
|
stz INBUF.TAIL
|
|
|
|
|
stz OUTBUF.HEAD
|
|
|
|
|
stz OUTBUF.TAIL
|
|
|
|
|
|
|
|
|
|
.ELSE
|
|
|
|
|
lda #SSC.CMD.RIRQDIS+SSC.CMD.TE+SSC.CMD.DTR
|
|
|
|
|
sta SSC.CMD-$8F,x
|
|
|
|
|
.FIN
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2018-04-10 14:46:10 +00:00
|
|
|
|
plp
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CLOSE php
|
|
|
|
|
sei
|
|
|
|
|
ldx DEVSLOTn08F
|
|
|
|
|
stz SSC.RESET-$8F,x
|
2018-09-12 15:27:00 +00:00
|
|
|
|
|
|
|
|
|
lda #S.DIB.S.OPENED
|
|
|
|
|
trb DIB+S.DIB.S
|
|
|
|
|
|
2018-04-10 14:46:10 +00:00
|
|
|
|
plp
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-09-19 15:25:42 +00:00
|
|
|
|
READ php
|
2018-04-10 14:46:10 +00:00
|
|
|
|
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
|
|
|
|
|
.10 inc ZPCount
|
|
|
|
|
bne .11
|
|
|
|
|
inc ZPCount+1
|
2019-10-03 06:25:27 +00:00
|
|
|
|
beq .8
|
2018-08-31 15:35:08 +00:00
|
|
|
|
.11 .DO SSCIRQ=1
|
|
|
|
|
ldy INBUF.TAIL
|
|
|
|
|
cpy INBUF.HEAD
|
2018-04-14 12:44:24 +00:00
|
|
|
|
beq .2
|
2018-08-31 15:35:08 +00:00
|
|
|
|
lda INBUF,y
|
|
|
|
|
iny
|
|
|
|
|
cpy #BUF.SIZE
|
2018-04-10 14:46:10 +00:00
|
|
|
|
bne .1
|
2018-08-31 15:35:08 +00:00
|
|
|
|
ldy #0
|
|
|
|
|
.1 sty INBUF.TAIL
|
|
|
|
|
|
|
|
|
|
sta (ZPBufPtr)
|
|
|
|
|
inc ZPBufPtr
|
|
|
|
|
bne .12
|
|
|
|
|
inc ZPBufPtr+1
|
|
|
|
|
.12 inc ZPCount2
|
|
|
|
|
bne .10
|
|
|
|
|
inc ZPCount2+1
|
2019-10-03 06:25:27 +00:00
|
|
|
|
bra .10
|
2018-08-31 15:35:08 +00:00
|
|
|
|
.FIN
|
|
|
|
|
.2 lda SSC.STATUS-$8F,x
|
|
|
|
|
bit #SSC.STATUS.nDSR true when 0
|
|
|
|
|
bne .9
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
2018-09-19 15:25:42 +00:00
|
|
|
|
bit #SSC.STATUS.RDRF incoming char?
|
2018-08-31 15:35:08 +00:00
|
|
|
|
beq .8
|
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
|
|
|
|
|
bne .13
|
|
|
|
|
inc ZPBufPtr+1
|
|
|
|
|
.13 inc ZPCount2
|
|
|
|
|
bne .2
|
|
|
|
|
inc ZPCount2+1
|
|
|
|
|
bra .2
|
|
|
|
|
.8 lda ZPCount2
|
|
|
|
|
bne .81
|
2018-09-19 15:25:42 +00:00
|
|
|
|
ora ZPCount2+1
|
2018-08-31 15:35:08 +00:00
|
|
|
|
beq .99
|
2018-09-19 15:25:42 +00:00
|
|
|
|
lda ZPCount2
|
2018-08-31 15:35:08 +00:00
|
|
|
|
.81 ldy #S.IOCTL.BYTECNT
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
plp
|
2018-04-10 14:46:10 +00:00
|
|
|
|
clc
|
2019-10-03 06:25:27 +00:00
|
|
|
|
rts
|
2019-05-16 15:51:19 +00:00
|
|
|
|
.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
|
|
|
|
|
2019-05-16 15:51:19 +00:00
|
|
|
|
.99 lda #E.NODATA
|
|
|
|
|
plp
|
2018-04-10 14:46:10 +00:00
|
|
|
|
sec
|
2019-10-03 06:25:27 +00:00
|
|
|
|
rts
|
2018-04-10 14:46:10 +00:00
|
|
|
|
*--------------------------------------
|
2018-09-19 15:25:42 +00:00
|
|
|
|
WRITE php
|
2018-04-10 14:46:10 +00:00
|
|
|
|
sei
|
2018-09-19 15:25:42 +00:00
|
|
|
|
jsr READ.WRITE.Init
|
2018-08-31 15:35:08 +00:00
|
|
|
|
.2 inc ZPCount
|
|
|
|
|
bne .3
|
|
|
|
|
inc ZPCount+1
|
|
|
|
|
beq .8
|
|
|
|
|
.3 .DO SSCIRQ=1
|
2018-04-14 12:44:24 +00:00
|
|
|
|
lda SSC.STATUS-$8F,x
|
|
|
|
|
bit #SSC.STATUS.nDSR true when 0
|
2019-05-16 15:51:19 +00:00
|
|
|
|
bne .9
|
2018-04-10 14:46:10 +00:00
|
|
|
|
lda OUTBUF.HEAD
|
|
|
|
|
cmp OUTBUF.TAIL Buffer Empty?
|
2018-08-31 15:35:08 +00:00
|
|
|
|
bne .6 not empty, queue char
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
|
|
|
|
lda SSC.STATUS-$8F,x
|
|
|
|
|
and #SSC.STATUS.TDRE Register Empty ?
|
2018-08-31 15:35:08 +00:00
|
|
|
|
beq .5 not empty, queue char
|
|
|
|
|
lda (ZPBufPtr) yes, write directly to ACIA
|
|
|
|
|
inc ZPBufPtr
|
|
|
|
|
bne .4
|
|
|
|
|
inc ZPBufPtr+1
|
|
|
|
|
|
|
|
|
|
.4 sta SSC.DATA-$8F,x
|
|
|
|
|
bra .2
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
2018-08-31 15:35:08 +00:00
|
|
|
|
.5 lda OUTBUF.HEAD
|
2018-09-19 15:25:42 +00:00
|
|
|
|
.6 tay
|
2018-04-10 14:46:10 +00:00
|
|
|
|
inc
|
|
|
|
|
and #BUF.MASK
|
|
|
|
|
cmp OUTBUF.TAIL
|
2019-05-16 15:51:19 +00:00
|
|
|
|
beq .99 Buffer Full!!
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
|
|
|
|
sta OUTBUF.HEAD
|
2018-08-31 15:35:08 +00:00
|
|
|
|
lda (ZPBufPtr)
|
|
|
|
|
inc ZPBufPtr
|
|
|
|
|
bne .7
|
|
|
|
|
inc ZPBufPtr+1
|
2018-09-19 15:25:42 +00:00
|
|
|
|
.7 sta OUTBUF,y
|
2018-08-31 15:35:08 +00:00
|
|
|
|
bra .2
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.ELSE
|
2018-08-31 15:35:08 +00:00
|
|
|
|
.4 lda SSC.STATUS-$8F,x
|
2018-09-19 15:25:42 +00:00
|
|
|
|
bit #SSC.STATUS.nDSR true when 0
|
2019-05-16 15:51:19 +00:00
|
|
|
|
bne .9
|
2018-09-19 15:25:42 +00:00
|
|
|
|
bit #SSC.STATUS.TDRE Outgoing char?
|
2018-08-31 15:35:08 +00:00
|
|
|
|
beq .4
|
|
|
|
|
lda (ZPBufPtr)
|
|
|
|
|
inc ZPBufPtr
|
|
|
|
|
bne .5
|
|
|
|
|
inc ZPBufPtr+1
|
|
|
|
|
.5 sta SSC.DATA-$8F,x
|
|
|
|
|
bra .2
|
|
|
|
|
.FIN
|
|
|
|
|
.8 plp
|
2018-04-10 14:46:10 +00:00
|
|
|
|
clc
|
2019-10-03 06:25:27 +00:00
|
|
|
|
rts
|
2019-05-16 15:51:19 +00:00
|
|
|
|
.9 lda #MLI.E.IO
|
2018-08-31 15:35:08 +00:00
|
|
|
|
.HS 2C BIT ABS
|
2019-05-16 15:51:19 +00:00
|
|
|
|
.99 lda #E.NODATA
|
2018-08-31 15:35:08 +00:00
|
|
|
|
plp
|
2018-04-10 14:46:10 +00:00
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
2018-04-10 14:46:10 +00:00
|
|
|
|
* IRQ Handler
|
|
|
|
|
* on exit, CC if handled
|
|
|
|
|
*--------------------------------------
|
2018-04-13 15:18:48 +00:00
|
|
|
|
.DO SSCIRQ=1
|
2018-04-10 14:46:10 +00:00
|
|
|
|
IRQ ldx DEVSLOTn08F
|
|
|
|
|
lda SSC.STATUS-$8F,x
|
|
|
|
|
* and #SSC.STATUS.IRQ Useless
|
|
|
|
|
bpl .9 IRQ from this device ? no, exit !!!!Applewin bug #308!!!!
|
|
|
|
|
|
|
|
|
|
bit #SSC.STATUS.RDRF incoming char?
|
2019-10-03 06:25:27 +00:00
|
|
|
|
beq .2
|
2018-04-10 14:46:10 +00:00
|
|
|
|
*------------ IRQ In
|
|
|
|
|
|
2018-04-13 15:18:48 +00:00
|
|
|
|
pha
|
2018-04-14 12:44:24 +00:00
|
|
|
|
lda INBUF.HEAD
|
2018-04-10 14:46:10 +00:00
|
|
|
|
tay save actual head for later
|
|
|
|
|
inc
|
|
|
|
|
and #BUF.MASK
|
2019-10-03 06:25:27 +00:00
|
|
|
|
cmp INBUF.TAIL
|
2018-04-14 12:44:24 +00:00
|
|
|
|
beq .1 buffer full, discard and exit
|
2018-04-10 14:46:10 +00:00
|
|
|
|
sta INBUF.HEAD
|
|
|
|
|
|
|
|
|
|
lda SSC.DATA-$8F,x read data to clear IRQ
|
|
|
|
|
sta INBUF,y
|
|
|
|
|
|
2018-04-14 12:44:24 +00:00
|
|
|
|
.1 pla
|
2018-04-10 14:46:10 +00:00
|
|
|
|
*------------ IRQ Out
|
2018-04-14 12:44:24 +00:00
|
|
|
|
.2 bit #SSC.STATUS.TDRE
|
2018-04-10 14:46:10 +00:00
|
|
|
|
beq .8 no transmition possible....
|
|
|
|
|
|
2018-04-14 12:44:24 +00:00
|
|
|
|
ldy OUTBUF.TAIL something to transmit ?
|
2018-04-10 14:46:10 +00:00
|
|
|
|
cpy OUTBUF.HEAD
|
|
|
|
|
beq .8 in that case, HOW TO CLEAR IRQ ????
|
|
|
|
|
lda OUTBUF,y
|
|
|
|
|
sta SSC.DATA-$8F,x write data to clear IRQ
|
|
|
|
|
tya
|
|
|
|
|
inc
|
|
|
|
|
and #BUF.MASK
|
|
|
|
|
sta OUTBUF.TAIL
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
.FIN
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DRV.CS.END
|
|
|
|
|
DEVSLOTn08F .BS 1
|
|
|
|
|
.DO SSCIRQ=1
|
|
|
|
|
INBUF.TAIL .BS 1
|
|
|
|
|
INBUF.HEAD .BS 1
|
|
|
|
|
OUTBUF.TAIL .BS 1
|
|
|
|
|
OUTBUF.HEAD .BS 1
|
|
|
|
|
INBUF .BS BUF.SIZE
|
|
|
|
|
OUTBUF .BS BUF.SIZE
|
|
|
|
|
.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
|
2018-04-10 14:46:10 +00:00
|
|
|
|
.ELSE
|
2018-07-19 15:33:55 +00:00
|
|
|
|
.DA #S.DIB.S.WRITE+S.DIB.S.READ
|
2018-04-10 14:46:10 +00:00
|
|
|
|
.FIN
|
|
|
|
|
.DA #0,#0,#0
|
|
|
|
|
>PSTR "Serial Card/Port"
|
2018-07-19 15:33:55 +00:00
|
|
|
|
.DA #S.DIB.T.CHAR
|
2018-04-10 14:46:10 +00:00
|
|
|
|
.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
|
|
|
|
|
.DA #S.DCB.COM.P.NONE PARITY
|
|
|
|
|
.DA #S.DCB.COM.C.XONXOFF
|
2018-04-10 14:46:10 +00:00
|
|
|
|
*--------------------------------------
|
2018-08-30 15:18:27 +00:00
|
|
|
|
DRV.END
|
2018-04-10 14:46:10 +00:00
|
|
|
|
MAN
|
2018-12-11 16:41:25 +00:00
|
|
|
|
SAVE USR/SRC/DRV/X.SSC.DRV.S
|
|
|
|
|
LOAD USR/SRC/DRV/SSC.I.DRV.S
|
2018-04-10 14:46:10 +00:00
|
|
|
|
ASM
|