Kernel version 0.9 : CP/MV/RM, bugfix and improved Error messages

This commit is contained in:
Rémy GIBERT 2017-02-23 17:43:42 +01:00
parent 76d1721df4
commit 69cf7bf321
11 changed files with 162 additions and 182 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -17,7 +17,6 @@ X.COPY.TO.DEST .EQ 1
X.DELETE.SOURCE .EQ 0
*--------------------------------------
.INB BIN/X.CPMVRM.S
*--------------------------------------
.INB BIN/X.FILEENUM.S
*--------------------------------------
CS.END

View File

@ -17,7 +17,6 @@ X.COPY.TO.DEST .EQ 1
X.DELETE.SOURCE .EQ 1
*--------------------------------------
.INB BIN/X.CPMVRM.S
*--------------------------------------
.INB BIN/X.FILEENUM.S
*--------------------------------------
CS.END

View File

@ -17,7 +17,6 @@ X.COPY.TO.DEST .EQ 0
X.DELETE.SOURCE .EQ 1
*--------------------------------------
.INB BIN/X.CPMVRM.S
*--------------------------------------
.INB BIN/X.FILEENUM.S
*--------------------------------------
CS.END
@ -26,7 +25,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"

View File

@ -215,25 +215,7 @@ CS.RUN >SYSCALL GetC
sec
rts
*--------------------------------------
CS.RUN.DEV >PUSHW ZPPtr1
>LDYA L.MSG.FILE
>SYSCALL CPrintFYA
bcs .9
ldy #bRecurse
lda (pData),y
bpl .8
jsr CS.RUN.PrintFile
bcs .9
lda #0
clc
jsr CS.RUN.CheckErr
>LDYA ZPPtr1
jmp EnterSubDirYA
CS.RUN.DEV
.8 clc
.9 rts
*--------------------------------------
@ -242,7 +224,22 @@ CS.RUN.DIR ldy #1
cmp #'.'
beq .8
jsr CS.RUN.PrintDir
.DO X.COPY.TO.DEST=1
ldy #hDstBasePath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
.FIN
>PUSHW ZPPtr1 Filename
ldy #hSrcBasePath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
>LDYA L.MSG.DIR
>SYSCALL CPrintFYA
bcs .9
*--------------------------------------
.DO X.COPY.TO.DEST=1
@ -263,7 +260,6 @@ CS.RUN.DIR ldy #1
jmp EnterSubDirYA
*--------------------------------------
.1 .DO X.DELETE.SOURCE=1
ldy #hSrcBasePath
jsr CS.RUN.GetFilePath
>LDYAI UsrBuf256
@ -275,7 +271,22 @@ CS.RUN.DIR ldy #1
.8 clc
.9 rts
*--------------------------------------
CS.RUN.FILE jsr CS.RUN.PrintFile
CS.RUN.FILE .DO X.COPY.TO.DEST=1
ldy #hDstBasePath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
.FIN
>PUSHW ZPPtr1
ldy #hSrcBasePath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
>LDYA L.MSG.FILE
>SYSCALL CPrintFYA
bcs .9
*--------------------------------------
.DO X.COPY.TO.DEST=1
@ -288,48 +299,13 @@ CS.RUN.FILE jsr CS.RUN.PrintFile
jsr CS.RUN.GetFilePath
>LDYAI UsrBuf256
>SYSCALL NewPStrYA
bcs .99
bcs .9
txa
ldy #hToDelete
sta (pData),y
.FIN
*--------------------------------------
rts
.9 jsr CS.RUN.CheckErr
.99 rts
*--------------------------------------
CS.RUN.PrintDir ldy #hDstBasePath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
>PUSHW ZPPtr1
ldy #hSrcBasePath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
>LDYA L.MSG.DIR
>SYSCALL CPrintFYA
rts
*--------------------------------------
CS.RUN.PrintFile
ldy #hDstBasePath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
>PUSHW ZPPtr1
ldy #hSrcBasePath
lda (pData),y
>SYSCALL GetMemPtrA
>PUSHYA
>LDYA L.MSG.FILE
>SYSCALL CPrintFYA
rts
.9 rts
*--------------------------------------
.DO X.COPY.TO.DEST=1
CS.RUN.CopyStart
@ -448,7 +424,7 @@ CS.RUN.CopyEnd ldy #hSrcFile
lda (pData),y
beq CS.RUN.CheckErr
sec
jmp CS.RUN.CheckErr
bra CS.RUN.CheckErr
.FIN
*--------------------------------------
.DO X.DELETE.SOURCE=1
@ -458,7 +434,7 @@ CS.RUN.Delete pha
pla
>SYSCALL GetMemPtrA
>SYSCALL RemoveYA
jmp CS.RUN.CheckErr
bra CS.RUN.CheckErr
.FIN
*--------------------------------------
CS.RUN.CheckErr bcs .1
@ -466,18 +442,23 @@ CS.RUN.CheckErr bcs .1
>SYSCALL CPrintFYA
rts
.1 sta .2+1
.1 pha
ldy #bContinue
lda (pData),y
bpl .2
pla
>PUSHA
>LDYA L.MSG.ERR
>SYSCALL CPrintFYA
bcs .9
rts
ldy #bContinue
lda (pData),y
bmi .9 CC
.2 lda #$ff
.2 lda #13
>SYSCALL PutCA
pla
sec
rts
@ -485,7 +466,6 @@ CS.RUN.CheckErr bcs .1
*--------------------------------------
CS.RUN.GetFilePath
jsr CS.RUN.GetBasePath
>PUSHW ZPPtr1
>PUSHWI UsrBuf256
>SYSCALL PStrCat
@ -532,5 +512,5 @@ CS.QUIT jsr LeaveSubDir
*--------------------------------------
MAN
SAVE BIN/X.CPMVRM.S
LOAD BIN/RM.S
LOAD BIN/CP.S
ASM

