mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-29 02:49:54 +00:00
273 lines
5.4 KiB
Plaintext
273 lines
5.4 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
*--------------------------------------
|
||
* DRV.DiskII
|
||
* X = IOCTL
|
||
* Y,A = PTR to S.IOCTL
|
||
*--------------------------------------
|
||
DRV.DiskII cld
|
||
cpx #IOCTL.FORMAT
|
||
bcs DRV.RamDrive.9
|
||
>STYA pIOCTL
|
||
jmp (.1,x)
|
||
|
||
.1 .DA DRV.DiskII.S
|
||
.DA DRV.BLK READ
|
||
.DA DRV.BLK WRITE
|
||
*--------------------------------------
|
||
DRV.DiskII.S >LDYAI DRV.DiskII.DIB
|
||
jmp DRV.STATUS.YA
|
||
*--------------------------------------
|
||
DRV.DiskII.DIB .DA #S.DIB.S.BLOCK+S.DIB.S.WRITE+S.DIB.S.READ
|
||
.DA 280
|
||
.DA #0
|
||
>PSTR "Disk ][ 5.25"
|
||
.BS 4
|
||
.DA #S.DIB.T.DISKII
|
||
.DA #0
|
||
.DA K.VER
|
||
*--------------------------------------
|
||
* DRV.RamDrive
|
||
* X = IOCTL
|
||
* Y,A = PTR to S.IOCTL
|
||
*--------------------------------------
|
||
DRV.RamDrive cld
|
||
cpx #IOCTL.CONTROL
|
||
bcs DRV.RamDrive.9
|
||
>STYA pIOCTL
|
||
jmp (.1,x)
|
||
.1 .DA DRV.RamDrive.S
|
||
.DA DRV.BLK READ
|
||
.DA DRV.BLK WRITE
|
||
.DA DRV.BLK FORMAT
|
||
DRV.RamDrive.9 jmp A2osX.BadCall
|
||
*--------------------------------------
|
||
DRV.RamDrive.S jsr DRV.Blk
|
||
bcs .9
|
||
|
||
stx DRV.RamDrive.DIB+S.DIB.SIZE
|
||
sty DRV.RamDrive.DIB+S.DIB.SIZE+1
|
||
>LDYAI DRV.RamDrive.DIB
|
||
jmp DRV.STATUS.YA
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
DRV.RamDrive.DIB
|
||
.DA #S.DIB.S.BLOCK+S.DIB.S.WRITE+S.DIB.S.READ
|
||
.BS 3
|
||
>PSTR "ProDOS /RAM Disk"
|
||
.DA #S.DIB.T.RAM
|
||
.DA #0
|
||
.DA K.VER
|
||
*--------------------------------------
|
||
* DRV.BlkDev
|
||
* X = IOCTL
|
||
* Y,A = PTR to S.IOCTL
|
||
*--------------------------------------
|
||
DRV.BlkDev cld
|
||
cpx #IOCTL.CONTROL
|
||
bcs DRV.RamDrive.9
|
||
>STYA pIOCTL
|
||
jmp (.1,x)
|
||
.1 .DA DRV.BlkDev.S
|
||
.DA DRV.BLK READ
|
||
.DA DRV.BLK WRITE
|
||
.DA DRV.BLK FORMAT
|
||
*--------------------------------------
|
||
DRV.BlkDev.S jsr DRV.Blk
|
||
bcs .9
|
||
|
||
stx DRV.BlkDev.DIB+S.DIB.SIZE
|
||
sty DRV.BlkDev.DIB+S.DIB.SIZE+1
|
||
|
||
>LDYAI DRV.BlkDev.DIB
|
||
jmp DRV.STATUS.YA
|
||
.9 rts
|
||
*--------------------------------------
|
||
DRV.BlkDev.DIB .DA #S.DIB.S.BLOCK+S.DIB.S.WRITE+S.DIB.S.READ
|
||
.BS 3
|
||
>PSTR "ProDOS Block Dev"
|
||
.DA #S.DIB.T.PRODOS
|
||
.DA #0
|
||
.DA K.VER
|
||
*--------------------------------------
|
||
* IOCTL to BLK protocol converter
|
||
* in : pIOCTL
|
||
*--------------------------------------
|
||
DRV.BLK 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.ProDOS
|
||
|
||
ldx #5
|
||
|
||
.2 lda DRV.BLK.P,x
|
||
sta DRV.BLK.Cmd,x
|
||
dex
|
||
bpl .2
|
||
|
||
.3 jsr $ffff SELF MODIFIED
|
||
|
||
jsr GO.A2osX
|
||
rts
|
||
|
||
DRV.BLK.P .BS 6
|
||
*--------------------------------------
|
||
* Smartport Driver
|
||
*--------------------------------------
|
||
DRV.SmartPort cld
|
||
>STYA pIOCTL
|
||
>STYA .3 smartport Params
|
||
|
||
txa
|
||
lsr
|
||
sta .2
|
||
tax
|
||
lda DRV.SmartPort.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.ProDOS Remapped SP
|
||
|
||
.1 jsr $ffff
|
||
.2 .BS 1
|
||
.3 .BS 2
|
||
|
||
jsr GO.A2osX
|
||
rts
|
||
|
||
DRV.SmartPort.Cnt
|
||
.HS 03030301030101010404
|
||
*--------------------------------------
|
||
* NULL DEVICE
|
||
* - OPEN,WRITE,CLOSE always succeed.
|
||
* - READ returns EOF.
|
||
*--------------------------------------
|
||
DRV.NULL cld
|
||
>STYA pIOCTL
|
||
txa
|
||
beq DRV.NULL.S
|
||
jmp (.1-12,x)
|
||
*--------------------------------------
|
||
.1
|
||
* .DA DRV.NULL.STATUS
|
||
* .DA A2osX.BADCALL READBLOCK
|
||
* .DA A2osX.BADCALL WRITEBLOCK
|
||
* .DA A2osX.BADCALL FORMAT
|
||
* .DA A2osX.BADCALL CONTROL
|
||
* .DA A2osX.BADCALL INIT
|
||
.DA DRV.CLCRTS OPEN
|
||
.DA DRV.CLCRTS CLOSE
|
||
.DA DRV.NULL.R
|
||
.DA DRV.CLCRTS WRITE
|
||
*--------------------------------------
|
||
DRV.NULL.DIB .DA #S.DIB.S.WRITE+S.DIB.S.READ+S.DIB.S.OPENED
|
||
.DA #0,#0,#0
|
||
>PSTR "NULL Device"
|
||
.BS 5
|
||
.DA #S.DIB.T.CHAR
|
||
.DA #0
|
||
.DA K.VER
|
||
*--------------------------------------
|
||
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
|
||
*--------------------------------------
|
||
DRV.CLCRTS clc
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/sys/kernel.s.drv
|
||
LOAD usr/src/sys/kernel.s
|
||
ASM
|