mirror of
https://github.com/A2osX/A2osX.git
synced 2024-07-12 21:31:00 +00:00
207 lines
4.5 KiB
Plaintext
207 lines
4.5 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
* PUBLIC
|
||
*--------------------------------------
|
||
S.CheckPrefixYA >STYA MLICALL.PARAMS+1
|
||
>STYA ZPQuickPtr1
|
||
lda (ZPQuickPtr1)
|
||
beq .98
|
||
tax
|
||
ldy #1
|
||
lda (ZPQuickPtr1),y
|
||
cmp #'/'
|
||
bne .98
|
||
cpx #1 "/" allowed for listing online volumes
|
||
beq .8
|
||
>MLICALL MLIGETFILEINFO
|
||
bcs .98 No, invalid path...
|
||
lda MLICALL.PARAMS+4 Check file type
|
||
cmp #$0F Directory?
|
||
bne .98
|
||
.8 clc
|
||
rts
|
||
.98 lda #SYSMGR.ERRIDIR
|
||
.99 sec
|
||
rts
|
||
*--------------------------------------
|
||
* S.FileSearch
|
||
* in :
|
||
* PULLW = PSTR to File Name (PSTRING)
|
||
* PULLW = PSTR to Search Path (PSTRING) %LIB%;/SYS/SLIB
|
||
* out :
|
||
* Y,A = PSTR to FilePath (PSTRING)
|
||
* X = hMem to FilePath
|
||
*--------------------------------------
|
||
S.FileSearch >PULLW ZPQuickPtr4 ZPQuickPtr1 trashed by ExpandPStrYA
|
||
>PULLYA Get Search list
|
||
jsr S.ExpandPStrYA Expand it
|
||
bcs .99
|
||
|
||
stx S.FileSearch.hSrch
|
||
>STYA ZPQuickPtr2 expanded search list ;
|
||
|
||
stz S.FileSearch.Index
|
||
|
||
.1 stz KrnBuffer256 reset String
|
||
ldx #0
|
||
|
||
ldy S.FileSearch.Index
|
||
|
||
.2 tya
|
||
cmp (ZPQuickPtr2) end of src string ?
|
||
beq .3 end of string, try it....
|
||
iny
|
||
lda (ZPQuickPtr2),y
|
||
cmp #';'
|
||
beq .3
|
||
inx
|
||
sta KrnBuffer256,x
|
||
bra .2
|
||
|
||
.3 txa
|
||
beq .98 String is empty....nothing to try
|
||
|
||
sty S.FileSearch.Index save current index
|
||
|
||
ldy #0
|
||
|
||
.4 iny
|
||
lda (ZPQuickPtr4),y Append Fiename...
|
||
inx
|
||
sta KrnBuffer256,x
|
||
tya
|
||
cmp (ZPQuickPtr4)
|
||
bne .4
|
||
|
||
stx KrnBuffer256 set string length
|
||
|
||
>LDYAI KrnBuffer256
|
||
jsr S.MLIGetFileInfoYA
|
||
bcs .1 Failed...retry next path...
|
||
|
||
lda S.FileSearch.hSrch Discard Expanded hSrch list
|
||
jsr S.FreeMemA
|
||
>LDYAI KrnBuffer256
|
||
jmp S.NewPStrYA
|
||
|
||
.98 lda S.FileSearch.hSrch Discard Expanded hSrch list
|
||
jsr S.FreeMemA
|
||
lda #SYSMGR.ERRFNF
|
||
sec
|
||
.99 rts
|
||
*--------------------------------------
|
||
S.FileSearch.File .BS 2
|
||
S.FileSearch.hSrch .BS 1
|
||
S.FileSearch.Index .BS 1
|
||
*--------------------------------------
|
||
* S.GetFullPathYA
|
||
* in :
|
||
* Y,A = Filename (PSTRING)
|
||
* out :
|
||
* Y,A = FullPath (PSTRING)
|
||
* X = hMem of FullPath
|
||
*--------------------------------------
|
||
S.GetFullPathYA >STYA ZPQuickPtr3 Ptr1 & 2 used by StrCpy
|
||
lda (ZPQuickPtr3)
|
||
beq .9
|
||
|
||
stz KrnBuffer256
|
||
|
||
ldy #1
|
||
lda (ZPQuickPtr3),y
|
||
cmp #'/' full path starting with '/'?
|
||
beq .1 yes, do not append to current prefix
|
||
|
||
ldy #S.PS.hPREFIX
|
||
lda (pPs),y
|
||
jsr S.GetMemPtrA
|
||
>PUSHYA
|
||
>PUSHWI KrnBuffer256
|
||
jsr S.PStrCpy
|
||
|
||
.1 >PUSHW ZPQuickPtr3
|
||
>PUSHWI KrnBuffer256
|
||
jsr S.PStrCat
|
||
|
||
>LDYAI KrnBuffer256
|
||
jmp S.NewPStrYA
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
* S.LoadFileYA
|
||
* in :
|
||
* Y,A = FilePath (PSTRING)
|
||
* out :
|
||
* Y,A = File Length
|
||
* X = hMem of Loaded File
|
||
*--------------------------------------
|
||
S.LoadFileYA jsr S.MLIOpenYA
|
||
bcc .10
|
||
rts
|
||
|
||
.10 sta S.LoadFile.hRef save ref_num
|
||
stx S.LoadFile.hBuf save Prodos Buffer for freemem
|
||
jsr S.MLIGetEOFA
|
||
bcs .98
|
||
|
||
phx Larger than 64k?
|
||
plx
|
||
beq .1 File too big!!!!
|
||
lda #SYSMGR.ERRFTB
|
||
bra .98
|
||
|
||
.1 >STYA S.LoadFile.Len save Length
|
||
>PUSHYA Push Length for S.GetMem
|
||
>PUSHBI 0
|
||
jsr S.GetMem
|
||
bcs .98
|
||
|
||
>STYA S.LoadFile.Mem
|
||
|
||
stx S.LoadFile.hMem save Segment hMem
|
||
>PUSHW S.LoadFile.Len Push Length for S.MLIRead
|
||
>PUSHW S.LoadFile.Mem Push PTR
|
||
>PUSHB S.LoadFile.hRef Push ref_num
|
||
jsr S.MLIRead
|
||
bcs .97
|
||
|
||
jsr .98 Close File....
|
||
|
||
>LDYA S.LoadFile.Len Return File Length...
|
||
ldx S.LoadFile.hMem ...and hMem to Caller
|
||
clc
|
||
rts
|
||
|
||
.97 pha
|
||
lda S.LoadFile.hMem
|
||
jsr S.FreeMemA freemem because of failed load
|
||
pla
|
||
|
||
.98 pha
|
||
lda S.LoadFile.hRef
|
||
jsr S.MLICloseA
|
||
lda S.LoadFile.hBuf
|
||
jsr S.FreeMemA ProDOS IO Buffer
|
||
pla
|
||
|
||
.99 sec
|
||
rts
|
||
*--------------------------------------
|
||
S.LoadFile.hRef .BS 1
|
||
S.LoadFile.hBuf .BS 1
|
||
S.LoadFile.hMem .BS 1
|
||
S.LoadFile.Mem .BS 2
|
||
S.LoadFile.Len .BS 2
|
||
*--------------------------------------
|
||
TmpFileName .BS 16
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE SYS/KERNEL.S.FIO
|
||
LOAD SYS/KERNEL.S
|
||
ASM
|