View File

@ -10,57 +10,6 @@ AUTO 6
* hDIRENTs .BS X.MAX.RECURSE+1
* hSrcBasePath .BS 1
* hDstBasePath .BS 1 (optional)
*--------------------------------------
.DO X.COPY.TO.DEST=1
InitDstDirYA >SYSCALL GetFullPathYA
bcs .99
stx .90+1
>STYA ZPPtr1
.5 >PUSHWI 256
>PUSHBI 0
>SYSCALL GetMem Get a 256 buffer to store DstBasePath
bcs .9
>STYA ZPPtr2
txa
ldy #hDstBasePath
sta (pData),y
lda (ZPPtr1)
sta (ZPPtr2)
tay
.6 lda (ZPPtr1),y
sta (ZPPtr2),y
dey
bne .6
lda (ZPPtr2)
tay
lda #'/'
cmp (ZPPtr2),y
beq .7
iny
sta (ZPPtr2),y
tya
sta (ZPPtr2)
.7 jsr .9 Cleanup
clc
.99 rts
.9 pha
.90 lda #$ff self modified
>SYSCALL FreeMemA
pla
sec
rts
.FIN
*--------------------------------------
InitSrcDirPatYA ldx #$80
.HS 2C bit abs
@ -144,7 +93,18 @@ InitSrcDirYA ldx #0
dey
bne .6
>LDYA ZPPtr1
lda (ZPPtr2)
tay
lda #'/'
cmp (ZPPtr2),y
beq .7
iny
sta (ZPPtr2),y
tya
sta (ZPPtr2)
.7 >LDYA ZPPtr1
>SYSCALL OpenDirYA
bcs .9
@ -168,6 +128,57 @@ InitSrcDirYA ldx #0
sec
InitSrcDirYA.RTS
rts
*--------------------------------------
.DO X.COPY.TO.DEST=1
InitDstDirYA >SYSCALL GetFullPathYA
bcs .99
stx .90+1
>STYA ZPPtr1
.5 >PUSHWI 256
>PUSHBI 0
>SYSCALL GetMem Get a 256 buffer to store DstBasePath
bcs .9
>STYA ZPPtr2
txa
ldy #hDstBasePath
sta (pData),y
lda (ZPPtr1)
sta (ZPPtr2)
tay
.6 lda (ZPPtr1),y
sta (ZPPtr2),y
dey
bne .6
lda (ZPPtr2)
tay
lda #'/'
cmp (ZPPtr2),y
beq .7
iny
sta (ZPPtr2),y
tya
sta (ZPPtr2)
.7 jsr .9 Cleanup
clc
.99 rts
.9 pha
.90 lda #$ff self modified
>SYSCALL FreeMemA
pla
sec
rts
.FIN
*--------------------------------------
GetNextEntry ldy #index
lda (pData),y
@ -337,6 +348,7 @@ EnterSubDirYA.1 lda (pData),y
LeaveSubDir ldy #index
lda (pData),y
beq .9
clc
adc #hDIRs-1
tay
@ -356,6 +368,7 @@ LeaveSubDir ldy #index
ldy #hSrcBasePath
lda (pData),y
>SYSCALL FreeMemA
.9 sec
rts

