Article Q50000
◄Contents► ◄Index► ◄Back►
─────────────────────────────────────────────────────────────────────────────
◄Knowledge Base Contents► ◄Knowledge Base Index►
How to Save and Restore the VGA Palette Registers - Q50000
In Microsoft Visual Basic version 1.0 for MS-DOS, a program can save
and restore the VGA PALETTE registers using the CALL INTERRUPT
statement. This can be useful when SHELLing to other programs that
might change the PALETTE registers.
This can also be used along with the BSAVE and BLOAD statements to
save graphic images. BLOAD and BSAVE save the binary image of the
graphic image, but not the color PALETTE. The CALL INTERRUPT
statement can be used to read the PALETTE registers into an array,
which can then be saved along with the graphic image.
More Information:
The BASIC program included below named SAVEPAL.BAS displays a
multicolored image and then restores the palette registers after
setting all of the palette registers to black.
◄See Example►
To demonstrate this program from an .EXE program, compile and link as
follows:
BC SAVEPAL.BAS;
LINK SAVEPAL;
When running the program from the Visual Basic editor environment, the
Quick library VBDOS.QLB must be loaded in. This is done with the
following command line:
VBDOS SAVEPAL /L