2018-06-08 14:42:11 +00:00
|
|
|
|
NEW
|
2019-05-15 05:46:12 +00:00
|
|
|
|
AUTO 3,1
|
2018-10-04 15:30:14 +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-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
|
|
|
|
*--------------------------------------
|
2019-07-31 15:10:59 +00:00
|
|
|
|
IO.OPEN.CDEV
|
|
|
|
|
IO.OPEN.BDEV jsr K.IOCTL.GetPDrv
|
|
|
|
|
ldx #IOCTL.OPEN
|
|
|
|
|
lda IO.hDev
|
|
|
|
|
jsr K.IOCTL.pDrvJmp
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
lda IO.hDev
|
2019-08-02 14:36:49 +00:00
|
|
|
|
* clc
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.9 rts
|
2019-07-31 15:10:59 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.CLOSE.CDEV
|
|
|
|
|
IO.CLOSE.BDEV
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
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-07-13 14:38:24 +00:00
|
|
|
|
>LDYAI K.S.IOCTL
|
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
|
|
|
|
*--------------------------------------
|
2019-07-31 15:10:59 +00:00
|
|
|
|
IO.OPEN.DSOCK
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.OPEN.SSOCK lda IO.hFD
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.CLOSE.DSOCK
|
|
|
|
|
IO.CLOSE.SSOCK
|
|
|
|
|
ldy #S.FD.SSOCK.CLOSE
|
2019-08-02 14:36:49 +00:00
|
|
|
|
.HS 2C BIT ABS
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.EOF.SSOCK ldy #S.FD.SSOCK.EOF
|
|
|
|
|
.HS 2C BIT ABS
|
2018-07-24 16:00:24 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-19 16:15:16 +00:00
|
|
|
|
IO.READ.SSOCK ldy #S.FD.SSOCK.READ
|
2019-07-31 15:10:59 +00:00
|
|
|
|
.HS 2C BIT ABS
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.WRITE.SSOCK ldy #S.FD.SSOCK.WRITE
|
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
|
2019-10-03 06:25:27 +00:00
|
|
|
|
lda IO.hFD
|
2019-05-12 20:45:11 +00:00
|
|
|
|
.1 jmp $FFFF SELF MODIFIED
|
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-09-07 14:12:42 +00:00
|
|
|
|
jsr K.IOCTL.GetPDrv
|
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)
|
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
|
2019-10-03 06:25:27 +00:00
|
|
|
|
*--------------------------------------
|
2019-05-02 09:52:32 +00:00
|
|
|
|
IO.EOF.REG >MLICALL MLIGETMARK
|
2019-08-02 14:36:49 +00:00
|
|
|
|
bcs .9
|
2019-05-02 09:52:32 +00:00
|
|
|
|
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
|
2019-08-02 14:36:49 +00:00
|
|
|
|
bcs .9
|
2019-05-02 09:52:32 +00:00
|
|
|
|
|
|
|
|
|
ldy #2
|
|
|
|
|
.2 lda K.MLI.PARAMS+2,y
|
2019-07-26 14:23:07 +00:00
|
|
|
|
eor ACC32,y
|
2019-08-02 14:36:49 +00:00
|
|
|
|
bne .8 FALSE
|
2019-05-02 09:52:32 +00:00
|
|
|
|
dey
|
|
|
|
|
bpl .2
|
2019-08-02 14:36:49 +00:00
|
|
|
|
lda #$ff TRUE
|
2019-05-02 09:52:32 +00:00
|
|
|
|
* clc
|
2019-08-02 14:36:49 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.8 lda #0
|
|
|
|
|
* clc
|
|
|
|
|
.9 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-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
|
2019-10-03 06:25:27 +00:00
|
|
|
|
* clc
|
2019-07-12 14:51:57 +00:00
|
|
|
|
.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-11-15 14:40:48 +00:00
|
|
|
|
ldx #S.MEM.F.ALIGN
|
2019-05-03 13:08:12 +00:00
|
|
|
|
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
|
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
* clc
|
2019-05-03 13:08:12 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2019-07-31 15:10:59 +00:00
|
|
|
|
IO.CLOSE.NOD ldx #2
|
|
|
|
|
|
|
|
|
|
lda IO.hFD
|
|
|
|
|
|
|
|
|
|
.1 cmp Nod.Table.hFD-2,x
|
|
|
|
|
bne .2
|
|
|
|
|
stz Nod.Table.hFD-2,x
|
|
|
|
|
lda Nod.Table.hPath-2,x
|
|
|
|
|
stz Nod.Table.hPath-2,x
|
|
|
|
|
jmp K.FreeMem
|
|
|
|
|
.2 inx
|
|
|
|
|
cpx #K.Nod.MAX+2
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda #E.INVH
|
2019-10-03 06:25:27 +00:00
|
|
|
|
* sec
|
2019-07-31 15:10:59 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-11-26 06:46:02 +00:00
|
|
|
|
IO.DEV.FIFO .AS "/dev/fifo"
|
2018-07-11 15:13:29 +00:00
|
|
|
|
*--------------------------------------
|
2018-06-08 14:42:11 +00:00
|
|
|
|
MAN
|
2018-11-17 17:17:13 +00:00
|
|
|
|
SAVE USR/SRC/SYS/KERNEL.S.IO
|
|
|
|
|
LOAD USR/SRC/SYS/KERNEL.S
|
2018-06-08 14:42:11 +00:00
|
|
|
|
ASM
|