A2osX/SYS/KERNEL.S.FIO.txt
2018-08-08 17:13:37 +02:00

158 lines
2.9 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
*/--------------------------------------
* # LoadTxtFile
* Load TXT a file in memory (with ending 0)
* **In:**
* Y,A = File Path
* **Out:**
* Y,A = File Length (without ending 0)
* X = hMem of Loaded File
*\--------------------------------------
K.LoadTxtFile pha
>PUSHWI 0 Aux type
>PUSHBI 4 S.FI.T.TXT
>PUSHBI SYS.FOpen.R
pla
sec
.HS 90 BCC
*/--------------------------------------
* # LoadFile
* Load a file in memory
* **In:**
* PUSHW = AUXTYPE (Handled by....
* PUSHB = TYPE ...
* PUSHB = MODE ...
* LDYA = PATH ...FOpen)
* **Out:**
* Y,A = File Length
* X = hMem of Loaded File
*\--------------------------------------
K.LoadFile clc
ror FIO.bTXT
jsr K.FOpen
bcc .12
rts
.12 sta FIO.hFile
pha
>PUSHWI K.S.Stat
pla
jsr K.FStat
bcs .11
lda K.S.Stat+S.STAT.SIZE+3
ora K.S.Stat+S.STAT.SIZE+2
bne .10
>LDYA K.S.Stat+S.STAT.SIZE
bit FIO.bTXT Add 1 to buffer size for ending 0
bpl .1
iny
bne .1
inc
bne .1
.10 lda #K.E.FTB
.11 bra .99
.1 jsr K.GetMem
bcs .99
>STYA FIO.Mem
stx .8+1
>PUSHW K.S.Stat+S.STAT.SIZE
>PUSHW FIO.Mem
lda FIO.hFile
jsr K.FRead
bcs .98
sty .6+1
sta .7+1 Save Bytes read
jsr .99 close file
bit FIO.bTXT
bpl .6
clc set ending 0
lda .6+1
adc FIO.Mem
sta .5+1
lda .7+1
adc FIO.Mem+1
sta .5+2
.5 stz $ffff Self Modified
.6 ldy #$ff Self Modified
.7 lda #$ff Self Modified
.8 ldx #$ff Self Modified
clc
.9 rts
.98 pha
lda .8+1
jsr K.FreeMem
pla
.99 pha
lda FIO.hFile
jsr K.FClose
pla
sec
rts
*--------------------------------------
FIO.bTXT .BS 1
FIO.hFile .BS 1
FIO.Mem .BS 2
*/--------------------------------------
* # ChTyp
* **In:**
* PUSHB = TYPE
* PUSHW = PATH
*\--------------------------------------
K.ChTyp jsr PFT.CheckPathSTK
jsr STDIO.PullMLIPath
>PULLB .1+1
>MLICALL MLIGETFILEINFO
bcs .9
.1 lda #$ff
sta K.MLI.PARAMS+S.FI.T
>MLICALL MLISETFILEINFO
.9 rts
*/--------------------------------------
* # ChMod
* **In:**
* PUSHW = UID
* PUSHW = PATH
*\--------------------------------------
K.ChMod
*/--------------------------------------
* # ChOwn
* **In:**
* PUSHW = UID
* PUSHW = PATH
*\--------------------------------------
K.ChOwn
*/--------------------------------------
* # ChGrp
* **In:**
* PUSHW = GID
* PUSHW = PATH
*\--------------------------------------
K.ChGrp
sec
rts
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.FIO
LOAD /A2OSX.SRC/SYS/KERNEL.S
ASM