Kernel 0.93+

This commit is contained in:
Rémy GIBERT 2020-01-16 17:26:21 +01:00
parent 333a12c3ac
commit 236dc5517a
4 changed files with 38 additions and 36 deletions

View File

@ -135,10 +135,10 @@ And return, if found, the full path to it.
## ASM ## ASM
**In:** **In:**
`>PUSHWI filestat` `>PUSHWI filename`
`>PUSHWI fullpath` `>PUSHWI fullpath`
`>PUSHWI searchpath` `>PUSHWI searchpath`
`>LDYAI filename` `>PUSHWI filestat`
## RETURN VALUE ## RETURN VALUE
CC : success CC : success

Binary file not shown.

View File

@ -10,7 +10,6 @@ NEW
*\-------------------------------------- *\--------------------------------------
.DUMMY .DUMMY
.OR ZPDRV .OR ZPDRV
ENV.SearchPath .BS 2
ENV.BufLen .BS 1 ENV.BufLen .BS 1
ENV.VarEndChar .BS 1 ENV.VarEndChar .BS 1
ENV.bNoExp .BS 1 ENV.bNoExp .BS 1
@ -139,22 +138,24 @@ K.ExpandStr jsr K.strdup
* `int filesearch ( char * filename, char * searchpath, char * fullpath, stat * filestat);` * `int filesearch ( char * filename, char * searchpath, char * fullpath, stat * filestat);`
* ## ASM * ## ASM
* **In:** * **In:**
* `>PUSHWI filestat` * `>PUSHWI filename`
* `>PUSHWI fullpath` * `>PUSHWI fullpath`
* `>PUSHWI searchpath` * `>PUSHWI searchpath`
* `>LDYAI filename` * `>PUSHWI filestat`
* ## RETURN VALUE * ## RETURN VALUE
* CC : success * CC : success
* DstBuf = FilePath * DstBuf = FilePath
* DstStat = S.STAT * DstStat = S.STAT
* CS : not found * CS : not found
*\-------------------------------------- *\--------------------------------------
K.FileSearch pha K.FileSearch >PULLW .4+1 DstStat
>PULLW ENV.SearchPath
>PULLW .2+1 DstBuf >PULLW .2+1 DstBuf
>PULLW .4+1 DstStat >PULLW ENV.Search.2+1 path to search
pla Y,A = filename >PULLW ENV.Search.4+1 filename to find
jsr ENV.Search.YA
stz ENV.Search.98+1
jsr ENV.Search
bcs K.FileSearch.RTS bcs K.FileSearch.RTS
ldx #$ff ldx #$ff
@ -171,12 +172,15 @@ K.FileSearch pha
K.FileSearch.RTS K.FileSearch.RTS
rts rts
*-------------------------------------- *--------------------------------------
ENV.Search.CWD >STYA ZPPtr2 filename to find ENV.Search.CWD >STYA ENV.Search.4+1 filename to find
ldy #S.PS.hCWD ldy #S.PS.hCWD
lda (PS.NewPSPtr),y lda (PS.NewPSPtr),y
jsr K.GetMemPtr jsr K.GetMemPtr
>STYA ENV.SearchPath >STYA ENV.Search.2+1
bra ENV.Search.Ptr2
stz ENV.Search.98+1
bra ENV.Search
ENV.Search.LIB ldx #0 ENV.Search.LIB ldx #0
.HS 2C BIT ABS .HS 2C BIT ABS
@ -184,70 +188,68 @@ ENV.Search.DRV ldx #2
.HS 2C BIT ABS .HS 2C BIT ABS
ENV.Search.PATH ldx #4 ENV.Search.PATH ldx #4
>STYA ZPPtr2 filename to find >STYA ENV.Search.4+1 filename to find
>PUSHW ENV.VARS,x
>LDYA ENV.VARS,x >PUSHW ENV.VARS,x
>PUSHWI 0 allocate... >PUSHWI 0 allocate...
jsr K.GetEnv get value for Search Path jsr K.GetEnv get value for Search Path
bcs K.FileSearch.RTS bcs K.FileSearch.RTS
>STYA ENV.SearchPath >STYA ENV.Search.2+1
stx ENV.Search.98+1 stx ENV.Search.98+1
ENV.Search.Ptr2 >LDYA ZPPtr2 ENV.Search stz ENV.Search.1+1
ENV.Search.YA >STYA .4+1
stz .1+1 ENV.Search.1 ldy #0 Self Modified Index in Search list string
.1 ldy #0 Self Modified Index in Search list string
ldx #0 ldx #0
.2 lda (ENV.SearchPath),y ENV.Search.2 lda $ffff,y SELF MODIFIED
beq .3 end of string, try it.... beq ENV.Search.3 end of string, try it....
iny iny
cmp #':' cmp #':'
beq .3 beq ENV.Search.3
sta K.Buf256,x sta K.Buf256,x
inx inx
bra .2 bra ENV.Search.2
.3 txa ENV.Search.3 txa
beq ENV.Search.98 String is empty....nothing to try beq ENV.Search.98 String is empty....nothing to try
sty .1+1 save current index sty ENV.Search.1+1 save current index
ldy #0 ldy #0
.4 lda $ffff,y Self Modified, Append Filename... ENV.Search.4 lda $ffff,y Self Modified, Append Filename...
sta K.Buf256,x sta K.Buf256,x
beq .5 beq ENV.Search.5
iny iny
inx inx
bra .4 bra ENV.Search.4
.5 >PUSHWI K.S.STAT ENV.Search.5 >PUSHWI K.S.STAT
>LDYAI K.Buf256 >LDYAI K.Buf256
>SYSCALL2 stat >SYSCALL2 stat
bcs .1 Failed...retry next path... bcs ENV.Search.1 Failed...retry next path...
lda K.S.STAT+S.STAT.P.TYPE lda K.S.STAT+S.STAT.P.TYPE
cmp #S.FI.T.DIR Dir ? cmp #S.FI.T.DIR Dir ?
beq .1 beq ENV.Search.1
jsr ENV.Search.98 Discard Expanded hSrch list jsr ENV.Search.98 Discard Expanded hSrch list
clc clc
rts rts
ENV.Search.98 lda #$ff SELF MODIFIED : Discard Search list ENV.Search.98 lda #$ff SELF MODIFIED : Discard Search list
beq .1
jsr K.FreeMem jsr K.FreeMem
lda #MLI.E.FNOTFND .1 lda #MLI.E.FNOTFND
sec sec
rts rts
*/-------------------------------------- */--------------------------------------

View File

@ -285,7 +285,7 @@ K.FreeMem.ERR phx
jsr K.SYSCALL2 jsr K.SYSCALL2
plx plx
lda #E.INVH lda #E.INVH
>DEBUGOA * >DEBUG
sec sec
rts rts
*-------------------------------------- *--------------------------------------