DOS copy command (Developers)
> Hi, a comment on the dos copy command threat: Try first setting
> the file to the right size (seek to end-1, write a byte, close)
> and then reopen the file and start writing data, for example in
> 32k blocks, taking care that the 32k buffer does not wrap around
> a multiple of 64k in terms of linear address / DMA boundary. The
> idea is that setting the final size immediately avoids having to
> update the FAT again later: The file size does not change later,
> while it would change all the time if starting with an empty file
> and appending data to it until all content is there...
>
> Eric
I did a brief test by setting the size of the default.$$$ to the same size as the default.zip prior to add a file to the archive. The file size will change later, but the copying prior to the adding takes a long time, and this increase for each file in the loop.
\doszip\src\clib\zip\wzipadd.asm:
    wzipadd_copylocal:
        xor     ax,ax
        mov     local_size_ax,ax
        mov     local_size_dx,ax
        inc     ax
        cmp     copy_fast,al
        jne     wzipadd_copyslow
  ifdef ERIKS_FASTCOPY
        mov     ax,4200h + SEEK_END     ; get .ZIP file size
        mov     bx,STDI.ios_file
        xor     cx,cx
        mov     dx,cx
        int     21h
        jc      wzipadd_error
        push    dx
        push    ax
        mov     ax,4200h + SEEK_SET     ; back to start..
        mov     bx,STDI.ios_file
        xor     cx,cx
        mov     dx,cx
        int     21h
        pop     dx
        pop     cx
        or      cx,cx
        jnz     wzipadd_size_ok
        cmp     dx,16
        jb      wzipadd_skip            ; skip if < 16 byte
    wzipadd_size_ok:
        sub     dx,1
        sbb     cx,0
        mov     ax,4200h + SEEK_SET     ; seek outfile to size-1
        mov     bx,STDO.ios_file
        int     21h
        jc      wzipadd_error
        mov     bx,STDO.ios_file
        mov     cx,1
        mov     ax,4000h                ; write one byte
        int     21h
        jc      wzipadd_error
        mov     ax,4200h + SEEK_SET     ; back to start..
        mov     bx,STDO.ios_file
        xor     cx,cx
        mov     dx,cx
        int     21h
    wzipadd_skip:
  endif
This reduced the compression time from 455 to 180 sec.
Complete thread:
- DOS copy command - georgpotthast, 26.09.2010, 21:37 ![Open in board view [Board]](img/board_d.gif) ![Open in mix view [Mix]](img/mix_d.gif) - DOS copy command - ecm, 26.09.2010, 23:46
- DOS copy command - Japheth, 27.09.2010, 02:06
- DOS copy command - georgpotthast, 27.09.2010, 21:28- DOS copy command - ecm, 27.09.2010, 21:40- DOS copy command - georgpotthast, 27.09.2010, 22:46- DOS copy command - bretjohn, 28.09.2010, 00:15- DOS copy command - ecm, 28.09.2010, 01:16- DOS copy command - Rugxulo, 28.09.2010, 05:37
- DOS copy command - Rugxulo, 28.09.2010, 22:40- DOS copy command - Rugxulo, 30.09.2010, 06:51- DOS copy command - georgpotthast, 30.09.2010, 19:59- DOS copy command - tom, 01.10.2010, 15:12- DOS copy command - georgpotthast, 02.10.2010, 22:56- DOS copy command - RayeR, 08.10.2010, 10:10
 
 
- DOS copy command - georgpotthast, 02.10.2010, 22:56
 
- DOS copy command - tom, 01.10.2010, 15:12
 
- DOS copy command - georgpotthast, 30.09.2010, 19:59
 
- DOS copy command - Rugxulo, 30.09.2010, 06:51
- DOS copy command - nidud, 03.10.2010, 17:17
 
- DOS copy command - georgpotthast, 28.09.2010, 21:04- DOS copy command - ecm, 29.09.2010, 14:05
 
 
- DOS copy command - ecm, 28.09.2010, 01:16
 
- DOS copy command - bretjohn, 28.09.2010, 00:15
 
- DOS copy command - georgpotthast, 27.09.2010, 22:46
 
- DOS copy command - ecm, 27.09.2010, 21:40
- DOS copy command | FATPLUS.EXE - DOS386, 13.10.2010, 04:02
 
 Board view
Board view Mix view
Mix view
