flat assembler
Message board for the users of flat assembler.
Index
> DOS > tiny .ZIP viewers (122 and 254 bytes) Goto page Previous 1, 2 |
Is this useless? | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
Total Votes : 22 |
Author |
|
rugxulo 10 Nov 2006, 17:37
ATV, are your changes (e.g., 106-byte version) public domain? GPL? Just curious. BTW, I'm not necessarily trying to avoid using your optimizations, but I'm just somewhat busy with other things.
I've now written a (buggy) 249-byte .LZH viewer, BUT it doesn't handle dirs plus I need to really handle header #2, LHA/Unix, etc ... in other words, I wrote it based on incorrect/outdated info and should *hopefully* correct it ... eventually (??). (But, it kinda sorta works ... doh). <EDIT #2> BTW, I've noticed that .LZHs (usually?) have smaller headers than .ZIPs, and are thus better for storing smaller files. -lh5- didn't compress the 249-byte .COM at all, but -lh1- (i.e., lha m -o lc02 lc02.com) compressed the .COM by five bytes (and the resulting .LZH was eight bytes smaller, too!). Plus, Gmail won't whine about executables in .LZH files (as it will with .ZIPs or even .ZIPs in .ZIPs). Also, ZOO and LZH are both based upon AR002 and hence often produce identical compressed data. So, just as you could probably convert .GZ <-> .ZIP without decompressing, you could probably do the same w/ .LZH <-> .ZOO. Just FYI. In my original C02.ASM, I incorrectly assumed zero-byte files were always directories (usually true but not always). I've now fixed that. P.S. Even though data descriptor is somewhat rare, it seems Java .JAR files are really .ZIPs, and they seem to (almost) always use the data descriptor bit. Here's an example (jlha.jar) and here's a comp.compression thread about a supposed proper way to read .ZIP files. </EDIT> Last edited by rugxulo on 18 Jul 2007, 23:09; edited 5 times in total |
|||
10 Nov 2006, 17:37 |
|
ATV 13 Nov 2006, 08:03
rugxulo, my code is free to use. So go ahead and copy paste if you find something useful, but there is not any big secrets inside 106 bytes.
|
|||
13 Nov 2006, 08:03 |
|
rugxulo 18 Nov 2006, 05:39
Warning! More useless information:
Okay, I also wrote a version of C02 in C, just for comparison's sake. The source is about 5k (compared to 10k for the .ASM, both liberally commented). Compiled with Turbo C++ 1.01 (smaller than either OpenWatcom 1.5 or DJGPP/GCC 3.4.4 or CC386 3.23) in tiny model and then packed w/ UPX 2.03 (--brute --8086), the .COM is about 6k. That's approximately 25 times the size of the assembly .COM (254 bytes). Now, I know that's not really a fair comparison, but it's probably true that no C compiler actually compiles stuff that small (well, Micro-C/PC 3.23 doesn't support longs so I had to tweak it, and that (compiled in tiny model, then compressed via UPX) results in 2,582 bytes, still 10x the assembly version's .COM size ... but Micro C/PC uses an assembler for basically everything, and even the libraries were written in ASM, I think). Obviously, though, the C version could be compiled natively for Windows without changes (unlike the .ASM version ... unless I port it to FASMLIB? ), but I can't think of any major reasons why you'd want to. P.S. For fun, I also messed around trying to obfuscate/shorten the C source and see how small it would get while still compiling. (No, I don't intend to enter IOCCC, it ain't nearly quite good enough ... but FYI, max. entry size for them is 1.5k, aka 1536 bytes). I trimmed the (non-MicroC) .C src itself down to about 744 bytes. EDIT: Check my post #3 for a .ZIP attachment with everything in it. Last edited by rugxulo on 02 Aug 2007, 23:21; edited 5 times in total |
|||
18 Nov 2006, 05:39 |
|
rugxulo 16 Dec 2006, 03:52
Privalov has one-upped me with his Java/ASM .ZIP-listing example (only 3k)! Kudos!
|
|||
16 Dec 2006, 03:52 |
|
rugxulo 23 Dec 2006, 14:39
P.S. Get Octasm for DOS or OctaOS.
Code: # # C-ZIP.SED : converts C.ASM, C-ATV.ASM, C02.ASM to Octasm 0.15 # # rugxulo AT bellsouth DOT net # Friday, December 22, 2006 5:50pm # # ---------------------------------------------------------------------- # Archive: c-zip.zip # Length Method Size Ratio Date Time CRC-32 Name # -------- ------ ------- ----- ---- ---- ------ ---- # 1984 Defl:X 768 61% 11-06-06 11:41 ab452ae8 c.asm # 10108 Defl:X 3336 67% 11-15-06 18:58 95c4126a c02.asm # 1724 Defl:X 677 61% 11-10-06 11:31 0784a251 c-atv.asm # -------- ------- --- ------- # 13816 4781 65% 3 files # ---------------------------------------------------------------------- # # Use the following .BAT to run sed and assemble everything: # # N.B. I assume HHsed (which is small and fast), so you need to # `set sed=sedmod' (or `gsed' or whatever) first, if you don't # have it. # # ====================================================================== # @echo off # REM Tested on DR-DOS 7.03 Lite # REM rugxulo AT bellsouth DOT net # REM Friday, December 22, 2006 5:34pm # # if "%SED%"=="" set sed=hhsed # # if "%1"=="/asm" goto asmit # if "%1"=="/clean" goto clean # if "%1"=="/cleanall" goto clean # if "%1"=="clean" goto clean # if "%1"=="cleanall" goto clean # # for %%a in (c c-atv c02) do call %0 /asm %%a # goto end # # :asmit # shift # if exist %1.asm ren %1.asm %1.as # if not exist %1.as goto end # %SED% -f c-zip.sed %1.as > %1.asm # octasm \%1.asm file_out \%1.com # if exist %1.asm del %1.asm # if exist %1.as ren %1.as %1.asm # goto end # # :clean # for %%a in (c c-atv c02) do if exist %%a.com del %%a.com # # :end # if "%SED%"=="hhsed" set sed= # ====================================================================== # # .BAT ends, sed script begins here: 1s/.*/LANG OCTASM,0.1\ &/ s/FASM/Octasm/g /short equ byte/d s/org 100h/& use16/ s/;;;*/;/g s/\([bw]\)[yo][tr][ed] \[/\1 [/ /^ *local_header_size *=/d /^ *dir_msg_size *=.*/s//#dir_msg_end/ s/dir_msg_size/dir_msg_end-dir_msg/ s/local_header_size/buffer-local_header/g s/^ *\(j[a-z][a-z]*\) short/\1/ s/^ *\([a-zA-Z0-9_][a-zA-Z0-9_]* [dr][bwd] \)/#\1/ s/^ *\([a-zA-Z0-9_][a-zA-Z0-9_]*\):/#\1/ s/ rw \([0-9][0-9]*\)/ rb \1+\1/ s/^ *#local_header/virtual\ &/ s/^ *#buffer/&\ code/ # EOF Last edited by rugxulo on 18 Jul 2007, 23:11; edited 2 times in total |
|||
23 Dec 2006, 14:39 |
|
nvictor 19 Feb 2007, 05:25
Guys, my dream is to write small version of softwares I usually use in order to be able to bring them on flashusb drives. Here is a small list :
1- multiple source code editor [php,xhtml,css,c,c++,asm,...]. I've seen someone reducing vim's size into a single exe using 7-zip .The genious part is that it automatically create vim's "~" and runtimes folders when launched, but these informations are volatile... 2- a graphic editor ala photoshop why not? there is anima8or (<1MB) out there doing great 3D. 3- 3D game similar to kkrieger http://en.wikipedia.org/wiki/.kkrieger , just admire... 4- animation studio, why not? 5- web browser, why not? Sell some games, why not? |
|||
19 Feb 2007, 05:25 |
|
yumka 19 Feb 2007, 18:09
rugxulo wrote: 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! Have you tried SBC? It's fast and extremelly good compresion ratio. But it's almost unknown for most people. That kind of archiver would be nice to have in a fasm library. http://sbcarchiver.netfirms.com/ _________________ rofl eax,eax |
|||
19 Feb 2007, 18:09 |
|
rugxulo 20 Feb 2007, 23:02
nvictor wrote: Guys, my dream is to write small version of softwares I usually use in order to be able to bring them on flashusb drives. Here is a small list : Try e3: it may not do everything, but it is pretty small, OS portable, and written in NASM. (I'm mainly referring to the Win9x version, which can also run under DOS w/ HXRT) nvictor wrote:
See Clayworks (Pascal w/ inline ASM). nvictor wrote:
Check out wolf (256 bytes, no src) and 3dmaze (C w/ inline ASM). It can indeed be done. nvictor wrote:
See link above to Clayworks. nvictor wrote:
This might be sorta difficult, but maybe QEmacs (C src) or FreeDOS's HTMLhelp (C w/ bit o' ASM) will show the way. QEmacs wrote:
nvictor wrote:
Good luck! |
|||
20 Feb 2007, 23:02 |
|
rugxulo 20 Feb 2007, 23:25
yumka wrote:
It's good, but I think UHarc (or WinUHA) is somewhat better (also closed source, though). If you prefer FOSS, the PAQ8? series (C++ w/ optional MMX or SSE2 .ASM speedup) is also good (if kinda slow). Also see P7ZIP (which now officially supports DOS but needs WATT32), ATV's TASM conversion of lzari/lzhuf/lzss .COMs + .ASM/.C src, and a few FASM/Win32 compression links (or just ASM compression links in general). Last edited by rugxulo on 18 Jul 2007, 23:14; edited 1 time in total |
|||
20 Feb 2007, 23:25 |
|
Hayden 15 Apr 2007, 18:56
I noticed the descussion here about INT 20H vs INT 21H to close a file.
AH=4CH JMP/RET to PSP:0 is the same as INT 21H AH=4CH Microsoft recommends not useing INT 20H for DOS 2+ _________________ New User.. Hayden McKay. |
|||
15 Apr 2007, 18:56 |
|
OzzY 12 Feb 2008, 00:54
This is very interesting.
I'd like to know where do you get information about ZIP format. Also, do you have any nice tutorial regarding compression? I've always been fascinated about file compression. This is a beautiful science! Also, which packer do you consider the best? I've been using 7zip, but you said WinUHA and lZArc. What they offer? |
|||
12 Feb 2008, 00:54 |
|
bitRAKE 12 Feb 2008, 02:21
http://www.arturocampos.com/ - easy to read beginning.
|
|||
12 Feb 2008, 02:21 |
|
rugxulo 13 Feb 2008, 06:25
Quote:
7-Zip is probably the best overall (so many archives supported, many useful options), but UHarc is darn good re: size/speed ratio (although closed src). Also, I like PAQ and LPAQ etc. because they are quite good (especially the latter; the former is extremely slow). And there are various other fringe archivers good for some eccentric cases. IZarc (also closed src) is really just a Win32 GUI interface with .DLLs for various archive and compression types. It's like 7-Zip's file manager but supports other formats too. There's also PeaZip (FOSS) and Precomp (FOSS soon??), which you may find interesting. |
|||
13 Feb 2008, 06:25 |
|
Raedwulf 16 Feb 2008, 08:01
Have a look at FreeArc compression.
http://freearc.sourceforge.net/index.htm It appears to have a selection of compression algorithms and applies them according to file type. _________________ Raedwulf |
|||
16 Feb 2008, 08:01 |
|
DOS386 18 Feb 2008, 04:23
> Also, which packer do you consider the best?
ZIP (PKZIP 2.x compatible), 7-ZIP, TAR > I've been using 7zip, but you said WinUHA and lZArc. What they offer? Nothing, except bloat, bugs and not working in DOS. BTW, WingUHA is not a packer, just an empty GUI ... but UH-ARC is an interesting packer. Has a DOS version (crippled because of PMODE/W's 64 MiB limit), and a Win32 one (use HX in DOS ). > Have a look at FreeArc compression. Doesn't work in DOS. Quote:
1. Terminate application, not close a file 2. Just use always INT $21/AH=$4C and don't cause confusion (works with COM, MZ-RM-EXE and DPMI). > I'd like to know where do you get information about ZIP format. Download now : http://board.flatassembler.net/download.php?id=3619 Just to see how PKWARE turned the most compatible archive file format into the most messy and incompatible one |
|||
18 Feb 2008, 04:23 |
|
roytam1 05 Mar 2015, 07:54
rugxulo wrote: Bugfixed! OT: I forked your C02-mc.c to make it extract stored(uncompressed) contents and creates directories. http://roy.orz.hm/gpc/files1.rt/exstrzip.zip I think it may be easy to turn it into assembly within 512 bytes. |
|||
05 Mar 2015, 07:54 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.