2018-04-10 14:46:10 +00:00
|
|
|
|
NEW
|
|
|
|
|
PREFIX /A2OSX.BUILD
|
|
|
|
|
AUTO 4,1
|
|
|
|
|
.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
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
2018-08-30 15:18:27 +00:00
|
|
|
|
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
|
|
|
|
|
>PUSHWI DRV.CS.END
|
|
|
|
|
>PUSHWI DRV.CS.START
|
|
|
|
|
>LDYA L.DRV.CS.START
|
|
|
|
|
>SYSCALL InsDrv
|
|
|
|
|
bcs .9
|
|
|
|
|
>STYA FD.DEV+S.FD.DEV.DRVPTR
|
|
|
|
|
|
|
|
|
|
>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
|
2018-08-30 15:18:27 +00:00
|
|
|
|
|
2018-09-07 14:12:42 +00:00
|
|
|
|
.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
|
|
|
|
|
|
|
|
|
|
.92 lda #K.E.SYN
|
|
|
|
|
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
|
2018-09-19 15:25:42 +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
|
|
|
|
|
FD.DEV.NAME .AZ "COM1" NAME
|
|
|
|
|
.HS 000000
|
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
|
|
|
|
|
sta (ZPIOCTL),y
|
|
|
|
|
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
|
|
|
|
|
bne STATUS.9
|
|
|
|
|
|
2018-09-19 15:25:42 +00:00
|
|
|
|
ldy #S.DCB.COM-1
|
2018-08-30 15:18:27 +00:00
|
|
|
|
|
2018-09-19 15:25:42 +00:00
|
|
|
|
.2 lda DCB,y
|
|
|
|
|
sta (ZPIOCTL),y
|
|
|
|
|
dey
|
2018-08-30 15:18:27 +00:00
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
clc
|
2018-04-10 14:46:10 +00:00
|
|
|
|
rts
|
2018-08-30 15:18:27 +00:00
|
|
|
|
|
|
|
|
|
STATUS.9 lda #MLI.E.BADCTL
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
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-08-30 15:18:27 +00:00
|
|
|
|
|
2018-09-19 15:25:42 +00:00
|
|
|
|
.2 lda (ZPIOCTL),y
|
|
|
|
|
sta DCB,y
|
|
|
|
|
dey
|
2018-08-30 15:18:27 +00:00
|
|
|
|
bpl .2
|
2018-04-10 14:46:10 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
OPEN php
|
|
|
|
|
sei
|
2018-09-12 15:27:00 +00:00
|
|
|
|
|
2018-04-10 14:46:10 +00:00
|
|
|
|
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
|
2018-09-12 15:27:00 +00:00
|
|
|
|
|
2018-04-10 14:46:10 +00:00
|
|
|
|
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-08-31 15:35:08 +00:00
|
|
|
|
|
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
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
.11 .DO SSCIRQ=1
|
|
|
|
|
ldy INBUF.TAIL
|
|
|
|
|
cpy INBUF.HEAD
|
2018-04-14 12:44:24 +00:00
|
|
|
|
beq .2
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
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
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
2018-08-31 15:35:08 +00:00
|
|
|
|
.1 sty INBUF.TAIL
|
|
|
|
|
|
|
|
|
|
sta (ZPBufPtr)
|
|
|
|
|
inc ZPBufPtr
|
|
|
|
|
bne .12
|
|
|
|
|
inc ZPBufPtr+1
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
2018-08-31 15:35:08 +00:00
|
|
|
|
.12 inc ZPCount2
|
|
|
|
|
bne .10
|
|
|
|
|
inc ZPCount2+1
|
|
|
|
|
bra .10
|
2018-04-14 12:44:24 +00:00
|
|
|
|
|
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
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
2018-08-31 15:35:08 +00:00
|
|
|
|
.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
|
2018-08-31 15:35:08 +00:00
|
|
|
|
rts
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
2018-08-31 15:35:08 +00:00
|
|
|
|
.9 lda #C.EOF
|
2018-09-19 15:25:42 +00:00
|
|
|
|
|
2018-08-31 15:35:08 +00:00
|
|
|
|
.99 plp
|
2018-04-10 14:46:10 +00:00
|
|
|
|
sec
|
2018-08-31 15:35:08 +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-08-31 15:35:08 +00:00
|
|
|
|
|
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
|
|
|
|
|
bne .90
|
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
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
2018-08-31 15:35:08 +00:00
|
|
|
|
lda (ZPBufPtr) yes, write directly to ACIA
|
|
|
|
|
inc ZPBufPtr
|
|
|
|
|
bne .4
|
|
|
|
|
inc ZPBufPtr+1
|
|
|
|
|
|
|
|
|
|
.4 sta SSC.DATA-$8F,x
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
2018-08-31 15:35:08 +00:00
|
|
|
|
bra .2
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
2018-08-31 15:35:08 +00:00
|
|
|
|
.5 lda OUTBUF.HEAD
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
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
|
|
|
|
|
beq .9 Buffer Full!!
|
|
|
|
|
|
|
|
|
|
sta OUTBUF.HEAD
|
|
|
|
|
|
2018-08-31 15:35:08 +00:00
|
|
|
|
lda (ZPBufPtr)
|
|
|
|
|
inc ZPBufPtr
|
|
|
|
|
bne .7
|
|
|
|
|
inc ZPBufPtr+1
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
2018-09-19 15:25:42 +00:00
|
|
|
|
.7 sta OUTBUF,y
|
2018-08-31 15:35:08 +00:00
|
|
|
|
|
|
|
|
|
bra .2
|
2018-09-19 15:25:42 +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
|
|
|
|
|
bne .90
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
2018-09-19 15:25:42 +00:00
|
|
|
|
bit #SSC.STATUS.TDRE Outgoing char?
|
2018-08-31 15:35:08 +00:00
|
|
|
|
beq .4
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
2018-08-31 15:35:08 +00:00
|
|
|
|
lda (ZPBufPtr)
|
|
|
|
|
inc ZPBufPtr
|
|
|
|
|
bne .5
|
|
|
|
|
inc ZPBufPtr+1
|
|
|
|
|
|
|
|
|
|
.5 sta SSC.DATA-$8F,x
|
|
|
|
|
|
|
|
|
|
bra .2
|
|
|
|
|
.FIN
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
2018-08-31 15:35:08 +00:00
|
|
|
|
.8 plp
|
2018-04-10 14:46:10 +00:00
|
|
|
|
clc
|
2018-08-31 15:35:08 +00:00
|
|
|
|
rts
|
2018-04-10 14:46:10 +00:00
|
|
|
|
|
2018-08-31 15:35:08 +00:00
|
|
|
|
.90 lda #0
|
|
|
|
|
.HS 2C BIT ABS
|
|
|
|
|
.9 lda #C.EOF
|
|
|
|
|
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
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPIOCTL),y
|
|
|
|
|
sta ZPBufPtr+1
|
|
|
|
|
|
|
|
|
|
* ldy #S.IOCTL.BYTECNT
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
lda (ZPIOCTL),y
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta ZPCount
|
|
|
|
|
iny
|
|
|
|
|
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?
|
2018-04-14 12:44:24 +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
|
|
|
|
|
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
|
|
|
|
|
SAVE /A2OSX.SRC/DRV/X.SSC.DRV.S
|
|
|
|
|
LOAD /A2OSX.SRC/DRV/SSC.I.DRV.S
|
|
|
|
|
ASM
|