2017-08-24 12:46:48 +00:00
|
|
|
|
PR#3
|
|
|
|
|
PREFIX /A2OSX.BUILD
|
|
|
|
|
LOMEM $A00
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # Stat
|
|
|
|
|
* Return information about a file
|
|
|
|
|
* ## In :
|
|
|
|
|
* PUSHW = PTR to S.STAT buffer
|
|
|
|
|
* PUSHW = PTR to Filename (PSTR)
|
|
|
|
|
* ## Out :
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.Stat jsr PFT.CheckPathSTK
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>PULLW K.MLI.PARAMS+1
|
|
|
|
|
>PULLW K.Stat.StoreY+1
|
2017-08-24 12:46:48 +00:00
|
|
|
|
>MLICALL MLIGETFILEINFO
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
ldx K.MLI.PARAMS+S.FILEINFO.ACCESS
|
|
|
|
|
|
|
|
|
|
lda #S.STAT.MODE.XO+S.STAT.MODE.WO+S.STAT.MODE.RO
|
|
|
|
|
cpx #S.FILEINFO.ACCESS.FULL
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
lda #S.STAT.MODE.XO+S.STAT.MODE.RO
|
|
|
|
|
cpx #S.FILEINFO.ACCESS.R
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
|
|
|
|
|
.2 ldy #S.STAT.MODE
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.Stat.StoreY
|
2017-08-24 12:46:48 +00:00
|
|
|
|
|
|
|
|
|
ldx #K.Stat.DST-K.Stat.SRC
|
|
|
|
|
|
|
|
|
|
.3 ldy K.Stat.SRC-1,x
|
|
|
|
|
lda K.MLI.PARAMS,y
|
|
|
|
|
ldy K.Stat.DST-1,x
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.Stat.StoreY
|
2017-08-24 12:46:48 +00:00
|
|
|
|
dex
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
ldy #S.STAT.SIZE
|
|
|
|
|
lda #0
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.Stat.StoreY
|
2017-08-24 12:46:48 +00:00
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
lda K.MLI.PARAMS+S.FILEINFO.BLOCKSUSED
|
|
|
|
|
asl
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.Stat.StoreY
|
2017-08-24 12:46:48 +00:00
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
lda K.MLI.PARAMS+S.FILEINFO.BLOCKSUSED+1
|
|
|
|
|
rol
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.Stat.StoreY
|
2017-08-24 12:46:48 +00:00
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
rol
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.Stat.StoreY
|
2017-08-24 12:46:48 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
2017-08-25 06:37:21 +00:00
|
|
|
|
|
|
|
|
|
K.Stat.StoreY sta $ffff,y
|
|
|
|
|
rts
|
2017-08-24 12:46:48 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.Stat.SRC .DA #S.FILEINFO.TYPE
|
|
|
|
|
.DA #S.FILEINFO.AUXTYPE,#S.FILEINFO.AUXTYPE+1
|
|
|
|
|
.DA #S.FILEINFO.BLOCKSUSED,#S.FILEINFO.BLOCKSUSED+1
|
|
|
|
|
K.Stat.DST .DA #S.STAT.P.TYPE
|
|
|
|
|
.DA #S.STAT.P.AUXTYPE,#S.STAT.P.AUXTYPE+1
|
|
|
|
|
.DA #S.STAT.BLOCKS,#S.STAT.BLOCKS+1
|
2017-08-24 15:29:22 +00:00
|
|
|
|
*/-------------------------------------
|
2017-08-25 06:37:21 +00:00
|
|
|
|
* # MKDirYA
|
2017-08-24 15:29:22 +00:00
|
|
|
|
* ## In:
|
|
|
|
|
* Y,A = DIR name
|
|
|
|
|
* ## Out:
|
|
|
|
|
* CC : success
|
|
|
|
|
* CS : error
|
|
|
|
|
* A = EC
|
|
|
|
|
*\-------------------------------------
|
|
|
|
|
K.MKDir.YA jsr PFT.CheckPathYA
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr STDIO.SetMLIPathYA
|
2017-08-24 15:29:22 +00:00
|
|
|
|
lda #S.FILEINFO.ACCESS.FULL
|
|
|
|
|
sta K.MLI.PARAMS+S.FILEINFO.ACCESS
|
|
|
|
|
lda #S.FILEINFO.TYPE.DIR
|
|
|
|
|
sta K.MLI.PARAMS+S.FILEINFO.TYPE
|
|
|
|
|
lda #S.FILEINFO.STORETYPE.DIR
|
|
|
|
|
sta K.MLI.PARAMS+S.FILEINFO.STORETYPE
|
|
|
|
|
|
|
|
|
|
* jsr DATETIME
|
|
|
|
|
|
|
|
|
|
ldx #3
|
|
|
|
|
.1 lda DATELO,x
|
|
|
|
|
sta K.MLI.PARAMS+8,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
>MLICALL MLICREATE
|
|
|
|
|
rts
|
|
|
|
|
*/--------------------------------------
|
2017-08-25 06:37:21 +00:00
|
|
|
|
* # MkNod.YA
|
2017-08-24 15:29:22 +00:00
|
|
|
|
* return a hFile for a given Device Name
|
|
|
|
|
* ## IN:
|
|
|
|
|
* Y,A=DevName
|
|
|
|
|
* ## OUT:
|
|
|
|
|
* CC = OK, CS = ERROR
|
|
|
|
|
* A = hFILE
|
|
|
|
|
*\--------------------------------------
|
2017-08-25 06:37:21 +00:00
|
|
|
|
K.MkNod.YA jsr K.GetDevByName.YA Ptr1=NAME
|
2017-08-24 15:29:22 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
>STYA pDev
|
|
|
|
|
stx .1+1
|
|
|
|
|
|
|
|
|
|
ldy #S.DEV.S
|
|
|
|
|
lda (pDev),y
|
|
|
|
|
bit #S.DEV.S.BLOCK
|
|
|
|
|
bne .99
|
|
|
|
|
|
|
|
|
|
txa Pass DEV.ID to OPEN
|
|
|
|
|
ldx #DEVMGR.OPEN
|
|
|
|
|
jsr pDevJmp
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDYAI S.NODE.DEV
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.GetMem0.YA
|
2017-08-24 15:29:22 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPPtr3 Ptr3=S.NODE
|
|
|
|
|
|
|
|
|
|
ldy #S.NODE.T
|
|
|
|
|
lda #S.NODE.T.CDEV
|
|
|
|
|
sta (ZPPtr3),y
|
|
|
|
|
|
|
|
|
|
ldy #S.NODE.DEV.ID
|
|
|
|
|
|
|
|
|
|
.1 lda #$ff Self Modified
|
|
|
|
|
sta (ZPPtr3),y
|
|
|
|
|
|
|
|
|
|
ldy #S.NODE.DEV.JMP
|
|
|
|
|
lda pDev
|
|
|
|
|
sta (ZPPtr3),y
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda pDev+1
|
|
|
|
|
sta (ZPPtr3),y
|
|
|
|
|
txa
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
|
|
|
|
|
.99 lda #MLI.ERR.IO
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*/--------------------------------------
|
2017-08-25 06:37:21 +00:00
|
|
|
|
* # MkNod.A
|
2017-08-24 15:29:22 +00:00
|
|
|
|
* return a hFile for a given Socket
|
|
|
|
|
* ## IN:
|
|
|
|
|
* A=hSocket
|
|
|
|
|
* ## OUT:
|
|
|
|
|
* CC = OK, CS = ERROR
|
|
|
|
|
* X = hFILE
|
|
|
|
|
* Y,A = pFILE
|
|
|
|
|
*\--------------------------------------
|
2017-08-25 06:37:21 +00:00
|
|
|
|
K.MkNod.A sta .1+1
|
2017-08-24 15:29:22 +00:00
|
|
|
|
>LDYAI S.NODE.SSOCK
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.GetMem0.YA
|
2017-08-24 15:29:22 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
ldy #S.NODE.T
|
|
|
|
|
lda #S.NODE.T.SSOCK
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
ldy #S.NODE.SSOCK.HSKT
|
|
|
|
|
.1 lda #$ff
|
|
|
|
|
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
>LDYA ZPPtr1
|
|
|
|
|
.9 rts
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # MKFIFO
|
|
|
|
|
* return a S.FILE to a new FIFO
|
|
|
|
|
* ## IN:
|
|
|
|
|
* ## OUT:
|
|
|
|
|
* CC = OK, CS = ERROR
|
|
|
|
|
* A = hFILE
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.MKFIFO >LDYAI 256
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.GetMem.YA
|
2017-08-24 15:29:22 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
stx .1+1 save FIFO buffer
|
|
|
|
|
|
|
|
|
|
>LDYAI S.NODE.FIFO
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.GetMem0.YA
|
2017-08-24 15:29:22 +00:00
|
|
|
|
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
ldy #S.NODE.T
|
|
|
|
|
lda #S.NODE.T.FIFO
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
iny S.NODE.FIFO.hMem
|
|
|
|
|
.1 lda #$ff Self Modified
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
txa
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 pha save error code
|
|
|
|
|
lda .1+1 get back FIFO buffer
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.FreeMem.A
|
2017-08-24 15:29:22 +00:00
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
|
|
|
|
|
.99 rts
|
2017-08-24 12:46:48 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE /A2OSX.SRC/SYS/KERNEL.S.STAT
|
|
|
|
|
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
|
|
|
|
ASM
|