Dwedit's Board

Enjoy the board

You are not logged in.

Announcement

User passwords may have been corrupted, if you can't log in, use the "Forgot Password" feature. If you still can't log in, contact me and I can try to manually reset your password.

#1 2006-12-29 4:55:17 pm

Dwedit
Administrator
From: Chicago
Registered: 2004-12-12
Posts: 1,017
Website

M3 Self Extractor

Here's the m3 self extractor stub and (slow) compression tool.
Right now the compression tool is very slow, and not yet optimal.  Because the compression is simple, it doesn't compress the file by that much.  However, the algorithm was designed for maximizing decompression speed, it's only slightly slower than memcpy.

If you want to try out these programs, just use lztest to create a compressed file (it takes a long time, sorry), then append the generated file to the end of the m3decompress.gba stub file.  When run on a GBA, the screen first turns red to indicate that it is doing a memcpy to transfer the file to the end of RAM, then turns blue to indicate that it is decompressing the file.  I've tested it on an M3 microSD, and it works.  It's supposed to support the M3, G6, and Supercard, but since the supercard already does decompression (if you enable that option :), it's kinda pointless for that card.

File format of compression:
All values are signed words.
Look at word:
  If positive: Copy the next N words to the destination
  If negative: Go back N words in the destination, then read the next word in the source to see how many words to transfer from earlier in the file.  This only takes up 2 words in the compressed file, and is the LZ-like part of the decompression.
  If zero: Finished

Or in other words:

u32 A,B;

do
{
	A = *src;
	src++;
	if (A>0)
	{
		memcpy(dest,src,A*sizeof(u32));
		dest+=A;
		src+=A;
	}
	if (A<0)
	{
		u32* back = dest+A;
		B = *src;
		src++;
		memcpy(dest,back,B*sizeof(u32));  //this will overlap
		dest+=B;
	}
	if (A==0)
	{
		break;
	}
} while(1);

Attachments:
Attachment Icon lztest.exe, Size: 176,128 bytes, Downloads: 254
Attachment Icon m3decompress.gba, Size: 940 bytes, Downloads: 248

"We are merely sprites that dance at the beck and call of our button pressing overlord."

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman