LZSS UNcompression for GBA v1.2
===============================

The GBA bios functions can't uncompress LZSS compressed data if they are in
SRAM. So here are too small functions which allow you to do that, uncompress
from SRAM to WRAM or VRAM. 'LZ77UnCompWRAM' is the sister of the bios fct 0x11, 
and 'LZ77UnCompVRAM' is the sister of the bios fct 0x12. You can uncompress 
from IWRAM, EWRAM & ROM too, of course.


From GCC, declare these functions :
   
 If your own code is anywhere else than in IWRAM :
  
  extern __attribute__((long_call)) void LZ77UnCompWRAM(char *src, char *dst);
  extern __attribute__((long_call)) void LZ77UnCompVRAM(char *src, short *dst);

 If your own code is in IWRAM :
  
  extern void LZ77UnCompWRAM(char *src, char *dst);
  extern void LZ77UnCompVRAM(char *src, short *dst);

Assembling :
 
 With an ARM GAS :
    
  as -mthumb-interwork -mcpu=arm7tdmi lzss_d.S -o lzss_d.o
     
 For any other assembler, the source code shouldn't be too hard to convert.


They aren't really optimized (no need) and I didn't overly test them, so if you
find errors, don't hesitate to contact me.

LZ77UnCompVRAM will do what LZ77UnCompWRAM do (apart from uncompressing 
to SRAM), just a little slower, so you can just assemble LZ77UnCompVRAM,
if code size is a concern. Just uncomment this line : 
@.EQU JUST_VRAM_PLEASE, 1   ->   .EQU JUST_VRAM_PLEASE, 1

And if code size is really a concern, uncomment this line :
@.EQU MINIMAL_CODE, 1   ->   .EQU MINIMAL_CODE, 1
You won't be able to uncompress to SRAM though.


Mail me if you need a thumb version. I know IWRAM is precious. ;)

You can find the corresponding compressor for GBA, which will allow you to 
compress directly in SRAM too, at this address :

http://www.geocities.com/dkl_74/

Happy coding,
DKL (dkl_74@yahoo.fr)

All content is copyright of the respective authors and copyright holders.
