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