LZSS (LZ77) Decompression for SNES.
More...
Go to the source code of this file.
LZSS (LZ77) Decompression for SNES.
Provides LZ77 decompression directly to VRAM. Used for compressed tile/tilemap data generated by gfx4snes or external LZ77 tools.
LZ77 Format
- Tag byte: 0x10
- 3-byte little-endian uncompressed data length
- Flag bytes: 8 bits each (1=reference, 0=literal)
- References: 12-bit distance, 4-bit length (min 3 bytes)
Usage
extern u8 compressed_tiles[], compressed_tiles_end[];
#define REG_INIDISP
Display control (W)
Definition registers.h:49
unsigned char u8
8-bit unsigned integer (0 to 255)
Definition types.h:46
void LzssDecodeVram(u8 *source, u16 address)
Decompress LZ77 data directly to VRAM.
- Warning
- VRAM writes must happen during VBlank or force blank. LzssDecodeVram disables interrupts internally, so call it during force blank for safety.
- Author
- OpenSNES Team (ported from PVSnesLib by Alekmaul)
- Copyright
- zlib License
◆ LzssDecodeVram()
| void LzssDecodeVram |
( |
u8 * |
source, |
|
|
u16 |
address |
|
) |
| |
Decompress LZ77 data directly to VRAM.
Reads LZ77-compressed data from ROM/RAM and writes decompressed output directly to VRAM via PPU registers. Disables interrupts during decompression to prevent NMI handler from interfering.
- Parameters
-
| source | Pointer to LZ77-compressed data (tag byte 0x10) |
| address | VRAM word address to write decompressed data |
- Note
- The source data must start with the LZ77 tag byte (0x10). If the tag doesn't match, the function returns immediately.
-
Interrupts are disabled during decompression and restored after.