fix block file block calculation (but ignores sparse files)

This commit is contained in:
Kelvin Sherlock 2015-09-14 12:19:32 -04:00
parent 49d8064ee5
commit 86be98ef7f
1 changed files with 28 additions and 39 deletions

View File

@ -198,56 +198,45 @@ do_blocks proc export
with dp,fst_parms with dp,fst_parms
with v1 with v1
; minix supports sparse blocks. should just guess based on size... ; minix supports sparse blocks. Just guess based on size...
phx ; save ; size + 1023
phy ; save
; 7 direct blocks, 1 indirect block, 1 double indirect block. lda disk_inode.size
ldx #0 clc
ldy #0 ; count adc #1023
@loop sta tmp
lda disk_inode.zone,x
beq @next
iny
@next
inx
inx
cpx #NR_DZONES*2
bcc @loop
; y is number of direct blocks. lda disk_inode.size+2
adc #0
sta tmp+2
; check for indirect block... ; divided by 256
lda disk_inode.zone + NR_DZONES * 2 lda tmp+1
beq dib sta tmp
lda tmp+3
and #$00ff
sta tmp+2
; ; divide by 4
; count up indirect blocks... lsr a
; ror tmp
iny lsr a
ror tmp
sta tmp+2
dib lda tmp
; check for double indirect block
lda disk_inode.zone + (NR_DZONES + 1) * 2
beq store
;
; count up double indirect blocks....
;
iny
store
tya
ply
sta [param_blk_ptr],y sta [param_blk_ptr],y
iny iny
iny iny
lda #0 lda tmp+2
sta [param_blk_ptr],y sta [param_blk_ptr],y
plx ; restore rts
rts
tmp ds.l 1
ds.b 1
endp endp