A2osX/DRV/PIC.DRV.S.txt
2020-08-25 16:54:30 +02:00

197 lines
4.0 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
.TF drv/pic.drv
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/mli.e.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 0
.DA #32 SS
.DA #2 ZP
.DA 0
*--------------------------------------
* 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.DRV.CS.START .DA DRV.CS.START
L.FD.DEV .DA FD.DEV
L.FD.DEV.NAME .DA FD.DEV.NAME
.DA 0 End Of Reloc Table
*--------------------------------------
Dev.Detect >STYA ARGS
>LDYA L.MSG.DETECT
>SYSCALL PutS
stz ZPTmpPtr1
lda #$C1
sta ZPTmpPtr1+1
.1 and #$0f
tay
lda A2osX.S,y
bne .3
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 FD.DEV.NAME+3
inc ZPTmpPtr1+1 no match, try next slot....
lda ZPTmpPtr1+1
cmp #$C8
bne .1
>LDYA L.MSG.DETECT.KO
>SYSCALL PutS
lda #MLI.E.NODEV Not Found in any slot, exiting
sec
rts
.4 lda ZPTmpPtr1+1
and #$0F
pha
tay
lda #A2osX.S.COM
sta A2osX.S,y
pla
asl
asl
asl
asl
sta DEVSLOTn0
.8 >PUSHW L.MSG.DETECT.OK
>PUSHW L.FD.DEV.NAME
>PUSHBI 2
>SYSCALL PrintF
>PUSHWI DRV.END
>PUSHWI DRV.CS.END-DRV.CS.START
>PUSHWI DRV.CS.START
>LDYA L.DRV.CS.START
>SYSCALL InsDrv
bcs .9
>STYA FD.DEV+S.FD.DEV.DRVPTR
>PUSHW L.FD.DEV
>PUSHW L.FD.DEV.NAME
>SYSCALL MKDev
.9 rts
*--------------------------------------
CS.END
DEVSIG.Offset .HS 0507
DEVSIG.Value .HS 4848
DEVSIG.Length .EQ DEVSIG.Value-DEVSIG.Offset
MSG.DETECT .AZ "Apple PIC (Parallel Interface Card).\r\n"
MSG.DETECT.OK .AZ "PIC Installed As Device : %S\r\n"
MSG.DETECT.KO .AZ "No PIC Found.\r\n"
ARGS .BS 2
*--------------------------------------
FD.DEV .DA #S.FD.T.CDEV
.DA #0 HANDLER
.DA #0 BUSID
.DA #0 DEVID
.DA 0 BUSPTR
.BS 2 DRVPTR
.DA 0 DCBPTR
.DA 0 BUFPTR
FD.DEV.NAME .AZ "lpt1"
*--------------------------------------
* Driver Code
*--------------------------------------
DRV.CS.START cld
jmp (.1,x)
.1 .DA STATUS
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA CONTROL
.DA A2osX.BADCALL
.DA OPEN
.DA CLOSE
.DA A2osX.BADCALL
.DA WRITE
L.STAT .DA STAT
.DA 0 end or relocation
*--------------------------------------
STATUS >LDYA L.STAT
clc
rts
*--------------------------------------
CONTROL
clc
rts
*--------------------------------------
OPEN
clc
rts
*--------------------------------------
CLOSE
clc
rts
*--------------------------------------
WRITE
clc
rts
*--------------------------------------
DRV.CS.END
DEVSLOT0n .BS 1
DEVSLOTCn .BS 1
DEVSLOTn0 .BS 1
*--------------------------------------
STAT .DA #S.DIB.S.WRITE
.DA #0,#0,#0
>PSTR "Parallel Card"
.DA #0,#0,#0
.DA #S.DIB.T.CHAR
.DA #0
.DA $0900
*--------------------------------------
DIB .DA #S.DIB.S.WRITE
.DA #0,#0,#0
>PSTR "Serial Card/Port"
.DA #S.DIB.T.CHAR
.DA #0
.DA K.VER
*--------------------------------------
DCB .DA #S.DCB.T.COM
.DA #0 FLAGS
.DA 0
.DA #0
.DA #0
.DA #0
.DA #0
*--------------------------------------
DRV.END
MAN
SAVE usr/src/drv/pic.drv.s
ASM