Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

DOS copy command (Developers)

posted by nidud E-mail, Norway, 03.10.2010, 17:17

> 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:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 210 users online (0 registered, 210 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum