A2osX/SYS/KERNEL.S.DRV.txt

277 lines
4.9 KiB
Plaintext
Raw Normal View History

2017-12-22 21:24:30 +00:00
NEW
2019-05-25 19:24:07 +00:00
AUTO 3,1
*--------------------------------------
2023-04-23 15:20:27 +00:00
* DRV.Disk][
2018-06-19 05:55:12 +00:00
* X = IOCTL
2018-06-20 15:02:09 +00:00
* Y,A = PTR to S.IOCTL
*--------------------------------------
2023-04-23 15:20:27 +00:00
DRV.D2 cpx #IOCTL.FORMAT
.HS 2C BIT ABS
DRV.BLK cpx #IOCTL.CONTROL
bcs .9
2018-07-06 14:42:20 +00:00
>STYA pIOCTL
2018-06-20 15:02:09 +00:00
jmp (.1,x)
2023-04-23 15:20:27 +00:00
.1 .DA DRV.BLK.S
.DA DRV.GBLK READ
.DA DRV.GBLK WRITE
.DA DRV.GBLK FORMAT
2023-04-23 15:20:27 +00:00
.9 lda #MLI.E.BADCALL
* sec
DRV.RTS rts
*--------------------------------------
2023-04-23 15:20:27 +00:00
DRV.BLK.S ldy #S.FD.DEV.SIZE
lda (pFD),y
tax
iny
lda (pFD),y
tay
bne .8
txa
bne .8
2021-05-04 17:31:21 +00:00
2023-04-23 15:20:27 +00:00
* ldx #IOCTL.STATUS
2018-07-06 14:42:20 +00:00
2023-04-23 15:20:27 +00:00
jsr DRV.GBLK
bcs DRV.RTS
2023-04-23 15:20:27 +00:00
.8 stx DRV.BLK.DIB+S.DIB.SIZE
sty DRV.BLK.DIB+S.DIB.SIZE+1
2023-04-23 15:20:27 +00:00
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
2023-04-23 15:20:27 +00:00
sta DRV.BLK.DIB+S.DIB.IDS+1,y
inx
iny
bra .1
.2 sty DRV.BLK.DIB+S.DIB.IDS
2023-04-23 15:20:27 +00:00
lda #C.SPACE
2021-05-04 17:31:21 +00:00
2023-04-23 15:20:27 +00:00
.3 cpy #16
beq .4
sta DRV.BLK.DIB+S.DIB.IDS+1,y
iny
bra .2
2023-04-23 15:20:27 +00:00
.4 >LDYAI DRV.BLK.DIB
2018-07-06 14:42:20 +00:00
jmp DRV.STATUS.YA
*--------------------------------------
2023-04-23 15:20:27 +00:00
DRV.BLK.DIB .DA #S.DIB.S.BLOCK+S.DIB.S.WRITE+S.DIB.S.READ
2018-07-06 14:42:20 +00:00
.BS 3
2023-04-23 15:20:27 +00:00
.BS 17 IDString
.DA #S.DIB.T.BLK
2018-07-06 14:42:20 +00:00
.DA #0
2018-08-25 11:23:59 +00:00
.DA K.VER
*--------------------------------------
2023-04-23 15:20:27 +00:00
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
*--------------------------------------
2023-04-23 15:20:27 +00:00
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"
*--------------------------------------
2018-07-06 14:42:20 +00:00
* IOCTL to BLK protocol converter
2019-05-06 12:58:15 +00:00
* in : pIOCTL
*--------------------------------------
2023-04-23 15:20:27 +00:00
DRV.GBLK txa
lsr
2021-04-29 11:56:34 +00:00
sta DRV.BLK.P CMD
2020-12-15 13:23:22 +00:00
ldy #S.FD.DEV.DEVID Drive 1, or 2
2018-07-11 15:13:29 +00:00
lda (pFD),y
dec O or 1
lsr in Carry
php
2018-07-10 15:33:13 +00:00
ldy #S.FD.DEV.BUSID
2018-07-11 15:13:29 +00:00
lda (pFD),y
asl
asl
asl
asl
asl
plp
ror DSSS0000
2021-04-29 11:56:34 +00:00
sta DRV.BLK.P+1 UNITNUM
2018-07-06 14:42:20 +00:00
ldx #3
ldy #S.IOCTL.BUFPTR+3
2020-11-19 15:34:02 +00:00
2018-07-06 14:42:20 +00:00
.1 lda (pIOCTL),y BUF,BLKNUM
2021-04-29 11:56:34 +00:00
sta DRV.BLK.P+2,x
2018-07-06 14:42:20 +00:00
dey
dex
bpl .1
2020-11-19 15:34:02 +00:00
2018-07-10 15:33:13 +00:00
ldy #S.FD.DEV.BUSPTR
lda (pFD),y
2018-07-06 14:42:20 +00:00
sta .3+1
iny
2018-07-10 15:33:13 +00:00
lda (pFD),y
2018-07-06 14:42:20 +00:00
sta .3+2
2020-01-28 16:42:51 +00:00
2018-07-06 14:42:20 +00:00
jsr GO.ProDOS
2020-01-28 16:42:51 +00:00
2018-07-06 14:42:20 +00:00
ldx #5
2020-11-19 15:34:02 +00:00
2021-04-29 11:56:34 +00:00
.2 lda DRV.BLK.P,x
sta DRV.BLK.Cmd,x
2018-07-06 14:42:20 +00:00
dex
bpl .2
2020-11-19 15:34:02 +00:00
2018-07-06 14:42:20 +00:00
.3 jsr $ffff SELF MODIFIED
jsr GO.A2osX
rts
2021-04-29 11:56:34 +00:00
DRV.BLK.P .BS 6
*--------------------------------------
* Smartport Driver
*--------------------------------------
2023-04-23 15:20:27 +00:00
DRV.SP >STYA pIOCTL
2019-05-06 12:58:15 +00:00
>STYA .3 smartport Params
2018-07-06 14:42:20 +00:00
txa
lsr
2019-05-06 12:58:15 +00:00
sta .2
2018-07-06 14:42:20 +00:00
tax
lda DRV.SP.Cnt,x
2020-01-07 16:46:50 +00:00
sta (pIOCTL) S.IOCTL.CNT
ldy #S.FD.DEV.DEVID
lda (pFD),y
ldy #S.IOCTL.UNITNUM
sta (pIOCTL),y
2018-07-10 15:33:13 +00:00
ldy #S.FD.DEV.BUSPTR
lda (pFD),y
2019-05-06 12:58:15 +00:00
sta .1+1
iny
2018-07-10 15:33:13 +00:00
lda (pFD),y
2019-05-06 12:58:15 +00:00
sta .1+2
2020-08-18 15:00:56 +00:00
jsr GO.ProDOS Remapped SP
2020-01-28 16:42:51 +00:00
2019-05-06 12:58:15 +00:00
.1 jsr $ffff
.2 .BS 1
.3 .BS 2
2020-08-18 15:00:56 +00:00
jsr GO.A2osX
rts
2018-07-06 14:42:20 +00:00
DRV.SP.Cnt .HS 03030301030101010404
*--------------------------------------
2018-07-05 15:39:36 +00:00
* NULL DEVICE
* - OPEN,WRITE,CLOSE always succeed.
* - READ returns EOF.
*--------------------------------------
2023-04-23 15:20:27 +00:00
DRV.NULL >STYA pIOCTL
2018-12-21 14:32:45 +00:00
txa
2021-05-04 17:31:21 +00:00
beq DRV.NULL.S
2023-04-23 15:20:27 +00:00
cmp #IOCTL.READ
beq DRV.NULL.R
cmp #IOCTL.OPEN
bcc .9
cmp #IOCTL.IRQ
bcs .9
rts
.9 jmp A2osX.BADCALL
*--------------------------------------
2021-05-04 17:31:21 +00:00
DRV.NULL.S >LDYAI DRV.NULL.DIB
2018-12-21 14:32:45 +00:00
*--------------------------------------
2018-07-06 14:42:20 +00:00
DRV.STATUS.YA >STYA .2+1
2021-05-04 17:31:21 +00:00
ldy #S.IOCTL.S
2018-07-06 14:42:20 +00:00
lda (pIOCTL),y
beq .1
2020-11-19 15:34:02 +00:00
2021-05-04 17:31:21 +00:00
cmp #S.IOCTL.S.GETDIB
2018-07-06 14:42:20 +00:00
bne .9
2020-11-19 15:34:02 +00:00
2018-07-19 15:33:55 +00:00
ldx #S.DIB-1
2018-07-06 14:42:20 +00:00
.HS 2C bit abs
.1 ldx #3
ldy #S.IOCTL.BUFPTR
lda (pIOCTL),y
sta .3+1
iny
lda (pIOCTL),y
sta .3+2
2020-11-19 15:34:02 +00:00
2018-07-06 14:42:20 +00:00
.2 lda $ffff,x SELF MODIFIED
.3 sta $ffff,x SELF MODIFIED
dex
bpl .2
2020-11-19 15:34:02 +00:00
2018-07-06 14:42:20 +00:00
clc
rts
.9 lda #MLI.E.BADCTL
sec
rts
*--------------------------------------
2021-05-04 17:31:21 +00:00
DRV.NULL.R ldx #C.EOF
2021-04-29 11:56:34 +00:00
ldy #S.IOCTL.BYTECNT
2018-07-05 15:39:36 +00:00
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
2023-04-23 15:20:27 +00:00
clc
2018-07-05 15:39:36 +00:00
rts
*--------------------------------------
2023-04-23 15:20:27 +00:00
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
2020-12-15 13:23:22 +00:00
SAVE usr/src/sys/kernel.s.drv
LOAD usr/src/sys/kernel.s
ASM