mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-25 20:33:13 +00:00
PIC.DRV:rewriting
This commit is contained in:
parent
b616022a9e
commit
ba6914be05
137
DRV/PIC.DRV.S.txt
Normal file
137
DRV/PIC.DRV.S.txt
Normal file
@ -0,0 +1,137 @@
|
||||
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
|
@ -1,108 +0,0 @@
|
||||
PR#3
|
||||
PREFIX /A2OSX.SRC
|
||||
NEW
|
||||
INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF DRV/PPIC.DRV
|
||||
*--------------------------------------
|
||||
.INB INC/MACROS.I
|
||||
.INB INC/A2OSX.I
|
||||
.INB INC/ZP.I
|
||||
*--------------------------------------
|
||||
ZPTmpPtr1 .EQ ZPDRV
|
||||
*--------------------------------------
|
||||
SIG.05 .EQ $48
|
||||
SIG.07 .EQ $48
|
||||
*--------------------------------------
|
||||
* Main DRV entry point
|
||||
* input :
|
||||
* X = CMD
|
||||
* 0 : OPEN
|
||||
* 2 : GETEVENT
|
||||
* 4 : SELECT
|
||||
* 6 : RELEASE
|
||||
* 8 : OUT
|
||||
* 10 : CLOSE
|
||||
*--------------------------------------
|
||||
* CLD $D8
|
||||
* JMP (*,x) $7C
|
||||
* #JMPTABLE
|
||||
* /JMPTABLE
|
||||
*--------------------------------------
|
||||
CS.START cld
|
||||
jmp (.1,x)
|
||||
.1 .DA OPEN
|
||||
.DA GETEVENT
|
||||
.DA SELECT
|
||||
.DA RELEASE
|
||||
.DA OUT
|
||||
.DA CLOSE
|
||||
.DA 0 end or relocation
|
||||
.DA CS.END-CS.START
|
||||
*--------------------------------------
|
||||
OPEN 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
|
||||
beq .99
|
||||
|
||||
.3 lda ZPTmpPtr1+1
|
||||
and #$0F
|
||||
sta DEVSLOT
|
||||
ora #$30
|
||||
sta DEVNAME+4
|
||||
|
||||
lda #S.DEV.F.CHAR+S.DEV.F.OUT
|
||||
sta (pDev)
|
||||
ldy #S.DEV.NAME
|
||||
|
||||
ldx #0
|
||||
.7 lda DEVNAME,x
|
||||
sta (pDev),y
|
||||
cpx DEVNAME
|
||||
beq .8
|
||||
inx
|
||||
iny
|
||||
bne .7
|
||||
.8 clc
|
||||
rts
|
||||
.99 lda #DEVMGR.ERRNOHW
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
GETEVENT lda #0
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
SELECT
|
||||
RELEASE
|
||||
*--------------------------------------
|
||||
OUT clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CLOSE clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
DEVNAME >PSTRING "LPT0"
|
||||
DEVSLOT .BS 1
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE DRV/PPIC.DRV.S
|
||||
ASM
|
Loading…
Reference in New Issue
Block a user