Kernel version 0.9 : CP/MV/RM migration OK

This commit is contained in:
Rémy GIBERT 2017-02-26 19:34:00 +01:00
parent 43011c7cd2
commit d9637361b9
10 changed files with 252 additions and 139 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -24,8 +24,8 @@ OptionList >PSTR "CRY"
OptionVars .DA #bContinue,#bRecurse,#bNoConfirm
*--------------------------------------
MSG.USAGE >CSTR "Usage : CP [Src File/Dir, *,? wildcards allowed]\n -C : Continue on error\n -R : Recurse subdirectories\n -Y : Dont't prompt for override\n"
MSG.DIR >CSTR "CP Dir :%S%S to %S..."
MSG.FILE >CSTR "CP File:%S%S to %S..."
MSG.DIR >CSTR "CP Dir :%S%S to %S%S..."
MSG.FILE >CSTR "CP File:%S%S to %S%S..."
MSG.OVERWRTE >CSTR "Overwrite [Yes,No,All]?"
MSG.OK >CSTR "[OK]\n"
MSG.ERR >CSTR "[%h]\n"
@ -50,6 +50,7 @@ bPause .BS 1
bCopy .BS 1
hToDelete .BS 1
CopyRC .BS 1
RC .BS 1
bContinue .BS 1
bRecurse .BS 1
bNoConfirm .BS 1

View File

@ -24,8 +24,8 @@ OptionList >PSTR "CRY"
OptionVars .DA #bContinue,#bRecurse,#bNoConfirm
*--------------------------------------
MSG.USAGE >CSTR "Usage : MV [Src File/Dir, *,? wildcards allowed]\n -C : Continue on error\n -R : Recurse subdirectories\n -Y : Dont't prompt for override\n"
MSG.DIR >CSTR "MV Dir :%S%S to %S..."
MSG.FILE >CSTR "MV File:%S%S to %S..."
MSG.DIR >CSTR "MV Dir :%S%S to %S%S..."
MSG.FILE >CSTR "MV File:%S%S to %S%S..."
MSG.OVERWRTE >CSTR "Overwrite [Yes,No,All]?"
MSG.OK >CSTR "[OK]\n"
MSG.ERR >CSTR "[%h]\n"
@ -49,6 +49,7 @@ hDstFile .BS 1
bPause .BS 1
bCopy .BS 1
hToDelete .BS 1
RC .BS 1
CopyRC .BS 1
bContinue .BS 1
bRecurse .BS 1

View File

@ -24,7 +24,7 @@ OptionList >PSTR "CRY"
OptionVars .DA #bContinue,#bRecurse,#bNoConfirm
*--------------------------------------
MSG.USAGE >CSTR "Usage : RM [File/Dir, *,? wildcards allowed]\n -C : Continue on error\n -R : Recurse subdirectories\n"
MSG.DIR >CSTR "RM Dir :%S..."
MSG.DIR >CSTR "RM Dir :%S%S..."
MSG.FILE >CSTR "RM File:%S%S..."
MSG.OK >CSTR "[OK]\n"
MSG.ERR >CSTR "[%h]\n"
@ -48,6 +48,7 @@ hDstFile .BS 1
bPause .BS 1
bCopy .BS 1
hToDelete .BS 1
RC .BS 1
CopyRC .BS 1
bContinue .BS 1
bRecurse .BS 1

View File

