A2osX/DRV/PIC.DRV.S.txt

138 lines
3.1 KiB
Plaintext
Raw Normal View History

2016-03-18 07:26:49 +00:00
PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BOOT/DRV/PIC.DRV
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
*--------------------------------------
ZPTmpPtr1 .EQ ZPDRV
*--------------------------------------
SIG.05 .EQ $48
SIG.07 .EQ $48
*--------------------------------------
* 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 stz ZPTmpPtr1
lda #$C1
sta ZPTmpPtr1+1
.1 ldy #5
lda (ZPTmpPtr1),y
cmp #SIG.05
bne .2
ldy #7
lda (ZPTmpPtr1),y
cmp #SIG.07
beq .3
.2 inc ZPTmpPtr1+1
lda ZPTmpPtr1+1
cmp #$C8
bne .1
>LDYA L.MSG.DETECT.KO
>SYSCALL SYS.PSTROutYA
lda #DEVMGR.ERRNOHW Not Found in any slot, exiting
sec
rts
.3 lda ZPTmpPtr1+1
sta DEVSLOTCn
and #$0F
sta DEVSLOT0n
ora #$30
sta DEV.HEADER.NAME+4
asl
asl
asl
asl
sta DEVSLOTn0
>LDYA L.MSG.DETECT.OK
>SYSCALL SYS.PSTROutYA
>LDYA L.DEV.HEADER.NAME
>SYSCALL SYS.PSTROutYA
lda #13
>SYSCALL SYS.COutA
clc
rts
*--------------------------------------
CS.END
MSG.DETECT >PSTRING "Apple Parallel Interface Card.\n"
MSG.DETECT.OK >PSTRING "PIC Installed As Device : "
MSG.DETECT.KO >PSTRING "No PIC Found.\n"
*--------------------------------------
* Device Header (16 Bytes)
*--------------------------------------
DEV.HEADER cld
jmp (DRV.CS.START,x)
.DA #S.DEV.F.EVENT+S.DEV.F.COUT+S.DEV.F.CHAR
DEV.HEADER.NAME >PSTRING "LPT1" NAME
.HS 00.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 clc
rts
*--------------------------------------
GETEVENT lda #0
sec
rts
*--------------------------------------
COUT clc
rts
*--------------------------------------
CLOSE clc
rts
*--------------------------------------
GETINFO >LDYA L.DEVINFO
IRQ clc
rts
*--------------------------------------
DRV.CS.END
DEVSLOT0n .BS 1
DEVSLOTCn .BS 1
DEVSLOTn0 .BS 1
DEVINFO .DA #S.DEVINFO.TYPE.CHAR
.DA #0
*--------------------------------------
MAN
SAVE DRV/PIC.DRV.S
ASM