A2osX/SYS/KERNEL.S.FIO.txt

164 lines
3.0 KiB
Plaintext
Raw Normal View History

2017-12-22 21:24:30 +00:00
NEW
PREFIX /A2OSX.BUILD
2017-12-22 21:24:30 +00:00
AUTO 4,1
*/--------------------------------------
2018-06-21 15:12:10 +00:00
* # LoadTxtFile
* Load TXT a file in memory (with ending 0)
2018-06-14 15:31:36 +00:00
* **In:**
* Y,A = File Path
2018-06-14 15:31:36 +00:00
* **Out:**
* Y,A = File Length (without ending 0)
* X = hMem of Loaded File
*\--------------------------------------
2018-06-21 15:12:10 +00:00
K.LoadTxtFile pha
>PUSHWI 0 Aux type
2018-10-02 15:52:30 +00:00
>PUSHBI S.FI.T.TXT
>PUSHBI O.RDONLY
pla
sec
.HS 90 BCC
*/--------------------------------------
* # LoadFile
* Load a file in memory
2018-06-14 15:31:36 +00:00
* **In:**
* PUSHW = AUXTYPE (Handled by....
* PUSHB = TYPE ...
* PUSHB = MODE ...
2018-07-25 15:26:14 +00:00
* LDYA = PATH ...FOpen)
2018-06-14 15:31:36 +00:00
* **Out:**
* Y,A = File Length
* X = hMem of Loaded File
*\--------------------------------------
K.LoadFile clc
2017-10-27 14:56:46 +00:00
ror FIO.bTXT
2018-08-08 15:13:37 +00:00
jsr K.FOpen
2018-08-08 15:13:37 +00:00
bcc .12
rts
2018-08-08 15:13:37 +00:00
.12 sta FIO.hFile
2018-08-08 15:13:37 +00:00
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
2017-10-27 14:56:46 +00:00
bit FIO.bTXT Add 1 to buffer size for ending 0
bpl .1
iny
bne .1
inc
bne .1
2018-08-08 15:13:37 +00:00
.10 lda #K.E.FTB
.11 bra .99
2018-06-21 15:12:10 +00:00
.1 jsr K.GetMem
bcs .99
2017-10-27 14:56:46 +00:00
>STYA FIO.Mem
2017-09-29 06:36:27 +00:00
stx .8+1
2018-08-08 15:13:37 +00:00
>PUSHW K.S.Stat+S.STAT.SIZE
2018-07-25 15:26:14 +00:00
>PUSHW FIO.Mem
2018-07-24 16:00:24 +00:00
lda FIO.hFile
2017-01-12 17:43:45 +00:00
jsr K.FRead
bcs .98
sty .6+1
sta .7+1 Save Bytes read
jsr .99 close file
2016-09-21 15:20:37 +00:00
2017-10-27 14:56:46 +00:00
bit FIO.bTXT
bpl .6
clc set ending 0
lda .6+1
2017-10-27 14:56:46 +00:00
adc FIO.Mem
sta .5+1
lda .7+1
2017-10-27 14:56:46 +00:00
adc FIO.Mem+1
sta .5+2
.5 stz $ffff Self Modified
.6 ldy #$ff Self Modified
.7 lda #$ff Self Modified
2017-09-29 06:36:27 +00:00
.8 ldx #$ff Self Modified
clc
2016-09-21 15:20:37 +00:00
.9 rts
.98 pha
2017-09-29 06:36:27 +00:00
lda .8+1
2018-06-22 06:24:35 +00:00
jsr K.FreeMem
pla
2016-09-21 15:20:37 +00:00
.99 pha
2017-10-27 14:56:46 +00:00
lda FIO.hFile
2018-06-22 06:24:35 +00:00
jsr K.FClose
pla
sec
2016-09-21 15:20:37 +00:00
rts
*--------------------------------------
2017-10-27 14:56:46 +00:00
FIO.bTXT .BS 1
FIO.hFile .BS 1
FIO.Mem .BS 2
*/--------------------------------------
* # ChTyp
2018-09-05 15:22:46 +00:00
* Change The type of a ProDOS File
* ## C
* `int chtyp(const char *filepath, const char filetype);`
* ## ASM
2018-06-14 15:31:36 +00:00
* **In:**
2018-09-05 15:22:46 +00:00
* `>PUSHBI filetype`
* `>LDYA filepath`
* `>SYSCALL chtyp`
* **Out:**
*\--------------------------------------
2018-09-05 15:22:46 +00:00
K.ChTyp jsr PFT.CheckPathYA
jsr STDIO.SetMLIPathYA
>PULLB .1+1
>MLICALL MLIGETFILEINFO
bcs .9
.1 lda #$ff
2017-10-27 14:56:46 +00:00
sta K.MLI.PARAMS+S.FI.T
>MLICALL MLISETFILEINFO
.9 rts
*/--------------------------------------
* # ChMod
2018-06-14 15:31:36 +00:00
* **In:**
* PUSHW = UID
* PUSHW = PATH
*\--------------------------------------
K.ChMod
*/--------------------------------------
* # ChOwn
2018-06-14 15:31:36 +00:00
* **In:**
2018-09-05 15:22:46 +00:00
* PUSHW = mod
* PUSHW = PATH
*\--------------------------------------
K.ChOwn
*/--------------------------------------
* # ChGrp
2018-06-14 15:31:36 +00:00
* **In:**
* PUSHW = GID
* PUSHW = PATH
*\--------------------------------------
K.ChGrp
sec
rts
*--------------------------------------
2015-03-14 21:48:35 +00:00
MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.FIO
LOAD /A2OSX.SRC/SYS/KERNEL.S
2015-03-14 21:48:35 +00:00
ASM