@ -181,10 +181,12 @@ CS.RUN >SYSCALL GetC
sta (pData),y
pla
plp
jmp CS.RUN.CheckErr
jsr CS.RUN.CheckErr
bcs .9
jmp CS.RUN.NEXT
.FIN
.3 jsr GetNextEntry
*---------------
.3 jsr GetEntry
bcs CS.RUN.LEAVE
ldy #hFilter
@ -195,7 +197,7 @@ CS.RUN >SYSCALL GetC
>PUSHYA
>PUSHW ZPFileName
>SYSCALL PStrMatch
bcs .8 no match, skip....
bcs CS.RUN.NEXT no match, skip....
.4 ldy #S.STAT.P.DRIVE
lda (ZPFileStat),y ProDOS Device ?
@ -208,37 +210,51 @@ CS.RUN >SYSCALL GetC
ldy #bRecurse
lda (pData),y
bpl .8
bpl CS.RUN.NEXT
ldy #1
lda (ZPFileName),y
cmp #'.'
beq .8 Skip "." & ".."
beq CS.RUN.NEXT Skip "." & ".."
jmp CS.RUN.DIR
.5 jmp CS.RUN.FILE
.6 lda #MLI.ERR.UNSUPSS
.6 lda #MLI.ERR.UNSUPST
sec
rts
.8 clc
.9 rts
*--------------------------------------
CS.RUN.CR.NEXT lda #13
>SYSCALL PutCA
CS.RUN.NEXT jsr GetNextEntry
bcs CS.RUN.LEAVE
rts
*--------------------------------------
CS.RUN.LEAVE jsr LeaveSubDir exit this sub dir....
bcs .99 base, we are done, exit
jsr BasePath..
.DO X.DELETE.SOURCE=1
.DO X.COPY.TO.DEST=0
ldy #hSrcBasePath
jsr CS.RUN.GetBasePath
>PUSHWI UsrBuf256
jsr GetEntry
bcs *
>PUSHW ZPFileName
ldy #hSrcBasePath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
>LDYA L.MSG.DIR
>SYSCALL CPrintFYA
bcs .9
ldy #hSrcBasePath
jsr CS.RUN.GetFilePath
>LDYAI UsrBuf256
>SYSCALL RemoveYA
jsr CS.RUN.CheckErr
@ -246,19 +262,22 @@ CS.RUN.LEAVE jsr LeaveSubDir exit this sub dir....
.FIN
.FIN
jsr BasePath..
clc
rts
jmp CS.RUN.NEXT
.99 lda #0
.99 ldy #RC
lda (pData),y get global RC in case of bContinue
sec
.9 rts
*--------------------------------------
CS.RUN.DIR .DO X.COPY.TO.DEST=1
>PUSHW ZPFileName Filename
ldy #hDstBasePath
jsr CS.RUN.GetFilePath
>PUSHWI UsrBuf256
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
>PUSHW ZPFileName Filename
@ -271,14 +290,17 @@ CS.RUN.DIR .DO X.COPY.TO.DEST=1
>SYSCALL CPrintFYA
bcs .9
ldy #hDstBasePath
jsr CS.RUN.GetFilePath
>PUSHW L.STAT
>PUSHWI UsrBuf256
>SYSCALL Stat
bcs .2 File Not exists...go create
bcs .3 File Not exists...go create
ldy #bNoConfirm
lda (pData),y
bmi .12 no prompt, nothing to create, enter subdir
bmi .21 no prompt, nothing to create, enter subdir
>LDYA L.MSG.OVERWRTE
>SYSCALL CPrintFYA
@ -291,14 +313,12 @@ CS.RUN.DIR .DO X.COPY.TO.DEST=1
beq .99 abort
cmp #'N'
bne .11
bne .2
lda #13
>SYSCALL PutCA
rts no overwrite, nothing to do, no recurse
jmp CS.RUN.CR.NEXT no overwrite, nothing to do, no recurse
.11 cmp #'Y'
beq .12 no create, but recurse
.2 cmp #'Y'
beq .21 no create, but recurse
cmp #'A'
bne .1
@ -307,28 +327,28 @@ CS.RUN.DIR .DO X.COPY.TO.DEST=1
lda #$ff
sta (pData),y
.12 lda #0
clc
bra .3
.21 clc
lda #0
bra .4
.2 >LDYAI UsrBuf256
.3 >LDYAI UsrBuf256
>SYSCALL MKDirYA
.3 jsr CS.RUN.CheckErr
.4 jsr CS.RUN.CheckErr
bcs .9
.FIN
.7 >LDYA ZPFileName
jmp EnterSubDirYA
.8 clc
.9 rts
.99 lda #0
.99 ldy #RC
lda (pData),y get global RC in case of bContnue
sec
rts
.9 rts
*--------------------------------------
CS.RUN.FILE .DO X.COPY.TO.DEST=1
>PUSHW ZPFileName
ldy #hDstBasePath
lda (pData),y
>SYSCALL GetMemPtrA
@ -336,7 +356,7 @@ CS.RUN.FILE .DO X.COPY.TO.DEST=1
.FIN
>PUSHW ZPFileName
ldy #hSrcBasePath
lda (pData),y
>SYSCALL GetMemPtrA
@ -348,6 +368,9 @@ CS.RUN.FILE .DO X.COPY.TO.DEST=1
.DO X.COPY.TO.DEST=1
ldy #hDstBasePath
jsr CS.RUN.GetFilePath
>PUSHW L.STAT
>PUSHWI UsrBuf256
>SYSCALL Stat
@ -370,9 +393,8 @@ CS.RUN.FILE .DO X.COPY.TO.DEST=1
cmp #'N'
bne .11
lda #13
>SYSCALL PutCA
rts no overwrite exit
jmp CS.RUN.CR.NEXT no overwrite exit
.9 rts
.11 cmp #'Y'
beq .12 copy
@ -384,8 +406,7 @@ CS.RUN.FILE .DO X.COPY.TO.DEST=1
lda #$ff
sta (pData),y
.12
* jsr GetEntry get back current entry corrupted by SLEEP
.12 jsr GetEntry get back current entry corrupted by SLEEP
.2 jsr CS.RUN.CopyStart
bcc .4
@ -396,6 +417,7 @@ CS.RUN.FILE .DO X.COPY.TO.DEST=1
.4 .DO X.DELETE.SOURCE=1
ldy #hSrcBasePath
jsr CS.RUN.GetFilePath
>LDYAI UsrBuf256
>SYSCALL NewPStrYA
bcs .9
@ -403,9 +425,12 @@ CS.RUN.FILE .DO X.COPY.TO.DEST=1
ldy #hToDelete
sta (pData),y
.FIN
clc
rts
.9 rts
.99 lda #0
.99 ldy #RC
lda (pData),y get global RC in case of bContnue
sec
rts
*--------------------------------------
@ -438,7 +463,7 @@ CS.RUN.CopyStart
>PUSHBI SYS.FOpen.W+SYS.FOpen.X
ldy #hDstBasePath
jsr CS.RUN.GetFilePath
>PUSHWI UsrBuf256
>SYSCALL FOpen
@ -525,9 +550,13 @@ CS.RUN.CopyEnd ldy #hSrcFile
clc
ldy #CopyRC
lda (pData),y
beq CS.RUN.CheckErr
beq .3
sec
bra CS.RUN.CheckErr
.3 jsr CS.RUN.CheckErr
bcs .9
jmp CS.RUN.NEXT
.9 rts
.FIN
*--------------------------------------
CS.RUN.CheckErr bcs .1
@ -535,7 +564,9 @@ CS.RUN.CheckErr bcs .1
>SYSCALL CPrintFYA
rts
.1 pha
.1 ldy #RC
sta (pData),y
pha
ldy #bContinue
lda (pData),y
@ -558,18 +589,15 @@ CS.RUN.CheckErr bcs .1
.9 rts
*--------------------------------------
CS.RUN.GetFilePath
jsr CS.RUN.GetBasePath
>PUSHW ZPFileName
>PUSHWI UsrBuf256
>SYSCALL PStrCat
rts
*--------------------------------------
CS.RUN.GetBasePath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
>PUSHWI UsrBuf256
>SYSCALL PStrCpy
>PUSHW ZPFileName
>PUSHWI UsrBuf256
>SYSCALL PStrCat
rts
*--------------------------------------
CS.DOEVENT sec
@ -605,5 +633,5 @@ CS.QUIT jsr LeaveSubDir
*--------------------------------------
MAN
SAVE BIN/X.CPMVRM.S
LOAD BIN/CP.S
LOAD BIN/MV.S
ASM

