flat assembler
Message board for the users of flat assembler.

Index > DOS > tiny .ZIP viewers (122 and 254 bytes)

Goto page 1, 2  Next

Is this useless?
yes
27%
 27%  [ 6 ]
no
54%
 54%  [ 12 ]
kinda sorta
18%
 18%  [ 4 ]
it ain't gfx oriented enough!
0%
 0%  [ 0 ]
Total Votes : 22

Author
Thread Post new topic Reply to topic
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 03 Nov 2006, 10:05
Okay, well, if anyone payed close attention, I mentioned writing a .ZIP viewer for DOS (EDIT: see attachment in post below). Actually, it works okay but could probably be vastly improved if I put more effort into it and then eventually rewrote it. But, for fun, I decided to do this instead:

P.S. Thanks to vid, Grenhald, relsoft, http://www.256b.com, etc. for inspiration! Smile

P.P.S. I'm not attaching a file but putting it in a code block instead so that non-members of the forum can see/get it too! Razz

122-byte .ZIP viewer

  • + pure 8086 DOS .COM (written in FASM)
  • + only 122 bytes Very Happy
  • + prints filenames to STDOUT (so, it's redirectable)
  • + - only reads local headers' info (but still should be accurate)
  • - won't correctly handle data descriptor (oh well)
  • - won't handle SFXs (duh)
  • - not well commented (but see 255-byte .ZIP viewer below)
  • - doesn't do anything else, really Razz


If you want a decent cmdline archive viewer (not written by me, heh) w/ .ASM source, get ARCLDS (reads ACE, ARC, ARJ, CAB, DWC, HA, HAP, HPK, HYP, LIM, LHA/LZH, PAK, RAR, SQZ, YAC, ZIP, ZOO) 0.94.3 beta (2006-08-06).

Else, Win32 peeps, get IZarc or WinUHA for all your basic archiving needs (except PAQ8?, of course)! Laughing

(new!) IZarc now supports BZip2 compression in .ZIPs, AES encryption in .ZIPs, and can handle archives > 4GB (i.e., it's more compatible with WinZip 9).

Code:
; C.ASM -- 122-byte .ZIP viewer!   Smile
;          reads local headers
;          only outputs filenames to STDOUT
;
; public domain, free for any use, no credit necessary
; assemble w/ FASM 1.67.14
;
; Thank you, Lord Jesus, for your kindness and mercy, etc.   Very Happy
;
; rugxulo AT bellsouth DOT net
; Monday, November 6, 2006   11:37am

CR=13
LF=10

STDOUT=1

org 100h

Komenco:
        mov ax,3D00h
        mov si,80h
        cmp byte [si+1],CR
        jz Fino
        xor bh,bh
        mov bl,[si]
        mov byte [si+bx+1],bh
        lea dx,[si+2]
        int 21h
        jc Fino
        xchg bx,ax
Ekzamenu:
        mov cx,local_header_size
        mov dx,local_header
        call read_file
        mov di,filesize_compressed
        cmp word [di-18],'PK'
        jnz Fino
;        cmp word [di-16],0201h
;        jz Fino
        cmp word [di-16],0403h
        jnz Fino
        push word [di+2]
        push word [di]
        mov cx,[di+8]
        push cx
        add cx,[di+10]
        mov dx,buffer
        call read_file
        pop cx
        mov ah,40h
        push bx
        mov bx,STDOUT
        int 21h
        pop bx
        mov ah,2
        mov dl,CR
        int 21h
        mov dl,LF
        int 21h
        pop dx
        pop cx
        test dx,dx
        jnz Bonege
        jcxz Ekzamenu
Bonege:
        mov ax,4201h
        int 21h
        jnc Ekzamenu
Fino:
        mov ax,4C00h
        int 21h

; read_file
read_file:
        mov ah,3Fh
        int 21h
        jc Fino
        cmp ax,cx
        jnz Fino
read_file_ret:
        ret

local_header:
   id rb 4
   version rb 2
   bitfield rb 2
   compression rb 2
   filetime rb 2
   filedate rb 2
   crc rb 4
   filesize_compressed rb 4
   filesize_uncompressed rb 4
   filename_length rb 2
   extra_field_length rb 2

local_header_size = $-local_header

buffer:

; EOF
    


Last edited by rugxulo on 16 Nov 2006, 02:03; edited 4 times in total
Post 03 Nov 2006, 10:05
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 03 Nov 2006, 10:23
still lot of place for improving there Wink
Post 03 Nov 2006, 10:23
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 03 Nov 2006, 11:00
<EDIT>

Well, I guess I may as well post my (unfinished, unpolished, needing-a-rewrite, very-slightly-buggy) semi-full-featured .ZIP viewer for DOS here. It ain't able to use FASM (yet), so please don't whine. Very Happy

Here's a text screen dump/screenshot:

Code:
[ WinXP ] Sun 11/05/2006>av AV19TEMP.ZIP /i! /m! /p /l!

AV19TEMP.ZIP

av19.asm       16,049        (74,475)          Oct,28,2006  09:24:06a  [Defl-X]
avlazy.bat     866           (2,461)           Jan,03,2006  09:49:28a  [Defl-X]
av19.com       4,585         (4,585)           Oct,28,2006  09:31:06a  [Stored]
izappnfo.txt   38,981        (166,297)         May,28,2004  06:20:00p  [Defl-X]
all4one.bat    85            (147)             Oct,29,2004  09:25:38p  [Defl-N]
one4all.bat    66            (66)              Oct,27,2004  08:03:16p  [Stored]
av186.asm      13,183        (65,416)          Jul,07,2005  10:44:20p  [Defl-X]
debugit.bat    998           (1,869)           Oct,07,2005  11:51:16p  [Defl-X]
zip630.txt     34,010        (136,852)         Oct,07,2006  06:52:54p  [Defl-X]
jmp2ret.bat    713           (1,685)           Aug,16,2006  12:46:36p  [Defl-X]

10 items: 0 dirs + 10 files
109,536 bytes (453,853 unzipped)
Created by ZIP 2.3 : DOS, OS/2, WinNT FAT

[ WinXP ] Sun 11/05/2006>scrndump
    


And here's the help screen:
Code:

AV 0.19 (October 28, 2006)
rugxulo AT bellsouth DOT net
Usage:  av /z:cXi c:\dir\ /E myfile.zip

/c !  print archive Comment after view  /d !  print Dirs only, not files
/e    print numbers in kb (kb = 1024)   /f !  print only Files, not dirs
/h    Help screen  (/? also works)      /i !  list numitems & size totals Info
/k !  print archive Komment only        /l !  do not List name of opened file
/m !  print compr. Method nums (! sub-) /n    print CRLF after every fname
/o    no colors                         /p !  no Pause if screen is full
/q !  Quiet mode (summary info only)    /r !  clear or Reset to CO80 then list
/s(.asm) ! Search for fnames w/ ".asm"  /u    no commas
/x !  toggle printing numbers in heX    /y !+ wait after view or until kbhit
/z:   multiple options  (/z:icp!)
    


TODO:

  • remove useless, bloating need for slash in ext_colors (already done in another program)
  • work around DOSBOX 0.65 incompatibilities (if possible)
  • fix a few (very minor) bugs
  • handle data descriptor
  • optionally read CDS instead of always using local headers
  • some other stuff that I forget
  • rewrite it all! (probably)


P.S. It ain't no great piece of software, but enjoy (if possible ... or have a good laugh, heh). Razz

</EDIT>


Description: AV 0.19 beta -- .ZIP file viewer for DOS
rugxulo AT bellsouth DOT net
public domain

Download
Filename: AV19TEMP.ZIP
Filesize: 107.93 KB
Downloaded: 1197 Time(s)



Last edited by rugxulo on 16 Nov 2006, 01:41; edited 2 times in total
Post 03 Nov 2006, 11:00
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 05 Nov 2006, 23:56
Bugfixed! Very Happy

Code:
; C02.ASM -- 254-byte .ZIP viewer!   Smile
;            (successor to the 122-byte "filenames-only" .ZIP viewer)
;
; public domain, free for any use, no credit necessary
; assemble w/ FASM 1.67.14  (http://www.flatassembler.net)
;
; God listens, God loves, God forgives, God helps ... thanks, God!   Wink
;
; rugxulo AT bellsouth DOT net
;
; Wednesday, November 15, 2006   6:58pm
;
;
;     +===========+
;     | Bugfixes: |
;     +===========+
;        ! a zero-byte file is not always a DIR!
;          - rare but needed fixing (e.g., GNU/DJGPP sed: SED415S.ZIP)
;            - also! needed extra PUSH/POP for my XP (P4 2.52 Ghz) cpu
;              - seems to be needed only on Win XP Home SP2 (Dell A05 BIOS)
;                - DR-DOS 7.03 (P166), MS-DOS 6.22 (486 Sx/25) both work
;                  with or without it  Razz
;        ! the .BAT was broken (oops, doh, oy, eek, wah)
;          - it was sometimes wrongly reporting success!  ;-(
;
;     +===========+
;     | Features: |
;     +===========+
;        + small (duh, that's the whole point!)
;        + written in FASM (which is FOSS/good/fast/small, etc.)
;          - TODO:  write sed scripts to convert to NASM, Octasm, etc.
;        + written in pure 8086 asm (no 386+ required)
;        + liberal license (or lack thereof ... (ab)use for whatever!)
;        + outputs names & sizes (w/ commas!) to STDOUT (redirectable)
;          + preserves filenames' case (upper, lower, mixed, whatever)
;          + now prints the .ZIP file's name itself first (hi, Dex!)
;        + always exits with errorlevel of zero (just to be nice)
;        - only reads local headers (not "Central Dir Structure")
;        - doesn't handle data descriptor (oh well, that's rare anyways)
;        - that's all!  it doesn't do anything else!  Razz
;
;     +==============+
;     | Misc. Notes: |
;     +==============+
;        = to find *only* directories:
;             c02 myfile.zip | sed -n "/\/$/{N;p;}"
;
;        = to count files and dirs:
;             c02 myfile.zip | sed -n "1,2d;n;p;" | sed -n "$="
;
;     +=========+
;     | Caveat: |
;     +=========+
;        = if optimizing this further, use this .BAT to make sure
;          the resulting info outputted is the same):
;
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; @echo off
; REM Tested on DR-DOS 7.03 Lite
; REM
; REM !!! FIXED !!!  Smile
;
; if "%1"=="/fc" goto test
;
; for %%a in (*.zip) do call %0 /fc %%a
; goto end
;
; :test
; shift
; c02-old.com %1>old
; c02.com %1>new
; fc old new
;
; :end
; for %%f in (old new) do if exist %%f del %%f
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;
;

;short equ byte                        ; uncomment for FASM < 1.65.20
                                       ;   (this prevents 386+ jumps)

CR=13                                  ; carriage return
LF=10                                  ; line feed

TAB=9
COMMA=','
SLASH='/'

org 100h

Komenco:
        mov ax,3D00h
        mov si,81h
        cmp byte [si],CR               ; end of cmdline
        jz short FinoFino
        xor bh,bh
        mov bl,[si-1]                  ; cmdline length (ignores CR)
        mov byte [si+bx],bh            ; change CR to 0 for int 21h,3Dh
        lea dx,[si+1]                  ;  (makes argv[1] into ASCIIZ)
        lea cx,[bx-1]                  ; CX = length - 1 (' ' after 'c02')

        int 21h                        ; open file for reading
        jc short FinoFino

        push ax                        ; save file handle
        mov si,dx
        call eldonu                    ; output .ZIP file's name
        call crlf
        call crlf                      ; output '\n' twice
        pop bx                         ; restore handle (for read_file)

Cxerpu:
        mov cx,local_header_size
        mov dx,local_header
        call read_file                 ; read in local header

        mov di,filesize_compressed

        cmp word [di-18],'PK'          ; verify if is a .ZIP file
        jnz short FinoFino
;        cmp word [di-16],0201h         ; if reached CDS, then quit
;        jz short Fino
        cmp word [di-16],0403h         ; if not local header, then quit
        jnz short FinoFino

        mov cx,[di+8]
        push cx                        ; save filename length
        add cx,[di+10]                 ; CX = fname len + extra field len
        mov dx,buffer
        call read_file                 ; read in filename and extra field
                                       ;  (to buffer)

        push dx
        mov ah,2
        mov dl,TAB                     ; output TAB (to ease readability)
        int 21h
        pop si                         ; SI = location of filename

        pop cx                         ; restore filename length
        call eldonu                    ; output filename

        mov cx,[di+2]
        mov dx,[di]                    ; CX:DX = size of compressed data

        test dx,dx
        jnz short Bonege
        test cx,cx                     ; is size of compressed data == 0 ?
        jnz short Bonege

        cmp al,SLASH                   ; if fname ends in '/', it's a DIR
        jnz short Bonege

Dosierujo:
        mov cx,dir_msg_size
        mov si,dir_msg+dir_msg_size-1  ; SI = offset of 'D' in 'DIR!' string
        clc                            ; clear carry flag
        pushf                          ; save flags for later
        jmp short Diru

FinoFino:
        jmp short Fino                 ; midway to Fino
                                       ;  (short jump range is exceeded)
CxerpuCxerpu:
        jmp short Cxerpu               ; midway to Cxerpu
                                       ;  (short jump range exceeded)
Bonege:
        mov ax,4201h                   ; move file pointer
        int 21h                        ;  (skip over compressed data,
        jc short Fino                  ;   if not a DIR)
        pushf

Grandeco:
        mov ax,[di+4]
        mov dx,[di+6]                  ; DX:AX = uncompressed file size

        push bx                        ; save file handle

bin2dec:
        mov cx,10                      ; output number in base 10 (decimal)

        mov di,buffer                  ; put ASCIIZ decimal string
;        mov si,di                      ;  w/ commas in buffer (backwards)
        xor bp,bp
bin2dec_start:
        xchg ax,dx
        push dx
        xor dx,dx                      ; convert word in AX to DX:AX (dword)
        div cx
        xchg ax,bx
        pop ax
        div cx
        xchg dx,bx

        or bl,'0'                      ; this only works for dec numbers!
;        push ax                        ; this works for dec or hex nums
;        xchg bl,al
;        mov bx,asciihex
;        xlatb                          ; translate digit to ASCII
;        xchg bl,al
;        pop ax

        inc bp
        mov byte [di],bl
        cmp bp,3
        jb short bin2dec_no_comma      ; comma_number = 3 (dec) or 4 (hex)

        inc di
        mov byte [di],COMMA
        xor bp,bp
bin2dec_no_comma:
        inc di
        test dx,dx
        jnz short bin2dec_start
        test ax,ax
        jnz short bin2dec_start
        dec di                         ; now DX:AX = 0
        cmp byte [di],COMMA            ; this will allow 3-digit numbers
        jz short bin2dec_bye           ;  not to be outputted w/ a comma
        inc di
bin2dec_bye:
        stosb
bin2dec_ret:

        pop bx                         ; restore file handle
        lea si,[di-2]                  ; SI = first digit in number
        lea cx,[di-buffer-1]           ; CX = size of number string

Diru:
        call crlf
        call eldonu_rev                ; output number ("buffer" in reverse)

Crlf_it:
        call crlf                      ; output \n
        popf                           ; restore flags
        jnc short CxerpuCxerpu         ; if not carry, get next header
Fino:
;        mov ax,4C00h                   ; closes files, returns errorlevel 0
;        int 21h
        int 20h                        ; thanks for your help, ATV   Smile

; read_file
read_file:
        mov ah,3Fh                     ; BX = handle, CX = # bytes to read
        int 21h                        ; DX = buffer to read into
        jc short Fino                  ; carry flag means error
        cmp ax,cx
        jnz short Fino                 ; quit if # bytes read in != # bytes
read_file_ret:                         ;  requested to be read in
        ret

; crlf
crlf:                                  ; outputs \n to STDOUT
        mov ah,2
        mov dl,CR
        int 21h
        mov dl,LF
        int 21h
crlf_ret:
        ret

; eldonu_rev
eldonu_rev:                            ; outputs string at SI in reverse
        std                            ;  (redirectable)
                                       ; CX = size of string
; eldonu
eldonu:                                ; outputs string at SI (redirectable)
        mov ah,2                       ; CX = size of string
eldonu_denove:
        lodsb
        mov dl,al                      ; DL = char to output
        push ax                        ; * (need to save this on my XP cpu)
        int 21h
        pop ax                         ; * (PUSH/POP not needed on my P166)
        loop eldonu_denove             ; loop while CX is > 0

        cld                            ; clear direction flag
eldonu_ret:
        ret


;asciihex db '0123456789ABCDEF',0
dir_msg db '!RID'

dir_msg_size = $-dir_msg

local_header:
   id rb 4
   version rb 2
   bitfield rb 2
   compression rb 2
   filetime rb 2
   filedate rb 2
   crc rb 4
   filesize_compressed rb 4
   filesize_uncompressed rb 4
   filename_length rb 2
   extra_field_length rb 2

local_header_size = $-local_header

buffer:

; EOF
    


Description: C.ASM, C02.ASM, C-ATV.ASM, C-ZIP.SED, C02_C.C, C02-MC.C, C02_C.OBF
Download
Filename: C02.ZIP
Filesize: 10.49 KB
Downloaded: 808 Time(s)



Last edited by rugxulo on 02 Aug 2007, 23:17; edited 3 times in total
Post 05 Nov 2006, 23:56
View user's profile Send private message Visit poster's website Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV 06 Nov 2006, 15:37
Some weird things found in av19.asm
Code:
lines 689-
        mov ax,word ptr [pauzenum]
        shr ax,1                       ; pauzenum = pauzenum / 2
        mov word ptr [pauzenum],ax
new 689-
        shr word ptr [pauzenum],1      ; pauzenum = pauzenum / 2


lines 838-
        mov dx,bx
        shl dx,1
        shl bx,1
        shl bx,1
        add bx,dx
new 838-
        mov dx,bx
        shl bx,1
        add bx,dx
        shl bx,1        ;bx=bx*6

lines 1151-
        mov bx,dx
        mov cx,ax
        push cx
original number saved, but never used
(+ si=0 because 10 loop and all scrolled bits in di with reverse order!)
        rcr dx,1
        rcr ax,1
should be (don't want extra CF messing result)
        shr dx,1
        rcr ax,1

lines 1922-
        xor ah,ah
        mov al,byte ptr [columns]
        xor bh,bh
        mov bl,byte ptr [rows]
        mul bl
        mov cx,ax                      ; CX = rows*columns
        mov ax,bp
        mov es,ax
new 1922-
        mov al,byte ptr [columns]
        mul byte ptr [rows]
        mov cx,ax                      ; CX = rows*columns
        mov es,bp
    
Even smaller zip viewer (maybe it give help for c02<256)
Code:
; C.ASM -- 106-byte .ZIP viewer!
;          reads local headers, only prints filenames!
;
; public domain, free for any use
; assemble w/ FASM 1.67.14
;
; rugxulo AT bellsouth DOT net
; Friday, November 3, 2006   12:43am
;
; 7.nov.2006 some cleaning 126 -> 106 bytes by ATV

CR=13
LF=10

STDOUT=1

org 100h

Komenco:
        mov bx,0080h
        add bl,[bx]                 ; Get command line length
        mov [bx+1],bh               ; Make filename into ASCIIZ format.
        mov dx,0082h
        cmp bx,dx
        jb Fino
        mov ax,3D00h
        int 21h
        jc Fino
        xchg bx,ax
Ekzamenu:
        mov cx,30
        mov dx,local_header
        mov di,dx
        call read_file
        cmp word [di],'PK'
        jnz Fino
        cmp word [di+2],0201h
        jz Fino
;        cmp word [di+2],0403h
;        jnz Fino
        mov cx,[di+18+8]
        push cx
        add cx,[di+18+10]
        mov dx,buffer
        call read_file
        pop cx
        mov ah,40h
        push bx
        mov bx,STDOUT
        int 21h
        pop bx
        mov ah,2
        mov dl,CR
        int 21h
        mov dl,LF
        int 21h
        mov cx,[di+18+2]
        mov dx,[di+18]
        mov ax,4201h
        int 21h
        jnc Ekzamenu
Fino:
        int 20h

; read_file
read_file:
        mov ah,3Fh
        int 21h
        jc Fino
        cmp ax,cx
        jnz Fino
        ret

local_header:
   id rb 4
   version rw 1
   bitfield rw 1
   compression rw 1
   filetime rw 1
   filedate rw 1
   crc rw 2
   filesize_compressed rw 2
   filesize_uncompressed rw 2
   filename_length rw 1
   extra_field_length rw 1

buffer:

; EOF    
Post 06 Nov 2006, 15:37
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 06 Nov 2006, 21:11
Hey ATV, nice job! Yeah, I know there are a few dumb things in AV19.ASM, but I was too lazy/busy to fix 'em all (in particular, I discovered the mul thing recently in another program of mine).

It's (apparently) TOO easy for me to make such silly mistakes, and I'm always correcting them, heh. Razz

<EDIT>
Oops! Looks like you mistakenly changed int 21h,4Ch into int 20h. That would be fine except int 21h,4Ch also closes open files! Shocked

<EDIT #2>
Actually, the file still seems to be closed (at least in DOSBOX 0.65 and Win XP Home SP2 ... why?? Needs further testing, probably).
</EDIT #2>

</EDIT>
Post 06 Nov 2006, 21:11
View user's profile Send private message Visit poster's website Reply with quote
polygon7



Joined: 14 Aug 2003
Posts: 62
Location: Poznan, Poland
polygon7 06 Nov 2006, 23:07
rugxulo wrote:
<EDIT>
Oops! Looks like you mistakenly changed int 21h,4Ch into int 20h. That would be fine except int 21h,4Ch also closes open files! Shocked

<EDIT #2>
Actually, the file still seems to be closed (at least in DOSBOX 0.65 and Win XP Home SP2 ... why?? Needs further testing, probably).
</EDIT #2>

</EDIT>


If you popped all things from stack, then you could even try to use "ret" instead "int 20". On clean stack "ret" in *.com files jumps to PSP:0h (if i remember correctly) which contains "int 20h" opcode. (Its something similar like in Windows executables)

_________________
best regards
p7
Post 06 Nov 2006, 23:07
View user's profile Send private message Visit poster's website Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV 07 Nov 2006, 11:41
rugxulo, I have been testing 286 (DOS 3.3) and 486 (DOS 6.22) and P166 (Win95) and all will close files with int 20h. I was little suprise that 286 and 486 starts without any problem, even floppy drive was working (only BIOS clock was wrong). Now I need couple hours fresh air, because those computers was covered in a thick layer of dust.
Post 07 Nov 2006, 11:41
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8357
Location: Kraków, Poland
Tomasz Grysztar 07 Nov 2006, 11:58
polygon7 wrote:
If you popped all things from stack, then you could even try to use "ret" instead "int 20". On clean stack "ret" in *.com files jumps to PSP:0h (if i remember correctly) which contains "int 20h" opcode. (Its something similar like in Windows executables)

You may find details on it here.
Post 07 Nov 2006, 11:58
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 08 Nov 2006, 10:32
...and then comes the time when I stop believing that 7-Zip is increadibly small
Post 08 Nov 2006, 10:32
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
polygon7



Joined: 14 Aug 2003
Posts: 62
Location: Poznan, Poland
polygon7 08 Nov 2006, 19:18
Tomasz Grysztar wrote:
polygon7 wrote:
If you popped all things from stack, then you could even try to use "ret" instead "int 20". On clean stack "ret" in *.com files jumps to PSP:0h (if i remember correctly) which contains "int 20h" opcode. (Its something similar like in Windows executables)

You may find details on it here.
Thanks, but I know this before (only one thing which I wasn't sure was PSP:0h) Cool

_________________
best regards
p7
Post 08 Nov 2006, 19:18
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8357
Location: Kraków, Poland
Tomasz Grysztar 08 Nov 2006, 19:23
However you may not be the only one that is reading it. Wink
Post 08 Nov 2006, 19:23
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 09 Nov 2006, 01:14
ATV, you're just ridiculously talented, that's all. I've noticed that about you (and people on this board in general). Thanks for the tips! Very Happy

Madis, I'm not sure I understand you here, but 7-Zip is definitely worthwhile. Even PKWARE uses(?) LZMA as compression method #14 in .ZIP according to their latest APPNOTE.TXT (6.3.1, Apr. 11, 2007).


Last edited by rugxulo on 18 Jul 2007, 23:05; edited 3 times in total
Post 09 Nov 2006, 01:14
View user's profile Send private message Visit poster's website Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV 09 Nov 2006, 10:12
I was looking little more deeper and found next text in chapter.004 from archive dosref33.zip
Quote:
Issue int 20h to exit from a program. This vector transfers to the
logic in DOS to restore the terminate address, the Ctrl-Break address,
and the critical error exit address to the values they had on entry to
the program. All the file buffers are flushed and all handles are
closed. You should close all files changed in length (see function
calls 10h and 3Eh) before issuing this interrupt. If the changed file
is not closed, its length, time, and date are not recorded correctly
in the directory.

Then I tested write file with DOS 3.3/6.22 and file size/date/time was updated. So I don't know which version of DOS can't handle int 20h with dir entry update if file has changed.

I should stop programming, because my near memory is very bad and I have made silly errors too, but it's so difficult give up after over 20 year programming. (VIC 20 was so good 1.1MHz 8bit computer)
Post 09 Nov 2006, 10:12
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 09 Nov 2006, 13:03
by that I meant that there were times when I thought that *other* zippers are bloat and 7-zip is small (as a program, not as a compression method).

Now when I see that you can really unzip around 100 bytes Very Happy wow - 7-zip feels bloat...

To throw another curveball:
...then there's the speed optimization issue.
Post 09 Nov 2006, 13:03
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 09 Nov 2006, 15:01
Madis731 wrote:
by that I meant that there were times when I thought that *other* zippers are bloat and 7-zip is small (as a program, not as a compression method).

Now when I see that you can really unzip around 100 bytes Very Happy wow - 7-zip feels bloat...

To throw another curveball:
...then there's the speed optimization issue.

This is a zipped file viewer, not a unzipper Wink.
Post 09 Nov 2006, 15:01
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 09 Nov 2006, 15:07
:$ oh, okay - its all logical then, NOT Very Happy

But impressive still! Wink I admire these small things...
Post 09 Nov 2006, 15:07
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 09 Nov 2006, 17:24
I agree its still impressive, rugxulo did a good job, so impressed i converted it to run in Dex4u OS (soon to be dexOS)
http://jas2o.forthworks.com/dexforum/index.php?topic=172.0

PS: A unzipper in less than 2k would be very impressive.
Post 09 Nov 2006, 17:24
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 09 Nov 2006, 17:58
I've seen at least two unzippers in < 3k (PKUNZJR, TUNZ), so it definitely can be done. But, neither is open source, and I'm NOT inclined to disassemble 'em (and definitely don't recommend doing so) for fear of breaking some law or whatever. Besides, writing my own would probably be easier and more fun, anyways.

EDIT: I now actually think that TUNZ is based on / hacked from PKUNZJR. Razz

Like I said in PM to Dex, there is lots of Unzip code out there (DJTAR, UZ, UnzipAda, Unzip in Pascal, Info-Zip, ZLIB, OctaOS, etc.), so anybody is welcome to try their hand at it. Smile

P.S. These mini proggies of mine are not that impressive. I've seen better (tet, bd3, inv, selfdasm, wolf, smile256). Wink


Last edited by rugxulo on 18 Jul 2007, 23:08; edited 4 times in total
Post 09 Nov 2006, 17:58
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 09 Nov 2006, 19:10
Quote:

P.S. These mini proggies of mine are not that impressive. I've seen better (tet, bd3, inv, selfdasm, wolf, smile256). Wink


CdPod and MiniDos are my mini efforts Laughing
Post 09 Nov 2006, 19:10
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.