A2osX/SYS/KERNEL.S.IO.txt

302 lines
5.9 KiB
Plaintext
Raw Normal View History

NEW
2019-05-15 05:46:12 +00:00
AUTO 3,1
2018-10-04 15:30:14 +00:00
*--------------------------------------
2019-01-13 13:10:14 +00:00
IO.OPEN.CDEV
2019-02-28 16:45:33 +00:00
IO.OPEN.BDEV jsr K.IOCTL.GetPDrv
2018-07-12 15:20:39 +00:00
ldx #IOCTL.OPEN
2019-02-28 16:45:33 +00:00
lda IO.hDev
2018-10-05 06:25:15 +00:00
jsr K.IOCTL.pDrvJmp
2018-09-05 15:22:46 +00:00
bcs .9
2018-12-03 06:59:30 +00:00
2019-02-28 16:45:33 +00:00
lda IO.hDev
2019-01-13 13:10:14 +00:00
2018-09-05 15:22:46 +00:00
.9 rts
*--------------------------------------
2019-07-08 15:39:14 +00:00
IO.OPEN.DSOCK
*--------------------------------------
IO.OPEN.SSOCK lda IO.hFD
2018-10-04 15:30:14 +00:00
clc
rts
2018-07-10 15:33:13 +00:00
*--------------------------------------
2018-07-11 15:13:29 +00:00
IO.CLOSE.REG
2018-11-19 16:15:16 +00:00
IO.CLOSE.DIR ldy #S.FD.REG.REF
2018-10-03 15:25:03 +00:00
lda (pFD),y
beq .1
sta K.MLI.PARAMS+1
>MLICALL MLICLOSE
.1 ldy #S.FD.REG.IOBUF
2019-06-10 13:52:20 +00:00
lda (pFD),y
beq .2
jsr K.FreeMem
.2 lda IO.hFD
jmp K.FreeMem
2018-07-10 15:33:13 +00:00
*--------------------------------------
2018-07-11 15:13:29 +00:00
IO.CLOSE.CDEV
2018-10-04 15:30:14 +00:00
IO.CLOSE.BDEV
2019-05-08 19:41:46 +00:00
clc
rts
2018-07-11 15:13:29 +00:00
*--------------------------------------
2018-10-03 15:25:03 +00:00
IO.CLOSE.DSOCK
2019-02-26 07:00:37 +00:00
IO.CLOSE.SSOCK
2019-05-08 19:41:46 +00:00
ldy #S.FD.SSOCK.CLOSE
lda (pFD),y
tax Function Offset in LIB
2019-02-26 07:00:37 +00:00
2019-05-08 19:41:46 +00:00
ldy #S.FD.SSOCK.IOHANDLER
lda (pFD),y
jsr K.GetMemPtr
>STYA .1+1
lda IO.hFD
2019-06-11 05:52:24 +00:00
.1 jmp $FFFF SELF MODIFIED
2019-02-18 06:42:17 +00:00
*--------------------------------------
2019-02-27 15:00:56 +00:00
IO.CLOSE.NOD ldx #2
2019-02-19 11:30:45 +00:00
lda IO.hFD
2019-02-27 15:00:56 +00:00
.1 cmp Nod.Table.hFD-2,x
2019-02-19 11:30:45 +00:00
bne .2
2019-02-27 15:00:56 +00:00
stz Nod.Table.hFD-2,x
2019-02-19 11:30:45 +00:00
2019-02-27 15:00:56 +00:00
lda Nod.Table.hPath-2,x
stz Nod.Table.hPath-2,x
2019-02-19 11:30:45 +00:00
jmp K.FreeMem
.2 inx
2019-02-27 15:00:56 +00:00
cpx #K.Nod.MAX+2
2019-02-19 11:30:45 +00:00
bne .1
2019-02-28 16:45:33 +00:00
lda #E.INVH
* sec
2019-02-19 11:30:45 +00:00
rts
2018-06-19 05:55:12 +00:00
*--------------------------------------
2018-08-08 15:13:37 +00:00
IO.READ.REG ldx #MLIREAD
.HS 2C BIT ABS
2018-07-24 16:00:24 +00:00
*--------------------------------------
2018-08-08 15:13:37 +00:00
IO.WRITE.REG ldx #MLIWRITE
2018-10-04 06:13:44 +00:00
2018-07-10 15:33:13 +00:00
ldy #S.FD.REG.REF
2018-07-24 16:00:24 +00:00
lda (pFD),y
2018-08-08 15:13:37 +00:00
sta K.MLI.PARAMS+1
2018-10-03 15:25:03 +00:00
>PULLW K.MLI.PARAMS+2
>PULLW K.MLI.PARAMS+4
2018-08-08 15:13:37 +00:00
lda #4 Param Count = 4 for MLIREAD & MLIWRITE
jsr GP.MLICall
2018-11-08 14:23:06 +00:00
bcs .9
2018-09-06 15:36:44 +00:00
>LDYA K.MLI.PARAMS+6
2018-11-08 14:23:06 +00:00
.9 rts
2018-06-19 05:55:12 +00:00
*--------------------------------------
2018-07-24 16:00:24 +00:00
IO.READ.CDEV ldx #IOCTL.READ
.HS 2C BIT ABS
*--------------------------------------
IO.WRITE.CDEV ldx #IOCTL.WRITE
2019-05-12 20:45:11 +00:00
>PULLW K.S.IOCTL+S.IOCTL.BUFPTR
>PULLW K.S.IOCTL+S.IOCTL.BYTECNT
2018-09-06 15:36:44 +00:00
jsr K.IOCTL.GetPDRV
2018-06-19 05:55:12 +00:00
2018-07-13 14:38:24 +00:00
>LDYAI K.S.IOCTL
2018-07-24 16:00:24 +00:00
2019-02-22 16:08:37 +00:00
jsr K.IOCTL.pDrvJmp
2019-05-12 20:45:11 +00:00
bcs .9
>LDYA K.S.IOCTL+S.IOCTL.BYTECNT
2019-02-22 16:08:37 +00:00
2019-05-12 20:45:11 +00:00
.9 rts
2018-06-19 05:55:12 +00:00
*--------------------------------------
2018-10-08 15:41:00 +00:00
IO.WRITE.SSOCK ldy #S.FD.SSOCK.WRITE
2018-07-24 16:00:24 +00:00
.HS 2C BIT ABS
*--------------------------------------
2018-11-19 16:15:16 +00:00
IO.READ.SSOCK ldy #S.FD.SSOCK.READ
2019-05-12 20:45:11 +00:00
2018-07-24 16:00:24 +00:00
lda (pFD),y
tax Function Offset in LIB
2018-11-19 07:43:00 +00:00
ldy #S.FD.SSOCK.IOHANDLER
2018-07-24 16:00:24 +00:00
lda (pFD),y
2018-06-21 15:12:10 +00:00
jsr K.GetMemPtr
2018-11-19 16:15:16 +00:00
>STYA .1+1
2018-06-19 05:55:12 +00:00
2019-03-02 20:47:58 +00:00
lda IO.hFD
2018-11-19 16:15:16 +00:00
2019-05-12 20:45:11 +00:00
.1 jmp $FFFF SELF MODIFIED
2019-02-22 13:34:06 +00:00
*--------------------------------------
2018-07-11 15:13:29 +00:00
*/--------------------------------------
* # IOCTL
* ## C
2019-01-13 13:10:14 +00:00
* `int ioctl(short int DevID, int request, void * param );`
2018-07-11 15:13:29 +00:00
* ## ASM
* `PUSHWI param`
2018-07-19 15:33:55 +00:00
* `PUSHBI request`
2019-01-13 13:10:14 +00:00
* `lda hDEV`
2018-07-11 15:13:29 +00:00
* `>SYSCALL IOCTL`
2018-10-11 15:23:06 +00:00
* ## RETURN VALUE
2018-07-11 15:13:29 +00:00
* Y,A = ...
*\--------------------------------------
2019-01-13 13:10:14 +00:00
K.IOCTL tax
2019-02-27 15:00:56 +00:00
lda Dev.Table,x
2019-01-13 13:10:14 +00:00
beq K.IOCTL.9
2019-07-27 20:51:39 +00:00
ldy Dev.Table-1,x
>STYA pFD
2018-08-08 15:13:37 +00:00
2018-09-07 14:12:42 +00:00
jsr K.IOCTL.GetPDrv
2018-09-06 15:36:44 +00:00
2018-07-19 15:33:55 +00:00
>PULLA
tax request
>PULLYA param
2018-10-24 15:36:45 +00:00
K.IOCTL.pDrvJmp jmp (pDrv)
2018-07-11 15:13:29 +00:00
2019-01-13 13:10:14 +00:00
K.IOCTL.9 sec
lda #MLI.E.NODEV
2018-08-08 15:13:37 +00:00
>RET 3
2018-09-06 15:36:44 +00:00
*--------------------------------------
K.IOCTL.GetPDrv ldy #S.FD.DEV.DRVPTR
lda (pFD),y
sta pDRV
iny
lda (pFD),y
sta pDRV+1
rts
2018-07-10 15:33:13 +00:00
*--------------------------------------
2019-05-02 09:52:32 +00:00
IO.EOF lda (pFD)
tax
2019-02-20 16:07:43 +00:00
jmp (.1,x)
2019-05-02 09:52:32 +00:00
.1 .DA IO.EOF.REG
2019-02-20 16:07:43 +00:00
.DA STDIO.IOERR DIR
.DA IO.EOF.CDEV
.DA STDIO.IOERR BDEV
.DA STDIO.IOERR LNK
.DA STDIO.IOERR DSOCK
.DA IO.EOF.SSOCK
.DA IO.EOF.PIPE
2019-05-02 09:52:32 +00:00
*--------------------------------------
IO.EOF.REG >MLICALL MLIGETMARK
bcs IO.EOF.REG.RTS
ldy #2
.1 lda K.MLI.PARAMS+2,y
2019-07-26 14:23:07 +00:00
sta ACC32,y
2019-05-02 09:52:32 +00:00
dey
bpl .1
>MLICALL MLIGETEOF
bcs IO.EOF.REG.RTS
ldy #2
.2 lda K.MLI.PARAMS+2,y
2019-07-26 14:23:07 +00:00
eor ACC32,y
2019-05-14 16:04:16 +00:00
bne IO.EOF.FALSE
2019-05-02 09:52:32 +00:00
dey
bpl .2
2019-07-27 20:51:39 +00:00
lda #$ff
2019-05-02 09:52:32 +00:00
* clc
IO.EOF.REG.RTS rts
2019-02-20 16:07:43 +00:00
*--------------------------------------
2019-05-16 15:51:19 +00:00
IO.EOF.CDEV lda #S.IOCTL.STATCODE.EOF
jmp K.GetDevStatus.I
2019-02-20 16:07:43 +00:00
*--------------------------------------
2019-03-02 20:47:58 +00:00
IO.EOF.SSOCK ldy #S.FD.SSOCK.EOF
lda (pFD),y
tax Function Offset in LIB
ldy #S.FD.SSOCK.IOHANDLER
lda (pFD),y
jsr K.GetMemPtr
>STYA .1+1
lda IO.hFD
.1 jmp $FFFF SELF MODIFIED
*--------------------------------------
2019-05-16 15:51:19 +00:00
IO.EOF.FALSE lda #0
* clc
rts
2019-02-20 16:07:43 +00:00
*--------------------------------------
2019-07-25 15:10:59 +00:00
IO.GetPFD sta IO.hFD
jsr K.GetMemPtr
>STYA pFD
rts
*--------------------------------------
2019-07-12 14:51:57 +00:00
* X = 0 > REG
* X = 1 > DIR
* X = 2 > PIPE
*--------------------------------------
IO.MkFD stx .8+1
ldy IO.MkFD.Y,x
lda #0
ldx #S.MEM.F.INIT0+S.MEM.F.FD
jsr MEM.GetMem.YAX
bcs .9
>STYA pFD
stx IO.hFD
.8 ldx #$ff SELF MODIFIED
lda IO.MkFD.T,x
sta (pFD) X = hFD, A = T
* clc
.9 rts
IO.MkFD.Y .DA #S.FD.REG,#S.FD.DIR,#S.FD.PIPE
IO.MkFD.T .DA #S.FD.T.REG,#S.FD.T.DIR,#S.FD.T.PIPE
*--------------------------------------
2019-07-26 14:23:07 +00:00
IO.MLI.CREATE sta K.MLI.PARAMS+7 Storage Type
ldx #3
.1 lda DATELO,x
sta K.MLI.PARAMS+8,x Create Date/Time
dex
bpl .1
lda #S.FI.A.FULL
sta K.MLI.PARAMS+3 Access
>MLICALL MLICREATE
rts
*--------------------------------------
IO.MLI.OPEN >LDYAI 1024 get a ProDOS IOBUF
2019-05-03 13:08:12 +00:00
ldx #S.MEM.F.ALIGN+S.MEM.F.NOMOVE
jsr MEM.GetMem.YAX
bcs .9
>STYA K.MLI.PARAMS+3 Save Ptr to IOBUF for MLIOPEN call
txa
ldy #S.FD.REG.IOBUF
sta (pFD),y
>MLICALL MLIOPEN
bcs .9
lda K.MLI.PARAMS+5 get ref_num
ldy #S.FD.REG.REF
sta (pFD),y
sta K.MLI.PARAMS+1 Next MLI Calls are REF_NUM based
* clc
.9 rts
*--------------------------------------
2019-07-29 15:38:55 +00:00
IO.DEV.FIFO .AS "/DEV/FIFO"
2018-07-11 15:13:29 +00:00
*--------------------------------------
MAN
2018-11-17 17:17:13 +00:00
SAVE USR/SRC/SYS/KERNEL.S.IO
LOAD USR/SRC/SYS/KERNEL.S
ASM