mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-26 13:49:18 +00:00
180 lines
3.3 KiB
Plaintext
180 lines
3.3 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.BUILD
|
||
LOMEM $A00
|
||
INC 1
|
||
AUTO 6
|
||
*/--------------------------------------
|
||
* # LoadFile
|
||
* ## In:
|
||
* PUSHW = AUXTYPE (Handled by....
|
||
* PUSHB = TYPE ...
|
||
* PUSHB = MODE ...
|
||
* PUSHW = PATH ...FOpen)
|
||
* ## Out:
|
||
* Y,A = File Length
|
||
* X = hMem of Loaded File
|
||
*\--------------------------------------
|
||
K.LoadFile jsr K.FOpen
|
||
bcs .9
|
||
sta K.LoadFile.hFile
|
||
|
||
jsr K.LoadFile.GetLen
|
||
bcs .99
|
||
|
||
>LDYA K.LoadFile.FSize
|
||
jsr K.GetMem.YA
|
||
bcs .99
|
||
>STYA K.LoadFile.Mem
|
||
stx .8+1
|
||
|
||
>PUSHW K.LoadFile.Mem
|
||
>PUSHW K.LoadFile.FSize
|
||
>PUSHB K.LoadFile.hFile
|
||
jsr K.FRead
|
||
bcs .97
|
||
|
||
phy
|
||
pha Save Bytes read
|
||
|
||
jsr .99
|
||
|
||
pla
|
||
ply
|
||
.8 ldx #$ff Self Modified
|
||
clc
|
||
.9 rts
|
||
|
||
.97 pha
|
||
lda .8+1
|
||
jsr K.FreeMem.A
|
||
pla
|
||
|
||
.99 pha
|
||
lda K.LoadFile.hFile
|
||
jsr K.FClose.A
|
||
pla
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
K.LoadFile.GetLen
|
||
stz K.LoadFile.FPos
|
||
stz K.LoadFile.FPos+1
|
||
stz K.LoadFile.FPos+2
|
||
stz K.LoadFile.FPos+3
|
||
|
||
>PUSHWI K.LoadFile.FPos
|
||
>PUSHBI SYS.FSeek.END
|
||
>PUSHB K.LoadFile.hFile
|
||
jsr K.FSeek
|
||
bcs .99
|
||
|
||
>PUSHWI K.LoadFile.FPos
|
||
>PUSHB K.LoadFile.hFile
|
||
jsr K.FTell
|
||
bcs .99
|
||
|
||
lda K.LoadFile.FPos+2
|
||
ora K.LoadFile.FPos+3
|
||
bne .98 too big!
|
||
|
||
>LDYA K.LoadFile.FPos
|
||
>STYA K.LoadFile.FSize
|
||
|
||
stz K.LoadFile.FPos
|
||
stz K.LoadFile.FPos+1
|
||
|
||
>PUSHWI K.LoadFile.FPos
|
||
>PUSHBI SYS.FSeek.SET
|
||
>PUSHB K.LoadFile.hFile
|
||
jmp K.FSeek
|
||
|
||
.98 lda #SYSMGR.ERRFTB
|
||
.99 rts
|
||
*--------------------------------------
|
||
K.LoadFile.hFile .BS 1
|
||
K.LoadFile.FPos .BS 4
|
||
K.LoadFile.Mem .BS 2
|
||
K.LoadFile.FSize .BS 2
|
||
*/--------------------------------------
|
||
* # SaveFile
|
||
* ## In:
|
||
* PUSHW = SrcPtr
|
||
* PUSHW = SrcLen
|
||
* PUSHW = AUXTYPE (Handled by....
|
||
* PUSHB = TYPE ...
|
||
* PUSHB = MODE ...
|
||
* PUSHW = PATH ...FOpen)
|
||
*\--------------------------------------
|
||
K.SaveFile jsr K.FOpen
|
||
bcs .9
|
||
|
||
sta .90+1
|
||
|
||
>PUSHA
|
||
jsr K.FWrite
|
||
bcs .99
|
||
|
||
jsr .99
|
||
clc
|
||
rts
|
||
|
||
.99 pha
|
||
.90 lda #$ff
|
||
jsr K.FClose.A
|
||
pla
|
||
sec
|
||
rts
|
||
|
||
.9 pha
|
||
lda pStack Discard SrcPtr & SrcLen
|
||
clc
|
||
adc #4
|
||
sta pStack
|
||
pla
|
||
sec
|
||
rts
|
||
*/--------------------------------------
|
||
* # 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.FILEINFO.TYPE
|
||
>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
|