mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-28 10:52:33 +00:00
190 lines
3.8 KiB
Plaintext
190 lines
3.8 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF drv/sptape.drv
|
||
*--------------------------------------
|
||
.INB inc/macros.i
|
||
.INB inc/a2osx.i
|
||
.INB inc/mli.e.i
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR ZPDRV
|
||
ZS.START
|
||
ZPTmpPtr1 .BS 2
|
||
DevID .BS 1
|
||
DevCnt .BS 1
|
||
ZS.END .ED
|
||
*--------------------------------------
|
||
* 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 #ZS.END-ZS.START Zero Page Size
|
||
.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.SP.DIB .DA SP.DIB
|
||
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
|
||
|
||
jsr SP.ScanSlots
|
||
bcc .4
|
||
|
||
>LDYA L.MSG.DETECT.KO
|
||
>SYSCALL PutS
|
||
|
||
lda #MLI.E.NODEV Not Found in any slot, exiting
|
||
sec
|
||
rts
|
||
|
||
.4 lda ZPTmpPtr1+1
|
||
and #$F
|
||
sta FD.DEV+S.FD.DEV.BUSID
|
||
ora #$30
|
||
sta FD.DEV.NAME+2
|
||
|
||
lda DevID
|
||
sta FD.DEV+S.FD.DEV.DEVID
|
||
ora #$30
|
||
sta FD.DEV.NAME+3
|
||
|
||
>LDYA ZPTmpPtr1
|
||
>STYA FD.DEV+S.FD.DEV.BUSPTR
|
||
|
||
.8 >PUSHW L.MSG.DETECT.OK
|
||
>PUSHW L.FD.DEV.NAME
|
||
>PUSHBI 2
|
||
>SYSCALL PrintF
|
||
bcs .9
|
||
|
||
* >STYA FD.DEV+S.FD.DEV.DRVPTR
|
||
* S.FD.DEV.DRVPTR = NULL -> KERNEL will hook to NATIVE SP
|
||
|
||
>PUSHW L.FD.DEV
|
||
>PUSHW L.FD.DEV.NAME
|
||
>SYSCALL MKDev
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
SP.ScanSlots lda #$C1
|
||
sta ZPTmpPtr1+1
|
||
|
||
>LDYA L.SP.DIB
|
||
>STYA SP.Params+S.IOCTL.BUFPTR
|
||
|
||
.1 stz ZPTmpPtr1
|
||
|
||
ldx #SmartPort.SIG-SmartPort.OFS-1
|
||
|
||
.2 ldy SmartPort.OFS,x Check if there is a smartport firmware
|
||
lda (ZPTmpPtr1),y
|
||
cmp SmartPort.SIG,x
|
||
bne .7 not a Disk Controller...
|
||
|
||
dex
|
||
bpl .2
|
||
|
||
ldy #$ff
|
||
lda (ZPTmpPtr1),y
|
||
clc
|
||
adc #3
|
||
sta ZPTmpPtr1
|
||
|
||
ldx #0 Unit Number = 0
|
||
lda #S.IOCTL.S.STATUS
|
||
jsr SP.Call
|
||
bcs .7
|
||
|
||
lda SP.DIB
|
||
beq .7
|
||
|
||
sta DevCnt
|
||
stz DevID
|
||
|
||
.3 inc DevID
|
||
ldx DevID
|
||
lda #S.IOCTL.S.GETDIB
|
||
jsr SP.Call
|
||
bcs .6
|
||
|
||
lda SP.DIB+S.DIB.T
|
||
cmp #S.DIB.T.TAPE
|
||
bne .6
|
||
|
||
clc
|
||
rts
|
||
|
||
.6 dec DevCnt
|
||
bne .3
|
||
|
||
.7 inc ZPTmpPtr1+1
|
||
lda ZPTmpPtr1+1
|
||
cmp #$C8
|
||
bne .1
|
||
|
||
lda #0
|
||
sec
|
||
.9 rts
|
||
*--------------------------------------
|
||
SP.Call stx SP.Params+S.IOCTL.UNITNUM
|
||
sta SP.Params+S.IOCTL.S
|
||
|
||
lda #0 SP STATUS (NO IOCTL values !!!)
|
||
sta .1
|
||
|
||
jsr .2
|
||
|
||
.1 lda SP.Params
|
||
rts
|
||
|
||
.2 jmp (ZPTmpPtr1)
|
||
*--------------------------------------
|
||
CS.END
|
||
*--------------------------------------
|
||
MSG.DETECT .CZ "A2osX SmartPort Tape Driver"
|
||
MSG.DETECT.OK .CZ "Tape Installed As Device : %s\r\n"
|
||
MSG.DETECT.KO .CZ "No Device Found."
|
||
ARGS .BS 2
|
||
*--------------------------------------
|
||
SmartPort.OFS .HS 01030507
|
||
SmartPort.SIG .HS 20000300
|
||
SP.Params .DA #3 ParamCount
|
||
.BS 1 UnitNum
|
||
.BS 2 StatBuf
|
||
.BS 1 StatusCode
|
||
.BS 5 -> S.IOCTL
|
||
SP.DIB .BS S.DIB
|
||
*--------------------------------------
|
||
FD.DEV .DA #S.FD.T.CDEV
|
||
.DA #0 HANDLER
|
||
.BS 1 BUSID
|
||
.BS 1 DEVID
|
||
.DA 0 BUSPTR
|
||
.DA 0 DRVPTR
|
||
.DA 0 DCBPTR
|
||
.DA 0 BUFPTR
|
||
FD.DEV.NAME .AZ "st00"
|
||
*--------------------------------------
|
||
DRV.END
|
||
MAN
|
||
SAVE usr/src/drv/sptape.drv.s
|
||
ASM
|