ecm 2026-07: Use LZSA1 or LZSA2 compression for crab-type flags - #9
ecm 2026-07: Use LZSA1 or LZSA2 compression for crab-type flags#9ecm-pushbx wants to merge 21 commits into
Conversation
|
Latest change to planize.py allows specifying the format out of I also added a benchmark program, which assembles with an The benchmark files are all built in https://pushbx.org/ecm/test/20260729/vgadepak/ and cmd.log contains the exact commands that I used to generate them. The results, only from the non-KVM dosemu2 on our server yet: The last result is from assembling the test with the |
|
Added raw variants of LZSA1 and LZSA2 to the planize.py script. And the corresponding define to the depackers. This is not noticeably faster than plain LZSA1, but the code required shrinks quite some. |
|
I added a benchmarking mode that actually repeatedly displays a flag from the main VGAPride executable, then determines how many ms (with two decimal places) a single display run took. I'm not sure whether this is a valid check but it does seem to work. Files in https://pushbx.org/ecm/test/20260731/ - note how lzsa1r is nearly as fast, if not faster, than the old lz4_8088 depacker. Running the image https://pushbx.org/ecm/test/20260731/diskette.img as a remote disk in https://www.pcjs.org/machines/pcx86/compaq/deskpro386/vga/ results, for I also added two string constants to all six depacker variants, which identify the depacker (_depackername) with a short name and specify the depacker attribution line for the help screen (_depackerattribution). |
|
By the way, at some point the bench.asm benchmark resulted in 0.30ms for lzsa1r normally but 0.20ms when the debugger was loaded. That's what the |
|
Added Jim Leonard's lzsa1 jump-table based depacker to my vgadepak repo: https://hg.pushbx.org/ecm/vgadepak/file/3d9f2c185f3e/lzsa1jmp.asm This is compatible to the raw LZSA1 format (hence The usage conditions for this are the zlib license, curing my original problem with the lz4_8088 depacker. bench.asm result: Running files from https://pushbx.org/ecm/test/20260801/ on https://www.pcjs.org/machines/pcx86/compaq/deskpro386/vga/ time for |
As previously discussed in #4 I want to replace the lz4_8088 depacker, mainly due to the incompatible usage conditions.
This PR switches to use the LZSA2 or LZSA1 formats. The depackers are provided in https://hg.pushbx.org/ecm/vgadepak/file/356876ae6503
The usage conditions of these are inherited by the original 8086 LZSA depacker, reading as a zlib license as follows:
To assemble the depackers, use either of the following commands:
Changes in the VGAPride repo include:
-f 1or-f 2, and emits .sa files. It also uses the-Nswitch currently, which requires a patch I submitted to ecm eod marker, capital -M and capital -N switches, and -S switch (more compatible block limit) emmanuel-marty/lzsa#74I prepared a diskette image in https://pushbx.org/ecm/test/20260728/ with VGAPRIDE.EXE from https://github.com/foone/VGAPride/releases/tag/v0.6 and vgalzsa1.exe and vgalzsa2.exe which I tested as a remote diskette in https://www.pcjs.org/machines/pcx86/compaq/deskpro386/vga/ The LZSA2 build runs noticeably slower than the lz4_8088 one, LZSA1 is much closer in speed.
Here's the file sizes:
255 kB for lz4_8088, 245 kB for LZSA1, and 239 kB for LZSA2.
Using raw LZSA blocks would allow to save a bit of data and some code, and we wouldn't have to depend on the -N switch. On the other hand, non-raw LZSA streams allow dispatching for the variant (LZSA2 vs LZSA1) so a single depacker function could handle both formats.
I am also interested in benchmarking the depackers on several different systems, for which I may re-use some of the code I added to inicomp. Further, display.cpp and the VGA commands format could be extended to pass along the buffer sizes to the depacker, which would allow a useful
_UNSAFE=0build which actually checks for buffer overflows. Finally, the display.cpp caller currently does not check the depacker's return value.