Kernel version 0.9 : CP,RM,MV, Code rewrite in progress....

This commit is contained in:
Rémy GIBERT 2017-06-27 18:00:32 +02:00
parent e5386f3e27
commit 503314812d
6 changed files with 139 additions and 112 deletions

Binary file not shown.

Binary file not shown.

View File

@ -24,9 +24,9 @@ OptionList >PSTR "CRYQcryq"
OptionVars .DA #bContinue,#bRecurse,#bNoConfirm,#bQuiet,#bContinue,#bRecurse,#bNoConfirm,#bQuiet 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.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%S to %S%S..." MSG.DIR >CSTR "CP Dir :%S to %S..."
MSG.FILE >CSTR "CP File:%S%S to %S%S..." MSG.FILE >CSTR "CP File:%S to %S..."
MSG.OVERWRTE >CSTR "Overwrite [Yes,No,All]?" MSG.OVERWRTE >CSTR "\r\nOverwrite [Yes,No,All]?"
MSG.OK >PSTR "[OK]\r\n" MSG.OK >PSTR "[OK]\r\n"
MSG.ERR >PSTR "[%h]\r\n" MSG.ERR >PSTR "[%h]\r\n"
MSG.DONE >PSTR "%D File(s) Copied.\r\n" MSG.DONE >PSTR "%D File(s) Copied.\r\n"

View File

