2015-12-10 18:53:30 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-04-13 20:59:25 +00:00
|
|
|
|
LOMEM $A00
|
2015-12-10 18:53:30 +00:00
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.TF /A2OSX.BUILD/DRV/SSC.I.DRV
|
2015-12-10 18:53:30 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.INB /A2OSX.BUILD/INC/MACROS.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/A2OSX.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/MLI.ERR.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/COM.6551.I
|
2015-12-10 18:53:30 +00:00
|
|
|
|
*--------------------------------------
|
2017-02-03 16:58:13 +00:00
|
|
|
|
BUF.SIZE .EQ $40
|
|
|
|
|
BUF.MASK .EQ $3F
|
2015-12-10 18:53:30 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
ZPTmpPtr1 .EQ ZPDRV
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 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
|
|
|
|
|
.DA DEV.HEADER-CS.START Device Header Offset
|
|
|
|
|
.DA DRV.CS.START-CS.START Driver Code Offset
|
|
|
|
|
.DA DRV.CS.END-DRV.CS.START Drv Code Length
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
L.MSG.DETECT .DA MSG.DETECT
|
|
|
|
|
L.MSG.DETECT.OK .DA MSG.DETECT.OK
|
|
|
|
|
L.MSG.DETECT.KO .DA MSG.DETECT.KO
|
|
|
|
|
L.DEV.HEADER.NAME .DA DEV.HEADER.NAME
|
|
|
|
|
.DA 0 End Of Reloc Table
|
|
|
|
|
*--------------------------------------
|
2017-04-13 20:59:25 +00:00
|
|
|
|
Dev.Detect >STYA ARGS
|
2017-04-28 15:04:16 +00:00
|
|
|
|
|
2015-12-10 18:53:30 +00:00
|
|
|
|
>LDYA L.MSG.DETECT
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
|
|
|
|
stz ZPTmpPtr1
|
|
|
|
|
lda #$C1
|
|
|
|
|
sta ZPTmpPtr1+1
|
|
|
|
|
|
2017-04-13 20:59:25 +00:00
|
|
|
|
.1 and #$0f
|
|
|
|
|
tay
|
2017-10-19 15:27:38 +00:00
|
|
|
|
lda A2osX.S,y
|
2017-04-13 20:59:25 +00:00
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
ldx #DEVSIG.Length-1
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
|
|
|
|
.2 ldy DEVSIG.Offset,x
|
|
|
|
|
lda (ZPTmpPtr1),y
|
|
|
|
|
cmp DEVSIG.Value,x
|
|
|
|
|
bne .3
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
bra .4
|
|
|
|
|
|
|
|
|
|
.3 inc ZPTmpPtr1+1 no match, try next slot....
|
|
|
|
|
lda ZPTmpPtr1+1
|
|
|
|
|
cmp #$C8
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.DETECT.KO
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2017-10-26 16:01:54 +00:00
|
|
|
|
lda #MLI.E.NODEV Not Found in any slot, exiting
|
2015-12-10 18:53:30 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.4 lda ZPTmpPtr1+1
|
|
|
|
|
and #$0F
|
2017-04-13 20:59:25 +00:00
|
|
|
|
pha
|
|
|
|
|
tay
|
2017-10-19 15:27:38 +00:00
|
|
|
|
lda #A2osX.S.COM
|
|
|
|
|
sta A2osX.S,y
|
2017-04-13 20:59:25 +00:00
|
|
|
|
pla
|
2015-12-10 18:53:30 +00:00
|
|
|
|
ora #$30
|
2017-09-27 15:40:31 +00:00
|
|
|
|
sta DEV.HEADER.NAME+3
|
2015-12-10 18:53:30 +00:00
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
sta DEVSLOTn0
|
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>PUSHW L.DEV.HEADER.NAME
|
|
|
|
|
>LDYA L.MSG.DETECT.OK
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2015-12-10 18:53:30 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
DEVSIG.Offset .HS 05070B0C
|
|
|
|
|
DEVSIG.Value .HS 38180131
|
|
|
|
|
DEVSIG.Length .EQ DEVSIG.Value-DEVSIG.Offset
|
2017-08-22 06:37:03 +00:00
|
|
|
|
MSG.DETECT >CSTR "Apple SSC (Super Serial Card,//c Serial Port) Driver (IRQ Enabled).\r\n"
|
2017-09-27 15:40:31 +00:00
|
|
|
|
MSG.DETECT.OK >CSTR "SSC Installed As Device : %s\r\n"
|
2017-08-22 06:37:03 +00:00
|
|
|
|
MSG.DETECT.KO >CSTR "No SSC Found.\r\n"
|
2017-04-13 20:59:25 +00:00
|
|
|
|
ARGS .BS 2
|
2015-12-10 18:53:30 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Device Header (16 Bytes)
|
|
|
|
|
*--------------------------------------
|
2017-03-15 16:44:15 +00:00
|
|
|
|
DEV.HEADER cld
|
|
|
|
|
jmp (DRV.CS.START,x)
|
2017-02-02 17:30:07 +00:00
|
|
|
|
.DA #S.DEV.S.WRITE+S.DEV.S.READ+S.DEV.S.IRQ
|
2017-03-15 16:44:15 +00:00
|
|
|
|
.BS 6
|
2017-09-27 15:40:31 +00:00
|
|
|
|
DEV.HEADER.NAME >CSTR "COM1" NAME
|
2015-12-10 18:53:30 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Driver Code
|
|
|
|
|
*--------------------------------------
|
2017-03-15 16:44:15 +00:00
|
|
|
|
DRV.CS.START .DA STATUS
|
2017-07-06 15:30:40 +00:00
|
|
|
|
.DA A2osX.BADCALL
|
|
|
|
|
.DA A2osX.BADCALL
|
|
|
|
|
.DA A2osX.BADCALL
|
2017-02-02 17:30:07 +00:00
|
|
|
|
.DA CONTROL
|
2017-07-06 15:30:40 +00:00
|
|
|
|
.DA A2osX.BADCALL
|
2017-02-02 17:30:07 +00:00
|
|
|
|
.DA OPEN
|
2015-12-10 18:53:30 +00:00
|
|
|
|
.DA CLOSE
|
2017-02-02 17:30:07 +00:00
|
|
|
|
.DA READ
|
|
|
|
|
.DA WRITE
|
2015-12-10 18:53:30 +00:00
|
|
|
|
.DA IRQ
|
2017-02-02 17:30:07 +00:00
|
|
|
|
L.STAT .DA STAT
|
2015-12-10 18:53:30 +00:00
|
|
|
|
.DA 0 end or relocation
|
|
|
|
|
*--------------------------------------
|
2017-02-02 17:30:07 +00:00
|
|
|
|
STATUS >LDYA L.STAT
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CONTROL clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-12-13 12:51:05 +00:00
|
|
|
|
OPEN php
|
|
|
|
|
sei
|
|
|
|
|
ldx DEVSLOTn0
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2016-12-12 16:38:32 +00:00
|
|
|
|
stz SSC.RESET,x
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2017-02-03 07:33:50 +00:00
|
|
|
|
stz INBUF.HEAD
|
|
|
|
|
stz INBUF.TAIL
|
|
|
|
|
stz OUTBUF.HEAD
|
|
|
|
|
stz OUTBUF.TAIL
|
2017-04-28 15:04:16 +00:00
|
|
|
|
|
2017-05-02 15:56:43 +00:00
|
|
|
|
lda #SSC.CTL.CLKEXT+SSC.CTL.B9600+SSC.CTL.8D+SSC.CTL.1S+SSC.CMD.NOP
|
2016-12-12 16:38:32 +00:00
|
|
|
|
sta SSC.CTL,x
|
2015-12-13 12:51:05 +00:00
|
|
|
|
|
2017-02-02 17:30:07 +00:00
|
|
|
|
lda #SSC.CMD.TEIRQ+SSC.CMD.TE+SSC.CMD.DTR
|
2016-12-12 16:38:32 +00:00
|
|
|
|
sta SSC.CMD,x
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2016-12-12 16:38:32 +00:00
|
|
|
|
lda SSC.DATA,x discard any garbage byte
|
|
|
|
|
lda SSC.STATUS,x clear any IRQ pending
|
2016-01-04 07:22:57 +00:00
|
|
|
|
|
2015-12-10 18:53:30 +00:00
|
|
|
|
plp
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-02-02 17:30:07 +00:00
|
|
|
|
CLOSE php
|
|
|
|
|
sei
|
|
|
|
|
ldx DEVSLOTn0
|
|
|
|
|
stz SSC.RESET,x
|
|
|
|
|
plp
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
READ php
|
2015-12-10 18:53:30 +00:00
|
|
|
|
sei
|
2017-02-03 07:33:50 +00:00
|
|
|
|
ldx INBUF.TAIL
|
|
|
|
|
cpx INBUF.HEAD
|
2015-12-10 18:53:30 +00:00
|
|
|
|
beq .9
|
|
|
|
|
|
2017-02-03 07:33:50 +00:00
|
|
|
|
lda INBUF,x
|
|
|
|
|
inx
|
|
|
|
|
cpx #BUF.SIZE
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.1 stx INBUF.TAIL
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
|
|
|
|
plp
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 plp
|
|
|
|
|
lda #0
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-02-02 17:30:07 +00:00
|
|
|
|
WRITE php
|
2015-12-10 18:53:30 +00:00
|
|
|
|
sei
|
2015-12-12 10:13:14 +00:00
|
|
|
|
tay save char in Y
|
2017-02-03 07:33:50 +00:00
|
|
|
|
|
2017-02-03 16:58:13 +00:00
|
|
|
|
ldx DEVSLOTn0
|
|
|
|
|
|
2017-02-02 17:30:07 +00:00
|
|
|
|
* lda SSC.STATUS,x
|
|
|
|
|
* bit #SSC.STATUS.DCD+SSC.STATUS.DSR true when 0
|
|
|
|
|
* bne .9
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2017-02-03 16:58:13 +00:00
|
|
|
|
lda OUTBUF.HEAD
|
|
|
|
|
cmp OUTBUF.TAIL Buffer Empty?
|
2017-02-02 17:30:07 +00:00
|
|
|
|
bne .11 not empty, queue char
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2017-02-02 17:30:07 +00:00
|
|
|
|
lda SSC.STATUS,x
|
|
|
|
|
|
|
|
|
|
and #SSC.STATUS.TDRE Register Empty ?
|
2015-12-12 10:13:14 +00:00
|
|
|
|
beq .10 not empty, queue char
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2015-12-12 10:13:14 +00:00
|
|
|
|
tya yes, write directly to ACIA
|
2017-02-02 17:30:07 +00:00
|
|
|
|
sta SSC.DATA,x
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
|
|
|
|
plp
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2017-02-03 16:58:13 +00:00
|
|
|
|
.10 lda OUTBUF.HEAD
|
2017-02-02 17:30:07 +00:00
|
|
|
|
|
2017-02-03 16:58:13 +00:00
|
|
|
|
.11 tax
|
|
|
|
|
inc
|
|
|
|
|
and #BUF.MASK
|
|
|
|
|
cmp OUTBUF.TAIL
|
2015-12-10 18:53:30 +00:00
|
|
|
|
beq .9 Buffer Full!!
|
|
|
|
|
|
2017-02-03 16:58:13 +00:00
|
|
|
|
sta OUTBUF.TAIL
|
2017-02-03 07:33:50 +00:00
|
|
|
|
|
2015-12-10 18:53:30 +00:00
|
|
|
|
tya
|
|
|
|
|
sta OUTBUF,x
|
|
|
|
|
|
2016-01-04 07:22:57 +00:00
|
|
|
|
* ldx DEVSLOTn0
|
2017-02-02 17:30:07 +00:00
|
|
|
|
* lda #SSC.CMD.TEIRQ+SSC.CMD.DTR
|
|
|
|
|
* sta SSC.CMD,x
|
2015-12-10 18:53:30 +00:00
|
|
|
|
plp
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 plp
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* IRQ Handler
|
|
|
|
|
* on exit, CC if handled
|
|
|
|
|
*--------------------------------------
|
2017-02-02 17:30:07 +00:00
|
|
|
|
IRQ stz .8+1
|
|
|
|
|
|
|
|
|
|
.1 ldx DEVSLOTn0
|
|
|
|
|
lda SSC.STATUS,x
|
2017-02-03 16:58:13 +00:00
|
|
|
|
|
2017-02-02 17:30:07 +00:00
|
|
|
|
* bpl .9 IRQ from this device ? no, exit !!!!Applewin bug #308!!!!
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2016-12-12 16:38:32 +00:00
|
|
|
|
bit #SSC.STATUS.RDRF incoming char?
|
2017-02-03 07:33:50 +00:00
|
|
|
|
beq .4
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2015-12-13 12:51:05 +00:00
|
|
|
|
*------------ IRQ In
|
|
|
|
|
|
2017-02-02 17:30:07 +00:00
|
|
|
|
ldy SSC.DATA,x read data to clear IRQ
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2017-02-03 07:33:50 +00:00
|
|
|
|
ldx INBUF.HEAD
|
|
|
|
|
txa
|
|
|
|
|
inc
|
2017-02-03 16:58:13 +00:00
|
|
|
|
and #BUF.MASK
|
|
|
|
|
cmp INBUF.TAIL
|
2017-02-02 17:30:07 +00:00
|
|
|
|
beq .8 buffer full, discard and exit
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2017-02-03 07:33:50 +00:00
|
|
|
|
sta INBUF.HEAD
|
|
|
|
|
tya
|
2015-12-13 12:51:05 +00:00
|
|
|
|
sta INBUF,x
|
2016-01-04 07:22:57 +00:00
|
|
|
|
|
2017-02-02 17:30:07 +00:00
|
|
|
|
lda #$ff
|
|
|
|
|
sta .8+1
|
|
|
|
|
|
|
|
|
|
bra .1
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2015-12-13 12:51:05 +00:00
|
|
|
|
*------------ IRQ Out
|
|
|
|
|
|
2017-02-03 07:33:50 +00:00
|
|
|
|
.3 ldx DEVSLOTn0
|
2017-02-02 17:30:07 +00:00
|
|
|
|
lda SSC.STATUS,x
|
|
|
|
|
|
2017-02-03 07:33:50 +00:00
|
|
|
|
.4 bit #SSC.STATUS.TDRE
|
2017-02-02 17:30:07 +00:00
|
|
|
|
beq .8 no transmition possible....
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2017-02-03 07:33:50 +00:00
|
|
|
|
ldy OUTBUF.TAIL something to transmit ?
|
|
|
|
|
cpy OUTBUF.HEAD
|
2017-02-02 17:30:07 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
lda OUTBUF,y
|
|
|
|
|
sta SSC.DATA,x
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2017-02-03 07:33:50 +00:00
|
|
|
|
iny
|
|
|
|
|
cpy #BUF.SIZE
|
|
|
|
|
bne .5
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.5 sty OUTBUF.TAIL
|
|
|
|
|
|
|
|
|
|
lda #$ff
|
|
|
|
|
sta .8+1
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2017-02-03 07:33:50 +00:00
|
|
|
|
bra .3
|
2015-12-13 12:51:05 +00:00
|
|
|
|
|
2017-02-02 17:30:07 +00:00
|
|
|
|
.8 lda #$ff did we finally handle and IRQ condtion ?
|
|
|
|
|
beq .9
|
|
|
|
|
clc
|
2015-12-10 18:53:30 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DRV.CS.END
|
|
|
|
|
DEVSLOTn0 .BS 1
|
2017-02-03 07:33:50 +00:00
|
|
|
|
INBUF.TAIL .BS 1
|
|
|
|
|
INBUF.HEAD .BS 1
|
|
|
|
|
OUTBUF.TAIL .BS 1
|
|
|
|
|
OUTBUF.HEAD .BS 1
|
2015-12-10 18:53:30 +00:00
|
|
|
|
INBUF .BS BUF.SIZE
|
|
|
|
|
OUTBUF .BS BUF.SIZE
|
2017-02-02 17:30:07 +00:00
|
|
|
|
*--------------------------------------
|
2017-10-27 06:36:46 +00:00
|
|
|
|
STAT .DA #S.DSTAT.S.WRITE+S.DSTAT.S.READ+S.DEV.S.IRQ
|
2017-02-02 17:30:07 +00:00
|
|
|
|
.DA #0,#0,#0
|
|
|
|
|
>PSTR "Serial Card/Port"
|
2017-10-27 06:36:46 +00:00
|
|
|
|
.DA #S.DSTAT.T.CHAR
|
2015-12-10 18:53:30 +00:00
|
|
|
|
.DA #0
|
2017-02-02 17:30:07 +00:00
|
|
|
|
.DA $0900
|
2015-12-10 18:53:30 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2017-04-13 20:59:25 +00:00
|
|
|
|
SAVE /A2OSX.SRC/DRV/SSC.I.DRV.S
|
2015-12-10 18:53:30 +00:00
|
|
|
|
ASM
|