Compression and decompression tools for NES, SNES, and Game Boy games by HAL Laboratory
HAL Laboratory NES/SNES/GB (de)compression tools
(version 1.21)
by Devin Acker (Revenant), 2013-2015
https://github.com/devinacker
exhal and inhal are tools designed to decompress and recompress/insert data used by several NES, SNES and Game Boy games developed by HAL Laboratory.
Due to the design of the original decompression algorithm (and hardware limitations), the size of a file to be compressed is limited to 64 kilobytes (65,536 bytes). Please note that depending on which system you are working with, the actual useful limit may be much smaller.
The compression routine used by inhal is very fast and capable of producing output which is smaller than that of HAL's original compressor.
Source code is available at https://github.com/devinacker and is released under the terms of the MIT license. See COPYING.txt for legal info. You are welcome to use compress.c in your own projects (if you do, I'd like to hear about it!)
To use exhal (the decompressor):
exhal romfile offset outfile
To insert compressed data into a ROM:
inhal [-fast] infile romfile offset
To write compressed data to a new file:
inhal [-fast] -n infile outfile
Offsets can be specified in either hexadecimal (recommended) or decimal.
Using the -fast switch results in compression which is about 3 to 4 times faster, but with slightly larger output data. Use this if you don't care about data sizes being 100% identical to the original compressed data.
This is a list of games which are known to use the supported compression method, or are assumed to, based on a binary search of the games' ROMs:
Also note, unfortunately, that exhal cannot automatically detect or locate compressed data. The included file "gamenotes.txt" contains an incomplete list of decompression routine addresses to make searching easier.
These tools were originally used in the development of my Kirby's Dream Course editor. I hope you find your own exciting use for them. (I'm not the only Kirby hacker in the West, right? sob)