Dec 182017
TSR that allows you to easily change an EGA's internal registers.
File PALET.ZIP from The Programmer’s Corner in
Category Display Utilities
TSR that allows you to easily change an EGA’s internal registers.
File Name File Size Zip Size Zip Type
DRAW.BAT 263 180 deflated
PALET.ASM 14770 4860 deflated
PALET.COM 1429 1041 deflated
PALET.DOC 7930 3088 deflated
SKETCH.TXT 2962 1213 deflated

Download File PALET.ZIP Here

Contents of the PALET.DOC file

for, Release 2

-------- is a TSR (Terminate, but Stay Resident) program that ties into int
10h and traps (or allows to pass) any changes to the values stored in the EGA
registers. It occupies only 448 bytes of memory (exclusive of memory taken up
by its environment). The program will not reload, but will pass any parameters
to the resident portion when you call it subsequent times.

Command line instructions


Entering this will display a usage screen to refresh your memory, it will not
install the resident portion of palet.

palet d (reset to default)

Entering this will install (if not already installed) the TSR portion of palet
and write the default values stored within palet to the EGA registers. This is
a good way to "clean everything up" after playing with setting the EGA regis-
ters with the next command. The 'd' command should precede any other parameters
on the command line.

palet o1 o2 .... o16 (set EGA register values)

Entering this will set any or all of the sixteen EGA palette registers. The
numbers o1, o2, etc. are two digit octal (sorry) numbers that represent one
of the 64 valid values for the EGA colors. The numbers may be separated by
a space, or you may run all digits together (in which case any single digit
must be preceded by a zero, ie.: 7 4 16 is same as: 070416). It is not nec-
essary to enter values for registers above the ones you wish to change. Values
for registers you wish to remain unchanged can be replaced with a period, ie.:

palet ..7....2 will change registers 3 and 8, and leave others

This command will change the EGA registers and by default, will set the 'X'
switch, which will allow other programs to change the EGA registers also (see
the exclude and exclude text commands).

palet e (exclude changes)

Entering this will set the exclude changes switch. Palet will now prevent any
attempt to change the values in the EGA registers, no matter what display mode
is set (text or graphics). If you have programs that display in graphics mode,
but don't provide a way to set the colors used, then this is a way to do it.
Some trial and error will usually show you which EGA registers the program is
using so that you can set the registers to suit your preference. Generally, the
easiest way to use palet for this is in a batch file, ie.:

Page 1

echo off
palet o1 o2 .....o16 e
program (program to run)
palet d

This file will set the registers of the EGA, make the change exclusive and load
the program to run. Upon exiting the program, palet will set the EGA registers
to the default value, leaving the exclude switch set.

palet t (exclude text color changes)

This is a variation on the exclude command, as it will only trap text mode
color changes, ie. attempts to change EGA register values while the display is
in graphics mode will go through.

palet x (turn off exclusions)

This command will turn off e or t exclusions, and allow other software to reset
the EGA registers.

Command usage

All commands can be combined in any way, with the exception of the 'd' command,
which when used, should precede all other parameters on the command line.


palet ...4...16e will write the octal values 4 and 16 (4 and 14 dec-
imal) to the 4th and 8th registers, and set the
exclude switch.

palet d..7....2t will write default values to 16 registers, then
change the 3rd and 8th registers, and set the text
exclude switch.

palet dx will write default values to 16 registers, and turn
off the exclude switches.

Of course it would be silly to combine 'x' with 't' or 'e' in the same call.

Page 2


When palet is called, it first checks for DOS 2.0 or higher, and the existence
of the EGA, then 'hooks' itself into int 10h (video interrupt). EGA registers
are reset (if requested in the parameters), and palet's internal switches are
set (if specified in the parameters). Palet then removes most of itself from
memory, leaving behind the TSR portion that monitors all calls to int 10h.

A flag is used within palet to monitor the current display mode, this way
palet can determine whether or not to allow changes to the EGA registers to
pass (based on the 'E' and 'T' switch settings).

Any display mode function call to the EGA will reset all EGA registers to the
system default values. Palet will allow the display mode change to go through,
then check the 'T' and 'E' switch settings, if the display mode has been
changed to graphics, and the 'T' switch is set, then palet will allow any EGA
register changes to pass, until the display mode is changed back to text. On
the other hand, if the 'E' switch is set, then palet will immediately write the
values stored in it's buffer area to the EGA registers, and trap any attempts
to change those values. Any EGA register changes initiated by a call to palet
will be allowed to pass with any switch settings (palet knows when it is called
by itself).

A table of palet's default values is contained within the program code (out-
side of the resident portion). By carefully patching palet with debug, you can
customize the default values to your preference. DOS normally uses the 8th EGA
register for its text color (white), and the 1st register for its background
color; the 3rd EGA register normally contains the value for green. If you pre-
fer green text on black, you can switch the values of the 3rd and 8th EGA reg-
isters (this way you still have white available, albeit in the 3rd EGA regis-
ter). Use debug to patch the locations below:

address value now (hex) EGA register
051eh0h 1
051fh1h 2
0520h 2h 3
0521h3h 4
0522h4h 5
0524h 14h7
0526h 38h9
0527h 39h 10
0528h 3ah 11
0529h 3bh 12
052ah 3ch 13
052bh 3dh 14
052ch 3eh 15
052dh 3fh 16

example: (next page)

Page 3

-e 051e
xxxx:051E 00.{enter new value here, hex number between 0 and 3F}

Do this carefully, and do not change values beyond 052dh.

Please note that programs which write directly to the EGA registers (and not
using int 10h) will be able to defeat palet. Programs like this are considered
'ill-behaved' since they don't use standard DOS or EGA BIOS calls, but address
the hardware directly.

Post Script
-----------, Release 2 is a public domain program, no claims are made to its
effectiveness or reliability. The original has been in use for
some time with no problems, Release 2 should also cause no problems. has evolved to it's current level through the joint efforts of
Charles Lazo III and Tim Worley, whose collaboration began with an exchange
of e-mail on CompuServe. Help support the 'hacker ethic', report any bugs, mod-
ifications, or suggestions for improvements to:

Charles Lazo IIITim Worley
P.O. Box 452 or1314 Poplar St.
Hohenwald, TN 38462Charlottesville, VA 22901

CIS ID [72210,17]CIS ID [71336,730]

Palet can remain in continuing development if you so desire, but let's make it
a joint effort.

Page 4

 December 18, 2017  Add comments

Leave a Reply