View File

@ -182,52 +182,107 @@ InitDstDirYA >SYSCALL GetFullPathYA
.FIN
*--------------------------------------
GetNextEntry ldy #index
GetNextEntry jsr GetEntry
bcs .9
lda (ZPFileName) Save actual file len for setting up
tax new offset later
lda ZPFileStat
clc
adc #S.STAT
sta ZPFileName
lda ZPFileStat+1
adc /S.STAT
sta ZPFileName+1 Make nDIRENTs[i] point to next DIRENT
lda (ZPFileName) are we at end of this buffer ?
beq .1 yes, go read next one ...
sec
adc ZPFileName
sta ZPFileStat
lda ZPFileName+1
adc #0
sta ZPFileStat+1
ldy #index
lda (pData),y
asl
clc
adc #oDIRENTs-1
tay
txa Get back previous file len
sec
adc (pData),y
sta (pData),y
iny
lda #0
adc (pData),y
sta (pData),y
dey
lda #S.STAT
clc
adc (pData),y
sta (pData),y
iny
lda /S.STAT
adc (pData),y
sta (pData),y
clc
rts
.1 jsr GetEntry.ReadDir
bcs .9
lda (ZPFileName)
beq .99
sec
adc ZPFileName
sta ZPFileStat
lda ZPFileName+1
adc #0
sta ZPFileStat+1
clc
.9 rts
.99 sec
rts
*--------------------------------------
GetEntry ldy #index
lda (pData),y
tax keep index for later
clc
adc #hDIRENTs-1
tay
lda (pData),y
bne .1 we have a buffer to scan
txa get back index....
clc
adc #hDIRs-1
tay
lda (pData),y
>SYSCALL ReadDirA
bcs InitSrcDirYA.RTS
>STYA ZPFileName
ldy #index
lda (pData),y
pha save index for later
clc
adc #hDIRENTs-1
tay
txa get hDIRENT in A
sta (pData),y
pla get back index
asl
adc #oDIRENTs-1 and reset offset for this buffer
tay
lda #0
sta (pData),y
iny
sta (pData),y
jsr GetEntry.ReadDir First run, get first block
bcs .9 ZPFileName = start of buffer
bra .2
lda (ZPFileName) Empty !!!
bne .8
txa
>SYSCALL FreeMemA
sec
rts
.1 >SYSCALL GetMemPtrA
>STYA ZPFileName
ldy #index
lda (pData),y
asl
adc #oDIRENTs-1 CC from ASL
clc
adc #oDIRENTs-1
tay
lda ZPFileName
@ -238,58 +293,64 @@ GetNextEntry ldy #index
iny
lda ZPFileName+1
adc (pData),y
sta ZPFileName+1
sta ZPFileName+1 ZPFileName=ZPFileName+oDIRENT
.2 lda (ZPFileName) first/next DIRENT
bne .8
sta (pData),y reset offset...
dey
sta (pData),y
ldy #index
lda (pData),y
clc
adc #hDIRENTs-1
tay
lda (pData),y
pha
lda #0
sta (pData),y reset hDIRENT
pla
>SYSCALL FreeMemA discard hDIRENT
bra GetNextEntry ...startover
.8 ldy #index
lda (pData),y
asl
adc #oDIRENTs-1
tay
lda (ZPFileName) Add file len+1...
sec
adc #S.STAT +S.STAT
clc
adc (pData),y Make oDIRENTs[i] point to next DIRENT
sta (pData),y
iny
lda (pData),y
adc #0
sta (pData),y
lda ZPFileName set Ptr2=Ptr1+LEN-> S.STAT
.8 lda ZPFileName
sec
adc (ZPFileName)
sta ZPFileStat
lda ZPFileName+1
adc #0
sta ZPFileStat+1
clc
rts
.9 rts
*--------------------------------------
GetEntry.ReadDir
ldy #index
lda (pData),y
clc
adc #hDIRENTs-1
tay
lda (pData),y
beq .1
pha
lda #0
sta (pData),y reset hDIRENT
pla
>SYSCALL FreeMemA discard previous hDIRENT
.1 ldy #index
lda (pData),y
clc
adc #hDIRs-1
tay
lda (pData),y
>SYSCALL ReadDirA
bcs .9
>STYA ZPFileName
ldy #index
lda (pData),y
clc
adc #hDIRENTs-1
tay
txa get hDIRENT in A
sta (pData),y
ldy #index
lda (pData),y
asl
clc
adc #oDIRENTs-1 and reset offset for this buffer
tay
lda #0
sta (pData),y
iny
sta (pData),y
clc
.9 rts
*--------------------------------------
EnterSubDirYA >STYA ZPPtr2 save SUBDIR for StrCat
@ -328,7 +389,8 @@ EnterSubDirYA >STYA ZPPtr2 save SUBDIR for StrCat
ldy #hDstBasePath
jsr EnterSubDirYA.1
.FIN
clc
.9 rts
EnterSubDirYA.1 lda (pData),y
@ -352,10 +414,27 @@ LeaveSubDir ldy #index
lda (pData),y
beq .9
ldy #index
lda (pData),y
clc
adc #hDIRENTs-1
tay
lda (pData),y
beq .1
pha
lda #0
sta (pData),y
pla
>SYSCALL FreeMemA
.1 ldy #index
lda (pData),y
clc
adc #hDIRs-1
tay
lda (pData),y
pha
lda #0
sta (pData),y
@ -382,6 +461,7 @@ BasePath.. .DO X.COPY.TO.DEST=1
ldy #hDstBasePath
jsr BasePath..1
.FIN
ldy #hSrcBasePath
BasePath..1 lda (pData),y

