2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-04-28 15:04:16 +00:00
|
|
|
|
LOMEM $A00
|
2015-03-14 21:48:35 +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.DRV
|
2015-03-14 21:48:35 +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-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-12-10 18:53:30 +00:00
|
|
|
|
ZPTmpPtr1 .EQ ZPDRV
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-08-05 20:38:05 +00:00
|
|
|
|
* File Header (16 Bytes)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
2015-08-05 20:38:05 +00:00
|
|
|
|
jmp Dev.Detect cld,jmp abs=DRV
|
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 DRV Layout Version 1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA 0
|
2015-08-05 20:38:05 +00:00
|
|
|
|
.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
|
2015-12-10 18:53:30 +00:00
|
|
|
|
L.MSG.DETECT.OK .DA MSG.DETECT.OK
|
|
|
|
|
L.MSG.DETECT.KO .DA MSG.DETECT.KO
|
|
|
|
|
L.DEV.HEADER.NAME .DA DEV.HEADER.NAME
|
2015-08-05 20:38:05 +00:00
|
|
|
|
.DA 0 End Of Reloc Table
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-04-13 20:59:25 +00:00
|
|
|
|
Dev.Detect >STYA ARGS
|
2017-04-28 15:04:16 +00:00
|
|
|
|
|
2015-08-05 20:38:05 +00:00
|
|
|
|
>LDYA L.MSG.DETECT
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
|
|
|
|
stz ZPTmpPtr1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda #$C1
|
|
|
|
|
sta ZPTmpPtr1+1
|
|
|
|
|
|
2017-04-13 20:59:25 +00:00
|
|
|
|
.1 and #$0f
|
|
|
|
|
tay
|
|
|
|
|
lda A2osX.SLOTS,y
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
ldx #DEVSIG.Length-1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
.2 ldy DEVSIG.Offset,x
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda (ZPTmpPtr1),y
|
2015-06-03 18:30:57 +00:00
|
|
|
|
cmp DEVSIG.Value,x
|
|
|
|
|
bne .3
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
bra .4
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.3 inc ZPTmpPtr1+1 no match, try next slot....
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda ZPTmpPtr1+1
|
|
|
|
|
cmp #$C8
|
|
|
|
|
bne .1
|
|
|
|
|
|
2015-12-10 18:53:30 +00:00
|
|
|
|
>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-02-02 17:30:07 +00:00
|
|
|
|
lda #MLI.ERR.NODEV Not Found in any slot, exiting
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.4 lda ZPTmpPtr1+1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
and #$0F
|
2017-04-13 20:59:25 +00:00
|
|
|
|
pha
|
|
|
|
|
tay
|
|
|
|
|
lda #A2osX.SLOTS.COM
|
|
|
|
|
sta A2osX.SLOTS,y
|
|
|
|
|
pla
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ora #$30
|
2015-08-05 20:38:05 +00:00
|
|
|
|
sta DEV.HEADER.NAME+4
|
2015-06-03 18:30:57 +00:00
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
sta DEVSLOTn0
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>PUSHW L.DEV.HEADER.NAME
|
2015-12-10 18:53:30 +00:00
|
|
|
|
>LDYA L.MSG.DETECT.OK
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2015-08-05 20:38:05 +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.\r\n"
|
|
|
|
|
MSG.DETECT.OK >CSTR "SSC Installed As Device : %S\r\n"
|
|
|
|
|
MSG.DETECT.KO >CSTR "No SSC Found.\r\n"
|
2017-04-13 20:59:25 +00:00
|
|
|
|
ARGS .BS 2
|
2015-08-05 20:38:05 +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
|
2017-03-15 16:44:15 +00:00
|
|
|
|
.BS 6
|
2016-10-24 15:54:43 +00:00
|
|
|
|
DEV.HEADER.NAME >PSTR "COM1" NAME
|
2015-08-05 20:38:05 +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-08-05 20:38:05 +00:00
|
|
|
|
.DA CLOSE
|
2017-02-02 17:30:07 +00:00
|
|
|
|
.DA READ
|
|
|
|
|
.DA WRITE
|
|
|
|
|
L.STAT .DA STAT
|
2015-08-05 20:38:05 +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-10 18:53:30 +00:00
|
|
|
|
OPEN ldx DEVSLOTn0
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-12-10 18:53:30 +00:00
|
|
|
|
php
|
|
|
|
|
sei
|
2016-12-12 16:38:32 +00:00
|
|
|
|
stz SSC.RESET,x
|
2015-12-10 18:53:30 +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-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
ldx DEVSLOTn0
|
2017-04-10 08:58:45 +00:00
|
|
|
|
lda #SSC.CMD.RIRQDIS+SSC.CMD.TE+SSC.CMD.DTR
|
2016-12-12 16:38:32 +00:00
|
|
|
|
sta SSC.CMD,x
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-12-12 16:38:32 +00:00
|
|
|
|
lda SSC.STATUS,x clear any IRQ pending
|
2015-12-10 18:53:30 +00:00
|
|
|
|
bmi *
|
2015-06-03 18:30:57 +00:00
|
|
|
|
plp
|
2015-12-10 18:53:30 +00:00
|
|
|
|
clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-02-02 17:30:07 +00:00
|
|
|
|
CLOSE php
|
|
|
|
|
sei
|
|
|
|
|
ldx DEVSLOTn0
|
|
|
|
|
stz SSC.RESET,x
|
|
|
|
|
plp
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
READ ldx DEVSLOTn0
|
2016-12-12 16:38:32 +00:00
|
|
|
|
lda SSC.STATUS,x
|
2015-12-10 18:53:30 +00:00
|
|
|
|
bmi *
|
|
|
|
|
|
2016-12-12 16:38:32 +00:00
|
|
|
|
and #SSC.STATUS.RDRF incoming char?
|
2015-12-10 18:53:30 +00:00
|
|
|
|
beq .9
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-12-12 16:38:32 +00:00
|
|
|
|
lda SSC.DATA,x
|
2015-06-03 18:30:57 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2015-12-10 18:53:30 +00:00
|
|
|
|
.9 lda #0
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-02-02 17:30:07 +00:00
|
|
|
|
WRITE pha
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
ldx DEVSLOTn0
|
2017-02-02 17:30:07 +00:00
|
|
|
|
|
2016-12-12 16:38:32 +00:00
|
|
|
|
.1 lda SSC.STATUS,x
|
2017-02-02 17:30:07 +00:00
|
|
|
|
|
|
|
|
|
* and #SSC.STATUS.DCD+SSC.STATUS.DSR
|
|
|
|
|
* beq .9
|
2017-04-28 15:04:16 +00:00
|
|
|
|
|
2016-12-12 16:38:32 +00:00
|
|
|
|
and #SSC.STATUS.TDRE Outgoing char?
|
2017-02-02 17:30:07 +00:00
|
|
|
|
beq .1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-12-10 18:53:30 +00:00
|
|
|
|
pla
|
2016-12-12 16:38:32 +00:00
|
|
|
|
sta SSC.DATA,x
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2015-12-10 18:53:30 +00:00
|
|
|
|
.9 pla
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sec
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-08-05 20:38:05 +00:00
|
|
|
|
DRV.CS.END
|
2015-06-03 18:30:57 +00:00
|
|
|
|
DEVSLOTn0 .BS 1
|
2017-02-02 17:30:07 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
STAT .DA #S.DEVSTAT.S.WRITE+S.DEVSTAT.S.READ
|
|
|
|
|
.DA #0,#0,#0
|
|
|
|
|
>PSTR "Serial Card/Port"
|
2017-06-02 15:14:42 +00:00
|
|
|
|
.DA #S.DEVSTAT.T.CHAR
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA #0
|
2017-02-02 17:30:07 +00:00
|
|
|
|
.DA $0900
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/DRV/SSC.DRV.S
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ASM
|