[comp.sys.handhelds] GROB Compression Programs

erikmb@etek.chalmers.se (Erik Bryntse) (04/11/91)

GROB COMPRESSION / UNCOMPRESSION PROGRAMS
=========================================

Here is two small programs that compresses and uncompresses GROBs. The
compression method is simple Run-Length Encoding, which means that a number 
of equal nibbles will be compressed into three nibbles saying "here comes
57 nibbles of zeroes" for example.

The efficiency of the programs depend largely on the type of GROB that you
are using. A picture with large areas of a single pattern and horizontal
lines will perhaps be compressed to 1/20 of the original size, but a very
complex picture may not be compressed at all (or even increase in size).

Since UPGROB is very small (145 bytes) and fast, it can easily be imple-
mented in games and other programs, where you wish to have nice screens
without running out of memory. It will probably save memory even if you
only have one screen GROB.

The programs behave nicely with all necessary error checking.


PGROB (compress GROB)
-----
1: GROB  -->  1: Binary Integer


UPGROB (uncompress GROB)
------
1: Binary Integer  -->  1: GROB


(Note: the binary integer that PGROB returns is never 16 nibbles long.
This means that you cannot edit it, and therefore you cannot crash
UPGROB this way.)


PGROB in ASC-format

%%HP: T(3)A(D)F(.);
"D9D20ECE8176040CCD20EB1008FB976014713506174147DAF4C2818F2E8FD7B5
081AF1813581AF0A80824E4A20141818F2913507818F24134142CAD816415271
517179818F2E13481AF0813713581AF0917115201510D31701601361348B9606
6601560155090661B67AEB808A73DA6F654031409EBB3136EB134137EB13581A
F11E2808A7A9818FA27BA013313181AF01627F137135EB81AF11E2818FA28AA8
1CE7A70137135EBCE81AF0981AF1913596B01AEB8089714D1721361348B56066
1F81AF1A81AF0806133130EA34A10008A6501608F176618F2D760071458DF192
081AF1113314D13101B21300239"


UPGROB in ASC-format

%%HP: T(3)A(D)F(.);
"D9D20ECE81D5040CCD204F0008FB97601471350617414334510008A6018F2D76
08D7AC8117414381AF0117414381AF008F3B51113681AF0813507818F2413414
2CAD816E14A1611361348BD46808770431F09EAF11567155716F17F81868F31F
09E65E15601550160170A6C5EE6DAF8084715601550170A6C55F160609F81AF1
08D1FF11B2130D903"


Happy graphing!

Erik Bryntse
erikmb@cd.chalmers.se