diff --git a/.Docs/KERNEL.md b/.Docs/KERNEL.md index 26fbf626..ae3cbed8 100644 --- a/.Docs/KERNEL.md +++ b/.Docs/KERNEL.md @@ -600,7 +600,7 @@ Convert String to 32 bits int ## In: + PUSHW PTR to target buffer DWORD -+ PUSHW Source String (PSTR) ++ PUSHW Source String (C-Sring) ## Out: diff --git a/.Floppies/A2OSX.BUILD.po b/.Floppies/A2OSX.BUILD.po index de708bd9..dd360065 100644 Binary files a/.Floppies/A2OSX.BUILD.po and b/.Floppies/A2OSX.BUILD.po differ diff --git a/.Floppies/A2OSX.SRC.po b/.Floppies/A2OSX.SRC.po index 3e9d0279..7d3fa331 100644 Binary files a/.Floppies/A2OSX.SRC.po and b/.Floppies/A2OSX.SRC.po differ diff --git a/BIN/ASM.S.DIR.txt b/BIN/ASM.S.DIR.txt index 99d0d3e2..6f71f851 100644 --- a/BIN/ASM.S.DIR.txt +++ b/BIN/ASM.S.DIR.txt @@ -212,7 +212,7 @@ DIR.IN jsr SRC.GetArg bcs .9 >LDYA L.SRC.BUFFER - >SYSCALL NewPStrYA + >SYSCALL NewStr.YA phx diff --git a/BIN/ASM.S.FIO.txt b/BIN/ASM.S.FIO.txt index 5a536264..02c3c25f 100644 --- a/BIN/ASM.S.FIO.txt +++ b/BIN/ASM.S.FIO.txt @@ -49,7 +49,7 @@ FIO.OpenFileA sta FIO.hFileName ldy #S.PS.hPREFIX lda (pPs),y >PUSHA - >SYSCALL PStrCat + >SYSCALL StrCat sta FIO.hFullPath sta FIO.hFileName diff --git a/BIN/ASM.S.txt b/BIN/ASM.S.txt index 5c3fd053..bdeed047 100644 --- a/BIN/ASM.S.txt +++ b/BIN/ASM.S.txt @@ -59,9 +59,10 @@ CS.START cld .DA #$61 6502,Level 1 (65c02) .DA #1 BIN Layout Version 1 .DA 0 - .DA CS.END-CS.START - .DA DS.END-DS.START Data Segment to Allocate - .DA 0 + .DA CS.END-CS.START CS + .DA DS.END-DS.START DS + .DA #128 SS + .DA #10 ZP .DA 0 *-------------------------------------- * Relocation Table @@ -149,13 +150,13 @@ J.EXP.OP .DA EXP.OP.EOR ^!|&<=>+-*/ .DA EXP.OP.DIV .DA 0 *--------------------------------------- -CS.INIT >SYSCALL GetArgC - cmp #1 - beq .99 No arg, new file.... +CS.INIT ldy #S.PS.ARGC + lda (pPs),y + beq .99 lda #1 >SYSCALL GetArg.A - >SYSCALL GetFullPath.YA + >SYSCALL RealPath.YA txa ldy #SRC.hFILENAME @@ -182,7 +183,7 @@ CS.INIT >SYSCALL GetArgC sec .9 rts *-------------------------------------- -CS.RUN >SYSCALL GetC +CS.RUN >SYSCALL GetChar bcs .11 no char cmp #$03 Ctrl-C @@ -445,6 +446,7 @@ SRC.FLabel.Flags .BS 1 SRC.FLabel.Value .BS 4 SRC.FLabel.Len .BS 1 SRC.FLabel.Name .BS SRC.GLABEL.MAXLEN +UsrBuf256 .BS 256 *-------------------------------------- .DUMMY .OR 0 diff --git a/BIN/CAT.S.txt b/BIN/CAT.S.txt index 4876b431..35219e53 100644 --- a/BIN/CAT.S.txt +++ b/BIN/CAT.S.txt @@ -22,9 +22,10 @@ CS.START cld .DA #$61 6502,Level 1 (65c02) .DA #1 BIN Layout Version 1 .DA 0 - .DA CS.END-CS.START Code Length To Relocate - .DA DS.END-DS.START Data Segment to Allocate - .DA 0 + .DA CS.END-CS.START CS + .DA DS.END-DS.START DS + .DA #16 SS + .DA #4 ZP .DA 0 *-------------------------------------- * Relocation Table @@ -264,7 +265,7 @@ CS.RUN.PRINTNUM clc >SYSCALL PrintF.YA .8 rts *-------------------------------------- -CS.RUN.OPEN >SYSCALL GetFullPath.YA +CS.RUN.OPEN >SYSCALL RealPath.YA bcs .9 stx hFullPath pha diff --git a/BIN/CP.S.txt b/BIN/CP.S.txt index 42121fed..f35da396 100644 --- a/BIN/CP.S.txt +++ b/BIN/CP.S.txt @@ -24,21 +24,21 @@ OptionList >PSTR "CRYQcryq" OptionVars .DA #bContinue,#bRecurse,#bNoConfirm,#bQuiet,#bContinue,#bRecurse,#bNoConfirm,#bQuiet *-------------------------------------- MSG.USAGE >CSTR "Usage : CP [Src File/Dir, *,? wildcards allowed]\r\n -C : Continue on error\r\n -Q : Quiet\r\n -R : Recurse subdirectories\r\n -Y : Dont't prompt for override\r\n" -MSG.DIR >CSTR "CP Dir :%S to %S..." -MSG.FILE >CSTR "CP File:%S to %S..." -MSG.OVERWRITE >CSTR "Overwrite %S [Yes,No,All]?" +MSG.DIR >CSTR "CP Dir :%s to %s..." +MSG.FILE >CSTR "CP File:%s to %s..." +MSG.OVERWRITE >CSTR "Overwrite %s [Yes,No,All]?" MSG.OK >CSTR "[OK]\r\n" MSG.ERR >CSTR "[%h]\r\n" MSG.DONE >CSTR "%D File(s) Copied.\r\n" -*-------------------------------------- -STAT .BS S.STAT -ArgCount .BS 1 -ArgIndex .BS 1 *-------------------------------------- .DUMMY .OR 0 DS.START +ArgCount .BS 1 Index .BS 1 +STAT .BS S.STAT + +hFullPath .BS 1 hDIRs .BS X.MAX.RECURSE hDIRENTs .BS X.MAX.RECURSE oDIRENTs .BS X.MAX.RECURSE*2 diff --git a/BIN/EDIT.S.txt b/BIN/EDIT.S.txt index 08b2bf1f..393d8240 100644 --- a/BIN/EDIT.S.txt +++ b/BIN/EDIT.S.txt @@ -110,7 +110,7 @@ CS.INIT lda #$ff lda #1 >SYSCALL GetArg.A - >SYSCALL GetFullPath.YA + >SYSCALL RealPath.YA txa ldy #hFileName sta (pData),y diff --git a/BIN/FORMAT.S.txt b/BIN/FORMAT.S.txt index a9b17b5a..812c664b 100644 --- a/BIN/FORMAT.S.txt +++ b/BIN/FORMAT.S.txt @@ -22,9 +22,10 @@ CS.START cld .DA #$61 6502,Level 1 (65c02) .DA #1 BIN Layout Version 1 .DA 0 - .DA CS.END-CS.START Code Length To Relocate - .DA DS.END-DS.START Data Segment to Allocate - .DA 0 + .DA CS.END-CS.START CS + .DA DS.END-DS.START DS + .DA #16 SS + .DA #4 ZP .DA 0 *-------------------------------------- * Relocation Table @@ -41,31 +42,22 @@ L.MSG.OK .DA MSG.OK L.MSG.ERR .DA MSG.ERR .DA 0 *-------------------------------------- -CS.INIT >SYSCALL GetArgC - sta ArgCount - cmp #1 - beq .99 - - stz ArgIndex +CS.INIT ldy #S.PS.ARGC + lda (pPs),y + beq .99 -.1 dec ArgCount - beq .7 +.1 >INC.G ArgIndex - inc ArgIndex - lda ArgIndex >SYSCALL GetArg.A + bcs .7 + >STYA ZPPtr1 lda (ZPPtr1) - cmp #2 - bne .4 - - ldy #1 - lda (ZPPtr1),y cmp #'-' bne .4 - iny + ldy #1 lda (ZPPtr1),y ldx OptionList @@ -89,31 +81,26 @@ CS.INIT >SYSCALL GetArgC .4 ldy #hDev lda (pData),y bne .5 Already have a dev name...go get VolName - - lda (ZPPtr1) - cmp #4 - bne .99 DevName must be DxDy - + >LDYA ZPPtr1 - >SYSCALL GetDevByNameYA + >SYSCALL GetDevByName.YA bcs .99 txa ldy #hDev sta (pData),y bra .1 -.5 lda (ZPPtr1) - cmp #16 - bcs .99 VolName too long +.5 ldy #$ff - tay +.6 iny -.6 lda (ZPPtr1),y + cpy #16 + beq .99 VolName too long + + lda (ZPPtr1),y sta (pData),y - dey - bpl .6 - - bra .1 success, scan for any other args + bne .6 success, scan for any other args + bra .1 .7 lda (pData) bne .8 Volume name ok @@ -146,7 +133,7 @@ CS.INIT >SYSCALL GetArgC bpl .71 .8 >LDYA L.LIBBLKDEV - >SYSCALL LoadLibYA + >SYSCALL LoadLib.YA sta hLIBBLKDEV lda (pPs) @@ -178,7 +165,7 @@ CS.RUN jsr CS.RUN.BuildCat *-------------------------------------- CS.RUN.BuildCat ldy #hDev lda (pData),y - >SYSCALL GetDevStatusA + >SYSCALL GetDevStatus.A bcs .99 >STYA ZPPtr1 @@ -191,7 +178,7 @@ CS.RUN.BuildCat ldy #hDev ldy #hDev lda (pData),y - >SYSCALL GetDevByIDA + >SYSCALL GetDevByID.A bcs .99 pha @@ -234,7 +221,7 @@ CS.RUN.WriteCat stz BlkParams.Num ldy #hDev lda (pData),y - >SYSCALL GetDevByIDA + >SYSCALL GetDevByID.A bcs .9 >STYA pDev @@ -261,7 +248,7 @@ CS.QUIT ldy #hBuf .1 lda hLIBBLKDEV beq .8 - >SYSCALL UnloadLibA + >SYSCALL UnloadLib.A .8 clc rts @@ -293,12 +280,10 @@ OptionVars .DA #bLL,#bLL MSG.USAGE >CSTR "Usage : FORMAT [VOLUME.NAME]\r\n -L : Low-Level Format\r\n" MSG.OK >CSTR "[OK]\r\n" MSG.ERR >CSTR "[%h]\r\n" -MSG.INIT >CSTR "Formatting %S (%D Blks),Volname:%S..." +MSG.INIT >CSTR "Formatting %s (%D Blks),Volname:%s..." *-------------------------------------- -LIBBLKDEV >PSTR "libblkdev.o" -DefaultVolName >PSTR "BLANKXXXXXXXX" -ArgCount .BS 1 -ArgIndex .BS 1 +LIBBLKDEV >CSTR "libblkdev.o" +DefaultVolName >CSTR "BLANKXXXXXXXX" hLIBBLKDEV .BS 1 SizeInBlocks .BS 2 BlkCnt .BS 1 @@ -308,6 +293,7 @@ BlkParams.Num .BS 2 .DUMMY .OR 0 DS.START +ArgIndex .BS 1 VolName .BS 16 hDev .BS 5 hBuf .BS 1 diff --git a/BIN/MD.S.txt b/BIN/MD.S.txt index 4fafc328..ccaaa108 100644 --- a/BIN/MD.S.txt +++ b/BIN/MD.S.txt @@ -39,7 +39,7 @@ CS.RUN lda #1 >SYSCALL GetArg.A bcs .99 - >SYSCALL GetFullPath.YA + >SYSCALL RealPath.YA bcs .9 phy pha diff --git a/BIN/X.CPMVRM.S.txt b/BIN/X.CPMVRM.S.txt index 5d981257..75bc3c6f 100644 --- a/BIN/X.CPMVRM.S.txt +++ b/BIN/X.CPMVRM.S.txt @@ -19,9 +19,10 @@ CS.START cld .DA #$61 6502,Level 1 (65c02) .DA #1 BIN Layout Version 1 .DA 0 - .DA CS.END-CS.START Code Length To Relocate - .DA DS.END-DS.START Data Segment to Allocate - .DA 0 + .DA CS.END-CS.START CS + .DA DS.END-DS.START DS + .DA #16 SS + .DA #8 ZP .DA 0 *-------------------------------------- * Relocation Table @@ -42,19 +43,10 @@ L.MSG.DONE .DA MSG.DONE L.STAT .DA STAT .DA 0 *-------------------------------------- -CS.INIT >SYSCALL GetArgC - sta ArgCount - cmp #1 - beq .99 - - stz ArgIndex - -.1 dec ArgCount - beq .7 - - inc ArgIndex - lda ArgIndex +CS.INIT +.1 >INC.G ArgCount >SYSCALL GetArg.A + bcs .7 >STYA ZPPtr1 lda (ZPPtr1) @@ -153,7 +145,7 @@ CS.INIT >SYSCALL GetArgC clc rts *-------------------------------------- -CS.RUN >SYSCALL GetC +CS.RUN >SYSCALL GetChar bcs .11 no char cmp #$03 Ctrl-C @@ -246,7 +238,7 @@ CS.RUN >SYSCALL GetC >SYSCALL GetMemPtr.A >PUSHYA >PUSHW ZPFileName - >SYSCALL PStrMatch + >SYSCALL StrMatch bcs CS.RUN.NEXT no match, skip.... .4 ldy #S.STAT.P.DRIVE @@ -352,7 +344,7 @@ CS.RUN.DIR jsr CS.RUN.DIR.MSG bcs CS.RUN.DIR.RTS .1 >SYSCALL Sleep - >SYSCALL GetC + >SYSCALL GetChar bcs .1 cmp #3 beq .99 abort @@ -416,7 +408,7 @@ CS.RUN.FILE jsr CS.RUN.FILE.MSG bcs .9 .1 >SYSCALL Sleep - >SYSCALL GetC + >SYSCALL GetChar bcs .1 cmp #3 beq .99 abort @@ -448,7 +440,7 @@ CS.RUN.FILE jsr CS.RUN.FILE.MSG jsr CS.RUN.GetPathY >PUSHYA - >SYSCALL PStrMatch + >SYSCALL StrMatch bcs .3 not same dir, go copy/delete jsr CS.RUN.Rename @@ -725,11 +717,11 @@ CS.RUN.BuildFilePath >STYA ZPPtr1 >PUSHYA - >SYSCALL PStrCpy + >SYSCALL StrCpy >PUSHW ZPFileName >PUSHW ZPPtr1 - >SYSCALL PStrCat + >SYSCALL StrCat .DO X.COPY.TO.DEST=1 ldy #hDstBasePath @@ -741,7 +733,7 @@ CS.RUN.BuildFilePath >STYA ZPPtr1 >PUSHYA - >SYSCALL PStrCpy + >SYSCALL StrCpy ldy #hDstFileName lda (pData),y @@ -754,7 +746,7 @@ CS.RUN.BuildFilePath .1 >PUSHW ZPFileName .2 >PUSHW ZPPtr1 - >SYSCALL PStrCat + >SYSCALL StrCat .FIN rts *-------------------------------------- diff --git a/BIN/X.FILEENUM.S.txt b/BIN/X.FILEENUM.S.txt index 83b3983f..2eddae36 100644 --- a/BIN/X.FILEENUM.S.txt +++ b/BIN/X.FILEENUM.S.txt @@ -15,28 +15,21 @@ X.MAX.RECURSE .EQ 8 * hDstBasePath .BS 1 (optional) * STAT .BS S.STAT *-------------------------------------- -InitSrcDirYA >SYSCALL GetFullPath.YA +InitSrcDirYA >SYSCALL RealPath.YA bcc .10 rts .10 >STYA ZPPtr1 txa >STA.G hFullPath - -* >LDYA ZPPtr1 -* >SYSCALL PrintF.YA -* lda #'|' -* >SYSCALL PutChar.A -* lda #13 -* >SYSCALL PutChar.A -* lda #10 -* >SYSCALL PutChar.A ldy #1 lda (ZPPtr1),y - beq .5 we have '/' +* beq .5 we have '/' + bne .55 + jmp .5 - >PUSHEA.G STAT +.55 >PUSHEA.G STAT >PUSHW ZPPtr1 >SYSCALL Stat bcs .1 File/DIR does not exists, go extract pattern @@ -46,11 +39,11 @@ InitSrcDirYA >SYSCALL GetFullPath.YA bne .4 TYPE not a DIR, extract.... beq .5 TYPE=DIR, do not extract pattern - ldy #0 TYPE is not DIR, check if wc +.1 ldy #0 TYPE is not DIR, check if wc -.1 iny +.11 iny lda (ZPPtr1),y Get Src Path Len - bne .1 + bne .11 dey @@ -72,7 +65,6 @@ InitSrcDirYA >SYSCALL GetFullPath.YA .3 txa beq .91 no wc, file not found.... - .4 ldy #0 .41 iny Search end of string..... @@ -86,7 +78,7 @@ InitSrcDirYA >SYSCALL GetFullPath.YA bne .42 tya - clc + sec +1 to skip '/' adc ZPPtr1 sta ZPPtr2 tay @@ -99,6 +91,9 @@ InitSrcDirYA >SYSCALL GetFullPath.YA txa >STA.G hFilter + >LDYA ZPPtr2 + jsr DEBUG.YA + lda #0 sta (ZPPtr2) @@ -145,12 +140,13 @@ InitSrcDirYA.RTS rts *-------------------------------------- .DO X.COPY.TO.DEST=1 -InitDstDirYA >SYSCALL GetFullPath.YA +InitDstDirYA >SYSCALL RealPath.YA bcs InitSrcDirYA.RTS - stx .90+1 >STYA ZPPtr1 - + txa + >STA.G hFullPath + >PUSHEA.G STAT >PUSHW ZPPtr1 >SYSCALL Stat @@ -160,40 +156,34 @@ InitDstDirYA >SYSCALL GetFullPath.YA cmp #$0f beq .5 Dst is a directory...no destfilename -.1 lda (ZPPtr1) - tay +.1 ldy #0 + +.11 iny Search end of string..... + lda (ZPPtr1),y + bne .11 -.2 lda (ZPPtr1),y search backward for a / - cmp #'/' - beq .3 - dey + lda #'/' + +.2 dey + cmp (ZPPtr1),y Search backward / bne .2 -.3 tya - cmp (ZPPtr1) - beq .5 Make sure at least one char - - ldx #0 - phy save / pos to trunk string later - -.4 iny - inx - lda (ZPPtr1),y - sta UsrBuf256,x tya - cmp (ZPPtr1) - bne .4 - - pla get back / pos - sta (ZPPtr1) trunk it for Opendir - - stx UsrBuf256 - >LDYAI UsrBuf256 - >SYSCALL NewPstrYA + sec +1 to skip '/' + adc ZPPtr1 + sta ZPPtr2 + tay + lda ZPPtr1+1 + adc #0 + sta ZPPtr2+1 + + >SYSCALL NewStr.YA bcs .9 txa - ldy #hDstFileName - sta (pData),y + >STA.G hDstFileName + + lda #0 + sta (ZPPtr2) .5 >LDYAI 256 >SYSCALL GetMem.YA Get a 256 buffer to store DstBasePath @@ -201,28 +191,26 @@ InitDstDirYA >SYSCALL GetFullPath.YA >STYA ZPPtr2 txa - ldy #hDstBasePath - sta (pData),y + >STA.G hDstBasePath - lda (ZPPtr1) - sta (ZPPtr2) - tay + ldy #$ff -.6 lda (ZPPtr1),y +.6 iny + lda (ZPPtr1),y sta (ZPPtr2),y - dey bne .6 - lda (ZPPtr2) - tay + dey + lda #'/' cmp (ZPPtr2),y beq .7 iny sta (ZPPtr2),y - tya - sta (ZPPtr2) + iny + lda #0 + sta (ZPPtr2),y .7 jsr .9 Cleanup @@ -230,7 +218,7 @@ InitDstDirYA >SYSCALL GetFullPath.YA .99 rts .9 pha -.90 lda #$ff self modified + >LDA.G hFullPath >SYSCALL FreeMem.A pla sec @@ -575,6 +563,14 @@ BasePath..1 lda (pData),y rts *-------------------------------------- +DEBUG.YA >SYSCALL PrintF.YA + lda #'|' + >SYSCALL PutChar.A + lda #13 + >SYSCALL PutChar.A + lda #10 + >SYSCALL PutChar.A + rts MAN SAVE /A2OSX.SRC/BIN/X.FILEENUM.S LOAD /A2OSX.SRC/BIN/LS.S diff --git a/INC/A2osX.I.txt b/INC/A2osX.I.txt index 2b5f25be..e8bdc11c 100644 --- a/INC/A2osX.I.txt +++ b/INC/A2osX.I.txt @@ -148,7 +148,7 @@ SYS.FPrintF.YA .EQ $5C * .EQ $5E * .EQ $60 -SYS.GetFullPath.YA .EQ $62 +* .EQ $62 SYS.LoadFile .EQ $64 SYS.SaveFile .EQ $66 diff --git a/README.md b/README.md index 68522a33..92d40e2b 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ note : '$VAR' does NOT expand Variable | RM | Working | -C : Continue On Error | 0.9 | | | | -Q : Quiet | | | | | -R : Recurse subdirectories | | -| CP | Working | -C : Continue On Error | 0.9 | +| CP | Working | -C : Continue On Error | 0.9.1 | | | | -Q : Quiet | | | | | -R : Recurse subdirectories | | | | | -Y : Dont't Prompt For Override | | @@ -207,7 +207,7 @@ note : '$VAR' does NOT expand Variable | | | -R : Recurse subdirectories | | | CHGRP | In Progress | -C : Continue On Error | 0.9 | | | | -R : Recurse subdirectories | | -| FORMAT | In Progress | -L : Low-Level Format | 0.9 | +| FORMAT | In Progress | -L : Low-Level Format | 0.9.1 | | EDIT | Working | still missing : find/replace | 0.9 | | NSCUTIL | Working | Tool for setting time in NSC/DL1216E | 0.9 | | ---- | ------ | ------- | ----- | diff --git a/SYS/KERNEL.S.FIO.txt b/SYS/KERNEL.S.FIO.txt index 6b035ce3..bdceccfc 100644 --- a/SYS/KERNEL.S.FIO.txt +++ b/SYS/KERNEL.S.FIO.txt @@ -4,52 +4,6 @@ LOMEM $A00 INC 1 AUTO 6 */-------------------------------------- -* # GetFullPath.YA -* ## In : -* Y,A = Filename (C-String) -* ## Out : -* CC : success -* Y,A = FullPath (C-String) -* X = hMem of FullPath -* CS : A = Error Code -*\-------------------------------------- -K.GetFullPath.YA - >STYA ZPPtr1 - - ldx #$ff - - lda (ZPPtr1) - beq .10 - - cmp #'/' full path starting with '/'? - beq .2 yes, do not append to current prefix - -.10 ldy #S.PS.hPREFIX - lda (pPs),y - jsr K.GetMemPtr.A - >STYA ZPPtr2 - - ldy #$ff - -.1 iny - inx - lda (ZPPtr2),y - sta K.Buf256,x - bne .1 - - dex - -.2 ldy #$ff - -.3 iny - inx - lda (ZPPtr1),y - sta K.Buf256,x - bne .3 - -.8 >LDYAI K.Buf256 - jmp K.NewStr.YA -*/-------------------------------------- * # LoadFile * ## In: * PUSHW = AUXTYPE (Handled by.... diff --git a/SYS/KERNEL.S.JMP.txt b/SYS/KERNEL.S.JMP.txt index 61f8ba47..cccd9112 100644 --- a/SYS/KERNEL.S.JMP.txt +++ b/SYS/KERNEL.S.JMP.txt @@ -63,7 +63,7 @@ K.SYSCALL.JMP .DA 0 $00 .DA 0 .DA 0 $60 - .DA K.GetFullPath.YA + .DA 0 .DA K.LoadFile .DA K.SaveFile .DA K.ChTyp diff --git a/SYS/KERNEL.S.STDLIB.txt b/SYS/KERNEL.S.STDLIB.txt index 23f4b483..dd989a02 100644 --- a/SYS/KERNEL.S.STDLIB.txt +++ b/SYS/KERNEL.S.STDLIB.txt @@ -208,33 +208,33 @@ K.RealPath.YA >STYA ZPPtr1 ldx #$ff lda (ZPPtr1) - beq .10 + beq .1 cmp #'/' full path starting with '/'? - beq .2 yes, do not append to current prefix + beq .3 yes, do not append to current prefix -.10 ldy #S.PS.hPREFIX +.1 ldy #S.PS.hPREFIX lda (pPs),y jsr K.GetMemPtr.A >STYA ZPPtr2 ldy #$ff -.1 iny +.2 iny inx lda (ZPPtr2),y sta K.Buf256,x - bne .1 + bne .2 dex -.2 ldy #$ff +.3 ldy #$ff -.3 iny +.4 iny inx lda (ZPPtr1),y sta K.Buf256,x - bne .3 + bne .4 *-------------------------------------- * X=LEN, K.Buf256 = /dir1../file(/) /x0 @@ -282,16 +282,16 @@ K.RealPath.YA >STYA ZPPtr1 jsr K.RealPath.RemoveAtX remove "/.." -.11 dex +.10 dex lda K.Buf256,x go to "/dir" cmp #'/' - bne .11 + bne .10 jsr K.RealPath.RemoveAtX ...remove "/dir" .80 txa - beq .89 + beq .89 Empty path!!! go put back "/" an exit dex bra .5 @@ -316,11 +316,18 @@ K.RealPath.RemoveAtX .3 lda K.Buf256,y sta K.Buf256,x - beq .8 + beq .4 iny inx bne .3 +.4 txa + bne .8 + + lda #'/' Make sure we have a least '/' in the buffer + sta K.Buf256 + stz K.Buf256+1 + .8 plx rts *-------------------------------------- diff --git a/SYS/KERNEL.S.STRING.txt b/SYS/KERNEL.S.STRING.txt index d02d2900..e28f15dd 100644 --- a/SYS/KERNEL.S.STRING.txt +++ b/SYS/KERNEL.S.STRING.txt @@ -86,12 +86,12 @@ K.StrMatch jsr PullPtr1Ptr2 bra .21 -.1 inc ZPPtr2 Make PTR2 advance to next char +.1 inc ZPPtr2 Make PTR2 (pattern) advance to next char bne .2 inc ZPPtr2+1 .2 lda (ZPPtr2) get pattern char - beq .41 + beq .41 end of pattern... .21 cmp #'*' beq .5 @@ -105,26 +105,27 @@ K.StrMatch jsr PullPtr1Ptr2 cmp (ZPPtr1),y Regular Char, compare with string at Y bne .9 no match, exit - iny advance to next char to compare - -.4 dex char matched, check if end of pattern - bne .1 continue if remaining char in pattern +.4 iny advance to next char to compare + bra .1 continue if remaining char in pattern .41 lda (ZPPtr1),y end of pattern, but end of string ? beq .8 yes, string matched entirely - bra .9 no, remaining char in string, no match +* no, remaining char in string, no match +.9 sec + rts .5 inc ZPPtr2 Make PTR2 advance to next char bne .6 inc ZPPtr2+1 - lda (ZPPtr2) we have '*', last char of pattern ? + +.6 lda (ZPPtr2) we have '*', last char of pattern ? beq .8 yes, match everything, including empty string -.6 lda (ZPPtr2) get next char of pattern + lda (ZPPtr2) get next char of pattern cmp #'*' another '*' ? beq .5 yes, '**' = '*', go next char - cmp #'?' '*?' ??? we must match a least one char + cmp #'?' '*?' ? we must match a least one char beq .3 .7 lda (ZPPtr1),y we need at least one remaining char in string, check if at end of string @@ -135,13 +136,11 @@ K.StrMatch jsr PullPtr1Ptr2 cmp (ZPPtr1),y compare with char in string bne .7 not equal to next non wildcard in pattern - bra .4 go check remaining char in pattern... + iny + bra .1 go check remaining char in pattern... .8 clc rts - -.9 sec - rts */-------------------------------------- * # StrUpr.YA/StrLwr.YA * Convert string to UPPERCASE/lowercase