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
**In:**
`>PUSHWI filestat`
`>PUSHWI filename`
`>PUSHWI fullpath`
`>PUSHWI searchpath`
`>LDYAI filename`
`>PUSHWI filestat`
## RETURN VALUE
CC : success

Binary file not shown.

View File

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

View File

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