2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-03-15 16:44:15 +00:00
|
|
|
|
LOMEM $A00
|
2015-03-14 21:48:35 +00:00
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*/--------------------------------------
|
2017-10-19 06:19:54 +00:00
|
|
|
|
* # LoadTxtFile.YA
|
|
|
|
|
* 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.YA
|
|
|
|
|
pha
|
|
|
|
|
>PUSHWI 0 Aux type
|
|
|
|
|
>PUSHBI 4 S.FILEINFO.TYPE.TXT
|
|
|
|
|
>PUSHBI SYS.FOpen.R
|
|
|
|
|
pla
|
|
|
|
|
>PUSHYA
|
|
|
|
|
sec
|
|
|
|
|
.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
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2016-10-26 20:51:06 +00:00
|
|
|
|
* PUSHW = AUXTYPE (Handled by....
|
|
|
|
|
* PUSHB = TYPE ...
|
|
|
|
|
* PUSHB = MODE ...
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* PUSHW = PATH ...FOpen)
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
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
|
|
|
|
|
ror K.LoadFile.bTXT
|
|
|
|
|
|
|
|
|
|
jsr K.FOpen
|
2017-10-09 15:30:48 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
sta K.LoadFile.hFile
|
2016-09-20 16:00:51 +00:00
|
|
|
|
|
2017-10-19 06:19:54 +00:00
|
|
|
|
jsr K.LoadFile.GetSize
|
2017-10-09 15:30:48 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>LDYA K.LoadFile.FSize
|
2017-10-19 06:19:54 +00:00
|
|
|
|
|
|
|
|
|
bit K.LoadFile.bTXT Add 1 to buffer size for ending 0
|
|
|
|
|
bpl .1
|
|
|
|
|
iny
|
|
|
|
|
bne .1
|
|
|
|
|
inc
|
|
|
|
|
bne .1
|
|
|
|
|
lda #SYSMGR.ERRFTB
|
|
|
|
|
bra .99
|
|
|
|
|
|
|
|
|
|
.1 jsr K.GetMem.YA
|
2017-10-09 15:30:48 +00:00
|
|
|
|
bcs .99
|
2016-09-21 15:20:37 +00:00
|
|
|
|
>STYA K.LoadFile.Mem
|
2017-09-29 06:36:27 +00:00
|
|
|
|
stx .8+1
|
2017-10-09 15:30:48 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
>PUSHW K.LoadFile.Mem
|
2017-10-09 15:30:48 +00:00
|
|
|
|
>PUSHW K.LoadFile.FSize
|
2016-09-21 15:20:37 +00:00
|
|
|
|
>PUSHB K.LoadFile.hFile
|
2017-01-12 17:43:45 +00:00
|
|
|
|
jsr K.FRead
|
2017-10-19 06:19:54 +00:00
|
|
|
|
bcs .98
|
2017-06-21 15:46:43 +00:00
|
|
|
|
|
2017-10-19 06:19:54 +00:00
|
|
|
|
sty .6+1
|
|
|
|
|
sta .7+1 Save Bytes read
|
2016-09-20 16:00:51 +00:00
|
|
|
|
|
2017-10-19 06:19:54 +00:00
|
|
|
|
jsr .99 close file
|
2016-09-21 15:20:37 +00:00
|
|
|
|
|
2017-10-19 06:19:54 +00:00
|
|
|
|
bit K.LoadFile.bTXT
|
|
|
|
|
bpl .6
|
|
|
|
|
|
|
|
|
|
clc set ending 0
|
|
|
|
|
lda .6+1
|
|
|
|
|
adc K.LoadFile.Mem
|
|
|
|
|
sta .5+1
|
|
|
|
|
lda .7+1
|
|
|
|
|
adc K.LoadFile.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
|
2016-09-20 16:00:51 +00:00
|
|
|
|
clc
|
2016-09-21 15:20:37 +00:00
|
|
|
|
.9 rts
|
2017-06-21 15:46:43 +00:00
|
|
|
|
|
2017-10-19 06:19:54 +00:00
|
|
|
|
.98 pha
|
2017-09-29 06:36:27 +00:00
|
|
|
|
lda .8+1
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.FreeMem.A
|
2016-09-30 15:04:55 +00:00
|
|
|
|
pla
|
2016-09-21 15:20:37 +00:00
|
|
|
|
|
2016-09-20 16:00:51 +00:00
|
|
|
|
.99 pha
|
2016-09-21 15:20:37 +00:00
|
|
|
|
lda K.LoadFile.hFile
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.FClose.A
|
2016-09-20 16:00:51 +00:00
|
|
|
|
pla
|
|
|
|
|
sec
|
2016-09-21 15:20:37 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-10-19 06:19:54 +00:00
|
|
|
|
K.LoadFile.GetSize
|
2017-10-09 15:30:48 +00:00
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
2017-10-19 06:19:54 +00:00
|
|
|
|
K.LoadFile.bTXT .BS 1
|
2017-06-21 15:46:43 +00:00
|
|
|
|
K.LoadFile.hFile .BS 1
|
2017-10-09 15:30:48 +00:00
|
|
|
|
K.LoadFile.FPos .BS 4
|
|
|
|
|
K.LoadFile.Mem .BS 2
|
|
|
|
|
K.LoadFile.FSize .BS 2
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SaveFile
|
|
|
|
|
* ## In:
|
2016-10-26 20:51:06 +00:00
|
|
|
|
* PUSHW = SrcPtr
|
2017-04-12 15:46:03 +00:00
|
|
|
|
* PUSHW = SrcLen
|
2016-10-26 20:51:06 +00:00
|
|
|
|
* PUSHW = AUXTYPE (Handled by....
|
|
|
|
|
* PUSHB = TYPE ...
|
|
|
|
|
* PUSHB = MODE ...
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* PUSHW = PATH ...FOpen)
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*\--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
K.SaveFile jsr K.FOpen
|
2016-09-20 16:00:51 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
sta .90+1
|
2016-09-20 16:00:51 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
>PUSHA
|
2017-01-12 17:43:45 +00:00
|
|
|
|
jsr K.FWrite
|
2016-09-20 16:00:51 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr .99
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.99 pha
|
2017-06-21 15:46:43 +00:00
|
|
|
|
.90 lda #$ff
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.FClose.A
|
2016-09-20 16:00:51 +00:00
|
|
|
|
pla
|
|
|
|
|
sec
|
2017-08-24 15:29:22 +00:00
|
|
|
|
rts
|
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
.9 pha
|
2017-10-12 15:28:59 +00:00
|
|
|
|
lda pStack Discard SrcPtr & SrcLen
|
|
|
|
|
clc
|
|
|
|
|
adc #4
|
|
|
|
|
sta pStack
|
2017-06-21 15:46:43 +00:00
|
|
|
|
pla
|
2016-10-21 15:03:41 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2017-04-03 21:13:46 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # ChTyp
|
|
|
|
|
* ## In:
|
2017-04-04 13:07:58 +00:00
|
|
|
|
* PUSHB = TYPE
|
|
|
|
|
* PUSHW = PATH
|
2017-04-03 21:13:46 +00:00
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.ChTyp jsr PFT.CheckPathSTK
|
2017-10-04 15:12:03 +00:00
|
|
|
|
jsr STDIO.PullMLIPath
|
2017-04-03 21:13:46 +00:00
|
|
|
|
>PULLB .1+1
|
|
|
|
|
>MLICALL MLIGETFILEINFO
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
.1 lda #$ff
|
|
|
|
|
sta K.MLI.PARAMS+S.FILEINFO.TYPE
|
2017-04-04 13:07:58 +00:00
|
|
|
|
>MLICALL MLISETFILEINFO
|
2017-04-03 21:13:46 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*/--------------------------------------
|
2017-08-25 06:37:21 +00:00
|
|
|
|
* # ChMod
|
|
|
|
|
* ## In:
|
|
|
|
|
* PUSHW = UID
|
|
|
|
|
* PUSHW = PATH
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.ChMod
|
|
|
|
|
*/--------------------------------------
|
2017-04-03 21:13:46 +00:00
|
|
|
|
* # ChOwn
|
|
|
|
|
* ## In:
|
2017-04-04 13:07:58 +00:00
|
|
|
|
* PUSHW = UID
|
|
|
|
|
* PUSHW = PATH
|
2017-04-03 21:13:46 +00:00
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.ChOwn
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # ChGrp
|
|
|
|
|
* ## 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
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/SYS/KERNEL.S.FIO
|
|
|
|
|
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ASM
|