SYS.LoadFileYA,SYS.LoadFileA now Expand pathnames

This commit is contained in:
Rémy GIBERT 2016-01-09 23:40:19 +01:00
parent 2bc2428de2
commit 3a3ae6d302

View File

@ -106,16 +106,16 @@ S.FileSearch.hFull .BS 1
* Y,A = File Length
* X = hMem of Loaded File
*--------------------------------------
S.LoadFileA jsr S.MLIOpenA
bcc S.LoadFile
S.LoadFileA jsr S.GetMemPtrA
S.LoadFileYA jsr S.ExpandPStrYA
sta S.LoadFile.hExp
jsr S.GetMemPtrA
jsr S.MLIOpenYA
bcc .10
jmp .99
S.LoadFile.RTS rts
S.LoadFileYA jsr S.MLIOpenYA
bcs S.LoadFile.RTS
S.LoadFile sta R.AL save ref_num
stx R.AH save Prodos Buffer for freemem
.10 sta S.LoadFile.hRef save ref_num
stx S.LoadFile.hBuf save Prodos Buffer for freemem
jsr S.MLIGetEOFA
bcs .98
@ -125,45 +125,58 @@ S.LoadFile sta R.AL save ref_num
lda #SYSMGR.ERRFTB
bra .98
.1 >STYA R.BX save Length
.1 >STYA S.LoadFile.Len save Length
>PUSHYA Push Length for S.GetMem
>PUSHBI 0
jsr S.GetMem
bcs .98
>STYA R.CX
stx R.DL save Segment hMem
>PUSHW R.BX Push Length for S.ReadFile
>PUSHW R.CX Push Dest PTR
>PUSHB R.AL Push ref_num
phy save Ptr
pha
stx S.LoadFile.hMem save Segment hMem
>PUSHW S.LoadFile.Len Push Length for S.MLIRead
pla restore Dest PTR
ply
>PUSHYA and push for S.MLIRead
>PUSHB S.LoadFile.hRef Push ref_num
jsr S.MLIRead
bcs .97
lda R.AL
lda S.LoadFile.hRef
jsr S.MLICloseA
lda R.AH
lda S.LoadFile.hBuf
jsr S.FreeMemA Discard ProDOS IO Buffer
>LDYA R.BX Return File Length...
ldx R.DL ...and hMem to Caller
>LDYA S.LoadFile.Len Return File Length...
ldx S.LoadFile.hMem ...and hMem to Caller
clc
rts
.97 pha
lda R.DL
lda S.LoadFile.hMem
jsr S.FreeMemA freemem because of failed load
pla
.98 pha
lda R.AL
lda S.LoadFile.hRef
jsr S.MLICloseA
lda R.AH
lda S.LoadFile.hBuf
jsr S.FreeMemA ProDOS IO Buffer
pla
.99 sec
.99 pha
lda S.LoadFile.hExp
jsr S.FreeMemA
pla
sec
rts
*--------------------------------------
S.LoadFile.hRef .BS 1
S.LoadFile.hBuf .BS 1
S.LoadFile.hExp .BS 1
S.LoadFile.hMem .BS 1
S.LoadFile.Len .BS 2
*--------------------------------------
* S.ListDirInitA
* in :
* A = PATH (PSTR) /DIR,/DIR/*.?s