mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-24 14:31:05 +00:00
277 lines
4.9 KiB
Plaintext
277 lines
4.9 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
*--------------------------------------
|
||
* DRV.Disk][
|
||
* X = IOCTL
|
||
* Y,A = PTR to S.IOCTL
|
||
*--------------------------------------
|
||
DRV.D2 cpx #IOCTL.FORMAT
|
||
.HS 2C BIT ABS
|
||
DRV.BLK cpx #IOCTL.CONTROL
|
||
bcs .9
|
||
|
||
>STYA pIOCTL
|
||
jmp (.1,x)
|
||
|
||
.1 .DA DRV.BLK.S
|
||
.DA DRV.GBLK READ
|
||
.DA DRV.GBLK WRITE
|
||
.DA DRV.GBLK FORMAT
|
||
|
||
.9 lda #MLI.E.BADCALL
|
||
* sec
|
||
DRV.RTS rts
|
||
*--------------------------------------
|
||
DRV.BLK.S ldy #S.FD.DEV.SIZE
|
||
lda (pFD),y
|
||
tax
|
||
|
||
iny
|
||
lda (pFD),y
|
||
tay
|
||
bne .8
|
||
|
||
txa
|
||
bne .8
|
||
|
||
* ldx #IOCTL.STATUS
|
||
|
||
jsr DRV.GBLK
|
||
bcs DRV.RTS
|
||
|
||
.8 stx DRV.BLK.DIB+S.DIB.SIZE
|
||
sty DRV.BLK.DIB+S.DIB.SIZE+1
|
||
|
||
ldy #S.FD.DEV.TYPE
|
||
lda (pFD),y
|
||
tay
|
||
|
||
lda DRV.IDS,y
|
||
tax
|
||
lda DRV.IDS+1,y
|
||
sta DRV.BLK.DIB+S.DIB.T
|
||
|
||
ldy #0
|
||
|
||
.1 lda DRV.D2.IDS,x
|
||
beq .2
|
||
|
||
sta DRV.BLK.DIB+S.DIB.IDS+1,y
|
||
inx
|
||
iny
|
||
bra .1
|
||
|
||
.2 sty DRV.BLK.DIB+S.DIB.IDS
|
||
|
||
lda #C.SPACE
|
||
|
||
.3 cpy #16
|
||
beq .4
|
||
|
||
sta DRV.BLK.DIB+S.DIB.IDS+1,y
|
||
iny
|
||
bra .2
|
||
|
||
.4 >LDYAI DRV.BLK.DIB
|
||
jmp DRV.STATUS.YA
|
||
*--------------------------------------
|
||
DRV.BLK.DIB .DA #S.DIB.S.BLOCK+S.DIB.S.WRITE+S.DIB.S.READ
|
||
.BS 3
|
||
.BS 17 IDString
|
||
.DA #S.DIB.T.BLK
|
||
.DA #0
|
||
.DA K.VER
|
||
*--------------------------------------
|
||
DRV.IDS .DA #0,#S.DIB.T.D2
|
||
.DA #DRV.RAM.IDS-DRV.D2.IDS,#S.DIB.T.BLK
|
||
.DA #DRV.USER.IDS-DRV.D2.IDS,#S.DIB.T.BLK
|
||
.DA #DRV.BLK.IDS-DRV.D2.IDS,#S.DIB.T.BLK
|
||
.DA #DRV.RBLK.IDS-DRV.D2.IDS,#S.DIB.T.BLK
|
||
.DA #0,#0 Smartport
|
||
.DA #DRV.RSP.IDS-DRV.D2.IDS,#S.DIB.T.BLK
|
||
*--------------------------------------
|
||
DRV.D2.IDS .CZ "Disk ][ 5.25"
|
||
DRV.RAM.IDS .CZ "ProDOS /RAM Disk"
|
||
DRV.USER.IDS .CZ "User Block Dev"
|
||
DRV.BLK.IDS .CZ "ProDOS Block Dev"
|
||
DRV.RBLK.IDS .CZ "Remapped BLK Dev"
|
||
DRV.RSP.IDS .CZ "Remapped SP Dev"
|
||
*--------------------------------------
|
||
* IOCTL to BLK protocol converter
|
||
* in : pIOCTL
|
||
*--------------------------------------
|
||
DRV.GBLK txa
|
||
lsr
|
||
sta DRV.BLK.P CMD
|
||
|
||
ldy #S.FD.DEV.DEVID Drive 1, or 2
|
||
lda (pFD),y
|
||
dec O or 1
|
||
lsr in Carry
|
||
php
|
||
ldy #S.FD.DEV.BUSID
|
||
lda (pFD),y
|
||
asl
|
||
asl
|
||
asl
|
||
asl
|
||
asl
|
||
plp
|
||
ror DSSS0000
|
||
|
||
sta DRV.BLK.P+1 UNITNUM
|
||
ldx #3
|
||
ldy #S.IOCTL.BUFPTR+3
|
||
|
||
.1 lda (pIOCTL),y BUF,BLKNUM
|
||
sta DRV.BLK.P+2,x
|
||
dey
|
||
dex
|
||
bpl .1
|
||
|
||
ldy #S.FD.DEV.BUSPTR
|
||
lda (pFD),y
|
||
sta .3+1
|
||
iny
|
||
lda (pFD),y
|
||
sta .3+2
|
||
|
||
jsr GO.MainIC
|
||
|
||
ldx #5
|
||
|
||
.2 lda DRV.BLK.P,x
|
||
sta DRV.BLK.Cmd,x
|
||
dex
|
||
bpl .2
|
||
|
||
.3 jsr $ffff SELF MODIFIED
|
||
|
||
jsr GO.AuxLC
|
||
rts
|
||
|
||
DRV.BLK.P .BS 6
|
||
*--------------------------------------
|
||
* Smartport Driver
|
||
*--------------------------------------
|
||
DRV.SP >STYA pIOCTL
|
||
>STYA .3 smartport Params
|
||
|
||
txa
|
||
lsr
|
||
sta .2
|
||
tax
|
||
lda DRV.SP.Cnt,x
|
||
sta (pIOCTL) S.IOCTL.CNT
|
||
|
||
ldy #S.FD.DEV.DEVID
|
||
lda (pFD),y
|
||
ldy #S.IOCTL.UNITNUM
|
||
sta (pIOCTL),y
|
||
|
||
ldy #S.FD.DEV.BUSPTR
|
||
lda (pFD),y
|
||
sta .1+1
|
||
iny
|
||
lda (pFD),y
|
||
sta .1+2
|
||
|
||
jsr GO.MainIC Remapped SP
|
||
|
||
.1 jsr $ffff
|
||
.2 .BS 1
|
||
.3 .BS 2
|
||
|
||
jsr GO.AuxLC
|
||
rts
|
||
|
||
DRV.SP.Cnt .HS 03030301030101010404
|
||
*--------------------------------------
|
||
* NULL DEVICE
|
||
* - OPEN,WRITE,CLOSE always succeed.
|
||
* - READ returns EOF.
|
||
*--------------------------------------
|
||
DRV.NULL >STYA pIOCTL
|
||
txa
|
||
beq DRV.NULL.S
|
||
|
||
cmp #IOCTL.READ
|
||
beq DRV.NULL.R
|
||
|
||
cmp #IOCTL.OPEN
|
||
bcc .9
|
||
|
||
cmp #IOCTL.IRQ
|
||
bcs .9
|
||
|
||
rts
|
||
|
||
.9 jmp A2osX.BADCALL
|
||
*--------------------------------------
|
||
DRV.NULL.S >LDYAI DRV.NULL.DIB
|
||
*--------------------------------------
|
||
DRV.STATUS.YA >STYA .2+1
|
||
|
||
ldy #S.IOCTL.S
|
||
lda (pIOCTL),y
|
||
beq .1
|
||
|
||
cmp #S.IOCTL.S.GETDIB
|
||
bne .9
|
||
|
||
ldx #S.DIB-1
|
||
.HS 2C bit abs
|
||
.1 ldx #3
|
||
|
||
ldy #S.IOCTL.BUFPTR
|
||
lda (pIOCTL),y
|
||
sta .3+1
|
||
iny
|
||
lda (pIOCTL),y
|
||
sta .3+2
|
||
|
||
.2 lda $ffff,x SELF MODIFIED
|
||
.3 sta $ffff,x SELF MODIFIED
|
||
dex
|
||
bpl .2
|
||
|
||
clc
|
||
rts
|
||
|
||
.9 lda #MLI.E.BADCTL
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
DRV.NULL.R ldx #C.EOF
|
||
|
||
ldy #S.IOCTL.BYTECNT
|
||
lda #1
|
||
sta (pIOCTL),y
|
||
iny
|
||
dec
|
||
sta (pIOCTL),y
|
||
|
||
ldy #S.IOCTL.BUFPTR
|
||
lda (pIOCTL),y
|
||
sta .1+1
|
||
iny
|
||
lda (pIOCTL),y
|
||
sta .1+2
|
||
.1 stx $ffff SELF MODIFIED
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
DRV.NULL.DIB .DA #S.DIB.S.WRITE+S.DIB.S.READ+S.DIB.S.OPENED
|
||
.DA #0,#0,#0
|
||
.PS "NULL Device"
|
||
.BS 5
|
||
.DA #S.DIB.T.CHAR
|
||
.DA #0
|
||
.DA K.VER
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/sys/kernel.s.drv
|
||
LOAD usr/src/sys/kernel.s
|
||
ASM
|