DU: Supports 32-bit number of blocks (for CIFS)

This commit is contained in:
Bobbi Webber-Manners 2021-06-15 17:44:06 -04:00
parent 426651ae0a
commit 4c0e8ca67b

View File

@ -1,7 +1,7 @@
NEW
AUTO 3,1
*---------------------------------------
* DU: Disk Usage - Bobbi - June 14, 2021
* DU: Disk Usage - Bobbi - June 15, 2021
*---------------------------------------
.LIST OFF
.OP 65C02
@ -228,7 +228,13 @@ CS.RUN.PRINT.REG bit bPass2
.1 ldx bDirLevel X is loop ctr bDirLevel..0
.2 >LEA.G BlkCounters
>STYA ZPPtr1
ldy #S.STAT.BLOCKS+1
ldy #S.STAT.BLOCKS+3 Read 32-bit number of blocks
lda (ZPFileStat),y
pha And push to stack
dey
lda (ZPFileStat),y
pha
dey
lda (ZPFileStat),y
pha
dey
@ -236,31 +242,40 @@ CS.RUN.PRINT.REG bit bPass2
pha
txa Get loop counter
asl x2
asl x2 again
tay
pla
pla Do 32-bit add
clc
adc (ZPPtr1),y LSB
sta (ZPPtr1),y
pla
iny
adc (ZPPtr1),y
sta (ZPPtr1),y
pla
iny
adc (ZPPtr1),y
sta (ZPPtr1),y
dex
cpx #$ff
pla
iny
adc (ZPPtr1),y MSB
sta (ZPPtr1),y
dex Decrement loop counter
cpx #$ff Stop if -1
bne .2
>LDA.G bAllFiles
beq .8
>PUSHW L.MSG.REG1
ldy #S.STAT.BLOCKS+1
ldx #2
ldy #S.STAT.BLOCKS+3
ldx #4
.3 lda (ZPFileStat),y
>PUSHA
dey
dex
bne .3 (2)
>PUSHBI 2
bne .3 (4)
>PUSHBI 4
>SYSCALL PrintF
bcs .9
jsr CS.RUN.PrintCwd
@ -330,6 +345,7 @@ CS.RUN.PrintDirSumm >LEA.G BlkCounters
>STYA ZPPtr1
lda bDirLevel
asl
asl
clc
adc ZPPtr1
sta ZPPtr1
@ -337,20 +353,30 @@ CS.RUN.PrintDirSumm >LEA.G BlkCounters
adc ZPPtr1+1
sta ZPPtr1+1
>PUSHW L.MSG.DIRSUMM
ldy #$01
ldy #$03
lda (ZPPtr1),y
>PUSHA
dey
lda (ZPPtr1),y
>PUSHA
>PUSHBI 2
dey
lda (ZPPtr1),y
>PUSHA
dey
lda (ZPPtr1),y
>PUSHA
>PUSHBI 4
>SYSCALL PrintF
ldy #$01
ldy #$03
lda #$00
sta (ZPPtr1),y
dey
sta (ZPPtr1),y
dey
sta (ZPPtr1),y
dey
sta (ZPPtr1),y
rts
*--------------------------------------
@ -399,10 +425,10 @@ OptionVars .DA #bSummary,#bAllFiles,#bSummary,#bAllFiles
MSG.USAGE .AS "Usage : DU [-A] [-S] [filespec]\r\n"
.AS " -A : Show all files (not only directories)\r\n"
.AZ " -S : Show only summary\r\n"
MSG.REG1 .AZ "%5D "
MSG.REG1 .AZ "%5u "
MSG.REG2 .AZ "%s"
MSG.CWD .AZ "%s"
MSG.DIRSUMM .AZ "%5D "
MSG.DIRSUMM .AZ "%5u "
MSG.BDEVEXT .AZ "/%15s s%dd%d Blocks Used:%5D Total:%5D"
MSG.BDEV .AZ "\e[32m%s/\e[0m"
*--------------------------------------
@ -415,7 +441,7 @@ bPause .BS 1
bSummary .BS 1
bAllFiles .BS 1
hPW .BS 1
BlkCounters .BS 16 Array of 16 bit integers, size 8
BlkCounters .BS 64 Array of 32 bit integers, size 16
.INB usr/src/shared/x.fileenum.g
DS.END .ED
*--------------------------------------