push bp
mov bp, sp
- sub sp, 12
+ sub sp, 16
push bx
push cx
mov bx, ax
+ and dx, dx
+ jz .L3
+
+ inc bx
+
+.L3:
+
mov ax, es:[si + 62]
mov dx, es:[si + 64]
div cx
mov cx, ax
+
+ and dx, dx
+ jz .L3
+
+ inc cx
+
+.L4:
+
xchg bx, cx
mov ax, es:[si + 58]
and bx, bx
jz _write_file.truncate_ok
+ dec cx
+
call cs:[_next_cluster]
jc _write_file.truncate_ok
- dec cx
-
dec bx
jnz _write_file.truncate_walk
mov ax, word ptr [bp - 6]
mov dx, word ptr [bp - 4]
+ mov word ptr [bp - 16], ax
+ mov word ptr [bp - 14], dx
+
mov word ptr [bp - 12], cx
_write_file.truncate_loop:
and bx, bx
jz _write_file.truncate_update
- mov ax, es:[si + 58]
- mov dx, es:[si + 60]
+ mov cx, word ptr [bp - 12]
+
+ cmp cx, 2
+ jb _write_file.truncate_expand_done
+
+ sub cx, 2
+
+_write_file.truncate_expand:
+
+ and cx, cx
+ jz _write_file.truncate_expand_done
+
+ call cs:[_find_free]
+ jc _write_file.truncate_expand_done
+
+ push bx
+ push cx
+
+ mov bx, dx
+ mov cx, ax
+
+ mov ax, word ptr [bp - 16]
+ mov dx, word ptr [bp - 14]
+
+ call cs:[_update_cluster]
+ mov word ptr [bp - 16], cx
+ mov word ptr [bp - 14], bx
+
+ pop cx
+ pop bx
+
+ dec cx
+ jnz _write_file.truncate_expand
+
+_write_file.truncate_expand_done:
+
push bx
push cx
mov bx, HEX (FFFF)
mov cx, HEX (FFF8)
+ mov ax, word ptr [bp - 16]
+ mov dx, word ptr [bp - 14]
+
call cs:[_update_cluster]
pop cx
pop bx
- dec word ptr [bp - 12]
+ mov ax, es:[si + 58]
+ mov dx, es:[si + 60]
_write_file.truncate_update:
mov bx, ax
+ and dx, dx
+ jz .L2
+
+ inc bx
+
+.L2:
+
mov ax, es:[si + 62]
mov dx, es:[si + 64]
mov cx, ax
+ and dx, dx
+ jz .L1
+
+ inc cx
+
+.L1:
+
mov ax, es:[si + 58]
mov dx, es:[si + 60]
pop cx
pop bx
- add sp, 12
+ add sp, 16
clc
mov ax, word ptr [bp - 2]
pop cx
pop bx
- add sp, 12
+ add sp, 16
stc
mov ax, 5