home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
PROGRAMM
/
FGL112B.ZIP
/
NEWSTUFF.DOC
< prev
next >
Wrap
Text File
|
1992-10-05
|
11KB
|
284 lines
Release Notes
Fastgraph/Light (tm) v1.12
October 5, 1992
Ted Gruber Software
PO Box 13408
Las Vegas, NV 89112
(702) 735-1980 voice
(702) 735-4603 FAX
(702) 796-7134 BBS
Copyright (c) 1992 Ted Gruber Software.
All Rights Reserved.
------------------------------------------------------------------------------
Introduction
------------------------------------------------------------------------------
The Fastgraph/Light 1.12 Release Notes describe the features added to
Fastgraph and Fastgraph/Light since publication of the Fastgraph User's Guide
and Reference Manual. The new features include:
* Mouse support for the extended VGA graphics modes (20 to 23).
* The ability to select 16 colors from a palette of 256K colors (instead
of 16 or 64) in modes 13, 14, and 16 when used on a VGA system.
* The ability to synchronize the vertical retrace with fg_transfer.
* Additional PCX file support.
------------------------------------------------------------------------------
Extended VGA Mouse Support
------------------------------------------------------------------------------
Fastgraph 2.12 and Fastgraph/Light 1.12 offer mouse support for the extended
VGA graphics video modes (modes 20 to 23). In these modes, the mouse cursor
is displayed by an interrupt handler that is activated whenever the mouse
moves. The handler is installed when you call the fg_mouseini routine in an
extended VGA graphics mode.
If you do not unhook this handler before your program exits, strange things
will happen. More specifically, characters may be invisible, or your system
may hang upon attempting a disk access. Obviously, these are problems to
avoid. The way to do this is make the mouse cursor invisible, restore the
original video mode, and then re-initialize the mouse for the original video
mode. The following code fragment illustrates this sequence:
fg_mousevis(0);
fg_setmode(old_mode);
fg_mouseini();
fg_reset();
/* now exit to DOS */
In the standard VGA/MCGA 256-color mode (mode 19), white pixels in the mouse
cursor are displayed in color 15. This is inconsistent with other graphics
modes, where the white pixels are displayed in the highest-numbered color
value available in that mode. Fastgraph corrects this inconsistency in modes
20 to 23 by displaying white mouse cursor pixels in color 255. Like color 15,
color 255 is white by default. This allows you to redefine color 15 in your
256-color applications without interfering with the mouse cursor colors.
The Fastgraph routines modified to provide extended VGA mouse support are
fg_mouseini, fg_mousemov, fg_mouseptr, and fg_mousevis.
------------------------------------------------------------------------------
Additional VGA DAC Support
------------------------------------------------------------------------------
The versions of fg_getdacs and fg_setdacs supplied with previous versions of
Fastgraph and Fastgraph/Light work only in video modes 17 to 23. The new
versions of these routines will also work in modes 13, 14, and 16 when used
on a VGA system. This lets you choose 16 colors from a palette of 262,144
colors, just as in mode 18.
If you attempt to use the new fg_getdacs or fg_setdacs on an EGA system, the
results are unpredictable. Therefore, applications that use these routines
should first verify that they are running on a VGA system by seeing if
fg_testmode(18,0) returns a nonzero value.
To use fg_getdacs and fg_setdacs in modes 13, 14, and 16, you should first be
aware of the relationship between VGA palettes and DAC registers. On the EGA,
palette values directly determine the color displayed. On the VGA, however,
there is an added level of indirection. A VGA palette register can be thought
of as a pointer to a video DAC register whose RGB components determine the
displayed color. There's a more detailed description of this in Chapter 5 of
the Fastgraph User's Guide (see pages 55 to 65).
Each palette register in the VGA 640x480 16-color graphics mode (mode 18)
initially points to the DAC register of the same number. We can thus pretend
the indirection does not exist because changing DAC register N affects those
pixels whose color value is N (unless, of course, we've changed the value of
palette register N). In modes 13, 14, and 16, we can't ignore the indirection
because the palette registers contain different values. In mode 13, for
instance, palette register 8 contains the value 16 by default, not the value
8 as in mode 18.
The easiest way around this inconsistency is to explicitly set the palette and
DAC registers so they correspond to the default values of mode 18. There are
two cases to consider -- one for modes 13 and 14, and the other for mode 16.
In modes 13 and 14, palettes 0 to 7 contain the values 0 to 7, but palettes 8
to 15 contain the values 16 to 23. Hence, if you want to use fg_getdacs and
fg_setdacs in these modes, we recommend including the following code after
calling fg_setmode.
char RGBvalues[3];
int i;
for (i = 8; i < 16; i++)
{
fg_getdacs(i+8,1,RGBvalues);
fg_setdacs(i,1,RGBvalues);
fg_palette(i,i);
}
The above code fragment will set the values of DACs 8 to 15 to the values of
DACs 16 to 23. It also sets palettes 8 to 15 to point to DACs 8 to 15. You
can then ignore the palette-DAC indirection because setting DAC register N
affects pixels of color N.
In mode 16, palette 6 is initially assigned the value 20, and palettes 8 to 15
are assigned the values 56 to 63. All other palettes point to the DAC of the
same number. Hence, if you want to use fg_getdacs and fg_setdacs in mode 16,
we recommend including the following code after calling fg_setmode.
char RGBvalues[3];
int i;
fg_getdacs(20,1,RGBvalues);
fg_setdacs(6,1,RGBvalues);
fg_palette(6,6);
for (i = 8; i < 16; i++)
{
fg_getdacs(i+48,1,RGBvalues);
fg_setdacs(i,1,RGBvalues);
fg_palette(i,i);
}
The above code fragment will set the values of DAC 6 to the values of DAC 20,
and also DACs 8 to 15 to the values of DACs 56 to 63. It also sets palettes
6 and 8-15 to point to the identically-numbered DACs. You can then ignore
the palette-DAC indirection because setting DAC register N affects pixels of
color N.
While this might all seem complicated at first, it really isn't once you
understand the relationship between palettes and DACs. The ability to select
colors from a palette of 256K colors instead of 16 or 64 is well worth the
extra effort.
------------------------------------------------------------------------------
Vertical Retrace Synchronization With fg_transfer
------------------------------------------------------------------------------
Fastgraph 2.12 and Fastgraph/Light 1.12 include a new version of fg_transfer
that allows you to synchronize video memory accesses with the vertical retrace
interval. If you use fg_transfer inside a tight loop to display the frames of
an animation sequence and don't synchronize the fg_transfer calls with the
vertical retrace, you may notice a flickering or bleeding effect. This is
especially true in 256-color graphics modes when transferring large or very
wide regions.
To synchronize fg_transfer with the vertical retrace, include the following
statements immediately before each call to fg_transfer:
Borland C++, Turbo C, Turbo C++, and Power C:
while(inportb(0x03DA) & 8);
while((inportb(0x03DA) & 8) == 0);
Microsoft C and QuickC:
while(inpb(0x03DA) & 8);
while((inpb(0x03DA) & 8) == 0);
QuickBASIC:
WHILE (INP(&h03DA) AND 8) <> 0
WEND
WHILE (INP(&h03DA) AND 8) = 0
WEND
Turbo Pascal:
asm
mov dx,03DAh
@1:
in al,dx
test al,8
jz @1
@2:
in al,dx
test al,8
jnz @2
end;
If you are using a monochrome display mode, use the port address 03BA hex
instead of 03DA hex.
The vertical retrace synchronization described above introduces a delay, which
of course slows down animation sequences. What we really need is a guarantee
that no two transfers occur to the same area within the same vertical retrace
interval. While synchronizing each fg_transfer call does guarantee this, the
delay so introduced may be more than what is actually needed.
In some cases, you can instead force a small delay in each animation frame.
The delay should be chosen so it is long enough to avoid vertical retrace
conflicts, yet short enough not to degrade the animation speed. Evidence
suggests a delay of 9 milliseconds (about one-sixth of a 55 ms clock tick)
works well. You can achieve such a delay by calling fg_stall(delay/6), where
"delay" is the value returned by the fg_measure function on a particular
system.
Which of these two techniques works best depends to a great extent on your
application. We suggest trying each method to determine which one works best
in the specific context of your application.
------------------------------------------------------------------------------
New Functions
------------------------------------------------------------------------------
FG_PCXHEAD
Prototype
int fg_pcxhead (char *pcx_file, char *pcx_header);
function FGpcxhead% (pcx_file$, pcx_header$)
integer*2 function fg_pcxhead (character*(*) pcx_file,
integer*1 pcx_header)
function fg_pcxhead (pcx_file : string; var pcx_header : byte) : integer;
Description
Read a PCX file header.
Parameters
pcx_file The name of the PCX file, terminated by a zero byte.
pcx_header The buffer to receive the 128-byte PCX file header.
Return value
0 Success
-1 The specified file does not exist.
-2 The specified file is not a PCX file.
Restrictions
none
FG_PCXMODE
Prototype
int fg_pcxmode (char *pcx_header);
function FGpcxmode% (pcx_header$)
integer*2 function fg_pcxmode (integer*1 pcx_header)
function fg_pcxmode (var pcx_header : byte) : integer;
Description
Determine the optimal video mode for the PCX image associated with
the specified PCX file header.
Parameters
pcx_header The buffer containing the 128-byte PCX file header.
Return value
>0 The optimal video mode for displaying the PCX image.
-1 The pcx_header buffer does not contain a valid PCX file header.
-2 Cannot determine a compatible video mode.
Restrictions
none