View File

@ -6,29 +6,29 @@ AUTO 6
.LIST OFF
*--------------------------------------
*$00 - No Error
*$01 - Bad Call Number
*$04 - Bad Parameter Count
*$25 - Interrupt Table Full
*$27 - I/O Error
*$28 - No Device Connected
*$2B - Write Protected
*$2E - Disk Switched
*$2F - Device Offline
*$40 - Invalid Pathname
*$42 - Maximum Number of Files Open
*$43 - Invalid Reference Number
*$44 - Directory Not Found
*$45 - Volume Not Found
*$46 - File Not Found
*$47 - Duplicate File Name
*$48 - Volume Full
*$49 - Directory Full
*$4A - Incompatible File Format
*$4B - Unsupported Storage Type
*$4C - End of File, No More Data
*$4D - Beyond EOF
*$4E - File Access Error, File Locked
*$50 - File Already Open
MLI.ERR.BADCALL .EQ $01 Bad Call Number
*MLI.ERR.BADCNT .EQ $04 Bad Parameter Count
*MLI.ERR.IRQFULL .EQ $25 Interrupt Table Full
MLI.ERR.IO .EQ $27 I/O Error
MLI.ERR.NODEV .EQ $28 No Device Connected
MLI.ERR.WRTPROT .EQ $2B Write Protected
MLI.ERR.DSKSWIT .EQ $2E Disk Switched
MLI.ERR.OFFLINE .EQ $2F Device Offline
MLI.ERR.INVPATH .EQ $40 Invalid Pathname
MLI.ERR.FCBFULL .EQ $42 Maximum Number of Files Open
MLI.ERR.BADREF .EQ $43 Invalid Reference Number
MLI.ERR.PNOTFND .EQ $44 Directory Not Found
MLI.ERR.VNOTFND .EQ $45 Volume Not Found
MLI.ERR.FNOTFND .EQ $46 File Not Found
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.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
MLI.ERR.OPEN .EQ $50 File Already Open
*$51 - Directory Structure Damaged
*$53 - Invalid Parameter
*$55 - Too Many Volumes
@ -36,23 +36,5 @@ AUTO 6
*$57 - Duplicate Volume
*$5A - File Structure Damaged
*--------------------------------------
MLI.ERR.BADCALL .EQ $01
*MLI.ERR.BADCNT .EQ $04
*MLI.ERR.IRQFULL .EQ $25
MLI.ERR.IO .EQ $27
MLI.ERR.NODEV .EQ $28
MLI.ERR.WRTPROT .EQ $2B
MLI.ERR.DSKSWIT .EQ $2E
MLI.ERR.INVPATH .EQ $40
MLI.ERR.FCBFULL .EQ $42
MLI.ERR.BADREF .EQ $43
MLI.ERR.PNOTFND .EQ $44
MLI.ERR.VNOTFND .EQ $45
MLI.ERR.FNOTFND .EQ $46
MLI.ERR.DUPFILE .EQ $47
MLI.ERR.OVERRUN .EQ $48
MLI.ERR.VOLFULL .EQ $49
MLI.ERR.EOF .EQ $4C
*--------------------------------------
MAN
SAVE /A2OSX.DEV/INC/MLI.ERR.I

View File

