mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-18 21:06:07 +00:00
12217347d4
- bugfix in SSC setup (SYS/KM.VSDRIVE.S.txt, drivers) - various cleanup/fix in KMs
204 lines
4.4 KiB
Plaintext
204 lines
4.4 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.BUILD
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF /A2OSX.BUILD/DRV/SSC.DRV
|
||
*--------------------------------------
|
||
.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
|
||
*--------------------------------------
|
||
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
|
||
*--------------------------------------
|
||
Dev.Detect sta hArgs
|
||
>LDYA L.MSG.DETECT
|
||
>SYSCALL CPrintFYA
|
||
|
||
stz ZPTmpPtr1
|
||
lda #$C1
|
||
sta ZPTmpPtr1+1
|
||
|
||
.1 ldx #DEVSIG.Length-1
|
||
|
||
.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
|
||
>SYSCALL CPrintFYA
|
||
|
||
lda #MLI.ERR.NODEV Not Found in any slot, exiting
|
||
sec
|
||
rts
|
||
|
||
.4 lda ZPTmpPtr1+1
|
||
and #$0F
|
||
ora #$30
|
||
sta DEV.HEADER.NAME+4
|
||
asl
|
||
asl
|
||
asl
|
||
asl
|
||
sta DEVSLOTn0
|
||
|
||
>PUSHW L.DEV.HEADER.NAME
|
||
>LDYA L.MSG.DETECT.OK
|
||
>SYSCALL CPrintFYA
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.END
|
||
DEVSIG.Offset .HS 05070B0C
|
||
DEVSIG.Value .HS 38180131
|
||
DEVSIG.Length .EQ DEVSIG.Value-DEVSIG.Offset
|
||
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"
|
||
hArgs .BS 1
|
||
*--------------------------------------
|
||
* Device Header (16 Bytes)
|
||
*--------------------------------------
|
||
DEV.HEADER cld
|
||
jmp (DRV.CS.START,x)
|
||
.DA #S.DEV.S.WRITE+S.DEV.S.READ
|
||
.BS 6
|
||
DEV.HEADER.NAME >PSTR "COM1" NAME
|
||
*--------------------------------------
|
||
* Driver Code
|
||
*--------------------------------------
|
||
DRV.CS.START .DA STATUS
|
||
.DA BADCALL
|
||
.DA BADCALL
|
||
.DA BADCALL
|
||
.DA CONTROL
|
||
.DA BADCALL
|
||
.DA OPEN
|
||
.DA CLOSE
|
||
.DA READ
|
||
.DA WRITE
|
||
L.STAT .DA STAT
|
||
.DA 0 end or relocation
|
||
*--------------------------------------
|
||
BADCALL lda #MLI.ERR.BADCALL
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
STATUS >LDYA L.STAT
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CONTROL clc
|
||
rts
|
||
*--------------------------------------
|
||
OPEN ldx DEVSLOTn0
|
||
|
||
php
|
||
sei
|
||
stz SSC.RESET,x
|
||
|
||
lda #SSC.CTL.CLKINT+SSC.CTL.B9600+SSC.CTL.8D+SSC.CTL.1S+SSC.CMD.NOP
|
||
sta SSC.CTL,x
|
||
|
||
ldx DEVSLOTn0
|
||
lda #SSC.CMD.RIRQDIS+SSC.CMD.TE+SSC.CMD.DTR
|
||
sta SSC.CMD,x
|
||
|
||
lda SSC.STATUS,x clear any IRQ pending
|
||
bmi *
|
||
plp
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CLOSE php
|
||
sei
|
||
ldx DEVSLOTn0
|
||
stz SSC.RESET,x
|
||
plp
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
READ ldx DEVSLOTn0
|
||
lda SSC.STATUS,x
|
||
bmi *
|
||
|
||
and #SSC.STATUS.RDRF incoming char?
|
||
beq .9
|
||
|
||
lda SSC.DATA,x
|
||
clc
|
||
rts
|
||
|
||
.9 lda #0
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
WRITE pha
|
||
|
||
ldx DEVSLOTn0
|
||
|
||
.1 lda SSC.STATUS,x
|
||
|
||
* and #SSC.STATUS.DCD+SSC.STATUS.DSR
|
||
* beq .9
|
||
|
||
and #SSC.STATUS.TDRE Outgoing char?
|
||
beq .1
|
||
|
||
pla
|
||
sta SSC.DATA,x
|
||
|
||
clc
|
||
rts
|
||
|
||
.9 pla
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
DRV.CS.END
|
||
DEVSLOTn0 .BS 1
|
||
*--------------------------------------
|
||
STAT .DA #S.DEVSTAT.S.WRITE+S.DEVSTAT.S.READ
|
||
.DA #0,#0,#0
|
||
>PSTR "Serial Card/Port"
|
||
.DA #S.DEVSTAT.TYPE.CHAR
|
||
.DA #0
|
||
.DA $0900
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/DRV/SSC.DRV.S
|
||
ASM
|