2017-12-22 21:24:30 +00:00
|
|
|
|
NEW
|
2018-11-17 17:17:13 +00:00
|
|
|
|
PREFIX
|
2017-12-22 21:24:30 +00:00
|
|
|
|
AUTO 4,1
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*/--------------------------------------
|
2018-06-21 15:12:10 +00:00
|
|
|
|
* # LoadTxtFile
|
2017-10-19 06:19:54 +00:00
|
|
|
|
* 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
|
2017-10-19 06:19:54 +00:00
|
|
|
|
* 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
|
|
|
|
|
FIO.ZPSIZE .EQ *
|
|
|
|
|
.ED
|
|
|
|
|
*--------------------------------------
|
2018-12-21 14:32:45 +00:00
|
|
|
|
K.LoadTxtFile sec
|
2017-10-19 06:19:54 +00:00
|
|
|
|
.HS 90 BCC
|
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # LoadFile
|
2017-10-19 06:19:54 +00:00
|
|
|
|
* 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
|
2016-10-26 20:51:06 +00:00
|
|
|
|
* Y,A = File Length
|
|
|
|
|
* X = hMem of Loaded File
|
|
|
|
|
*\--------------------------------------
|
2017-10-19 06:19:54 +00:00
|
|
|
|
K.LoadFile clc
|
2018-12-21 14:32:45 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
ror FIO.bTXT
|
2017-10-19 06:19:54 +00:00
|
|
|
|
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
|
2017-10-19 06:19:54 +00:00
|
|
|
|
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
|
2017-10-19 06:19:54 +00:00
|
|
|
|
|
2018-06-21 15:12:10 +00:00
|
|
|
|
.1 jsr K.GetMem
|
2017-10-09 15:30:48 +00:00
|
|
|
|
bcs .99
|
2019-01-04 13:17:31 +00:00
|
|
|
|
>STYA FIO.MemPtr
|
|
|
|
|
stx FIO.hMem
|
2017-10-09 15:30:48 +00:00
|
|
|
|
|
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
|
2017-06-21 15:46:43 +00:00
|
|
|
|
|
2019-01-04 13:17:31 +00:00
|
|
|
|
.2 >STYA FIO.BytesRead
|
2016-09-20 16:00:51 +00:00
|
|
|
|
|
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
|
2017-10-19 06:19:54 +00:00
|
|
|
|
|
2019-01-04 13:17:31 +00:00
|
|
|
|
adc FIO.MemPtr
|
2018-12-21 14:32:45 +00:00
|
|
|
|
sta .4+1
|
2017-10-19 06:19:54 +00:00
|
|
|
|
|
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
|
2017-10-19 06:19:54 +00:00
|
|
|
|
|
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
|
2016-09-20 16:00:51 +00:00
|
|
|
|
clc
|
2016-09-21 15:20:37 +00:00
|
|
|
|
rts
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*/--------------------------------------
|
2017-04-03 21:13:46 +00:00
|
|
|
|
* # 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
|
2017-04-03 21:13:46 +00:00
|
|
|
|
*\--------------------------------------
|
2018-09-05 15:22:46 +00:00
|
|
|
|
K.ChTyp jsr PFT.CheckPathYA
|
2018-11-16 16:04:20 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2017-04-03 21:13:46 +00:00
|
|
|
|
>PULLB .1+1
|
|
|
|
|
>MLICALL MLIGETFILEINFO
|
|
|
|
|
bcs .9
|
2018-11-07 06:59:37 +00:00
|
|
|
|
|
2017-04-03 21:13:46 +00:00
|
|
|
|
.1 lda #$ff
|
2017-10-27 14:56:46 +00:00
|
|
|
|
sta K.MLI.PARAMS+S.FI.T
|
2017-04-04 13:07:58 +00:00
|
|
|
|
>MLICALL MLISETFILEINFO
|
2017-04-03 21:13:46 +00:00
|
|
|
|
.9 rts
|
2018-11-16 16:04:20 +00:00
|
|
|
|
|
|
|
|
|
.99 >RET 1 discard filetype
|
2017-04-03 21:13:46 +00:00
|
|
|
|
*/--------------------------------------
|
2017-08-25 06:37:21 +00:00
|
|
|
|
* # ChMod
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **In:**
|
2017-08-25 06:37:21 +00:00
|
|
|
|
* PUSHW = UID
|
|
|
|
|
* PUSHW = PATH
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.ChMod
|
|
|
|
|
*/--------------------------------------
|
2017-04-03 21:13:46 +00:00
|
|
|
|
* # ChOwn
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **In:**
|
2018-09-05 15:22:46 +00:00
|
|
|
|
* PUSHW = mod
|
2017-04-04 13:07:58 +00:00
|
|
|
|
* PUSHW = PATH
|
2017-04-03 21:13:46 +00:00
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.ChOwn
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # ChGrp
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **In:**
|
2017-04-04 13:07:58 +00:00
|
|
|
|
* PUSHW = GID
|
|
|
|
|
* PUSHW = PATH
|
2017-04-03 21:13:46 +00:00
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.ChGrp
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2016-01-09 22:40:19 +00:00
|
|
|
|
*--------------------------------------
|
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
|