View File

@ -24,7 +24,7 @@ MLI.ERR.DUPFILE .EQ $47 Duplicate File Name
MLI.ERR.VOLFULL .EQ $48 Volume Full
MLI.ERR.DIRFULL .EQ $49 Directory Full
MLI.ERR.INCFF .EQ $4A Incompatible File Format
MLI.ERR.UNSUPSS .EQ $4B Unsupported Storage Type
MLI.ERR.UNSUPST .EQ $4B Unsupported Storage Type
MLI.ERR.EOF .EQ $4C End of File, No More Data
MLI.ERR.BEYEOF .EQ $4D Beyond EOF
MLI.ERR.LOCKED .EQ $4E File Access Error, File Locked

View File

@ -17,6 +17,7 @@ ERR.Codes .DA #MLI.ERR.IO
.DA #MLI.ERR.DUPFILE
.DA #MLI.ERR.VOLFULL
.DA #MLI.ERR.DIRFULL
.DA #MLI.ERR.UNSUPST
.DA #MLI.ERR.EOF
.DA #MLI.ERR.LOCKED
.DA #MLI.ERR.OPEN
@ -38,6 +39,7 @@ ERR.Messages >PSTR "I/O Error"
>PSTR "Duplicate Filename"
>PSTR "Volume Is Full"
>PSTR "Directory Is Full"
>PSTR "Unsupported Storage Type"
>PSTR "End Of File"
>PSTR "File Access Error, File Locked"
>PSTR "File Already Open"