Compression Algorithm - Nintendo GAME BOY Programming Manual

Hide thumbs Also See for GAME BOY:
Table of Contents

Advertisement

Game Boy Programming Manual

9. COMPRESSION ALGORITHM

Compressed data essentially consist of control codes specifying the data type and length and the actual
data.
Control code 1 + raw data
Control code 2 + loop data
Control Code
...
7Fh
RAW Data
Control code 1 + Raw data
7Fh: Next 80h bytes are raw data
0h-7Eh (N): Next < N + 1 data items (01h-7Fh) are raw data
Control code 2 + Loop data
FFh: Repeat the next < 1 byte of data for 81h bytes
80h-FEh: Repeat the next < 1 byte of data for 2 (80) – 80h (FE) items
Example:
09h
A0h
A1h
10h bytes of raw data
Control Code
Control Code
...
7Eh
FFh
RAW Data
Loop Data
...
A2h
A3h
7Fh
AAh
80h bytes of raw data
Control Code
Control Code
...
...
80h
FEh
Loop Data
Loop Data
...
80h
81h
82h
FFh
250
...
...
FFh
55h
80h
AAh
81h items of 55h, 02h items of
AAh

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents