diff --git a/.Floppies/A2OSX.BUILD.po b/.Floppies/A2OSX.BUILD.po index 71cf3235..9641bc30 100644 Binary files a/.Floppies/A2OSX.BUILD.po and b/.Floppies/A2OSX.BUILD.po differ diff --git a/.Floppies/A2OSX.TEST.po b/.Floppies/A2OSX.TEST.po index 20c5e401..b159d59a 100644 Binary files a/.Floppies/A2OSX.TEST.po and b/.Floppies/A2OSX.TEST.po differ diff --git a/BIN/CP.S.txt b/BIN/CP.S.txt index d9e603bd..153bf561 100644 --- a/BIN/CP.S.txt +++ b/BIN/CP.S.txt @@ -19,17 +19,19 @@ X.DELETE.SOURCE .EQ 0 *-------------------------------------- CS.END *-------------------------------------- -OptionList .AS "CcQqRrYy" -OptionVars .DA #bContinue,#bContinue +OptionList .AS "IiCcQqRrYy" +OptionVars .DA #0,#0 + .DA #bContinue,#bContinue .DA #bQuiet,#bQuiet .DA #bRecurse,#bRecurse .DA #bNoConfirm,#bNoConfirm *-------------------------------------- MSG.USAGE .CS "Usage : CP [Src File/Dir, *,? wildcards allowed]\r\n" .CS " -C : Continue on error\r\n" + .CS " -I <*,? wildcards allowed> : Ignore matching files\r\n" .CS " -Q : Quiet\r\n" .CS " -R : Recurse subdirectories\r\n" - .CZ " -Y : Don't prompt for override\r\n" + .CZ " -Y : Don't prompt for overwrite\r\n" MSG.DIR .CZ "CP Dir :%s to %s..." MSG.REG .CZ "CP File:%s to %s..." MSG.OVERWRITE .CZ "Overwrite %s [Yes,No,All]?" @@ -40,7 +42,7 @@ MSG.DONE .CZ "%D File(s) Copied.\r\n" *-------------------------------------- .DUMMY .OR 0 -DS.START .INB usr/src/shared/x.cpmvrm.g +DS.START .INB usr/src/shared/x.fileenum.g DS.END .ED *-------------------------------------- diff --git a/BIN/LS.S.txt b/BIN/LS.S.txt index 323b8933..2c9d18f3 100644 --- a/BIN/LS.S.txt +++ b/BIN/LS.S.txt @@ -894,6 +894,7 @@ MSG.USAGE .CS "Usage : LS [-A] [-C] [-F] [-L] [-R] [filespec]\r\n" .CS " -A : Show all files\r\n" .CS " -C : List in one column\r\n" .CS " -F : Show full paths\r\n" + .CS " -I <*,? wildcards allowed> : Ignore matching files\r\n" .CS " -L : Use long listing format\r\n" .CZ " -R : Recursively list subdirectories\r\n" *-------------------------------------- diff --git a/BIN/MV.S.txt b/BIN/MV.S.txt index 37cc30dc..8156ae19 100644 --- a/BIN/MV.S.txt +++ b/BIN/MV.S.txt @@ -19,17 +19,19 @@ X.DELETE.SOURCE .EQ 1 *-------------------------------------- CS.END *-------------------------------------- -OptionList .AS "CcQqRrYy" -OptionVars .DA #bContinue,#bContinue +OptionList .AS "IiCcQqRrYy" +OptionVars .DA #0,#0 + .DA #bContinue,#bContinue .DA #bQuiet,#bQuiet .DA #bRecurse,#bRecurse .DA #bNoConfirm,#bNoConfirm *-------------------------------------- MSG.USAGE .CS "Usage : MV [Src File/Dir, *,? wildcards allowed]\r\n" .CS " -C : Continue on error\r\n" + .CS " -I <*,? wildcards allowed> : Ignore matching files\r\n" .CS " -Q : Quiet\r\n" .CS " -R : Recurse subdirectories\r\n" - .CZ " -Y : Dont't prompt for override\r\n" + .CZ " -Y : Dont't prompt for overwrite\r\n" MSG.DIR .CZ "MV Dir :%s to %s..." MSG.REG .CZ "MV File:%s to %s..." MSG.OVERWRITE .CZ "Overwrite %s [Yes,No,All]?" @@ -40,7 +42,7 @@ MSG.DONE .CZ "%D File(s) Moved.\r\n" *-------------------------------------- .DUMMY .OR 0 -DS.START .INB usr/src/shared/x.cpmvrm.g +DS.START .INB usr/src/shared/x.fileenum.g DS.END .ED *-------------------------------------- diff --git a/BIN/RM.S.txt b/BIN/RM.S.txt index 3efc217e..e1858920 100644 --- a/BIN/RM.S.txt +++ b/BIN/RM.S.txt @@ -19,13 +19,15 @@ X.DELETE.SOURCE .EQ 1 *-------------------------------------- CS.END *-------------------------------------- -OptionList .AS "CcQqRr" -OptionVars .DA #bContinue,#bContinue +OptionList .AS "IiCcQqRr" +OptionVars .DA #0,#0 + .DA #bContinue,#bContinue .DA #bQuiet,#bQuiet .DA #bRecurse,#bRecurse *-------------------------------------- MSG.USAGE .CS "Usage : RM [File/Dir, *,? wildcards allowed]\r\n" .CS " -C : Continue on error\r\n" + .CS " -I <*,? wildcards allowed> : Ignore matching files\r\n" .CS " -Q : Quiet\r\n" .CZ " -R : Recurse subdirectories\r\n" MSG.DIR .CZ "RM Dir :%s..." @@ -37,7 +39,7 @@ MSG.DONE .CZ "%D File(s) Removed.\r\n" *-------------------------------------- .DUMMY .OR 0 -DS.START .INB usr/src/shared/x.cpmvrm.g +DS.START .INB usr/src/shared/x.fileenum.g DS.END .ED *-------------------------------------- diff --git a/LIB/LIBTUI.S.OBJ.txt b/LIB/LIBTUI.S.OBJ.txt index 14b15560..b5257666 100644 --- a/LIB/LIBTUI.S.OBJ.txt +++ b/LIB/LIBTUI.S.OBJ.txt @@ -922,6 +922,12 @@ OBJ.CurOff ldy #S.OBJ.F clc rts *-------------------------------------- +OBJ.ZeroWordAtY lda #0 + lda (ZPObjPtr),y + iny + sta (ZPObjPtr),y + rts +*-------------------------------------- OBJ.IncWordAtY lda (ZPObjPtr),y inc sta (ZPObjPtr),y diff --git a/LIB/LIBTUI.S.TBOX.txt b/LIB/LIBTUI.S.TBOX.txt index e265e1d8..fa4bfb21 100644 --- a/LIB/LIBTUI.S.TBOX.txt +++ b/LIB/LIBTUI.S.TBOX.txt @@ -20,7 +20,7 @@ TBOX.New lda #S.OBJ.T.TBOX jsr OBJ.Insert bcs .99 - + lda hObj * clc rts @@ -47,7 +47,7 @@ TBOX.Run ldy #S.OBJ.S .1 cmp #C.DEL beq .3 - + jsr TBOX.GetBuf jsr TBOX.ToBuf1 bcs .8 Buffer full @@ -55,7 +55,7 @@ TBOX.Run ldy #S.OBJ.S jsr TBOX.RUN.FS1 bit bRepaintAll bmi .2 - + jsr OBJ.CurUpdPos jmp TBOX.DrawCurLine @@ -74,8 +74,8 @@ TBOX.Run ldy #S.OBJ.S jmp TBOX.DrawCurLine .4 jmp TBOX.DrawAllLines - -.8 + +.8 *-------------------------------------- TBOX.RUN.Ignore lda #0 sec @@ -87,13 +87,13 @@ TBOX.RUN.SelBegin tax iny lda (ZPObjPtr),y - + ldy #S.TBOX.SelBegin+1 sta (ZPObjPtr),y txa dey sta (ZPObjPtr),y - + bra TBOX.RUN.Sel *-------------------------------------- TBOX.RUN.SelEnd ldy #S.TBOX.BufPtr @@ -101,7 +101,7 @@ TBOX.RUN.SelEnd ldy #S.TBOX.BufPtr tax iny lda (ZPObjPtr),y - + ldy #S.TBOX.SelEnd+1 sta (ZPObjPtr),y txa @@ -117,18 +117,18 @@ TBOX.RUN.Sel ldy #S.TBOX.SelEnd lda (ZPObjPtr),y ldy #S.TBOX.SelBegin+1 sbc (ZPObjPtr),y - + ldy #S.TBOX.bSelect lda #0 ror pha eor (ZPObjPtr),y bpl .1 - + pla sta (ZPObjPtr),y jmp TBOX.SetViewPort - + .1 pla clc rts @@ -161,7 +161,7 @@ TBOX.RUN.BS ldy #S.TBOX.BufPtr+1 *-------------------------------------- TBOX.RUN.LF jsr TBOX.GetBuf - jsr TBOX.GetCurlineInAX +TBOX.RUN.LF1 jsr TBOX.GetCurlineInAX inx bne .1 @@ -262,17 +262,17 @@ TBOX.RUN.SOL lda #0 sta (ZPObjPtr),y iny sta (ZPObjPtr),y - + jsr TBOX.GetCurlineInAX jsr TBOX.GetLineAX - + ldy #S.TBOX.BufPtr lda TempC BufPtr at SOL sta (ZPObjPtr),y iny lda TempC+1 sta (ZPObjPtr),y - + jmp TBOX.CheckViewPort *-------------------------------------- TBOX.RUN.EOL jsr TBOX.GetCurlineInAX @@ -304,19 +304,34 @@ TBOX.RUN.CR jsr TBOX.GetBuf jsr TBOX.ToBuf1 bcs .8 Buffer full - jmp TBOX.RUN.FS1 + lda #0 + ldy #S.TBOX.DocX + sta (ZPObjPtr),y + iny + sta (ZPObjPtr),y + + jsr TBOX.RUN.LF1 + jsr OBJ.CurUpdPos + + bit bRepaintAll + bmi .1 + + jsr TBOX.DrawBottom + +.1 jmp TBOX.DrawAllLines + .8 clc rts *-------------------------------------- -TBOX.RUN.PGUP +TBOX.RUN.PGUP *-------------------------------------- TBOX.RUN.PGDN lda #0 sec rts *-------------------------------------- TBOX.RUN.QUIT lda #3 User Interrupt - clc + sec rts *-------------------------------------- TBOX.RUN.Home ldy #S.TBOX.DocX @@ -342,7 +357,7 @@ TBOX.RUN.EraseCL jsr TBOX.GetLineAX jsr TBOX.GetLineLenInAXC jsr TBOX.DeleteAXC - + jmp TBOX.RUN.VT1 *-------------------------------------- TBOX.RUN.EOF lda #$ff @@ -353,9 +368,9 @@ TBOX.RUN.EOF lda #$ff lda TempI sta (ZPObjPtr),y tax - + lda TempI+1 - iny + iny sta (ZPObjPtr),y jsr TBOX.GetLineAX @@ -377,7 +392,7 @@ TBOX.RUN.EOF lda #$ff sta (ZPObjPtr),y iny txa - sta (ZPObjPtr),y + sta (ZPObjPtr),y jmp TBOX.CheckViewPort *-------------------------------------- @@ -388,26 +403,50 @@ TBOX.DrawAllLines jsr OBJ.Draw.Body inc pStack - + rts *-------------------------------------- +TBOX.DrawBottom ldy #S.OBJ.InnerY + lda (ZPObjPtr),y + + clc + + ldy #S.OBJ.CurY + adc (ZPObjPtr),y + >PUSHA Start + + ldy #S.OBJ.InnerH + lda (ZPObjPtr),y + + sec + + ldy #S.OBJ.CurY + sbc (ZPObjPtr),y + >PUSHA Count + + ldy #S.OBJ.CurY + lda (ZPObjPtr),y Relative Y + >PUSHA + + jmp OBJ.Draw.Lines +*-------------------------------------- TBOX.DrawCurLine ldy #S.OBJ.InnerY lda (ZPObjPtr),y - + clc - + ldy #S.OBJ.CurY adc (ZPObjPtr),y >PUSHA Start - + lda #1 >PUSHA Count ldy #S.OBJ.CurY lda (ZPObjPtr),y Relative Y >PUSHA - + jmp OBJ.Draw.Lines *-------------------------------------- TBOX.Draw ldy #S.TBOX.VScroll @@ -425,15 +464,15 @@ TBOX.Draw ldy #S.TBOX.VScroll ldy #S.TBOX.HScroll lda (ZPObjPtr),y + beq .12 tax - beq .12 .1 jsr TBOX.GetLineChar - beq .12 + beq .5 cmp #C.CR - beq .12 + beq .5 dex bne .1 @@ -454,7 +493,7 @@ TBOX.Draw ldy #S.TBOX.VScroll .3 txa bne .6 - + clc rts @@ -471,7 +510,7 @@ TBOX.Draw ldy #S.TBOX.VScroll .8 clc rts *-------------------------------------- -TBOX.Activate +TBOX.Activate *-------------------------------------- TBOX.Deactivate clc rts @@ -524,7 +563,7 @@ TBOX.GetLineAX stx TempW jsr TBOX.GetLineLenInAXC bcc .9 - + php pha @@ -569,18 +608,18 @@ TBOX.GetLineChar lda (ZPPtr1) beq .8 - + inc ZPPtr1 bne .7 - + inc ZPPtr1+1 - + .7 inc TempC bne .8 - + inc TempC+1 - -.8 rts + +.8 rts *-------------------------------------- TBOX.GetLineLenInAXC lda ZPPtr1+1 @@ -706,9 +745,9 @@ TBOX.CheckViewPort jsr TBOX.SetViewPort bit bRepaintAll bpl .8 - + jmp TBOX.DrawAllLines - + .8 jmp OBJ.CurUpdPos *-------------------------------------- TBOX.SetViewPort @@ -899,7 +938,7 @@ TBOX.SetViewPort .40 ldy #S.OBJ.CurY sta (ZPObjPtr),y - + dec bRepaintAll .41 clc CLC RTS to jmp to diff --git a/SBIN/CIFSD.S.CORE.txt b/SBIN/CIFSD.S.CORE.txt index bcd83802..2b9a1621 100644 --- a/SBIN/CIFSD.S.CORE.txt +++ b/SBIN/CIFSD.S.CORE.txt @@ -112,6 +112,14 @@ CORE.AppendPathPtr2 rts *-------------------------------------- CORE.AppendTypePtr2 + pha + + lda #'.' + sta (ZPPtr2),y + iny + + pla + ldx #0 .1 cmp PRODOS.FT.HEX,x @@ -121,6 +129,43 @@ CORE.AppendTypePtr2 cpx #PRODOS.FT.TXT-PRODOS.FT.HEX bne .1 + pha + + lda #'0' + sta (ZPPtr2),y + iny + + pla + bra CORE.AppendHEXPtr2 + +.4 txa + asl + asl + tax + +.6 lda PRODOS.FT.TXT,x + sta (ZPPtr2),y + beq .8 + + inx + iny + bra .6 + +.8 rts +*-------------------------------------- +CORE.AppendAuxTPtr2 + pha + + lda #'_' + sta (ZPPtr2),y + iny + + pla + jsr CORE.AppendHEXPtr2 + + txa +*-------------------------------------- +CORE.AppendHEXPtr2 pha lsr lsr @@ -133,7 +178,9 @@ CORE.AppendTypePtr2 adc #6 -.2 sta PRODOS.FT.DFLT+1 +.2 sta (ZPPtr2),y + iny + pla and #$0F @@ -143,26 +190,10 @@ CORE.AppendTypePtr2 adc #6 -.3 sta PRODOS.FT.DFLT+2 - -.4 txa - asl - asl - tax - - lda #'.' - sta (ZPPtr2),y +.3 sta (ZPPtr2),y iny - -.6 lda PRODOS.FT.TXT,x - sta (ZPPtr2),y - beq .8 - - inx - iny - bra .6 - -.8 rts + + rts *-------------------------------------- CORE.Add2ByteCount ldy ByteCountOfs @@ -256,7 +287,6 @@ CORE.SetReqLen lda ZPReqLen sta (ZPReqPtr),y lda ZPReqLen+1 - sec sbc /S.NETBIOS dey sta (ZPReqPtr),y diff --git a/SBIN/CIFSD.S.IO.txt b/SBIN/CIFSD.S.IO.txt index e2da5e0a..3e7e391a 100644 --- a/SBIN/CIFSD.S.IO.txt +++ b/SBIN/CIFSD.S.IO.txt @@ -39,7 +39,7 @@ IO.Sleep ldy #S.PS.PID sta CIFS.PID dec CIFS.Status - + stz CIFS.Cnt stz CIFS.Cnt+1 @@ -231,7 +231,7 @@ IO.Q.OpenDir >STYA pPath resolved path .98 jmp IO.Exit *-------------------------------------- -* IO.R.OpenDir +* IO.R.OpenDir *-------------------------------------- * A = hDIR *-------------------------------------- @@ -472,72 +472,12 @@ IO.R.ReadDir.FillBuf sec jsr IO.AddA2Ptr1 - txa - sec - sbc #4 "x.EXT" ? - bcc .7 + jsr IO.R.ReadDir.AuxT - tay - - lda (ZPPtr2),y - cmp #'.' - bne .7 - - ldx #0 - -.4 phy Y = '.' offset - - phx - -.5 iny - lda (ZPPtr2),y - beq .51 - - cmp #'A' - bcc .50 - - cmp #'Z'+1 - bcs .50 - - eor #$20 - -.50 cmp PRODOS.FT.TXT,x - bne .6 - - inx - bra .5 - -.51 pla - lsr - lsr - tax - lda PRODOS.FT.HEX,x - sta StatBuf+S.STAT.P.TYPE - - ply - lda #0 - sta (ZPPtr2),y - - tya - bra .70 - -.6 pla - clc - adc #4 - tax - - ply - - cpx #PRODOS.FT.END - bne .4 - - tya -* sec - adc #3 - bra .70 + jsr IO.R.ReadDir.Type .7 txa -.70 sec +\0 + sec +\0 jsr IO.AddA2Ptr2 jsr IO.StatBuf2Ptr2 @@ -552,6 +492,180 @@ IO.R.ReadDir.FillBuf sta (ZPPtr2) rts +*-------------------------------------- +IO.R.ReadDir.AuxT + txa X = filename len + sec + sbc #5 "x.EXT_hhhh" ? + bcc .99 + beq .99 + + tay + + lda (ZPPtr2),y + cmp #'_' + bne .99 + + phy + + iny + lda (ZPPtr2),y + + jsr IO.IsHexDigit + bcs .9 + + asl + asl + asl + asl + sta StatBuf+S.STAT.P.AUXTYPE+1 + + iny + lda (ZPPtr2),y + + jsr IO.IsHexDigit + bcs .9 + + ora StatBuf+S.STAT.P.AUXTYPE+1 + sta StatBuf+S.STAT.P.AUXTYPE+1 + + iny + lda (ZPPtr2),y + + jsr IO.IsHexDigit + bcs .9 + + asl + asl + asl + asl + sta StatBuf+S.STAT.P.AUXTYPE + + iny + lda (ZPPtr2),y + + jsr IO.IsHexDigit + bcs .9 + + ora StatBuf+S.STAT.P.AUXTYPE + sta StatBuf+S.STAT.P.AUXTYPE + + pla + tax + tay + lda #0 + sta (ZPPtr2),y + rts + +.9 plx + +.99 stz StatBuf+S.STAT.P.AUXTYPE + stz StatBuf+S.STAT.P.AUXTYPE+1 + + rts +*-------------------------------------- +IO.R.ReadDir.Type + txa X = filename len + sec + sbc #4 "x.EXT" ? + bcc .99 + beq .99 + + tay + + lda (ZPPtr2),y + cmp #'.' + bne .99 + + phx + + ldx #0 + +.1 phy Y = '.' offset + +.2 iny + lda (ZPPtr2),y + beq .4 + + cmp #'A' + bcc .3 + + cmp #'Z'+1 + bcs .3 + + eor #$20 + +.3 cmp PRODOS.FT.TXT,x + bne .5 + + inx + bra .2 + +.4 txa + lsr + lsr + tax + lda PRODOS.FT.HEX,x + sta StatBuf+S.STAT.P.TYPE + + ply + bra .8 + +.5 txa + and #$FC + clc + adc #4 + tax + + ply + + cpx #PRODOS.FT.END + bne .1 + + iny + lda (ZPPtr2),y + cmp #'0' + bne .9 + + iny + lda (ZPPtr2),y + + jsr IO.IsHexDigit + bcs .9 + + asl + asl + asl + asl + sta StatBuf+S.STAT.P.TYPE + + iny + lda (ZPPtr2),y + + jsr IO.IsHexDigit + bcs .9 + + ora StatBuf+S.STAT.P.TYPE + sta StatBuf+S.STAT.P.TYPE + +.8 pla + sec + sbc #4 + tax + + tay + lda #0 + sta (ZPPtr2),y + + rts + +.9 plx + +.99 stz StatBuf+S.STAT.P.TYPE + + rts +*-------------------------------------- + *-------------------------------------- IO.Q.CloseReg IO.Q.CloseDir tax @@ -574,7 +688,7 @@ IO.Q.CloseDir tax jmp IO.Exit *-------------------------------------- -* IO.R.CloseDir +* IO.R.CloseDir *-------------------------------------- * short int fopen ( const char *filename, short int flags, short int ftype, int auxtype ); *-------------------------------------- @@ -594,18 +708,38 @@ IO.Q.FOpen >STYA pPath resolved path jsr CORE.ReqSetupPtr2 - ldy #2 - lda (pStack),y TYPE - pha - jsr CORE.AppendPathPtr2 - pla + phy + + ldy #2 + lda (pStack),y TYPE beq .2 + ply + jsr CORE.AppendTypePtr2 -.2 jsr CORE.AddYReqLen + phy + + lda (pStack) AUXT + tax + + ldy #1 + ora (pStack),y + beq .2 + + lda (pStack),y AUXT + + ply + + jsr CORE.AppendAuxTPtr2 + + phy + +.2 ply + + jsr CORE.AddYReqLen tya @@ -784,8 +918,6 @@ IO.R.FClose sta hFILE .99 jmp IO.SleepCont *-------------------------------------- -* -*-------------------------------------- IO.Q.FRead ldy #4 hFILE lda (pStack),y @@ -915,7 +1047,7 @@ IO.R.FRead jsr IO.ReadSocket >LDYA CIFS.Cnt clc - + .98 >POP 5 jmp IO.Exit @@ -1106,9 +1238,9 @@ IO.Q.FTell jsr IO.GetFD dey cpy #S.FD.REG.FPOS-1 bne .1 - + clc - + jmp IO.Exit *-------------------------------------- * IO.R.FTell @@ -1541,6 +1673,45 @@ IO.FileInfo2StatBufDT rts *-------------------------------------- +IO.IsHexDigit jsr IO.IsDigit + bcc .8 + + cmp #'A' + bcc .9 + + cmp #'F'+1 + bcc .1 + + cmp #'a' + bcc .9 + + cmp #'f'+1 + bcs .99 + + eor #$20 + +.1 +* clc + sbc #'A'-11 cc so A->10 (11-CC) + clc +.8 rts + +.9 sec +.99 rts +*-------------------------------------- +IO.IsDigit cmp #'0' + bcc .9 + + cmp #'9'+1 + bcs .99 + + and #$0F +* clc + rts + +.9 sec +.99 rts +*-------------------------------------- MAN SAVE usr/src/sbin/cifsd.s.io LOAD usr/src/sbin/cifsd.s diff --git a/SBIN/CIFSD.S.txt b/SBIN/CIFSD.S.txt index 78311585..18d1fd3e 100644 --- a/SBIN/CIFSD.S.txt +++ b/SBIN/CIFSD.S.txt @@ -450,7 +450,6 @@ PRODOS.FT.TXT .AZ "txt" .AZ "pak" .AZ "sys" PRODOS.FT.END .EQ *-PRODOS.FT.TXT -PRODOS.FT.DFLT .AZ "$ " *-------------------------------------- SMBERR01 .DA #2,#3,#32 MLIERR01 .DA #MLI.E.FNOTFND,#MLI.E.PNOTFND,#MLI.E.OPEN diff --git a/SHARED/X.CPMVRM.G.txt b/SHARED/X.CPMVRM.G.txt deleted file mode 100644 index c7a1ba0a..00000000 --- a/SHARED/X.CPMVRM.G.txt +++ /dev/null @@ -1,31 +0,0 @@ -NEW - AUTO 3,1 - .LIST OFF -*-------------------------------------- -ArgCount .BS 1 -bPause .BS 1 - -hSrcFullPath .BS 1 -Count .BS 2 -RC .BS 1 - - .DO X.COPY.TO.DEST=1 -hDstFileName .BS 1 -hDstFullPath .BS 1 - -bCopy .BS 1 - -hSrcFile .BS 1 -hDstFile .BS 1 -hCopyBuf .BS 1 -CopyRC .BS 1 - .FIN - - .DO X.DELETE.SOURCE=1 -hToDelete .BS 1 - .FIN -*-------------------------------------- -MAN -SAVE usr/src/shared/x.cpmvrm.g -LOAD usr/src/bin/cp.s -ASM diff --git a/SHARED/X.CPMVRM.S.txt b/SHARED/X.CPMVRM.S.txt index 9e3314cb..9e1b6a57 100644 --- a/SHARED/X.CPMVRM.S.txt +++ b/SHARED/X.CPMVRM.S.txt @@ -2,7 +2,7 @@ NEW AUTO 3,1 .LIST OFF *-------------------------------------- -X.COPY.BUF.SIZE .EQ 4096 +X.RESETSRCDIR .EQ 0 single pass *-------------------------------------- .DUMMY .OR ZPBIN @@ -15,9 +15,28 @@ ZPFileStat .BS 2 bContinue .BS 1 bRecurse .BS 1 bQuiet .BS 1 +bPause .BS 1 + +Count .BS 2 + +PageCount .EQ * +ArgIndex .BS 1 + +hSrcFullPath .BS 1 + .DO X.COPY.TO.DEST=1 +X.COPY.MINBUF .EQ 1024 +X.COPY.MAXBUF .EQ 4096 + bNoConfirm .BS 1 + +hDstFullPath .BS 1 + +hSrcFile .BS 1 +hDstFile .BS 1 +hCopyBuf .BS 1 .FIN + ZS.END .ED *-------------------------------------- * File Header (16 Bytes) @@ -51,308 +70,138 @@ L.MSG.CRLF .DA MSG.CRLF L.MSG.DONE .DA MSG.DONE .DA 0 *-------------------------------------- -CS.INIT -.1 >INC.G ArgCount - >SYSCALL ArgV - bcs .7 +CS.INIT clc +CS.INIT.RTS rts +*-------------------------------------- +CS.RUN jsr CS.RUN.CheckOpt + bcs CS.INIT.RTS - >STYA ZPPtr1 - lda (ZPPtr1) - cmp #'-' - bne .4 - - ldy #1 - lda (ZPPtr1),y - beq .99 - -.20 ldx #OptionVars-OptionList-1 - -.2 cmp OptionList,x - beq .3 - - dex - bpl .2 - -.99 >LDYA L.MSG.USAGE - >SYSCALL PutS - lda #E.SYN - sec - rts - -.3 lda OptionVars,x - tax -* sec - ror $0,x - - iny - lda (ZPPtr1),y - bne .20 - - bra .1 - -.4 >LDA.G index - - .DO X.COPY.TO.DEST=1 - bne .5 Already have a Src dir... - .ELSE - bne .99 - .FIN - - >LDYA ZPPtr1 - jsr InitSrcDirYA - bcc .1 success, scan for any other args - -.9 rts - - .DO X.COPY.TO.DEST=1 -.5 >LDA.G hDstBasePath - bne .99 we already have a second arg....error! - - >LDYA ZPPtr1 - jsr InitDstDirYA - bcc .1 success, scan for any other args - - rts - .FIN - -.7 >LDA.G index processed all args - beq .99 , no src ? ERROR - - .DO X.COPY.TO.DEST=1 - >LDA.G hDstBasePath - bne .8 we also have a Dst folder - - ldy #S.PS.hCWD no dst folder, use actual prefix - lda (pPS),y - >SYSCALL GetMemPtr - jsr InitDstDirYA - bcs .99 - .FIN - -.8 >LDYAI 256 + >LDYAI 256 >SYSCALL GetMem - bcs .9 + bcs CS.INIT.RTS - txa - >STA.G hSrcFullPath + stx hSrcFullPath .DO X.COPY.TO.DEST=1 >LDYAI 256 >SYSCALL GetMem - bcs .9 + bcs CS.INIT.RTS - txa - >STA.G hDstFullPath - - .FIN - clc -CS.INIT.RTS rts -*-------------------------------------- -CS.RUN ldy #S.PS.hStdIn - lda (pPS),y - >SYSCALL FEOF - bcs CS.INIT.RTS I/O error - tay - bne .15 - - >SYSCALL GetChar - bcs CS.INIT.RTS I/O error - cmp #$03 Ctrl-C - bne .10 - - sec - rts Abort.... - -.10 cmp #$13 Ctrl-S - bne .15 - - >LDA.G bPause - eor #$ff - sta (pData),y - -.15 >LDA.G bPause - bpl .1 - -.8 clc - rts -*-------------------------------------- -.1 .DO X.COPY.TO.DEST=1 - - >LDA.G bCopy - beq .2 - - jsr CS.RUN.Copy - - >LDA.G bCopy Copy completed ? - bne .8 no.....exit - - clc - >LDA.G CopyRC - - .DO X.DELETE.SOURCE=0 - beq .20 no copy error - - sec - jsr CS.RUN.CheckErr we have an error.... - bcs .9 - - jmp CS.RUN.NEXT - -.20 jsr CS.RUN.CheckErr Success!! - jsr CS.RUN.IncCount - jmp CS.RUN.NEXT - .ELSE - beq .2 - - sec - jsr CS.RUN.CheckErr we have an error.... - bcc .21 - - rts - -.21 >STZ.G hToDelete Cancel delete if any - jmp CS.RUN.NEXT - .FIN - .FIN - -.2 .DO X.DELETE.SOURCE=1 - >LDA.G hToDelete - beq .3 - - lda #0 - sta (pData),y - - ldy #hSrcFullPath - jsr CS.RUN.GetPathY - >SYSCALL Remove - bcs .22 - - jsr CS.RUN.CheckErr Success!!! - jsr CS.RUN.IncCount - jmp CS.RUN.NEXT - -.22 jsr CS.RUN.CheckErr - bcs .9 - - jmp CS.RUN.NEXT + stx hDstFullPath .FIN *-------------------------------------- -.3 jsr GetEntry - bcs CS.RUN.LEAVE - jsr FilterMatch +CS.RUN.Loop jsr CS.RUN.CheckKey + bcs .99 - bcs CS.RUN.NEXT no match, skip.... -.4 ldy #S.STAT.MODE+1 - lda (ZPFileStat),y - and #$70 - bne .5 REG file ? + bit bPause + bmi CS.RUN.Loop + + jsr X.GetEntry + bcs .80 + + jsr X.IncludeMatch + bcs .8 no match, skip.... + + jsr X.IgnoreMatch + bcc .8 jsr CS.RUN.BuildFilePath - jmp CS.RUN.REG -.5 cmp /S.STAT.MODE.DIR DIR ? - bne .7 + ldy #S.STAT.MODE+1 + lda (ZPFileStat),y + and #$70 + bne .1 REG file ? + + jsr CS.RUN.REG + bra .7 + +.1 cmp /S.STAT.MODE.DIR DIR ? + bne .98 bit bRecurse - bpl CS.RUN.NEXT + bpl .8 lda (ZPFileName) cmp #'.' - beq CS.RUN.NEXT Skip "." & ".." + bne .2 Skip "." & ".." - jsr CS.RUN.BuildFilePath - jmp CS.RUN.DIR + ldy #1 + lda (ZPFileName),y + beq .8 + + cmp #'.' + bne .2 Skip "." & ".." + + iny + lda (ZPFileName),y + beq .8 + +.2 jsr CS.RUN.DIR + +.7 jsr CS.RUN.CheckErr + bcs .99 + +.8 jsr X.GetNextEntry + bcc CS.RUN.Loop + +.80 jsr CS.RUN.LEAVE + bcc .8 -.7 lda #MLI.E.UNSUPST - sec -.9 rts -*-------------------------------------- -CS.RUN.CR.NEXT jsr CS.RUN.CR -CS.RUN.NEXT jsr GetNextEntry - bcs CS.RUN.LEAVE rts + +.98 lda #MLI.E.UNSUPST + sec +.99 rts *-------------------------------------- -CS.RUN.LEAVE jsr LeaveSubDir exit this sub dir.... - bcs .99 base, we are done, exit +CS.RUN.LEAVE jsr X.LeaveSubDir exit this sub dir.... + bcs .90 base, we are done, exit - jsr BasePath.. + jsr X.BasePath.. .DO X.DELETE.SOURCE=1 -* .DO X.COPY.TO.DEST=0 - jsr GetEntry + jsr X.GetEntry jsr CS.RUN.BuildFilePath jsr CS.RUN.DIR.MSG - bcs CS.RUN.LEAVE.RTS - - ldy #hSrcFullPath - jsr CS.RUN.GetPathY - >SYSCALL Remove - jsr CS.RUN.CheckErr bcs .99 -* .FIN + + lda hSrcFullPath + jsr CS.RUN.GetPathA + >SYSCALL Remove + .ELSE + clc .FIN - jmp CS.RUN.NEXT + rts -.99 bit bQuiet - bmi .91 +.90 bit bQuiet + bmi .98 >PUSHW L.MSG.DONE - ldy #Count+1 - >PUSHB (pData),y - dey - >PUSHB (pData),y + >PUSHW Count >PUSHBI 2 >SYSCALL PrintF + bcs .99 -.91 ldy #RC - lda (pData),y get global RC in case of bContinue +.98 lda #0 sec -CS.RUN.LEAVE.RTS - rts +.99 rts *-------------------------------------- -CS.RUN.DIR .DO X.COPY.TO.DEST=1 - jsr CS.RUN.DIR.MSG - bcs CS.RUN.LEAVE.RTS +CS.RUN.DIR jsr CS.RUN.DIR.MSG + bcs .99 - jsr CS.RUN.StatDst - bcs .3 File Not exists...go create + .DO X.COPY.TO.DEST=1 - bit bNoConfirm - bmi .21 no prompt, nothing to create, enter subdir + jsr CS.RUN.CheckOverwrite + bcs .99 ABORT - jsr CS.RUN.OVERWRITE.MSG - bcs CS.RUN.DIR.RTS + bmi .99 NO -.1 >SLEEP - >SYSCALL GetChar - bcs .1 + bne .8 YES, no create but enter - cmp #3 - beq .99 abort + lda hDstFullPath NOT EXISTS + jsr CS.RUN.PushPathA - jsr CS.RUN.ToUpper - - cmp #'N' - bne .2 - - jmp CS.RUN.CR.NEXT no overwrite, nothing to do, no recurse -.2 cmp #'Y' - beq .21 no create, but recurse - - cmp #'A' - bne .1 - -* sec - ror bNoConfirm - -.21 clc - lda #0 - bra .4 - -.3 ldy #hDstFullPath - jsr CS.RUN.PushPathY ldy #S.STAT.MODE+1 lda (ZPFileStat),y >PUSHA @@ -360,99 +209,64 @@ CS.RUN.DIR .DO X.COPY.TO.DEST=1 lda (ZPFileStat),y >PUSHA >SYSCALL MKDir + bcs .99 -.4 jsr CS.RUN.CheckErr - bcs CS.RUN.DIR.RTS jsr CS.RUN.IncCount .FIN - >LDYA ZPFileName - jmp EnterSubDirYA +.8 >LDYA ZPFileName + jmp X.EnterSubDirYA -.99 ldy #RC - lda (pData),y get global RC in case of bContinue - sec -CS.RUN.DIR.RTS rts +.99 rts *-------------------------------------- CS.RUN.REG ldx #2 jsr CS.RUN.REG.MSG - bcs CS.RUN.DIR.RTS + bcs .99 .DO X.COPY.TO.DEST=1 - jsr CS.RUN.StatDst - bcs .2 File Not exists...go create - bit bNoConfirm - bmi .2 no prompt, overwrite + jsr CS.RUN.CheckOverwrite + bcs .99 ABORT - jsr CS.RUN.OVERWRITE.MSG - bcs .9 - -.1 >SLEEP - >SYSCALL GetChar - bcs .1 - - cmp #3 - beq .99 abort - - jsr CS.RUN.ToUpper - - cmp #'N' - bne .11 - - jmp CS.RUN.CR.NEXT no overwrite exit - -.90 rts - -.11 cmp #'Y' - beq .12 copy - - cmp #'A' - bne .1 - -* sec - ror bNoConfirm - -.12 jsr GetEntry get back current entry corrupted by SLEEP + bmi .99 do not overwrite .2 .DO X.DELETE.SOURCE=1 mv file, check if srcbase=dstbase - ldy #hSrcBasePath - jsr CS.RUN.PushPathY - ldy #hDstBasePath - jsr CS.RUN.PushPathY + bne .3 overwrite, copy over + + lda hSrcBasePath + jsr CS.RUN.PushPathA + lda hDstBasePath + jsr CS.RUN.PushPathA >SYSCALL StrCaseCmp bcs .3 not same dir, go copy/delete - jsr CS.RUN.Rename - jsr CS.RUN.CheckErr - bcs .9 + lda hSrcFullPath + jsr CS.RUN.PushPathA + lda hDstFullPath + jsr CS.RUN.PushPathA + >SYSCALL Rename + bcc .8 - jmp CS.RUN.NEXT + rts .FIN .3 jsr CS.RUN.CopyStart - bcc .4 + bcs .99 - jsr CS.RUN.CheckErr - bcs .9 - - jmp CS.RUN.NEXT .FIN .4 .DO X.DELETE.SOURCE=1 - ldy #hSrcFullPath - lda (pData),y - ldy #hToDelete - sta (pData),y + lda hSrcFullPath + jsr CS.RUN.GetPathA + >SYSCALL Remove + bcs .99 + .FIN - clc -.9 rts +.8 jmp CS.RUN.IncCount -.99 >LDA.G RC get global RC in case of bContinue - sec - rts +.99 rts *-------------------------------------- CS.RUN.DIR.MSG ldx #0 @@ -461,12 +275,12 @@ CS.RUN.REG.MSG bit bQuiet >PUSHW L.MSG.DIR,x - ldy #hSrcFullPath - jsr CS.RUN.PushPathY + lda hSrcFullPath + jsr CS.RUN.PushPathA .DO X.COPY.TO.DEST=1 - ldy #hDstFullPath - jsr CS.RUN.PushPathY + lda hDstFullPath + jsr CS.RUN.PushPathA >PUSHBI 4 .ELSE @@ -479,96 +293,74 @@ CS.RUN.REG.MSG bit bQuiet .8 clc rts -*-------------------------------------- - .DO X.COPY.TO.DEST=1 -CS.RUN.OVERWRITE.MSG - bit bQuiet - bmi .1 - - jsr CS.RUN.CR - -.1 >PUSHW L.MSG.OVERWRITE - ldy #hDstFullPath - jsr CS.RUN.PushPathY - >PUSHBI 2 - >SYSCALL PrintF - rts - .FIN *-------------------------------------- CS.RUN.CR >PUSHW L.MSG.CRLF >PUSHBI 0 >SYSCALL PrintF - rts -*-------------------------------------- - .DO X.COPY.TO.DEST=1 - .DO X.DELETE.SOURCE=1 -CS.RUN.Rename ldy #hSrcFullPath - jsr CS.RUN.PushPathY - ldy #hDstFullPath - jsr CS.RUN.PushPathY - >SYSCALL Rename - bcs .9 - - jsr CS.RUN.IncCount - -.9 rts - .FIN - .FIN +CS.RUN.CR.RTS rts *-------------------------------------- .DO X.COPY.TO.DEST=1 CS.RUN.CopyStart - >STZ.G hSrcFile - >STA.G hDstFile - >STA.G hCopyBuf - >STA.G CopyRC Reset RC + stz hSrcFile + stz hDstFile + stz hCopyBuf - >LDYAI X.COPY.BUF.SIZE + lda hSrcFullPath + ldx #O.RDONLY + jsr CS.RUN.Open + bcs .9 + + sta hSrcFile + + lda hDstFullPath + ldx #O.WRONLY+O.CREATE + jsr CS.RUN.Open + + bcs .9 + + sta hDstFile + + lda /X.COPY.MAXBUF + +.1 sta PageCount + + ldy #0 >SYSCALL GetMem - bcs .99 + bcc .2 + + tax + + lda PageCount + lsr + cmp /X.COPY.MINBUF + bcs .1 - >STYA ZPPtr1 txa - >STA.G hCopyBuf + sec +.9 bra CS.RUN.CopyEnd - ldy #hSrcFullPath - lda #O.RDONLY - jsr CS.RUN.Open - bcs CS.RUN.CopyEnd - - >STA.G hSrcFile - - ldy #hDstFullPath - lda #O.WRONLY+O.CREATE - jsr CS.RUN.Open - - bcs CS.RUN.CopyEnd - - >STA.G hDstFile - - lda #$ff - >STA.G bCopy -* clc -.99 rts +.2 >STYA ZPPtr1 + stx hCopyBuf *-------------------------------------- -CS.RUN.Copy >PUSHB.G hSrcFile +CS.RUN.Copy >PUSHB hSrcFile >PUSHW ZPPtr1 Dst Ptr - >PUSHWI X.COPY.BUF.SIZE Bytes To Read + >PUSHB PageCount Bytes To Read + >PUSHBI 0 >SYSCALL FRead bcc .1 cmp #MLI.E.EOF - bne .9 + sec + bne CS.RUN.CopyEnd lda #0 clc bra CS.RUN.CopyEnd -.1 phy - pha - >PUSHB.G hDstFile +.1 pha + >PUSHB hDstFile >PUSHW ZPPtr1 Src Ptr pla - ply >PUSHYA Bytes To Write >SYSCALL FWrite bcs CS.RUN.CopyEnd @@ -579,40 +371,35 @@ CS.RUN.Copy >PUSHB.G hSrcFile lda #'.' >SYSCALL PutChar -.8 rts - -.9 sec +.8 jsr CS.RUN.CheckKey + bcc CS.RUN.Copy *-------------------------------------- -CS.RUN.CopyEnd >STA.G CopyRC - - php +CS.RUN.CopyEnd php pha - - >LDA.G hDstFile + + lda hDstFile beq .1 >SYSCALL FClose -.1 >LDA.G hSrcFile +.1 lda hSrcFile beq .2 >SYSCALL FClose -.2 >LDA.G hCopyBuf +.2 lda hCopyBuf beq .3 >SYSCALL FreeMem -.3 >STZ.G bCopy - - pla +.3 pla plp - rts +CS.RUN.Copy.RTS rts .FIN *-------------------------------------- -CS.RUN.Open pha Save open mode - jsr CS.RUN.PushPathY +CS.RUN.Open phx Save open mode + jsr CS.RUN.PushPathA pla >PUSHA @@ -637,41 +424,47 @@ CS.RUN.CheckErr bcs .1 >SYSCALL PutS .8 rts -.1 pha +.1 tax + clc + beq .8 SKIP + >PUSHW L.MSG.ERR - pla + txa pha >PUSHA >PUSHBI 1 >SYSCALL PrintF - lda bContinue - eor #$80 - asl pla - rts + sec + bit bContinue + bpl .99 + + clc + +.99 rts *-------------------------------------- CS.RUN.BuildFilePath - ldy #hSrcFullPath - jsr CS.RUN.PushPathY - ldy #hSrcBasePath - jsr CS.RUN.PushPathY + lda hSrcFullPath + jsr CS.RUN.PushPathA + >LDA.G hSrcBasePath + jsr CS.RUN.PushPathA >SYSCALL StrCpy - ldy #hSrcFullPath - jsr CS.RUN.PushPathY + lda hSrcFullPath + jsr CS.RUN.PushPathA >PUSHW ZPFileName >SYSCALL StrCat .DO X.COPY.TO.DEST=1 - ldy #hDstFullPath - jsr CS.RUN.PushPathY - ldy #hDstBasePath - jsr CS.RUN.PushPathY + lda hDstFullPath + jsr CS.RUN.PushPathA + >LDA.G hDstBasePath + jsr CS.RUN.PushPathA >SYSCALL StrCpy - ldy #hDstFullPath - jsr CS.RUN.PushPathY + lda hDstFullPath + jsr CS.RUN.PushPathA >LDA.G hDstFileName beq .1 @@ -686,23 +479,12 @@ CS.RUN.BuildFilePath .FIN rts *-------------------------------------- - .DO X.COPY.TO.DEST=1 - -CS.RUN.StatDst ldy #hDstFullPath - jsr CS.RUN.PushPathY - >PUSHEA.G STATBUF - >SYSCALL Stat - rts - - .FIN -*-------------------------------------- -CS.RUN.GetPathY sec +CS.RUN.GetPathA sec .HS 90 BCC -CS.RUN.PushPathY +CS.RUN.PushPathA clc php - lda (pData),y >SYSCALL GetMemPtr plp @@ -712,48 +494,220 @@ CS.RUN.PushPathY .8 rts *-------------------------------------- -CS.RUN.IncCount >INCW.G Count - rts -*-------------------------------------- -CS.RUN.ToUpper cmp #'a' - bcc .8 +CS.RUN.IncCount inc Count + bne .8 - cmp #'z'+1 - bcs .8 - - eor #$20 + inc Count+1 .8 rts +*-------------------------------------- + .DO X.COPY.TO.DEST=1 +CS.RUN.CheckOverwrite +*-------------------------------------- + lda hDstFullPath + jsr CS.RUN.PushPathA + >PUSHEA.G STATBUF + >SYSCALL Stat + bcs .8 File Not exists... + + bit bNoConfirm + bmi .4 no prompt, override + + bit bQuiet + bmi .10 + + jsr CS.RUN.CR + +.10 >PUSHW L.MSG.OVERWRITE + lda hDstFullPath + jsr CS.RUN.PushPathA + >PUSHBI 2 + >SYSCALL PrintF + bcs .99 + +.1 >SYSCALL GetChar + + cmp #3 + beq .99 abort + + jsr X.ToUpper + + cmp #'N' + bne .2 + + lda #$80 EXISTS, NO OVERWRITE + clc + rts + +.2 cmp #'Y' + beq .4 + +.3 cmp #'A' + bne .1 + +* sec + ror bNoConfirm + +.4 lda #$01 EXISTS, OVERWRITE + clc + rts + +.8 lda #0 NOT EXISTS + clc +.99 rts + .FIN +*-------------------------------------- +CS.RUN.CheckKey ldy #S.PS.hStdIn + lda (pPS),y + >SYSCALL FEOF + bcs .9 I/O error + + tay + bne .8 + + >SYSCALL GetChar + bcs .9 I/O error + + cmp #$03 Ctrl-C + beq .9 + + cmp #$13 Ctrl-S + bne .8 + + lda bPause + eor #$ff + sta bPause + +.8 clc + +.9 rts +*-------------------------------------- +CS.RUN.CheckOpt jsr CS.RUN.NextOpt + bcs .7 + + >STYA ZPPtr1 + + lda (ZPPtr1) + cmp #'-' + bne .5 + + ldy #1 + lda (ZPPtr1),y + beq .98 + +.1 ldx #OptionVars-OptionList-1 + +.2 cmp OptionList,x + beq .3 + + dex + bpl .2 + +.98 >LDYA L.MSG.USAGE + >SYSCALL PutS + lda #E.SYN + sec +.99 rts + +.3 lda OptionVars,x + beq .4 -I + + tax + dec 0,x + + iny + lda (ZPPtr1),y + bne .1 + + bra CS.RUN.CheckOpt + +.4 iny + lda (ZPPtr1),y + bne .98 + + >LDA.G hExclude + bne .98 + + jsr CS.RUN.NextOpt + bcs .98 + + >SYSCALL StrDup + bcs .99 + + txa + >STA.G hExclude + bra CS.RUN.CheckOpt +*-------------------------------------- +.5 >LDA.G index + + .DO X.COPY.TO.DEST=1 + bne .6 Already have a Src dir... + .ELSE + bne .98 + .FIN + + jsr X.InitSrcDirPtr1 + bcc CS.RUN.CheckOpt success, scan for any other args + + rts + + .DO X.COPY.TO.DEST=1 +.6 >LDA.G hDstBasePath + bne .98 we already have a second arg....error! + + jsr X.InitDstDirPtr1 + bcc CS.RUN.CheckOpt success, scan for any other args + + rts + .FIN +*-------------------------------------- +.7 >LDA.G index processed all args + beq .98 , no src ? ERROR + + .DO X.COPY.TO.DEST=1 + >LDA.G hDstBasePath + bne .8 we also have a Dst folder + + ldy #S.PS.hCWD no dst folder, use actual prefix + lda (pPS),y + >SYSCALL GetMemPtr + jsr X.InitDstDirYA + bcs .99 + .FIN + +.8 clc + rts +*-------------------------------------- +CS.RUN.NextOpt inc ArgIndex + lda ArgIndex + >SYSCALL ArgV + rts *-------------------------------------- CS.DOEVENT sec rts *-------------------------------------- -CS.QUIT jsr LeaveSubDir +CS.QUIT jsr X.LeaveSubDir bcc CS.QUIT .DO X.COPY.TO.DEST=1 - >LDA.G bCopy - bpl .1 - jsr CS.RUN.CopyEnd - -.1 ldy #hDstFullPath - jsr .7 + lda hDstFullPath + jsr .8 ldy #hDstFileName jsr .7 .FIN - ldy #hSrcFullPath - jsr .7 + lda hSrcFullPath + jsr .8 - ldy #hFilter + ldy #hInclude jsr .7 ldy #hExclude .7 lda (pData),y - beq .9 +.8 beq .9 >SYSCALL FreeMem .9 clc diff --git a/SHARED/X.FILEENUM.G.txt b/SHARED/X.FILEENUM.G.txt index 56a5aae6..cfac6a96 100644 --- a/SHARED/X.FILEENUM.G.txt +++ b/SHARED/X.FILEENUM.G.txt @@ -6,15 +6,17 @@ hDIRs .BS X.MAX.RECURSE+1 hDIRENTs .BS X.MAX.RECURSE+1 oDIRENTs .BS X.MAX.RECURSE*2 STATBUF .BS S.STAT -hFullPath .BS 1 -hSrcBasePath .BS 1 -hFilter .BS 1 + +hInclude .BS 1 hExclude .BS 1 + +hSrcBasePath .BS 1 .DO X.COPY.TO.DEST=1 hDstBasePath .BS 1 +hDstFileName .BS 1 .FIN *-------------------------------------- MAN SAVE usr/src/shared/x.fileenum.g -LOAD usr/src/bin/ls.s +LOAD usr/src/bin/cp.s ASM diff --git a/SHARED/X.FILEENUM.S.txt b/SHARED/X.FILEENUM.S.txt index ef37daa4..db9d1c87 100644 --- a/SHARED/X.FILEENUM.S.txt +++ b/SHARED/X.FILEENUM.S.txt @@ -4,7 +4,13 @@ NEW *-------------------------------------- X.MAX.RECURSE .EQ 8 *-------------------------------------- -* Uses: (pData) +* Uses: +* (ZP) +* ZPPtr1 .BS 2 +* ZPPtr2 .BS 2 +* ZPFileName .BS 2 +* ZPFileStat .BS 2 +* (pData) * Index .BS 1 * hDIRs .BS X.MAX.RECURSE+1 * hDIRENTs .BS X.MAX.RECURSE+1 @@ -12,38 +18,35 @@ X.MAX.RECURSE .EQ 8 * STATBUF .BS S.STAT * hSrcBasePath .BS 1 * hDstBasePath .BS 1 (optional) -* hFilter .BS 1 +* hInclude .BS 1 * hExclude .BS 1 *-------------------------------------- -* Compare a ZPFileName against hFilter (e.g. '*test?.*') +* Compare a ZPFileName against hInclude (e.g. '*test?.*') * CC : match * CS : no match *-------------------------------------- -FilterMatch >LDA.G index +X.IncludeMatch >LDA.G index dec - bne FilterMatch.CLCRTS in a subdir, match everything + bne X.FilterMatch.CLCRTS in a subdir, match everything clc .HS B0 BCS -ExcludeMatch sec - php - lda #hFilter - adc #0 - tay - lda (pData),y - plp - - tax - - beq FilterMatch.RTS No filter....exit with passed carry +X.IgnoreMatch sec + ldy #hInclude + bcc .11 + + iny + +.11 lda (pData),y + beq X.FilterMatch.RTS No filter....exit with passed carry >SYSCALL GetMemPtr >STYA ZPPtr2 ldy #S.STAT.FSID lda (ZPFileStat),y if 0, Regular ProDOS.... - pha save FSID for comapring later + pha save FSID for comparing later bne .10 >LDYA ZPPtr2 ... so CI compare @@ -57,7 +60,7 @@ ExcludeMatch sec ldy #0 bra .2 -.1 jsr FilterMatch.NextPtr2 get next pattern char +.1 jsr X.FilterMatch.NextPtr2 get next pattern char beq .41 end of pattern... .2 cmp #'*' @@ -70,7 +73,7 @@ ExcludeMatch sec cmp #'?' beq .4 no need to compare, any char will match - jsr FilterMatch.CmpPtr2CharPtr1Y Regular Char, compare with string at Y + jsr X.FilterMatch.CmpPtr2CharPtr1Y Regular Char, compare with string at Y bne .9 no match, exit .4 iny advance to next char to compare @@ -82,7 +85,7 @@ ExcludeMatch sec .9 sec rts -.5 jsr FilterMatch.NextPtr2 we have '*', last char of pattern ? +.5 jsr X.FilterMatch.NextPtr2 we have '*', last char of pattern ? beq .8 yes, match everything, including empty string cmp #'*' another '*' ? @@ -95,40 +98,30 @@ ExcludeMatch sec beq .9 no chance to match ? or regular char iny - jsr FilterMatch.CmpPtr2CharPtr1Y compare with char in string + jsr X.FilterMatch.CmpPtr2CharPtr1Y compare with char in string bne .7 not equal to next non wildcard in pattern iny bra .1 go check remaining char in pattern... .8 -FilterMatch.CLCRTS +X.FilterMatch.CLCRTS clc -FilterMatch.RTS +X.FilterMatch.RTS rts *-------------------------------------- -FilterMatch.CmpPtr2CharPtr1Y +X.FilterMatch.CmpPtr2CharPtr1Y + lda (ZPFileName),y phx plx - bne .2 Foreign FS or ProDOS.FX : CS compare + bne .1 Foreign FS or ProDOS.FX : CS compare - lda (ZPFileName),y - cmp #'a' - bcc .1 - - cmp #'z'+1 - bcs .1 - - eor #$20 + jsr X.ToUpper .1 cmp (ZPPtr2) rts - -.2 lda (ZPPtr2) - cmp (ZPFileName),y - rts *-------------------------------------- -FilterMatch.NextPtr2 +X.FilterMatch.NextPtr2 inc ZPPtr2 Make PTR2 advance to next char bne .1 @@ -137,22 +130,19 @@ FilterMatch.NextPtr2 .1 lda (ZPPtr2) rts *-------------------------------------- -InitSrcDirYA >PUSHYA - >PUSHWZ Allocate - >SYSCALL RealPath - bcs FilterMatch.RTS +X.InitSrcDirYA >STYA ZPPtr1 - >STYA ZPPtr1 - txa - >STA.G hFullPath +X.InitSrcDirPtr1 + jsr X.InitGetBuf Get a 256 buffer to store BasePath + bcs .99 + + >STA.G hSrcBasePath ldy #1 - lda (ZPPtr1),y - beq .5 we have '/' + lda (ZPPtr2),y + beq .8 we have '/' - >PUSHW ZPPtr1 - >PUSHEA.G STATBUF - >SYSCALL Stat + jsr X.Init.StatBuf bcs .1 File/DIR does not exists, go extract pattern .DO X.ENTER.SUBDIR=1 @@ -169,15 +159,16 @@ InitSrcDirYA >PUSHYA .1 cmp #MLI.E.INVPATH beq .11 - jmp .9 + sec + rts -.11 jsr GetPtr1Len TYPE is not DIR, check if wc +.11 jsr X.GetPtr2Len TYPE is not DIR, check if wc dey ldx #0 Init Wildcard count -.2 lda (ZPPtr1),y search backward for a / +.2 lda (ZPPtr2),y search backward for a / cmp #'/' beq .3 @@ -192,58 +183,16 @@ InitSrcDirYA >PUSHYA bne .2 .3 txa - beq .90 no wc, file not found.... + beq .98 no wc, file not found.... -.4 jsr GetPtr1Len Search end of string..... +.4 jsr X.InitSplitBuf + bcs .99 - lda #'/' + >STA.G hInclude -.42 dey - cmp (ZPPtr1),y Search backward / - bne .42 - - tya - sec +1 to skip '/' - adc ZPPtr1 - sta ZPPtr2 - tay - lda ZPPtr1+1 - adc #0 - sta ZPPtr2+1 - - >SYSCALL StrDup - bcs .9 - - txa - >STA.G hFilter - - lda #0 - sta (ZPPtr2) cut path at last '/' to remove wildcards - -.5 >LDYAI 256 - >SYSCALL GetMem Get a 256 buffer to store BasePath - bcs .9 - - >STYA ZPPtr2 - txa - >STA.G hSrcBasePath - - jsr StrcpyPtr1ptr2 - - dey - lda #'/' - cmp (ZPPtr2),y - beq .7 - - iny - sta (ZPPtr2),y - iny - lda #0 - sta (ZPPtr2),y - -.7 >LDYA ZPPtr2 +.8 >LDYA ZPPtr2 >SYSCALL OpenDir - bcs .9 + bcs .99 ldy #hDIRs sta (pData),y set hDIRs[0] = Src Hdir @@ -251,22 +200,16 @@ InitSrcDirYA >PUSHYA lda #1 sta (pData),y index=hDIRs[0] - jsr .9 Cleanup +* clc - clc rts -.90 lda #MLI.E.FNOTFND - -.9 pha - >LDA.G hFullPath - >SYSCALL FreeMem - pla +.98 lda #MLI.E.INVPATH sec -InitSrcDirYA.RTS - rts +.99 rts *-------------------------------------- -ResetSrcDir jsr GethDIR + .DO X.RESETSRCDIR=1 +X.ResetSrcDir jsr X.GethDIR >SYSCALL CloseDir @@ -287,92 +230,107 @@ ResetSrcDir jsr GethDIR * clc .9 rts + .FIN *-------------------------------------- .DO X.COPY.TO.DEST=1 -InitDstDirYA >PUSHYA - >PUSHWZ Allocate - >SYSCALL RealPath - bcs InitSrcDirYA.RTS +X.InitDstDirYA >STYA ZPPtr1 - >STYA ZPPtr1 - txa - >STA.G hFullPath - - >PUSHW ZPPtr1 - >PUSHEA.G STATBUF - >SYSCALL Stat +X.InitDstDirPtr1 + jsr X.InitGetBuf Get a 256 buffer to store BasePath + bcs .99 + + >STA.G hDstBasePath + + jsr X.Init.StatBuf bcs .1 File/DIR does not exists, go extract DstFileName >LDA.G STATBUF+S.STAT.MODE+1 and #$F0 cmp /S.STAT.MODE.DIR - beq .5 Dst is a directory...no destfilename + beq .8 Dst is a directory...no hDstFileName -.1 jsr GetPtr1Len Search end of string..... +.1 jsr X.InitSplitBuf + bcs .99 + + >STA.G hDstFileName + +.8 jmp X.NormalizePtr2 + +.99 rts + + .FIN +*-------------------------------------- +X.InitGetBuf >LDYAI 256 + >SYSCALL GetMem Get a 256 buffer to store BasePath + bcs .99 + + >STYA ZPPtr2 + phx + + >PUSHW ZPPtr1 + >PUSHW ZPPtr2 + >SYSCALL RealPath + bcs .98 + + pla hBuf + +* clc + + rts + +.98 plx + + pha + txa + >SYSCALL FreeMem + pla + + sec + +.99 rts +*-------------------------------------- +X.Init.StatBuf >PUSHW ZPPtr2 + >PUSHEA.G STATBUF + >SYSCALL Stat + rts +*-------------------------------------- +X.InitSplitBuf jsr X.GetPtr2Len Search end of string..... lda #'/' -.2 dey - cmp (ZPPtr1),y Search backward / - bne .2 +.1 dey + cmp (ZPPtr2),y Search backward / + bne .1 tya sec +1 to skip '/' - adc ZPPtr1 - sta ZPPtr2 - tay - lda ZPPtr1+1 + adc ZPPtr2 + sta ZPPtr1 + + lda ZPPtr2+1 adc #0 - sta ZPPtr2+1 + sta ZPPtr1+1 + lda (ZPPtr1) + beq .8 path is /dir/ + + >LDYA ZPPtr1 >SYSCALL StrDup - bcs .9 - - txa - >STA.G hDstFileName + bcs .99 lda #0 - sta (ZPPtr2) + sta (ZPPtr1) -.5 >LDYAI 256 - >SYSCALL GetMem Get a 256 buffer to store DstBasePath - bcs .9 - - >STYA ZPPtr2 txa - >STA.G hDstBasePath - jsr StrcpyPtr1ptr2 +.8 clc - dey - - lda #'/' - cmp (ZPPtr2),y - beq .7 - - iny - sta (ZPPtr2),y - iny - lda #0 - sta (ZPPtr2),y - -.7 jsr .9 Cleanup - - clc - rts - -.9 pha - >LDA.G hFullPath - >SYSCALL FreeMem - pla - sec - rts - .FIN +.99 rts *-------------------------------------- -GetNextEntry jsr GetEntry +X.GetNextEntry jsr X.GetEntry bcs .9 - jsr GetFilenameLen Save actual file len for setting up + jsr X.GetFilenameLen Save actual file len for setting up pha new offset later lda ZPFileStat clc @@ -383,12 +341,12 @@ GetNextEntry jsr GetEntry adc /S.STAT sta ZPFileName+1 Make nDIRENTs[i] point to next DIRENT - jsr GetFilenameLen are we at end of this buffer ? + jsr X.GetFilenameLen are we at end of this buffer ? beq .1 yes, go read next one ... - jsr SetFileStatPtr + jsr X.SetFileStatPtr - jsr GetoDIRENT + jsr X.GetoDIRENT pla Get back previous file len sec @@ -413,13 +371,13 @@ GetNextEntry jsr GetEntry rts .1 pla - jsr GetEntry.ReadDir + jsr X.GetEntry.ReadDir bcs .9 - jsr GetFilenameLen + jsr X.GetFilenameLen beq .99 - jsr SetFileStatPtr + jsr X.SetFileStatPtr clc .9 rts @@ -427,10 +385,10 @@ GetNextEntry jsr GetEntry .99 sec rts *-------------------------------------- -GetEntry jsr GethDIRENT +X.GetEntry jsr X.GethDIRENT bne .1 we have a buffer to scan - jsr GetEntry.ReadDir First run, get first block + jsr X.GetEntry.ReadDir First run, get first block bcs .9 ZPFileName = start of buffer lda (ZPFileName) Empty !!! @@ -441,7 +399,7 @@ GetEntry jsr GethDIRENT .1 >SYSCALL GetMemPtr >STYA ZPFileName - jsr GetoDIRENT + jsr X.GetoDIRENT lda ZPFileName clc @@ -454,15 +412,15 @@ GetEntry jsr GethDIRENT adc (pData),y sta ZPFileName+1 ZPFileName=ZPFileName+oDIRENT -.8 jsr GetFilenameLen +.8 jsr X.GetFilenameLen - jsr SetFileStatPtr + jsr X.SetFileStatPtr clc .9 rts *-------------------------------------- -GetEntry.ReadDir - jsr GethDIRENT +X.GetEntry.ReadDir + jsr X.GethDIRENT beq .1 pha @@ -471,7 +429,7 @@ GetEntry.ReadDir pla >SYSCALL FreeMem discard previous hDIRENT -.1 jsr GethDIR +.1 jsr X.GethDIR >SYSCALL ReadDir bcs .9 @@ -484,7 +442,7 @@ GetEntry.ReadDir txa get hDIRENT in A sta (pData),y - jsr GetoDIRENT + jsr X.GetoDIRENT lda #0 and reset offset for this buffer sta (pData),y @@ -493,15 +451,15 @@ GetEntry.ReadDir clc .9 rts *-------------------------------------- -EnterSubDirYA >STYA ZPPtr2 save SUBDIR for StrCat +X.EnterSubDirYA >STYA ZPPtr1 save SUBDIR for StrCat >LDA.G index cmp #X.MAX.RECURSE beq .9 ldy #hSrcBasePath - jsr EnterSubDirY - >LDYA ZPPtr1 + jsr X.EnterSubDirY + >LDYA ZPPtr2 >SYSCALL OpenDir bcs .9 @@ -521,44 +479,44 @@ EnterSubDirYA >STYA ZPPtr2 save SUBDIR for StrCat .DO X.COPY.TO.DEST=1 ldy #hDstBasePath - jsr EnterSubDirY + jsr X.EnterSubDirY .FIN clc .9 rts - -EnterSubDirY lda (pData),y +*-------------------------------------- +X.EnterSubDirY lda (pData),y >SYSCALL GetMemPtr - >STYA ZPPtr1 save full path + >STYA ZPPtr2 save full path - jsr .1 Make sure ending with / - - >PUSHW ZPPtr1 >PUSHW ZPPtr2 + >PUSHW ZPPtr1 >SYSCALL StrCat -.1 jsr GetPtr1Len +X.NormalizePtr2 jsr X.GetPtr2Len dey lda #'/' - cmp (ZPPtr1),y + cmp (ZPPtr2),y beq .8 iny - sta (ZPPtr1),y + sta (ZPPtr2),y + iny lda #0 - sta (ZPPtr1),y + sta (ZPPtr2),y -.8 rts +.8 clc + rts *-------------------------------------- -LeaveSubDir >LDA.G index +X.LeaveSubDir >LDA.G index beq .7 - jsr GethDIRENT.A - jsr LeaveSubDir.free + jsr X.GethDIRENT.A + jsr X.LeaveSubDir.free - jsr GethDIR + jsr X.GethDIR beq .1 pha @@ -571,11 +529,11 @@ LeaveSubDir >LDA.G index bne .8 .7 >LDA.G hSrcBasePath - jsr LeaveSubDir.free + jsr X.LeaveSubDir.free .DO X.COPY.TO.DEST=1 >LDA.G hDstBasePath - jsr LeaveSubDir.free + jsr X.LeaveSubDir.free .FIN sec @@ -584,7 +542,7 @@ LeaveSubDir >LDA.G index .8 clc rts *-------------------------------------- -LeaveSubDir.free +X.LeaveSubDir.free tax beq .8 @@ -595,51 +553,53 @@ LeaveSubDir.free .8 rts *-------------------------------------- -BasePath.. .DO X.COPY.TO.DEST=1 +X.BasePath.. .DO X.COPY.TO.DEST=1 ldy #hDstBasePath - jsr BasePath..1 + jsr X.BasePath..1 .FIN ldy #hSrcBasePath -BasePath..1 lda (pData),y +X.BasePath..1 lda (pData),y >SYSCALL GetMemPtr - >STYA ZPPtr1 save full path + >STYA ZPPtr2 save full path - jsr GetPtr1Len get len + jsr X.GetPtr2Len get len dey discard ending / .2 dey - lda (ZPPtr1),y + lda (ZPPtr2),y cmp #'/' bne .2 iny lda #0 - sta (ZPPtr1),y cut DIR2/ from /dir1/DIR2/ + sta (ZPPtr2),y cut DIR2/ from /dir1/DIR2/ rts *-------------------------------------- -GetPtr1Len ldy #$ff +X.ToUpper cmp #'a' + bcc .8 + + cmp #'z'+1 + bcs .8 + + eor #$20 + +.8 rts +*-------------------------------------- +X.GetPtr2Len ldy #$ff .1 iny - lda (ZPPtr1),y get len + lda (ZPPtr2),y get len bne .1 - rts + rts *-------------------------------------- -StrcpyPtr1ptr2 ldy #$ff - -.1 iny - lda (ZPPtr1),y - sta (ZPPtr2),y - bne .1 - - rts -*-------------------------------------- -GetFilenameLen ldy #$ff +X.GetFilenameLen + ldy #$ff .1 iny lda (ZPFileName),y @@ -648,7 +608,8 @@ GetFilenameLen ldy #$ff tya rts *-------------------------------------- -SetFileStatPtr sec +X.SetFileStatPtr + sec adc ZPFileName sta ZPFileStat lda ZPFileName+1 @@ -656,7 +617,7 @@ SetFileStatPtr sec sta ZPFileStat+1 rts *-------------------------------------- -GethDIR >LDA.G index +X.GethDIR >LDA.G index clc adc #hDIRs-1 @@ -664,15 +625,15 @@ GethDIR >LDA.G index lda (pData),y rts *-------------------------------------- -GethDIRENT >LDA.G index +X.GethDIRENT >LDA.G index -GethDIRENT.A clc +X.GethDIRENT.A clc adc #hDIRENTs-1 tay lda (pData),y rts *-------------------------------------- -GetoDIRENT >LDA.G index +X.GetoDIRENT >LDA.G index asl clc adc #oDIRENTs-1 @@ -681,5 +642,5 @@ GetoDIRENT >LDA.G index *-------------------------------------- MAN SAVE usr/src/shared/x.fileenum.s -LOAD usr/src/bin/ls.s +LOAD usr/src/bin/cp.s ASM