A2osX/SYS/KERNEL.S.IO.txt

199 lines
4.2 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
*--------------------------------------
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
2020-02-16 20:45:16 +00:00
IO.OPEN.BDEV jsr SHARED.GetPDrv
2019-07-31 15:10:59 +00:00
ldx #IOCTL.OPEN
lda IO.hDev
2020-02-16 20:45:16 +00:00
jsr SHARED.pDrvJmp
2019-07-31 15:10:59 +00:00
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
2020-02-16 20:45:16 +00:00
jsr SHARED.GetPDRV
2018-07-13 14:38:24 +00:00
>LDYAI K.S.IOCTL
2020-02-16 20:45:16 +00:00
jsr SHARED.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
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
2020-02-16 20:45:16 +00:00
jmp SHARED.GetDevStatus
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
*--------------------------------------
MAN
2018-11-17 17:17:13 +00:00
SAVE USR/SRC/SYS/KERNEL.S.IO
LOAD USR/SRC/SYS/KERNEL.S
ASM