Contents of the VGXDEMO.DOC file
Welcome to VGX!
IMPORTANT INFORMATION: All programs with this package REQUIRE a VGA display
The following files are included in this ZIP distribution file:
VGXDEMO.EXE - demo program;
VGXVIEW.EXE - utility to view VGX files;
PCX2VGX.EXE - utility to convert PCX files to VGX files;
VGXGRAB.COM - TSR to capture VGA screens to VGX files;
VGXDEMOx.VGX - eight VGX files used with VGXDEMO.EXE;
VGXDEMO.DOC - If this is missing then you must be in the Twilight
Zone (because you're reading it now.)
INTRODUCTION - What is VGX?
VGX is a new graphics file format for use by QuickBASIC 4.x and BASIC 7.0
programmers. VGX supports ONLY the VGA 640x480 pixel 16-color graphics mode
(SCREEN 12), and because of this it is very fast.
If you've ever programmed VGA graphics files using the BASIC BSAVE/BLOAD
commands you know that even the least complex image requires 153k of disk
space in FOUR separate files. Also, your palette is not saved. While BLOAD
is fast, the file sizes, number of files and lack of palette are enough to
make one think twice before developing a VGA image program in BASIC.
Perhaps you have heard of or purchased one of the PCX file assembly language
loaders for BASIC (at a cost of up to $200!). These work fine if you don't
mind the inefficiencies of PCX and the "scrolling" manner that images are
Well VGX is here to save the day. VGX files are almost always smaller than
PCX files (compressed up to 95%); VGX files load faster than PCX loaders
(almost as fast as BLOAD!); VGX files save their palette; VGX stores the
image in one single file; and best of all, VGX costs as little as 1/10th of
the price of commercial PCX loaders!
HOW DOES VGX WORK?:
VGX is similar to BLOAD/BSAVE in that images are stored in "banks" just like
the VGA video memory stores them. Each bank represents one color (red,
blue, green and intensity) and each bit in the bank is either on or off.
(PCX deals with all colors at once by analysing the bytes of a "scan line";
a much slower process.)
VGX is similar to PCX in that it uses a "run-length" encoding scheme to
compress the data. When a run of the same byte pattern is encountered in a
color bank, VGX stores a count for them instead of the actual data. Because
banks are a series of 1's and 0's (on and off), the VGX compression of an
entire bank is usually more efficient than the PCX compression of a single
scan line. VGX switches banks four times for each file, PCX switches banks
four times for each scan line (1920 times per file!)
The VGA adapter stores the palette in 16 byte-triplets (one byte for each
color; 48 bytes total.) VGX simply gets this data and adds it to the VGX
file. Included with the VGX package is a BASIC program, PALCALLS.BAS which
will demonstrate the BIOS palette calls, show how to "fade" the 48-byte
palette data, and also how to rotate the palette ("palette animation".)
The VGX file format is very easy to use in your QuickBASIC programs. You
simply add VGX.LIB to your normal quicklibrary (INTERRUPTX, which comes with
QB, is also required.) To create a stand-alone EXE file simply link your
program's object file (created with BC) with VGX.LIB.
Once in QB, you simply CALL VGXSave (filname$) to save a file or CALL
VGXLoad (filname$, palflag%) to load a file. It's that easy!
PalFlag% is the parameter to choose one of five loading options, from
"instant on" to "fade-in". Run VGXDEMO.EXE and VGXVIEW.EXE to see these
options in action.
Just type VGXDEMO from the DOS prompt to watch the demo. Please note that
the entire set of VGX files used in the demo add up to LESS THAN ONE normal
VGA file in BLOAD format!
You can run VGXVIEW to view the included VGX files or files you make using
PCX2VGX or VGXGRAB. Please note that if you enter a bad filename at the
prompt, VGXVIEW will NOT crash, though you will lose your palette. Just hit
twice to leave the program and restore the default palette.
You may notice that one of the included VGX files is blank when viewed from
VGXVIEW. This is not because the file is bad, but because it is invisible!
What this file contains is the graphics for the animated light bulb you see
in VGXDEMO. What I have done is set all the colors in the palette for this
VGX image to zero. The image data is all still there. So when VGXDEMO runs
it loads the file (using VGXLoad), the viewer sees nothing because the
colors are all black, I get the frames of the animated image (using BASIC's
GET) and then later, with a new palette, I use PUT to show the animation.
If you have PCX files you can convert them to VGX and use VGXVIEW to compare
for yourself how much smaller and faster they are. Remember you can ONLY
use PCX files created in VGA 640x480 16-color mode. PCX2VGX will convert
the file, test load it, and even test the gray-scale color balance (to see
how your image will look on a monochrome VGA display.)
Type `PCX2VGX filename' at the DOS prompt, DO NOT include the filename
extension in `filename'.
VGXGRAB.COM is a TSR (memory resident) program that will dump whatever is on
your VGA 640x480 16-color screen to a VGX file. Type VGXGRAB at the DOS
prompt and it will become resident. VGXGRAB will allocate approximately 80k
of RAM while resident. Some paint programs that require a full 640k to run
will not run when VGXGRAB is resident (you will get an "insufficient memory"
error) In that event, hopefully, your paint program will save to a PCX file
format which you can then convert to VGX using PCX2VGX.
After VGXGRAB is resident, run whatever VGA screen display program you wish
to capture from (VGXVIEW and VGXDEMO will work) and hit the "hotkey" to save
the image to a VGX format file. The hotkey for VGXGRAB is CTRL/ENTER (both
the "Control" and "Enter" keys pressed at the same time.) After the VGX
file is saved you will hear a short beep and control will return to your
VGX files saved by VGXGRAB are named VGXxxx.VGX where xxx is a number, so
the first VGX file you create with VGXGRAB will be VGX1.VGX, the second,
VGX2.VGX, and so on. If a VGX file with the same name already exists, that
number will be skipped, so, for example, if VGX1.VGX and VGX2.VGX already
exist on the default directory, then the fist file VGXGRAB will save is
If you wish to remove VGXGRAB from memory (unhook the "hotkey" and free up
the RAM), hit CTRL/END (both the "Control" and "End" keys at the same time)
while the LAST VGX file is being saved. If you forget this, you will have
to make at least one more VGX file by hitting CTRL/ENTER and then CTRL/END
immediately after. If removal is successful you will here two notes
ascending in frequency, if the removal is unsuccessful (your program or
another TSR has "grabbed" the interupts) you will hear a long low beep and
VGXGRAB will remain in memory (you may have to reboot to remove it.)
VGXGRAB works only in 640x480 16-color VGA graphics mode. Hitting
CTRL/ENTER will cause unpredictable results in other modes (in text mode it
creates a 153k garbage VGX file.)
Using VGXLoad will add approximately 6k to your finished EXE program. Using
VGXSave will add approximately 4k (10k if your program uses both VGXSave and
While running, VGXSave will need 78k of RAM, while VGXLoad will need 56k of
RAM. Please note that this used RAM is released after each call.
All critical DOS errors are "passed through"; that is, if an error occurs
(filename, disk or memory), the VGX routines will pass control back to your
program (the call may fail, but your program will not crash.)
VGX will work with any IBM-compatible microcomputer with a VGA display
adapter. DOS 2.1 and above are required (I think.)
No source code is included for VGXSave and VGXLoad. This is to protect the
integrity of the VGX algorithm so that it is universal in compatibility. (I
apologize for this as I am a firm believer in providing source code. I am
just afraid that numerous homemade versions would proliferate and then
compatibility would be destroyed. By keeping the algorithm "proprietary" I
can guarantee it's compatibility between users and also I can inform
registered users of upgrades and the VERY remote possibility of an upgrade
that is not backward compatible.)
The VGX routines are "word-aligned"; that is they are optimized for the 286
CPU. 8088 CPU machines (PC's and XT's) will work just as fast, and 386
CPU's will work to nearly as fast as possible.
VGXSave and VGXLoad were written in MASM assembly language and BASIC itself.
VGX comes in two versions, one for QuickBASIC 4.x (using near strings) and
the other for BASIC 7.0 (using far strings.) (The near string version can
be compiled with BASIC 7.0 but will not run in the QBX environment.)
PRICE and GUARANTEE:
The VGX QuickBASIC 4.x package costs only $25.00 (U.S). California
residents please add 6.25% sales tax ($26.57 total.) If you wish the BASIC
7.0 version as well (both), add $5.00 ($30.00 total for non-California
residents, $31.88 for California residents.)
Milestone Software guarantees your 100% satisfaction with VGX. If not
satisfied, you may return the original VGX package within 30 days for a
full refund, PROVIDING you agree to remove all VGX files from your system
and agree not to distribute programs using the VGX algorithms.
Thank you for trying VGX.
1260 Sunset Ave.
Arcata, CA 95521 USA