A2osX/DRV/SSC.DRV.S.txt

203 lines
4.2 KiB
Plaintext
Raw Normal View History

2015-03-14 21:48:35 +00:00
PR#3
2015-06-03 18:30:57 +00:00
PREFIX /A2OSX.SRC
2015-03-14 21:48:35 +00:00
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BOOT/DRV/SSC.DRV
2015-03-14 21:48:35 +00:00
*--------------------------------------
.INB /A2OSX.DEV/INC/MACROS.I
.INB /A2OSX.DEV/INC/A2OSX.I
2015-03-14 21:48:35 +00:00
*--------------------------------------
ZPTmpPtr1 .EQ ZPDRV
2015-06-03 18:30:57 +00:00
*--------------------------------------
.INB DRV/X.SER.6551.S
2015-03-14 21:48:35 +00:00
*--------------------------------------
* File Header (16 Bytes)
2015-03-14 21:48:35 +00:00
*--------------------------------------
CS.START cld
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
.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
2015-03-14 21:48:35 +00:00
*--------------------------------------
Dev.Detect sta hArgs
>LDYA L.MSG.DETECT
>SYSCALL CPrintFYA
stz ZPTmpPtr1
2015-03-14 21:48:35 +00:00
lda #$C1
sta ZPTmpPtr1+1
2015-06-03 18:30:57 +00:00
.1 ldx #DEVSIG.Length-1
.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
>LDYA L.MSG.DETECT.KO
>SYSCALL CPrintFYA
2015-06-03 18:30:57 +00:00
lda #DEVMGR.ERRNOHW Not Found in any slot, exiting
sec
rts
.4 lda ZPTmpPtr1+1
sta DEVSLOTCn
2015-03-14 21:48:35 +00:00
and #$0F
2015-06-03 18:30:57 +00:00
sta DEVSLOT0n
2015-03-14 21:48:35 +00:00
ora #$30
sta DEV.HEADER.NAME+4
2015-06-03 18:30:57 +00:00
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.\n"
MSG.DETECT.OK >CSTR "SSC Installed As Device : %S\n"
MSG.DETECT.KO >CSTR "No SSC Found.\n"
hArgs .BS 1
*--------------------------------------
* Device Header (16 Bytes)
*--------------------------------------
DEV.HEADER cld
jmp (DRV.CS.START,x)
.HS 00 DevID
.DA #S.DEV.F.EVENT+S.DEV.F.COUT+S.DEV.F.CHAR
DEV.HEADER.NAME >PSTR "COM1" NAME
.HS 00
.HS 00.00.00.00
*--------------------------------------
* Driver Code
*--------------------------------------
DRV.CS.START .DA OPEN
.DA GETEVENT
.DA COUT
.DA CLOSE
.DA GETINFO
.DA IRQ
L.DEVINFO .DA DEVINFO
.DA 0 end or relocation
*--------------------------------------
OPEN ldx DEVSLOTn0
2015-06-03 18:30:57 +00:00
php
sei
stz SSC.RESET,x
2015-06-03 18:30:57 +00:00
lda #$1E
sta SSC.CTL,x
2015-06-03 18:30:57 +00:00
ldx DEVSLOTn0
lda #SSC.CMD.RIRQDIS
sta SSC.CMD,x
2015-06-03 18:30:57 +00:00
lda SSC.STATUS,x clear any IRQ pending
bmi *
2015-06-03 18:30:57 +00:00
plp
clc
2015-03-14 21:48:35 +00:00
rts
*--------------------------------------
GETEVENT ldx DEVSLOTn0
lda SSC.STATUS,x
bmi *
and #SSC.STATUS.RDRF incoming char?
beq .9
2015-06-03 18:30:57 +00:00
lda SSC.DATA,x
2015-06-03 18:30:57 +00:00
ldy #S.EVT.DATA
sta (pEvent),y
iny
lda #0
sta (pEvent),y
lda #S.EVT.F.KEY
sta (pEvent)
clc
rts
.9 lda #0
2015-03-14 21:48:35 +00:00
sec
rts
*--------------------------------------
COUT pha
2015-06-03 18:30:57 +00:00
ldx DEVSLOTn0
.1 lda SSC.STATUS,x
bmi *
and #SSC.STATUS.DCD+SSC.STATUS.DSR
2015-06-03 18:30:57 +00:00
beq .9
and #SSC.STATUS.TDRE Outgoing char?
2015-06-03 18:30:57 +00:00
bne .1
pla
sta SSC.DATA,x
2015-06-03 18:30:57 +00:00
clc
rts
.9 pla
2015-06-03 18:30:57 +00:00
sec
2015-03-14 21:48:35 +00:00
rts
*--------------------------------------
CLOSE php
sei
2015-06-03 18:30:57 +00:00
ldx DEVSLOTn0
stz SSC.RESET,x
plp
2015-06-03 18:30:57 +00:00
clc
rts
*--------------------------------------
GETINFO >LDYA L.DEVINFO
IRQ clc
rts
2015-06-03 18:30:57 +00:00
*--------------------------------------
DRV.CS.END
2015-06-03 18:30:57 +00:00
DEVSLOT0n .BS 1
DEVSLOTCn .BS 1
DEVSLOTn0 .BS 1
DEVINFO .DA #S.DEVINFO.TYPE.CHAR
2015-06-03 18:30:57 +00:00
.DA #0
2015-03-14 21:48:35 +00:00
*--------------------------------------
MAN
SAVE DRV/SSC.DRV.S
ASM