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-03-30 16:11:31 +00:00
|
|
|
|
* # FileSearch
|
2016-11-01 14:37:28 +00:00
|
|
|
|
* Search a file in the provided PATH list
|
|
|
|
|
* And return, if found, the full path to it.
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2017-08-23 15:05:29 +00:00
|
|
|
|
* PUSHW = Ptr to Search Path (CSTR) %LIB%;/SYS/SLIB
|
|
|
|
|
* PUSHW = Ptr to File Name (CSTR)
|
2017-08-23 11:33:51 +00:00
|
|
|
|
* PUSHW = Ptr to DstBuf
|
2017-08-23 15:05:29 +00:00
|
|
|
|
* PUSHW = Ptr to DstStat
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2016-11-01 14:37:28 +00:00
|
|
|
|
* CC : success
|
2017-08-23 11:33:51 +00:00
|
|
|
|
* DstBuf = FilePath
|
2017-08-23 15:05:29 +00:00
|
|
|
|
* DstStat = S.STAT
|
2016-11-01 14:37:28 +00:00
|
|
|
|
* CS : not found
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*\--------------------------------------
|
2017-08-23 11:33:51 +00:00
|
|
|
|
K.FileSearch >PULLW ZPPtr2 DstBuf
|
|
|
|
|
jsr K.FileSearch.I
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2017-08-24 12:46:48 +00:00
|
|
|
|
lda K.Buf256
|
2017-08-23 11:33:51 +00:00
|
|
|
|
sta (ZPPtr2)
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
|
2017-08-24 12:46:48 +00:00
|
|
|
|
.1 lda K.Buf256,y
|
2017-08-23 11:33:51 +00:00
|
|
|
|
sta (ZPPtr2),y
|
|
|
|
|
dey
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
|
2017-08-24 15:29:22 +00:00
|
|
|
|
K.FileSearch.I >PULLW ZPPtr4 ZPPtr1 trashed by ExpandStr.YA
|
2017-06-21 15:46:43 +00:00
|
|
|
|
>PULLYA Get Search list
|
2017-08-24 15:29:22 +00:00
|
|
|
|
>SYSCALL ExpandStr.YA Expand it (SYSCALL to BNK1)
|
2016-10-07 06:09:25 +00:00
|
|
|
|
bcs .99
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
stx .98+1
|
2017-08-23 11:33:51 +00:00
|
|
|
|
>STYA ZPPtr3 expanded search list ;
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
stz .11+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-08-24 12:46:48 +00:00
|
|
|
|
.1 stz K.Buf256 reset String
|
2016-08-17 06:25:58 +00:00
|
|
|
|
ldx #0
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
.11 ldy #$ff Self Modified
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.2 tya
|
2017-06-21 15:46:43 +00:00
|
|
|
|
cmp (ZPPtr3) end of src string ?
|
2016-08-17 06:25:58 +00:00
|
|
|
|
beq .3 end of string, try it....
|
|
|
|
|
iny
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr3),y
|
2016-08-17 06:25:58 +00:00
|
|
|
|
cmp #';'
|
2016-10-07 06:09:25 +00:00
|
|
|
|
beq .3
|
2016-08-17 06:25:58 +00:00
|
|
|
|
inx
|
2017-08-24 12:46:48 +00:00
|
|
|
|
sta K.Buf256,x
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bra .2
|
2016-10-06 15:50:20 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.3 txa
|
|
|
|
|
beq .98 String is empty....nothing to try
|
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
sty .11+1 save current index
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
ldy #0
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.4 iny
|
2017-06-21 15:46:43 +00:00
|
|
|
|
lda (ZPPtr4),y Append Fiename...
|
2016-08-17 06:25:58 +00:00
|
|
|
|
inx
|
2017-08-24 12:46:48 +00:00
|
|
|
|
sta K.Buf256,x
|
2016-08-17 06:25:58 +00:00
|
|
|
|
tya
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr4)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bne .4
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-08-24 12:46:48 +00:00
|
|
|
|
stx K.Buf256 set string length
|
2017-06-23 12:04:39 +00:00
|
|
|
|
|
2017-03-21 16:29:15 +00:00
|
|
|
|
>PUSHWI K.S.STAT
|
2017-08-24 12:46:48 +00:00
|
|
|
|
>PUSHWI K.Buf256
|
2016-09-26 16:00:52 +00:00
|
|
|
|
jsr K.STAT
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .1 Failed...retry next path...
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
jsr .98 Discard Expanded hSrch list
|
2016-10-06 15:50:20 +00:00
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2016-10-07 06:09:25 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
.98 lda #$ff SELF MODIFIED : Discard Expanded hSrch list
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.FreeMem.A
|
2017-06-21 15:46:43 +00:00
|
|
|
|
lda #MLI.ERR.FNOTFND
|
2016-10-07 06:09:25 +00:00
|
|
|
|
sec
|
2016-10-21 15:03:41 +00:00
|
|
|
|
.99 rts
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*/--------------------------------------
|
2017-08-25 06:37:21 +00:00
|
|
|
|
* # GetFullPath.YA
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In :
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* Y,A = Filename (PSTR)
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out :
|
2016-11-01 14:37:28 +00:00
|
|
|
|
* CC : success
|
|
|
|
|
* Y,A = FullPath (PSTR)
|
|
|
|
|
* X = hMem of FullPath
|
|
|
|
|
* CS : A = Error Code
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*\--------------------------------------
|
2017-08-25 06:37:21 +00:00
|
|
|
|
K.GetFullPath.YA
|
|
|
|
|
>STYA ZPPtr3 Ptr1 & 2 used by StrCpy
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr3)
|
2017-08-25 06:37:21 +00:00
|
|
|
|
beq K.GetFullPath.YA.9
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-08-24 12:46:48 +00:00
|
|
|
|
stz K.Buf256
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
ldy #1
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr3),y
|
2016-08-17 06:25:58 +00:00
|
|
|
|
cmp #'/' full path starting with '/'?
|
|
|
|
|
beq .1 yes, do not append to current prefix
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hPREFIX
|
|
|
|
|
lda (pPs),y
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.GetMemPtr.A
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>PUSHYA
|
2017-08-24 12:46:48 +00:00
|
|
|
|
>PUSHWI K.Buf256
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PStrCpy
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 >PUSHW ZPPtr3
|
2017-08-24 12:46:48 +00:00
|
|
|
|
>PUSHWI K.Buf256
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PStrCat
|
2017-08-25 06:37:21 +00:00
|
|
|
|
K.GetFullPath.YA.NewStr
|
2017-08-24 12:46:48 +00:00
|
|
|
|
>LDYAI K.Buf256
|
2017-08-25 15:02:16 +00:00
|
|
|
|
jsr K.NewPStr.YA
|
2016-10-06 15:50:20 +00:00
|
|
|
|
rts
|
|
|
|
|
|
2017-08-25 06:37:21 +00:00
|
|
|
|
K.GetFullPath.YA.9
|
2016-10-21 15:03:41 +00:00
|
|
|
|
sec
|
2016-08-17 06:25:58 +00:00
|
|
|
|
rts
|
2016-10-26 20:51:06 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # LoadFile
|
|
|
|
|
* ## 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-06-21 15:46:43 +00:00
|
|
|
|
K.LoadFile lda (pStack) read PTR.LO on top of stack
|
|
|
|
|
pha
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (pStack),y read PTR.HI on top of stack
|
|
|
|
|
pha
|
|
|
|
|
>PUSHWI K.S.STAT
|
|
|
|
|
pla
|
|
|
|
|
ply
|
|
|
|
|
>PUSHYA
|
|
|
|
|
jsr K.Stat
|
|
|
|
|
bcs .10
|
2016-09-20 16:00:51 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
lda K.S.STAT+S.STAT.SIZE+3
|
|
|
|
|
ora K.S.STAT+S.STAT.SIZE+2
|
|
|
|
|
bne .11
|
|
|
|
|
|
2017-07-01 13:44:40 +00:00
|
|
|
|
>LDYA K.S.STAT+S.STAT.SIZE push len
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.GetMem.YA
|
2017-06-21 15:46:43 +00:00
|
|
|
|
bcs .10
|
2016-09-21 15:20:37 +00:00
|
|
|
|
>STYA K.LoadFile.Mem
|
2017-06-21 15:46:43 +00:00
|
|
|
|
stx K.LoadFile.hMem
|
2016-09-20 16:00:51 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
jsr K.FOpen
|
|
|
|
|
bcs .9
|
|
|
|
|
sta K.LoadFile.hFile
|
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
>PUSHW K.LoadFile.Mem
|
2017-06-21 15:46:43 +00:00
|
|
|
|
>PUSHW K.S.STAT+S.STAT.SIZE
|
2016-09-21 15:20:37 +00:00
|
|
|
|
>PUSHB K.LoadFile.hFile
|
2017-01-12 17:43:45 +00:00
|
|
|
|
jsr K.FRead
|
2016-09-30 15:04:55 +00:00
|
|
|
|
bcs .97
|
2017-06-21 15:46:43 +00:00
|
|
|
|
|
|
|
|
|
phy
|
|
|
|
|
pha Save Bytes read
|
2016-09-20 16:00:51 +00:00
|
|
|
|
|
|
|
|
|
jsr .99
|
2016-09-21 15:20:37 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
pla
|
|
|
|
|
ply
|
2016-09-21 15:20:37 +00:00
|
|
|
|
ldx K.LoadFile.hMem
|
2016-09-20 16:00:51 +00:00
|
|
|
|
clc
|
2016-09-21 15:20:37 +00:00
|
|
|
|
.9 rts
|
2016-09-30 15:04:55 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
.11 lda #SYSMGR.ERRFTB
|
|
|
|
|
.10 pha
|
|
|
|
|
>POP 6
|
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2016-09-30 15:04:55 +00:00
|
|
|
|
.97 pha
|
|
|
|
|
lda K.LoadFile.hMem
|
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-06-21 15:46:43 +00:00
|
|
|
|
K.LoadFile.hFile .BS 1
|
|
|
|
|
K.LoadFile.hMem .BS 1
|
|
|
|
|
K.LoadFile.Mem .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
|
|
|
|
|
>POP 4 Discard SrcPtr & SrcLen
|
|
|
|
|
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
|
|
|
|
|
>PULLW K.MLI.PARAMS+1
|
|
|
|
|
>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
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*/--------------------------------------
|
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
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # 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
|