Dec 232017
Compress screen images, and then display them with TP V4.0+. Very Good!.
File RELPAS.ZIP from The Programmer’s Corner in
Category Pascal Source Code
Compress screen images, and then display them with TP V4.0+. Very Good!.
File Name File Size Zip Size Zip Type
RLE.DOC 5158 1970 deflated
RLE.PAS 9878 2816 deflated
TEST-RLE.INC 7155 2995 deflated
TEST-RLE.PAS 1642 840 deflated
UNPACK.INC 2168 894 deflated

Download File RELPAS.ZIP Here

Contents of the RLE.DOC file


by Rob Rosenberger
CompuServe 74017,1344

Version 1.00 released to the public domain on 30 Nov 88.

This application takes a text file and converts it to Turbo
Pascal source code. It "packs" the text into the equivalent of
an array using a simple technique known as "run length encoding."
The resulting source code can be compiled into your program to
keep your product from consuming too much disk space or memory.
You can unpack the text to a screen, file, or printer.
This application can be used to store screen skeletons or
registration forms in your program, taking up less room than if
you stored them in their normal (unpacked) state. I've been able
to get better than 50% compression on some files because of all
the "white space" I use to make my screens & registration forms
look professional.


The file UNPACK.INC is a short routine that must be included
in your program. Place it in your program so other procedures &
functions have access to it.
You then must compile RLE.PAS and create the RLE.EXE file.
You are now ready to use the RLE generator application.

Creating RLE text

The command to invoke RLE is:

RLE output
RLE >output

where "input" is the text file to be converted and "output" is
the file where the resulting source code is stored. Be sure to
use different files for input & output, or you'll destroy your
original file. (Consult your DOS manual if you don't know what
the the < > >> redirection symbols do for you.)

Put the output file where your compiler can find it. Next,
add a {$I filename} to your program where appropriate. (You can
see where I put it in TEST-RLE.PAS.) All you have to do now is
make a call in your program to the unpacking routine.

Unpacking RLE text

The UnpackText function does the grunt work in your program.
When you call it, it will de-compress your text and ship it to
the device you specify (printer/screen/file).

FUNCTION UnpackText(RLELength : WORD;
VAR TheArray; {an untyped parameter}
Destination : STRING) : BYTE;

RLELength the size of the array. RLE.EXE puts this value
in the file you created. As you might expect,
it's called RLELength.

TheArray the actual RLE array created by RLE.EXE. As
you'd guess, the name of the array is TheArray.

Destination The output destination for the text. If the
destination is 'CON' (all caps), UnpackText
will execute an ASSIGNCRT statement instead of
ASSIGN. (This will considerably speed up
writing to the screen.)


Yes, the RLE utility has a few limitations. They are:

Limit of 64k in code and data segments.
If you create an RLE array that gets a little bit too large,
you could overstep TP4/TP5 limits on data segments. Each unit is
limited to 64k of code, 64k of data. If your array is too big,
create a dedicated unit to hold it. In fact, you really should
create a separate unit for each RLE array. It's good programming
You can tell if you overstepped the 64k barriers if you get
compiler errors 22 (structure too large), 48 (code segment too
large), 49 (data segment too large), or 96 (too many variables).

Text files cannot contain characters #0 or #255.
Char #0 & #255 have special meanings inside the RLE utility.
The UnpackText function will freak out on you if you use either
of them in your text file. Fortunately, few text files use these

- 2 -


I'd like to pass on a special thanx to Neil Rubenking, who
worked with me to get this tool off the ground. It was supposed
to be an article for Turbo Technix magazine, but you may know the
magazine is no longer in print. (Too bad. It was a beauty!)

- 3 -

 December 23, 2017  Add comments

Leave a Reply