RunLengthEncodeDecode - emutyworks/Learning-GB-Programming GitHub Wiki

Run-length encode binary data with php and decode it with assembly code.

Reference

Change log

- Fixed a bug where data could not be decoded correctly.(main.asm)
- Fixed a bug where data could not be encoded correctly.(RunLengthEncoder.php)

Run-length encoding

https://github.com/emutyworks/Learning-GB-Programming/tree/main/RunLengthEncodeDecode/RunLengthEncoder.php

Usage:
php RunLengthEncoder.php <input filename(bin)> <output filename(compression)>

Example:
php RunLengthEncoder.php bg_tile0_1024.bin bg_tile0_compress.bin
Compression example: Car Game Compression data size
Tile Maps data 1024 bytes -> 260 bytes (26%)
Attributes data 1024 bytes -> 154 bytes (15%)
Sprites data 2048 bytes -> 634 bytes(31%)
Tiles data 2048 bytes -> 1377 bytes(67%)

Run-length decoding

https://github.com/emutyworks/Learning-GB-Programming/tree/main/RunLengthEncodeDecode/main.asm#L89C10-L89C10