2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2015-03-14 21:48:35 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* PUBLIC
|
|
|
|
|
*--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
K.CheckPrefixYA >STYA MLICALL.PARAMS+1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
>STYA ZPQuickPtr1
|
|
|
|
|
lda (ZPQuickPtr1)
|
|
|
|
|
beq .98
|
|
|
|
|
tax
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
cmp #'/'
|
|
|
|
|
bne .98
|
|
|
|
|
cpx #1 "/" allowed for listing online volumes
|
|
|
|
|
beq .8
|
2015-06-03 18:30:57 +00:00
|
|
|
|
>MLICALL MLIGETFILEINFO
|
2015-03-14 21:48:35 +00:00
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
* K.FileSearch
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* in :
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* PULLW = PSTR to File Name (PSTRING)
|
|
|
|
|
* PULLW = PSTR to Search Path (PSTRING) %LIB%;/SYS/SLIB
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* out :
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* Y,A = PSTR to FilePath (PSTRING)
|
|
|
|
|
* X = hMem to FilePath
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
K.FileSearch >PULLW ZPQuickPtr4 ZPQuickPtr1 trashed by ExpandPStrYA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>PULLYA Get Search list
|
2016-09-21 15:20:37 +00:00
|
|
|
|
jsr K.ExpandPStrYA Expand it
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
stx K.FileSearch.hSrch
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>STYA ZPQuickPtr2 expanded search list ;
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
stz K.FileSearch.Index
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
.1 stz KrnBuffer256 reset String
|
|
|
|
|
ldx #0
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
ldy K.FileSearch.Index
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.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
|
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
sty K.FileSearch.Index 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
|
|
|
|
|
lda (ZPQuickPtr4),y Append Fiename...
|
|
|
|
|
inx
|
|
|
|
|
sta KrnBuffer256,x
|
|
|
|
|
tya
|
|
|
|
|
cmp (ZPQuickPtr4)
|
|
|
|
|
bne .4
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
stx KrnBuffer256 set string length
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>LDYAI KrnBuffer256
|
2016-09-21 15:20:37 +00:00
|
|
|
|
jsr K.MLIGetFileInfoYA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .1 Failed...retry next path...
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
lda K.FileSearch.hSrch Discard Expanded hSrch list
|
|
|
|
|
jsr K.FreeMemA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>LDYAI KrnBuffer256
|
2016-09-21 15:20:37 +00:00
|
|
|
|
jmp K.NewPStrYA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
.98 lda K.FileSearch.hSrch Discard Expanded hSrch list
|
|
|
|
|
jsr K.FreeMemA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda #SYSMGR.ERRFNF
|
|
|
|
|
sec
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.99 rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
K.FileSearch.File .BS 2
|
|
|
|
|
K.FileSearch.hSrch .BS 1
|
|
|
|
|
K.FileSearch.Index .BS 1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
*--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
* K.GetFullPathYA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* in :
|
|
|
|
|
* Y,A = Filename (PSTRING)
|
|
|
|
|
* out :
|
|
|
|
|
* Y,A = FullPath (PSTRING)
|
|
|
|
|
* X = hMem of FullPath
|
|
|
|
|
*--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
K.GetFullPathYA >STYA ZPQuickPtr3 Ptr1 & 2 used by StrCpy
|
2016-08-17 06:25:58 +00:00
|
|
|
|
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
|
2016-09-21 15:20:37 +00:00
|
|
|
|
jsr K.GetMemPtrA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHWI KrnBuffer256
|
2016-09-21 15:20:37 +00:00
|
|
|
|
jsr K.PStrCpy
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
.1 >PUSHW ZPQuickPtr3
|
|
|
|
|
>PUSHWI KrnBuffer256
|
2016-09-21 15:20:37 +00:00
|
|
|
|
jsr K.PStrCat
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
>LDYAI KrnBuffer256
|
2016-09-21 15:20:37 +00:00
|
|
|
|
jmp K.NewPStrYA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
* K.LoadFile
|
2016-09-20 16:00:51 +00:00
|
|
|
|
* in :
|
|
|
|
|
* PULLW = PATH (Handled by....
|
|
|
|
|
* PULLB = MODE ...
|
|
|
|
|
* PULLB = TYPE ...
|
|
|
|
|
* PULLW = AUXTYPE ...FOPEN)
|
|
|
|
|
* out :
|
|
|
|
|
* Y,A = File Length
|
|
|
|
|
* X = hMem of Loaded File
|
|
|
|
|
*--------------------------------------
|
2016-09-22 15:46:01 +00:00
|
|
|
|
K.LoadFile jsr K.FOPEN
|
2016-09-20 16:00:51 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
sta K.LoadFile.hFile
|
2016-09-20 16:00:51 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
ldx #SYS.FSEEK.END
|
|
|
|
|
jsr K.LoadFile.Seek
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
lda K.LoadFile.hFile
|
|
|
|
|
jsr K.FTELLA
|
|
|
|
|
bcs .99
|
|
|
|
|
>STYA K.LoadFile.Len
|
|
|
|
|
phx
|
|
|
|
|
plx
|
|
|
|
|
bne .98 LEN > 65535 !!???
|
2016-09-20 16:00:51 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
>PUSHYA push len
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
jsr K.GetMem
|
|
|
|
|
bcs .99
|
|
|
|
|
>STYA K.LoadFile.Mem
|
|
|
|
|
stx K.LoadFile.hMem
|
|
|
|
|
|
|
|
|
|
ldx #SYS.FSEEK.SET
|
|
|
|
|
jsr K.LoadFile.Seek
|
|
|
|
|
bcs .99
|
2016-09-20 16:00:51 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
>PUSHW K.LoadFile.Mem
|
|
|
|
|
>PUSHW K.LoadFile.Len
|
|
|
|
|
>PUSHB K.LoadFile.hFile
|
|
|
|
|
jsr K.FREAD
|
2016-09-20 16:00:51 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr .99
|
2016-09-21 15:20:37 +00:00
|
|
|
|
|
|
|
|
|
>LDYA K.LoadFile.Len
|
|
|
|
|
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-20 16:00:51 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
.98 lda #SYSMGR.ERRFTB
|
|
|
|
|
|
2016-09-20 16:00:51 +00:00
|
|
|
|
.99 pha
|
2016-09-21 15:20:37 +00:00
|
|
|
|
lda K.LoadFile.hFile
|
|
|
|
|
jsr K.FCLOSEA
|
2016-09-20 16:00:51 +00:00
|
|
|
|
pla
|
|
|
|
|
sec
|
2016-09-21 15:20:37 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.LoadFile.Seek >PUSHWI 0
|
|
|
|
|
>PUSHWI 0
|
|
|
|
|
txa
|
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHB K.LoadFile.hFile
|
|
|
|
|
jmp K.FSEEK
|
2016-09-20 16:00:51 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* PULLW = SrcPtr
|
|
|
|
|
* PULLW = SrcLen
|
|
|
|
|
* PULLW = PATH (Handled by....
|
|
|
|
|
* PULLB = MODE ...
|
|
|
|
|
* PULLB = TYPE ...
|
|
|
|
|
* PULLW = AUXTYPE ...FOPEN)
|
|
|
|
|
*--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
K.SaveFile >PULLW K.LoadFile.Mem
|
|
|
|
|
>PULLW K.LoadFile.Len
|
2016-09-20 16:00:51 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
jsr K.FOPEN
|
2016-09-20 16:00:51 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
sta K.LoadFile.hFile
|
2016-09-20 16:00:51 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
>PUSHW K.LoadFile.Mem
|
2016-09-20 16:00:51 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
>PUSHW K.LoadFile.Len
|
2016-09-20 16:00:51 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
>PUSHB K.LoadFile.hFile
|
|
|
|
|
jsr K.FWRITE
|
2016-09-20 16:00:51 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr .99
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.99 pha
|
2016-09-21 15:20:37 +00:00
|
|
|
|
lda K.LoadFile.hFile
|
|
|
|
|
jsr K.FCLOSEA
|
2016-09-20 16:00:51 +00:00
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
K.LoadFile.Filename .BS 2
|
|
|
|
|
K.LoadFile.hFile .BS 1
|
|
|
|
|
K.LoadFile.hMem .BS 1
|
|
|
|
|
K.LoadFile.Mem .BS 2
|
|
|
|
|
K.LoadFile.Len .BS 2
|
|
|
|
|
K.LoadFile.hRef .BS 1
|
|
|
|
|
K.LoadFile.hBuf .BS 1
|
2016-01-09 22:40:19 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
MAN
|
2015-11-22 22:30:06 +00:00
|
|
|
|
SAVE SYS/KERNEL.S.FIO
|
2015-03-14 21:48:35 +00:00
|
|
|
|
LOAD SYS/KERNEL.S
|
|
|
|
|
ASM
|