flat assembler
Message board for the users of flat assembler.
Index
> Main > FASMLIB (FASM Standard Library Project) Goto page Previous 1, 2, 3, 4, 5 Next |
Author |
|
decard 23 Nov 2005, 10:00
Code was written by me, but it is based on C snippet from here: http://programmersheaven.com/zone5/cat858/2260.htm (Although it is in Assembler section, it is all written in C). Allegro routines are based on this one too. However with bitstreams my code can achieve better compression ratio (because dictionary isn't limited to 2^12 bytes, if you know what I mean ).
|
|||
23 Nov 2005, 10:00 |
|
vid 23 Nov 2005, 10:57
so bitstreams are required for your lzss library to run? What dictionary size do you use?
|
|||
23 Nov 2005, 10:57 |
|
decard 23 Nov 2005, 11:12
Yes, they are.
Dictionary size can be adjusted in lzss.inc file: Code: LZSS_COUNT_BITS = 4 LZSS_OFFSET_BITS = 12 This are settings in version that I posted. Dictionary size is 2^LZSS_OFFSET_BITS, so it will be 4096 bytes in this case. One "entry" fits in 2 bytes (16 bits). Different files need different settings to achieve better compression ratio, but generally you can rise LZSS_OFFSET_BITS to 13 to get optimal settings (and maybe LZSS_COUNT_BITS to 5). Of course files cannot be packed and unpacked with different settings - that's most important drawback of my library. |
|||
23 Nov 2005, 11:12 |
|
vid 23 Nov 2005, 14:07
i believe it could take a rewrite, i believe these can act as variables.
Are ratios at different sizes so significant? Wouldn't it be better to use always 12/4 and thus get rid of need for bitstream? because i don't like tying modules too much, i want them to be a lot independent, so we won't end with 30kb Hello World. |
|||
23 Nov 2005, 14:07 |
|
decard 23 Nov 2005, 14:27
It again depends on file type
And to get rid of bitstreams you would have to do more changes - each "entry" is prefixed by one bit flag telling if it is a "direct (unpacked) byte" or dictionary entry. And sizes lower than 12/4 will give horrible ratio. So why don't you treat bitstreams as a part of LZSS library? If user wants to use compression, then he proably won't main this few bytes of code. Your "hello world" app won't grow at all, because it doesn't need compression routines . |
|||
23 Nov 2005, 14:27 |
|
Matrix 23 Nov 2005, 14:48
cool idea,
nice set of procedures / functions in standard library, i whould have a little question, whould it be hard to implement fasm to get used functions from libraries, include it into compiled executable, so unused functions not get included? as a feature added like : switch: skip_unused_procs_from_include_files this could speed up program writing a bit, so asm ers does not have to find, cut paste functions, only look at the TOC (table of contents) parameters, results |
|||
23 Nov 2005, 14:48 |
|
vid 23 Nov 2005, 14:51
i was thinking about using 8 flags packed in one byte and then 8 entries.
That thing with bitstreams could work, it's really extremely easy to implement bitstream. about hello world - i was thinking about something like - make string -> allocate memory for it -> pass to complex printf-like thing -> pass to write stream -> pass to write console -> pass to OS. (little pesimistic, i know ) |
|||
23 Nov 2005, 14:51 |
|
decard 23 Nov 2005, 15:16
vid wrote: i was thinking about using 8 flags packed in one byte and then 8 entries. that is exactly how it works in oryginal code But, why not to have something better than that? |
|||
23 Nov 2005, 15:16 |
|
Madis731 23 Nov 2005, 16:27
Noooooo way - I don't want to hear about 30KB "Hello World!". This means you put everything in just in case. Don't do that. We have MATCH and macros and we can make conditional inclusion - we don't need to have all that bloat. FASM is so fast that you barely notice the filtering that its going through under the core.
|
|||
23 Nov 2005, 16:27 |
|
vid 23 Nov 2005, 18:15
decard: i know, i've read it already. okay, i seems really easy to implement so it's okay. but i'll have to play with that... later
madis: don't worry, i'm here to prevent that!!! :] |
|||
23 Nov 2005, 18:15 |
|
vid 23 Nov 2005, 22:52
[EDIT] Out of date, see next post[/EDIT]
One problem: Some non-strlib routines will take strings (null-terminated) as arguments. But this will require some kind of calling str.ptr before to use strings from strlib as arguments. I see 3 solutions: 1. User must always call str.ptr 2. String library will be "automaticaly" included. Problem here is this tends to 30kb Hello world problem, and user also has to initialize it. Every proc taking strings will automatically call str.ptr on that argument. 3. This solution is improved solution #2, but is little unnatural: strlib is always included, but doesn't have to be initialized. str.ptr will check if strlib is initialized, if it isn't it will just return argument in eax, if it is it will act normally. You still have to always-include strlib, but you don't need to initialize it (and thus most of procs from there won't be really included then). So what do we want: smarter but little overbloating library easier to use, or hardcore plain simple harder to use one? I vote for solution #3. Overbloat in this case isn't notable, effect is very big. Consistency of strlib is little damaged, but i would make this one an exception... effect is really great. |
|||
23 Nov 2005, 22:52 |
|
vid 23 Nov 2005, 23:16
grrrrrrr, that won't work. I think strlib has to be "always" initialized. I was planning that things like input procedures will use it by default, so you don't have to pass buffer and it's size thus limiting input size.
Anyway I use same approach for strlib using mem module. So "str.ptr" will stay as i described it in previous post for extreme cases when user doesn't want strlib (and thus everything what uses it, like input, conversion to string etc,etc). Procs which wants will use it and throw error if it isn't initialized. decard: i saw that many routines ignored zero arguments as string handles, instead of treating them as error. Does someone use this behavior. IMHO it was bad, because some procs which should return string handle returned 0 on error, and so you can't say "string handle 0 means ignore". PS: I have about half of strlib done (not of whole fresh's strlib, i removed few things like conversions or URL encoding...). I've uploaded newest version, with some changes in guide.txt as well. |
|||
23 Nov 2005, 23:16 |
|
decard 24 Nov 2005, 07:44
You're right. I've been doing some fixes about that in latest release.
|
|||
24 Nov 2005, 07:44 |
|
Reverend 24 Nov 2005, 20:29
I once wrote LZW algorithm but in MASM. Unforutnately I knew nothing about optmization then, so it compresses really slow, but worked good
|
|||
24 Nov 2005, 20:29 |
|
decard 24 Nov 2005, 20:36
I wrote my program myself, just optimization is based on C source that I provieded link to.
|
|||
24 Nov 2005, 20:36 |
|
vid 29 Nov 2005, 17:45
decard wrote: Do you want every function to report error in CF? Sorry, i missed this post. Yes, every single procedure will return errors in CF. I find it much easier to use, for us assembly programmers, than any other option. |
|||
29 Nov 2005, 17:45 |
|
decard 29 Nov 2005, 18:06
OK so let's see how it will work.
|
|||
29 Nov 2005, 18:06 |
|
vid 29 Nov 2005, 18:28
btw, things like str.pos returns with this:
Code: ;==============================================================================================; ; str.pos ; desc: find position of string inside another string ; args: string - handle or pointer to string ; pattern - handle or pointer to pattern to search for in string ; ret: CF set on error, otherwise ; ZF set if pattern doesn't occur inside string, otherwise ; eax = offset of first occurence of pattern inside string ;==============================================================================================; think how will this be solved in HLL stdcall. Only "standard" way i can think of is something like: Code: invoke StrCmp, [str1], [str2] push eax invoke GetLastError cmp eax,0 jnz .error pop eax cmp eax,-1 je .notfound .found: compared to ours: Code: stdcall str.cmp,[str1],[str2] jc .error jz .notfound found: |
|||
29 Nov 2005, 18:28 |
|
vid 29 Nov 2005, 19:35
new version there, fixed global data definiton bug, some more of strlib rewriten, some more fixes.
|
|||
29 Nov 2005, 19:35 |
|
Goto page Previous 1, 2, 3, 4, 5 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.