A2osX/SYS/KERNEL.S.FIO.txt

170 lines
3.1 KiB
Plaintext
Raw Normal View History

2017-12-22 21:24:30 +00:00
NEW
2019-04-19 05:42:43 +00:00
AUTO 3,1
*/--------------------------------------
2018-06-21 15:12:10 +00:00
* # LoadTxtFile
* Load TXT a file in memory (with ending 0)
2018-12-21 14:32:45 +00:00
* ## C
* `int loadtxtfile ( const char * filename, short int flags, short int ftype, int auxtype );`
* ## ASM
2018-06-14 15:31:36 +00:00
* **In:**
2018-12-21 14:32:45 +00:00
* `>PUSHW auxtype`
* `>PUSHB ftype`
* `>PUSHB flags`
* `>LDYA filename`
* `>SYSCALL loadtxtfile`
2018-10-11 15:23:06 +00:00
* ## RETURN VALUE
* Y,A = File Length (without ending 0)
* X = hMem of Loaded File
*\--------------------------------------
2019-01-04 13:17:31 +00:00
.DUMMY
.OR ZPTMP
FIO.bTXT .BS 1
FIO.hFILE .BS 1
FIO.MemPtr .BS 2
FIO.hMem .BS 1
FIO.BytesRead .BS 2
.ED
*--------------------------------------
2018-12-21 14:32:45 +00:00
K.LoadTxtFile sec
.HS 90 BCC
*/--------------------------------------
* # LoadFile
* Load a file in memory
2018-12-21 14:32:45 +00:00
* ## C
* `int loadfile ( const char * filename, short int flags, short int ftype, int auxtype );`
* ## ASM
2018-06-14 15:31:36 +00:00
* **In:**
2018-12-21 14:32:45 +00:00
* `>PUSHW auxtype`
* `>PUSHB ftype`
* `>PUSHB flags`
* `>LDYA filename`
* `>SYSCALL loadfile`
2018-10-11 15:23:06 +00:00
* ## RETURN VALUE
* Y,A = File Length
* X = hMem of Loaded File
*\--------------------------------------
K.LoadFile clc
2018-12-21 14:32:45 +00:00
2017-10-27 14:56:46 +00:00
ror FIO.bTXT
jsr K.FOpen
2018-12-21 14:32:45 +00:00
bcs .9
2018-11-07 06:59:37 +00:00
2019-01-04 13:17:31 +00:00
.12 sta FIO.hFILE
2018-11-07 06:59:37 +00:00
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
2018-11-07 06:59:37 +00:00
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
2018-10-21 20:54:07 +00:00
.10 lda #E.FTB
2018-08-08 15:13:37 +00:00
.11 bra .99
2018-06-21 15:12:10 +00:00
.1 jsr K.GetMem
bcs .99
2019-01-04 13:17:31 +00:00
>STYA FIO.MemPtr
stx FIO.hMem
2018-08-08 15:13:37 +00:00
>PUSHW K.S.Stat+S.STAT.SIZE
2019-01-04 13:17:31 +00:00
>PUSHW FIO.MemPtr
lda FIO.hFILE
2017-01-12 17:43:45 +00:00
jsr K.FRead
2018-12-21 14:32:45 +00:00
bcc .2
pha
2019-01-04 13:17:31 +00:00
lda FIO.hMem
2018-12-21 14:32:45 +00:00
jsr K.FreeMem
pla
.99 pha
2019-01-04 13:17:31 +00:00
lda FIO.hFILE
2018-12-21 14:32:45 +00:00
jsr K.FClose
pla
sec
.9 rts
2019-01-04 13:17:31 +00:00
.2 >STYA FIO.BytesRead
2017-10-27 14:56:46 +00:00
bit FIO.bTXT
2018-12-21 14:32:45 +00:00
bpl .5
pha set ending 0
tya
* clc
2019-01-04 13:17:31 +00:00
adc FIO.MemPtr
2018-12-21 14:32:45 +00:00
sta .4+1
2018-12-21 14:32:45 +00:00
pla
2019-01-04 13:17:31 +00:00
adc FIO.MemPtr+1
2018-12-21 14:32:45 +00:00
sta .4+2
2018-12-21 14:32:45 +00:00
.4 stz $ffff Self Modified
.5 jsr .99 close file
2019-01-04 13:17:31 +00:00
>LDYA FIO.BytesRead
ldx FIO.hMem
clc
2016-09-21 15:20:37 +00:00
rts
*/--------------------------------------
* # 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`
2018-10-11 15:23:06 +00:00
* ## RETURN VALUE
*\--------------------------------------
2018-09-05 15:22:46 +00:00
K.ChTyp jsr PFT.CheckPathYA
2018-11-16 16:04:20 +00:00
bcs .99
>PULLB .1+1
>MLICALL MLIGETFILEINFO
bcs .9
2018-11-07 06:59:37 +00:00
.1 lda #$ff
2017-10-27 14:56:46 +00:00
sta K.MLI.PARAMS+S.FI.T
>MLICALL MLISETFILEINFO
.9 rts
2018-11-16 16:04:20 +00:00
.99 >RET 1 discard filetype
*/--------------------------------------
* # 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
2018-11-17 17:17:13 +00:00
SAVE USR/SRC/SYS/KERNEL.S.FIO
LOAD USR/SRC/SYS/KERNEL.S
2015-03-14 21:48:35 +00:00
ASM