I thought Cartridge BASIC added a file to DOS's 'vocabulary' - a sort of non-traditional ROM BIOS extension that supplied a file name and entry point rather than being directly executed.
-Alan
Trixter wrote:As for "optimal way", that's called "optimal parsing", which is a way to guarantee the most efficient matches (offset+length) of the source material, at the cost of speed. Storer and Szymanski described it in their 1984 paper that described LZSS, if you want to look it up out of curiosity; their solution was to parse the data BACKWARDS which initially seems wacko but makes sense if you think about it. LZ4, ZX7, MegaLZ, and exomizer all have an optimal parsing option. Don't know if RNC Pro Pack does, but it still performs competitively.
147,456 JRCARTS7.IMG - original
130,281 JRCARTS8.IMG - my 00-00-00 compression
103,307 JRCARTS7.PP2 - RNC Pro Pack (method 2)
101,009 JRCARTS7.ZX7
100,180 JRCARTS7.IMG.hrm - Russian Hrum
99,974 JRCARTS7.IMG.mlz - Russian MegaLZ
98,006 JRCARTS7.LZH - created by LHA v2.13
80,016 JRCARTS7.IMG.bz2
79,098 JRCARTS7.LZ4
72,959 JRCARTS7.PP1 - RNC Pro Pack (method 1)
71,950 JRCARTS7.zip - modern ZIP from Debian
71,925 JRCARTS7.ARJ - created by ARJ v2.41a
71,865 JRCARTS7.AIN - another Russian archiver from 90s
71,855 JRCARTS7.ZIP - old PKZIP v2.06
71,808 JRCARTS7.IMG.gz
70,041 JRCARTS7.HA - HA 0.98 (Harri Hirvola)
67,437 JRCARTS7.IMG.hst - Russian Hrust
66,970 JRCARTS7.RAR - old RAR v1
65,765 JRCARTS7.RAR - modern RAR v5
62,543 JRCARTS7.7z - modern 7-zip
62,508 JRCARTS7.IMG.xz - modern LZMA2
Brutman wrote:I've been working on a nice little LZW compressor/decompressor that would be interesting to try out on your image. It's never going to get as good as ZIP (because I don't want to invest the time), but it also works much faster too.
(I'm going to use it mostly for text compression. It's basically equivalent to the old Unix compress program.)
147,456 JRCARTS7.IMG - original
130,281 JRCARTS8.IMG - my 00-00-00 compression
112,715 JRCARTS7.IMGFF - my byte-oriented LZ77-like compression (SHAFF0) <<<<<
103,307 JRCARTS7.PP2 - RNC Pro Pack (method 2)
101,009 JRCARTS7.ZX7
100,180 JRCARTS7.IMG.hrm - Russian Hrum
99,974 JRCARTS7.IMG.mlz - Russian MegaLZ
.....
XX - any byte other than #FF is a single data byte
#FF #00 - single byte #FF
#FF 0xxxxxxx LENGTH (distance -1...-127)
#FF 10xxxxxx LENGTH (distance -128...-190 and -191 means last distance longer or equal to -191)
#FF 11xxxxxx xxxxxxxx LENGTH (directly encoded distance from -191 to -16383)
special case without LENGTH:
#FF #C0 #00 - end of block (instead of distance -16384)
i = 0;
while(i<=cursize)
{
character = fgetc(f);
if(character==0xFF)
{
character = fgetc(f);
if(character==0) /* Literal 0xFF */
buf[i++] = 0xFF;
else /* Reference */
{
/* Decode offset */
if((character&0xC0)==0xC0)
{
offset = (((short)character)<<8)|((short)fgetc(f));
lastoffset = offset;
if(offset==-16384)
{
/* Marker of the block end */
if(i!=cursize)
{
printf("ERROR: Something wrong with size (%i)...\n",i);
}
break;
}
}
else if(character==191)
offset = lastoffset;
else
offset = -character;
/* Decode length */
character = fgetc(f);
if((character&0xC0)==0)
length = (character<<8)|fgetc(f);
else if((character&0xC0)==64)
length = character + 68; /* 132-64 */
else
length = character - 124; /* 4-128 */
j = i + offset;
if(j < 0)
{
printf("ERROR: Something wrong with offset (%i)...\n",offset);
}
else
{
do
{
if(j>=cursize)
{
printf("ERROR: Something wrong with size (%i)....\n",j);
}
else buf[i++] = buf[j++];
} while(--length);
}
}
}
else /* Literal */
buf[i++] = character;
}
12 0866:0100 AC LODSB
04 0866:0101 3CFF CMP AL,FF
16/04 0866:0103 742B JZ 0130
11 0866:0105 AA STOSB
18 0866:0106 E2F8 LOOP 0100
LENGTH is 1 or 2 bytes:
1xxxxxxx - for 4...131
01xxxxxx - for 132..195
00xxxxxx xxxxxxxx - for up to 16383
cmp al,10000000b
je handle_1
...
handle_1:
and al,01111111b
add al,4
shr al,1
jc handle_1
...
handle_1:
add al,4
Users browsing this forum: No registered users and 2 guests