@ -24,9 +24,9 @@ OptionList >PSTR "CRYQcryq"
OptionVars .DA #bContinue,#bRecurse,#bNoConfirm,#bQuiet,#bContinue,#bRecurse,#bNoConfirm,#bQuiet OptionVars .DA #bContinue,#bRecurse,#bNoConfirm,#bQuiet,#bContinue,#bRecurse,#bNoConfirm,#bQuiet
*-------------------------------------- *--------------------------------------
MSG.USAGE >CSTR "Usage : MV [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.USAGE >CSTR "Usage : MV [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 "MV Dir :%S%S to %S%S..." MSG.DIR >CSTR "MV Dir :%S to %S..."
MSG.FILE >CSTR "MV File:%S%S to %S%S..." MSG.FILE >CSTR "MV File:%S to %S..."
MSG.OVERWRTE >CSTR "Overwrite [Yes,No,All]?" MSG.OVERWRTE >CSTR "\r\nOverwrite [Yes,No,All]?"
MSG.OK >PSTR "[OK]\r\n" MSG.OK >PSTR "[OK]\r\n"
MSG.ERR >PSTR "[%h]\r\n" MSG.ERR >PSTR "[%h]\r\n"
MSG.DONE >PSTR "%D File(s) Moved.\r\n" MSG.DONE >PSTR "%D File(s) Moved.\r\n"
@ -42,12 +42,17 @@ Index .BS 1
hDIRs .BS X.MAX.RECURSE hDIRs .BS X.MAX.RECURSE
hDIRENTs .BS X.MAX.RECURSE hDIRENTs .BS X.MAX.RECURSE
oDIRENTs .BS X.MAX.RECURSE*2 oDIRENTs .BS X.MAX.RECURSE*2
hSrcBasePath .BS 1 hSrcBasePath .BS 1
hDstBasePath .BS 1
hFilter .BS 1 hFilter .BS 1
hDstFileName .BS 1 hSrcFullPath .BS 1
hSrcFile .BS 1 hSrcFile .BS 1
hDstBasePath .BS 1
hDstFileName .BS 1
hDstFullPath .BS 1
hDstFile .BS 1 hDstFile .BS 1
bPause .BS 1 bPause .BS 1
bCopy .BS 1 bCopy .BS 1
hToDelete .BS 1 hToDelete .BS 1

View File

@ -24,8 +24,8 @@ OptionList >PSTR "CRYQcryq"
OptionVars .DA #bContinue,#bRecurse,#bNoConfirm,#bQuiet,#bContinue,#bRecurse,#bNoConfirm,#bQuiet OptionVars .DA #bContinue,#bRecurse,#bNoConfirm,#bQuiet,#bContinue,#bRecurse,#bNoConfirm,#bQuiet
*-------------------------------------- *--------------------------------------
MSG.USAGE >CSTR "Usage : RM [File/Dir, *,? wildcards allowed]\r\n -C : Continue on error\r\n -Q : Quiet\r\n -R : Recurse subdirectories\r\n" MSG.USAGE >CSTR "Usage : RM [File/Dir, *,? wildcards allowed]\r\n -C : Continue on error\r\n -Q : Quiet\r\n -R : Recurse subdirectories\r\n"
MSG.DIR >CSTR "RM Dir :%S%S..." MSG.DIR >CSTR "RM Dir :%S..."
MSG.FILE >CSTR "RM File:%S%S..." MSG.FILE >CSTR "RM File:%S..."
MSG.OK >PSTR "[OK]\r\n" MSG.OK >PSTR "[OK]\r\n"
MSG.ERR >PSTR "[%h]\r\n" MSG.ERR >PSTR "[%h]\r\n"
MSG.DONE >PSTR "%D File(s) Removed.\r\n" MSG.DONE >PSTR "%D File(s) Removed.\r\n"
@ -41,12 +41,12 @@ Index .BS 1
hDIRs .BS X.MAX.RECURSE hDIRs .BS X.MAX.RECURSE
hDIRENTs .BS X.MAX.RECURSE hDIRENTs .BS X.MAX.RECURSE
oDIRENTs .BS X.MAX.RECURSE*2 oDIRENTs .BS X.MAX.RECURSE*2
hSrcBasePath .BS 1 hSrcBasePath .BS 1
hDstBasePath .BS 1
hFilter .BS 1 hFilter .BS 1
hDstFileName .BS 1 hSrcFullPath .BS 1
hSrcFile .BS 1 hSrcFile .BS 1
hDstFile .BS 1
bPause .BS 1 bPause .BS 1
bCopy .BS 1 bCopy .BS 1
hToDelete .BS 1 hToDelete .BS 1

View File

@ -132,11 +132,23 @@ CS.INIT >SYSCALL GetArgC
bcs .99 bcs .99
.FIN .FIN
.8 ldy #Count .8 >PUSHWI 256
lda #0 >PUSHBI 0
>SYSCALL GetMem
bcs .9
txa
ldy #hSrcFullPath
sta (pData),y sta (pData),y
iny
.DO X.COPY.TO.DEST=1
>PUSHWI 256
>PUSHBI 0
>SYSCALL GetMem
bcs .9
txa
ldy #hDstFullPath
sta (pData),y sta (pData),y
.FIN
* lda (pPs) * lda (pPs)
* ora #S.PS.F.EVENT Now accept events * ora #S.PS.F.EVENT Now accept events
@ -251,9 +263,11 @@ CS.RUN >SYSCALL GetC
cmp #'.' cmp #'.'
beq CS.RUN.NEXT Skip "." & ".." beq CS.RUN.NEXT Skip "." & ".."
jsr CS.RUN.BuildFilePath
jmp CS.RUN.DIR jmp CS.RUN.DIR
.5 jmp CS.RUN.FILE .5 jsr CS.RUN.BuildFilePath
jmp CS.RUN.FILE
.6 lda #MLI.ERR.UNSUPST .6 lda #MLI.ERR.UNSUPST
sec sec
@ -286,7 +300,7 @@ CS.RUN.LEAVE jsr LeaveSubDir exit this sub dir....
>LDYA L.MSG.DIR >LDYA L.MSG.DIR
>SYSCALL CPrintFYA >SYSCALL CPrintFYA
bcs .9 bcs CS.RUN.LEAVE.RTS
jsr CS.RUN.GetSrcFilePath jsr CS.RUN.GetSrcFilePath
@ -314,32 +328,27 @@ CS.RUN.LEAVE jsr LeaveSubDir exit this sub dir....
.91 ldy #RC .91 ldy #RC
lda (pData),y get global RC in case of bContinue lda (pData),y get global RC in case of bContinue
sec sec
.9 rts CS.RUN.LEAVE.RTS
rts
*-------------------------------------- *--------------------------------------
CS.RUN.DIR .DO X.COPY.TO.DEST=1 CS.RUN.DIR .DO X.COPY.TO.DEST=1
>PUSHW ZPFileName Filename ldy #hSrcFullPath
ldy #hDstBasePath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
>PUSHW ZPFileName Filename
ldy #hSrcBasePath
lda (pData),y lda (pData),y
>SYSCALL GetMemPtrA >SYSCALL GetMemPtrA
>PUSHYA >PUSHYA
>LDYA L.MSG.DIR >LDYA L.MSG.DIR
>SYSCALL CPrintFYA >SYSCALL CPrintFYA
bcs CS.RUN.DIR.RTS bcs CS.RUN.LEAVE.RTS
jsr CS.RUN.GetDstFilePath
>PUSHW L.STAT >PUSHW L.STAT
>PUSHWI UsrBuf256
ldy #hDstFullPath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
>SYSCALL Stat >SYSCALL Stat
bcs .3 File Not exists...go create bcs .3 File Not exists...go create
@ -376,7 +385,10 @@ CS.RUN.DIR .DO X.COPY.TO.DEST=1
lda #0 lda #0
bra .4 bra .4
.3 >LDYAI UsrBuf256 .3 ldy #hDstFullPath
lda (pData),y
>SYSCALL GetMemPtrA
>SYSCALL MKDirYA >SYSCALL MKDirYA
.4 jsr CS.RUN.CheckErr .4 jsr CS.RUN.CheckErr
@ -400,10 +412,13 @@ CS.RUN.FILE ldy #bQuiet
.14 .DO X.COPY.TO.DEST=1 .14 .DO X.COPY.TO.DEST=1
jsr CS.RUN.GetDstFilePath
>PUSHW L.STAT >PUSHW L.STAT
>PUSHWI UsrBuf256
ldy #hDstFullPath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
>SYSCALL Stat >SYSCALL Stat
bcs .2 File Not exists...go create bcs .2 File Not exists...go create
@ -470,9 +485,10 @@ CS.RUN.FILE ldy #bQuiet
.4 .DO X.DELETE.SOURCE=1 .4 .DO X.DELETE.SOURCE=1
jsr CS.RUN.GetSrcFilePath ldy #hDstFullPath
lda (pData),y
>SYSCALL GetMemPtrA
>LDYAI UsrBuf256
>SYSCALL NewPStrYA >SYSCALL NewPStrYA
bcs .9 bcs .9
txa txa
@ -489,25 +505,14 @@ CS.RUN.FILE ldy #bQuiet
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.FILE.MSG .DO X.COPY.TO.DEST=1 CS.RUN.FILE.MSG .DO X.COPY.TO.DEST=1
ldy #hDstFileName
lda (pData),y
beq .1
>SYSCALL GetMemPtrA ldy #hDstFullPath
>PUSHYA
bra .2
.1 >PUSHW ZPFileName
.2 ldy #hDstBasePath
lda (pData),y lda (pData),y
>SYSCALL GetMemPtrA >SYSCALL GetMemPtrA
>PUSHYA >PUSHYA
.FIN .FIN
>PUSHW ZPFileName ldy #hDstFullPath
ldy #hSrcBasePath
lda (pData),y lda (pData),y
>SYSCALL GetMemPtrA >SYSCALL GetMemPtrA
>PUSHYA >PUSHYA
@ -518,26 +523,18 @@ CS.RUN.FILE.MSG .DO X.COPY.TO.DEST=1
*-------------------------------------- *--------------------------------------
.DO X.COPY.TO.DEST=1 .DO X.COPY.TO.DEST=1
.DO X.DELETE.SOURCE=1 .DO X.DELETE.SOURCE=1
CS.RUN.Rename jsr CS.RUN.GetDstFilePath CS.RUN.Rename ldy #hDstFullPath
lda (pData),y
>LDYAI UsrBuf256 >SYSCALL GetMemPtrA
>SYSCALL NewPStrYA
stx .1+1
>PUSHYA >PUSHYA
jsr CS.RUN.GetSrcFilePath ldy #hSrcFullPath
>PUSHWI UsrBuf256 lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
>SYSCALL Rename >SYSCALL Rename
php
pha
.1 lda #$ff
>SYSCALL FreeMemA
pla
plp
rts rts
.9 bra .9
.FIN .FIN
.FIN .FIN
*-------------------------------------- *--------------------------------------
@ -551,9 +548,11 @@ CS.RUN.CopyStart
>PUSHB (ZPFileStat),y >PUSHB (ZPFileStat),y
>PUSHBI SYS.FOpen.R >PUSHBI SYS.FOpen.R
jsr CS.RUN.GetSrcFilePath ldy #hSrcFullPath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHWI UsrBuf256 >PUSHYA
>SYSCALL FOpen >SYSCALL FOpen
bcs .99 bcs .99
@ -568,9 +567,11 @@ CS.RUN.CopyStart
>PUSHB (ZPFileStat),y >PUSHB (ZPFileStat),y
>PUSHBI SYS.FOpen.W+SYS.FOpen.X >PUSHBI SYS.FOpen.W+SYS.FOpen.X
jsr CS.RUN.GetDstFilePath ldy #hDstFullPath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHWI UsrBuf256 >PUSHYA
>SYSCALL FOpen >SYSCALL FOpen
bcs .9 bcs .9
@ -717,35 +718,51 @@ CS.RUN.CheckErr bcs .1
.8 clc .8 clc
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.GetSrcFilePath CS.RUN.BuildFilePath
ldy #hSrcBasePath ldy #hSrcBasePath
jsr CS.RUN.GeFilePath lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
ldy #hSrcFullPath
lda (pData),y
>SYSCALL GetMemPtrA
>STYA ZPPtr1
>PUSHYA
>SYSCALL PStrCpy
>PUSHW ZPFileName >PUSHW ZPFileName
>PUSHWI UsrBuf256 >PUSHW ZPPtr1
>SYSCALL PStrCat >SYSCALL PStrCat
rts
*-------------------------------------- .DO X.COPY.TO.DEST=1
CS.RUN.GetDstFilePath
ldy #hDstBasePath ldy #hDstBasePath
jsr CS.RUN.GeFilePath lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
ldy #hDstFullPath
lda (pData),y
>SYSCALL GetMemPtrA
>STYA ZPPtr1
>PUSHYA
>SYSCALL PStrCpy
ldy #hDstFileName ldy #hDstFileName
lda (pData),y lda (pData),y
beq .9 beq .1
>SYSCALL GetMemPtrA >SYSCALL GetMemPtrA
>PUSHYA >PUSHYA
>PUSHWI UsrBuf256 bra .2
.1 >PUSHW ZPFileName
.2 >PUSHW ZPPtr1
>SYSCALL PStrCat >SYSCALL PStrCat
.9 rts .FIN
*--------------------------------------
CS.RUN.GeFilePath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
>PUSHWI UsrBuf256
>SYSCALL PStrCpy
rts rts
*-------------------------------------- *--------------------------------------
CS.DOEVENT sec CS.DOEVENT sec
@ -754,14 +771,9 @@ CS.DOEVENT sec
CS.QUIT jsr LeaveSubDir CS.QUIT jsr LeaveSubDir
bcc CS.QUIT bcc CS.QUIT
ldy #hToDelete ldy #bCopy
lda (pData),y lda (pData),y
beq .1 bpl .1
>SYSCALL FreeMemA
.1 ldy #bCopy
lda (pData),y
bpl .2
ldy #hSrcFile ldy #hSrcFile
lda (pData),y lda (pData),y
@ -771,19 +783,29 @@ CS.QUIT jsr LeaveSubDir
lda (pData),y lda (pData),y
>SYSCALL FCloseA >SYSCALL FCloseA
.2 ldy #hDstFilename .1 ldy #hToDelete
lda (pData),y jsr CS.QUIT.FREE
beq .3
>SYSCALL FreeMemA
.3 ldy #hFilter ldy #hDstFilename
lda (pData),y jsr CS.QUIT.FREE
beq .8
>SYSCALL FreeMemA
.8 clc ldy #hFilter
jsr CS.QUIT.FREE
ldy #hDstFullPath
jsr CS.QUIT.FREE
ldy #hSrcFullPath
jsr CS.QUIT.FREE
clc
rts rts
*-------------------------------------- *--------------------------------------
CS.QUIT.FREE lda (pData),y
beq .9
>SYSCALL FreeMemA
.9 rts
*--------------------------------------
MAN MAN
SAVE /A2OSX.SRC/BIN/X.CPMVRM.S SAVE /A2OSX.SRC/BIN/X.CPMVRM.S
LOAD /A2OSX.SRC/BIN/MV.S LOAD /A2OSX.SRC/BIN/MV.S