DU.S: Added -a option, Usage info.

This commit is contained in:
Bobbi Webber-Manners 2021-06-10 22:58:48 -04:00
parent c57b5dc9bc
commit b8d965ff21

View File

@ -24,7 +24,6 @@ ZPPtr2 .BS 2
ZPFileName .BS 2
ZPFileStat .BS 2
ZPPW .BS 2
bCRLF .BS 1
hLineBuf .BS 1
ZPLineBuf .BS 2
bPass2 .BS 1
@ -51,13 +50,13 @@ CS.START cld
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.REGEXT .DA MSG.REGEXT
L.MSG.DIREXT .DA MSG.DIREXT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.REG1 .DA MSG.REG1
L.MSG.REG2 .DA MSG.REG2
L.MSG.DIRSUMM .DA MSG.DIRSUMM
L.MSG.BDEV .DA MSG.BDEV
L.MSG.BDEVEXT .DA MSG.BDEVEXT
L.MSG.ENTER .DA MSG.ENTER
L.MSG.EXIT .DA MSG.EXIT
L.MSG.CWD .DA MSG.CWD
L.MSG.TOTSUMM .DA MSG.TOTSUMM
J.CS.RUN.PRINT .DA CS.RUN.PRINT.REG
.DA CS.RUN.PRINT.DIR
@ -91,6 +90,9 @@ CS.RUN
dex
bpl .2
>PUSHW L.MSG.USAGE
>PUSHBI 0
>SYSCALL PrintF
lda #E.SYN
sec
rts
@ -126,19 +128,6 @@ CS.RUN
bcs .9
>STYA ZPLineBuf
stx hLineBuf
* ldy #S.PS.hStdOut
* lda (pPS),y
* tax
* lda OF.Table.hFD-1,x
* >SYSCALL GetMemPtr
* >STYA ZPPtr1
* lda (ZPPtr1) S.FD.T
* beq CS.RUN.LOOP S.FD.T.REG
* cmp #S.FD.T.PIPE
* beq CS.RUN.LOOP
dec bCRLF
*--------------------------------------
CS.RUN.LOOP stz bPass2
@ -202,7 +191,7 @@ CS.RUN.LOOP stz bPass2
bne .91
jsr CS.RUN.PrintDirSumm
jsr CS.RUN.EXIT.MSG
jsr CS.RUN.PrintCwd
jsr CS.RUN.NewLine
.91 jsr LeaveSubDir "cd .."
@ -210,9 +199,6 @@ CS.RUN.LOOP stz bPass2
jsr BasePath.. Prune pathname
* jsr CS.RUN.ENTER.MSG
* bcs .99
jsr GetNextEntry Get next entry
jmp CS.RUN.LOOP Go again
@ -229,9 +215,11 @@ CS.RUN.PRINT.JMP
*--------------------------------------
CS.RUN.PRINT.REG
bit bPass2
bpl .8
bmi .1
clc
rts
ldy #S.STAT.BLOCKS+1
.1 ldy #S.STAT.BLOCKS+1
lda (ZPFileStat),y
pha
dey
@ -257,19 +245,27 @@ CS.RUN.PRINT.REG
adc (pData),y
sta (pData),y
* >PUSHW L.MSG.REGEXT
* ldy #S.STAT.BLOCKS+1
* ldx #2
*.2 lda (ZPFileStat),y
* >PUSHA
* dey
* dex
* bne .2 (2)
* >PUSHW ZPFileName (2)
* >PUSHBI 4
* >SYSCALL PrintF
* bcs .9
* jmp CS.RUN.NewLine.1
>LDA.G bAllFiles
beq .8
>PUSHW L.MSG.REG1
ldy #S.STAT.BLOCKS+1
ldx #2
.2 lda (ZPFileStat),y
>PUSHA
dey
dex
bne .2 (2)
>PUSHBI 2
>SYSCALL PrintF
bcs .9
jsr CS.RUN.PrintCwd
>PUSHW L.MSG.REG2
>PUSHW ZPFileName (2)
>PUSHBI 2
>SYSCALL PrintF
bcs .9
jmp CS.RUN.NewLine.1
.8 clc
.9 rts
@ -278,27 +274,13 @@ CS.RUN.PRINT.DIR
bit bPass2
bmi .8
* >PUSHW L.MSG.DIREXT
* >PUSHW ZPFileName
* >PUSHBI 2
* >SYSCALL PrintF
* bcs .9
* jsr CS.RUN.NewLine.1
* bcs .9
lda (ZPFileName)
cmp #'.'
beq .8
* jsr CS.RUN.NewLine.1
* bcs .9
>LDYA ZPFileName
jmp EnterSubDirYA
jmp CS.RUN.ENTER.MSG
.8 clc
.9 rts
*--------------------------------------
@ -337,8 +319,6 @@ CS.RUN.PRINT.BDEV
jsr EnterSubDirYA
bcs .9
jmp CS.RUN.ENTER.MSG
.8 clc
.9 rts
*--------------------------------------
@ -360,21 +340,8 @@ CS.RUN.PrintTotSumm >PUSHW L.MSG.TOTSUMM
>SYSCALL PrintF
rts
*--------------------------------------
CS.RUN.ENTER.MSG
>PUSHW L.MSG.ENTER
ldy #hSrcBasePath
lda (pData),y
>SYSCALL GetMemPtr
>PUSHYA
>PUSHBI 2
>SYSCALL PrintF
bcc CS.RUN.NewLine.1
rts
*--------------------------------------
CS.RUN.EXIT.MSG
>PUSHW L.MSG.EXIT
CS.RUN.PrintCwd
>PUSHW L.MSG.CWD
ldy #hSrcBasePath
lda (pData),y
>SYSCALL GetMemPtr
@ -441,16 +408,18 @@ CS.QUIT
*--------------------------------------
CS.END
*--------------------------------------
OptionList .AS "Ss"
OptionVars .DA #bSummary,#bSummary
OptionList .AS "SAsa"
OptionVars .DA #bSummary,#bAllFiles,#bSummary,#bAllFiles
*--------------------------------------
MSG.REGEXT .AZ "%5D %s"
MSG.DIREXT .AZ "<dir> %s"
MSG.EXIT .AZ "%s "
MSG.USAGE .AS "Usage : DU\r\n"
.AS " -A : Show all files (not only directories)\r\n"
.AZ " -S : Show only summary\r\n"
MSG.REG1 .AZ "%5D "
MSG.REG2 .AZ "%s"
MSG.CWD .AZ "%s"
MSG.DIRSUMM .AZ "%5D "
MSG.BDEVEXT .AZ "/%15s s%dd%d Blocks Used:%5D Total:%5D"
MSG.BDEV .AZ "\e[32m%s/\e[0m"
MSG.ENTER .AZ "Directory:%s"
MSG.TOTSUMM .AZ "Total: %5D blocks"
*--------------------------------------
.DUMMY
@ -460,6 +429,7 @@ ArgCount .BS 1
TIME.SysTime .BS S.TIME
bPause .BS 1
bSummary .BS 1
bAllFiles .BS 1
DirBlksL .BS 1
DirBlksH .BS 1
TotBlksL .BS 1