A2osX/DRV/PIC.DRV.S.txt
2019-10-03 08:25:27 +02:00

155 lines
3.4 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
PREFIX
AUTO 4,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 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 >STYA ARGS
>LDYA L.MSG.DETECT
>SYSCALL printf
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 ZPTmpPtr1+1 no match, try next slot....
lda ZPTmpPtr1+1
cmp #$C8
bne .1
>LDYA L.MSG.DETECT.KO
>SYSCALL printf
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
ora #$30
sta DEV.HEADER.NAME+4
asl
asl
asl
asl
sta DEVSLOTn0
>PUSHW L.DEV.HEADER.NAME
>LDYA L.MSG.DETECT.OK
>SYSCALL printf
clc
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
*--------------------------------------
* Device Header (16 Bytes)
*--------------------------------------
DEV.HEADER cld
jmp (DRV.CS.START,x)
.DA #S.DEV.S.WRITE
.BS 6
DEV.HEADER.NAME >PSTR "LPT1"
*--------------------------------------
* Driver Code
*--------------------------------------
DRV.CS.START .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
*--------------------------------------
MAN
SAVE /A2OSX/SRC/DRV/PIC.DRV.S
ASM