@ -9,8 +9,8 @@ AUTO 6
.TF /A2OSX.BOOT/SBIN/SHELL
*--------------------------------------
.INB /A2OSX.DEV/INC/MACROS.I
.INB /A2OSX.DEV/INC/PRODOS.I
.INB /A2OSX.DEV/INC/A2OSX.I
.INB /A2OSX.DEV/INC/MLI.ERR.I
*--------------------------------------
ZPPTR1 .EQ ZPBIN
ZPPTR2 .EQ ZPBIN+2
@ -107,7 +107,14 @@ CS.RUN ldy #bPause
lda (pData),y
bne CS.RUN.READ
ldy #hInputFile batch mode ?
ldy #S.PS.RC
lda (pPs),y
beq .11
jsr ERR.Print
bcs CS.RUN.EXIT.RTS
.11 ldy #hInputFile batch mode ?
lda (pData),y
beq .10
@ -119,7 +126,7 @@ CS.RUN ldy #bPause
ldy #bSecureRead
sta (pData),y
jsr PrintPrompt
.12 jsr PrintPrompt
bcs CS.RUN.EXIT.RTS
.1 >SYSCALL Sleep
@ -136,20 +143,15 @@ CS.RUN ldy #bPause
jsr CmdBuffer.Normalize
lda (pData)
beq .8 Empty line
beq .12 Empty line
jsr HIS.Add
>LDYA pData
jsr Cmd.ExecYA
ldy #S.PS.RC
sta (pPs),y
bcc .8
tay
beq .8
jsr ERR.Print
bcs CS.RUN.EXIT.RTS
.8 ldy #bEXIT
lda (pData),y
@ -203,9 +205,9 @@ CS.RUN.BATCH jsr TXT.ReadFile
jsr CmdBuffer.Normalize
lda (pData)
beq .8 Empty line
beq CS.RUN.BATCH Empty line
jsr HIS.Add
* jsr HIS.Add
>LDYA pData
jsr Cmd.ExecYA
@ -219,7 +221,7 @@ CS.RUN.BATCH jsr TXT.ReadFile
lda (pData),y
bne CS.RUN.EXIT
.8 clc
clc
rts
*--------------------------------------
CS.DOEVENT sec
@ -493,7 +495,7 @@ CMDS >PSTR "CD"
MSG.GREETINGS >CSTR "\nA2osX-Shell\n\n"
MSG.PROMPT >CSTR "%S$ "
MSG.ECHO >CSTR ">%S\n"
MSG.ERROR >CSTR "%S ($%h)\n"
MSG.ERROR >CSTR "Err:%S [%h]\n"
FMT.DATE >PSTR "%A, %B %d %Y"
FMT.TIME >PSTR "%H:%M:%S (%I:%M:%S%p)"
MSG.PRINTENV >CSTR "%S=%S\n"

View File

@ -9,14 +9,17 @@ ERR.Codes .DA #MLI.ERR.IO
.DA #MLI.ERR.NODEV
.DA #MLI.ERR.WRTPROT
.DA #MLI.ERR.DSKSWIT
.DA #MLI.ERR.OFFLINE
.DA #MLI.ERR.INVPATH
.DA #MLI.ERR.PNOTFND
.DA #MLI.ERR.VNOTFND
.DA #MLI.ERR.FNOTFND
.DA #MLI.ERR.DUPFILE
.DA #MLI.ERR.OVERRUN
.DA #MLI.ERR.VOLFULL
.DA #MLI.ERR.DIRFULL
.DA #MLI.ERR.EOF
.DA #MLI.ERR.LOCKED
.DA #MLI.ERR.OPEN
*--------------------------------------
.DA #SYSMGR.ERRSYN
.DA #SYSMGR.ERRFNF
@ -27,14 +30,17 @@ ERR.Messages >PSTR "I/O Error"
>PSTR "No Device"
>PSTR "Disk Write-Protected"
>PSTR "Disk Switched"
>PSTR "Device Is Offline"
>PSTR "Invalid Path"
>PSTR "Path Not Found"
>PSTR "Volume Not Found"
>PSTR "File Not Found"
>PSTR "Duplicate Filename"
>PSTR "Buffer Overrun"
>PSTR "Volume Is Full"
>PSTR "Directory Is Full"
>PSTR "End Of File"
>PSTR "File Access Error, File Locked"
>PSTR "File Already Open"
*--------------------------------------
>PSTR "Syntax Error"
>PSTR "Command Not Found"