FilePack

Description

FilePack is simply a tool that can compress any kind of data. It typically perform a 50% compression ratio on code and graphics.

Utilisation

FilePack can compress files, but also restore files that have been compressed.

To compress a file:

	%OSDK%\bin\FilePack -p source_file compressed_file 

To decompress a file:

	%OSDK%\bin\FilePack -u compressed_file destination file 
Packed file format

The format of packed files is actually very simple, and is mostly based on a 8 bytes header followed by compressed data.

	+0	'L'
	+1	'Z'
	+2	'7'
	+3	'7'
	+4	Unpacked size (low byte)
	+5	Unpacked size (high byte)
	+6	Packed size (low byte) 
	+7	Packed size (high byte)
	+8	Compressed data starts here

Please note that this header is present only when packed in default mode (-p1), if you pack in -p0 mode the header is not present. In place of the header you will find a text file having the same name that your "program.s", looking like this:

	#define run_adress $600 	; Come from original TAP executable
	#define unpacked_size $1000	; Come from original TAP executable
Depacking

For depacking a file, you can simply use the corresponding library routine:

	void file_unpack(void *ptr_dst,void *ptr_src);

Please note that this routine expect the data to get a header, so it will not work for files packed in -p0 mode. To unpack these files you need to use another routine.



Known issues


No known problem - please signal any issue on the Cross development tools forum.

comments powered by Disqus
History
Version 0.4
  • Added p0/p1 mode to pack a file without appending the header.
    Very usefull when you want to spare a maximum of bytes in a size compo.
Version 0.1-0.3
  • First released versions.