mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-26 13:49:18 +00:00
164 lines
3.0 KiB
Plaintext
164 lines
3.0 KiB
Plaintext
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
|
||
* Change The type of a ProDOS File
|
||
* ## C
|
||
* `int chtyp(const char *filepath, const char filetype);`
|
||
* ## ASM
|
||
* **In:**
|
||
* `>PUSHBI filetype`
|
||
* `>LDYA filepath`
|
||
* `>SYSCALL chtyp`
|
||
* **Out:**
|
||
*\--------------------------------------
|
||
K.ChTyp jsr PFT.CheckPathYA
|
||
jsr STDIO.SetMLIPathYA
|
||
>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 = mod
|
||
* 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
|