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 >
Text File  |  1992-10-05  |  11KB  |  284 lines

  1.  
  2.                                 Release Notes
  3.  
  4.                           Fastgraph/Light (tm) v1.12
  5.  
  6.                                October 5, 1992
  7.  
  8.  
  9.  
  10.                              Ted Gruber Software
  11.                                  PO Box 13408
  12.                              Las Vegas, NV  89112
  13.  
  14.                              (702) 735-1980 voice
  15.                               (702) 735-4603 FAX
  16.                               (702) 796-7134 BBS
  17.  
  18.                     Copyright (c) 1992 Ted Gruber Software.
  19.                              All Rights Reserved.
  20.  
  21. ------------------------------------------------------------------------------
  22.                                  Introduction
  23. ------------------------------------------------------------------------------
  24.  
  25. The Fastgraph/Light 1.12 Release Notes describe the features added to
  26. Fastgraph and Fastgraph/Light since publication of the Fastgraph User's Guide
  27. and Reference Manual.  The new features include:
  28.  
  29. *  Mouse support for the extended VGA graphics modes (20 to 23).
  30. *  The ability to select 16 colors from a palette of 256K colors (instead
  31.    of 16 or 64) in modes 13, 14, and 16 when used on a VGA system.
  32. *  The ability to synchronize the vertical retrace with fg_transfer.
  33. *  Additional PCX file support.
  34.  
  35. ------------------------------------------------------------------------------
  36.                           Extended VGA Mouse Support
  37. ------------------------------------------------------------------------------
  38.  
  39. Fastgraph 2.12 and Fastgraph/Light 1.12 offer mouse support for the extended
  40. VGA graphics video modes (modes 20 to 23).  In these modes, the mouse cursor
  41. is displayed by an interrupt handler that is activated whenever the mouse
  42. moves. The handler is installed when you call the fg_mouseini routine in an
  43. extended VGA graphics mode.
  44.  
  45. If you do not unhook this handler before your program exits, strange things
  46. will happen.  More specifically, characters may be invisible, or your system
  47. may hang upon attempting a disk access.  Obviously, these are problems to
  48. avoid.  The way to do this is make the mouse cursor invisible, restore the
  49. original video mode, and then re-initialize the mouse for the original video
  50. mode.  The following code fragment illustrates this sequence:
  51.  
  52.         fg_mousevis(0);
  53.         fg_setmode(old_mode);
  54.         fg_mouseini();
  55.         fg_reset();
  56.         /* now exit to DOS */
  57.  
  58. In the standard VGA/MCGA 256-color mode (mode 19), white pixels in the mouse
  59. cursor are displayed in color 15.  This is inconsistent with other graphics
  60. modes, where the white pixels are displayed in the highest-numbered color
  61. value available in that mode.  Fastgraph corrects this inconsistency in modes
  62. 20 to 23 by displaying white mouse cursor pixels in color 255.  Like color 15,
  63. color 255 is white by default.  This allows you to redefine color 15 in your
  64. 256-color applications without interfering with the mouse cursor colors.
  65.  
  66. The Fastgraph routines modified to provide extended VGA mouse support are
  67. fg_mouseini, fg_mousemov, fg_mouseptr, and fg_mousevis.
  68.  
  69. ------------------------------------------------------------------------------
  70.                           Additional VGA DAC Support
  71. ------------------------------------------------------------------------------
  72.  
  73. The versions of fg_getdacs and fg_setdacs supplied with previous versions of
  74. Fastgraph and Fastgraph/Light work only in video modes 17 to 23.  The new
  75. versions of these routines will also work in modes 13, 14, and 16 when used
  76. on a VGA system.  This lets you choose 16 colors from a palette of 262,144
  77. colors, just as in mode 18.
  78.  
  79. If you attempt to use the new fg_getdacs or fg_setdacs on an EGA system, the
  80. results are unpredictable.  Therefore, applications that use these routines
  81. should first verify that they are running on a VGA system by seeing if
  82. fg_testmode(18,0) returns a nonzero value.
  83.  
  84. To use fg_getdacs and fg_setdacs in modes 13, 14, and 16, you should first be
  85. aware of the relationship between VGA palettes and DAC registers.  On the EGA,
  86. palette values directly determine the color displayed.  On the VGA, however,
  87. there is an added level of indirection.  A VGA palette register can be thought
  88. of as a pointer to a video DAC register whose RGB components determine the
  89. displayed color.  There's a more detailed description of this in Chapter 5 of
  90. the Fastgraph User's Guide (see pages 55 to 65).
  91.  
  92. Each palette register in the VGA 640x480 16-color graphics mode (mode 18)
  93. initially points to the DAC register of the same number.  We can thus pretend
  94. the indirection does not exist because changing DAC register N affects those
  95. pixels whose color value is N (unless, of course, we've changed the value of
  96. palette register N).  In modes 13, 14, and 16, we can't ignore the indirection
  97. because the palette registers contain different values.  In mode 13, for
  98. instance, palette register 8 contains the value 16 by default, not the value
  99. 8 as in mode 18.
  100.  
  101. The easiest way around this inconsistency is to explicitly set the palette and
  102. DAC registers so they correspond to the default values of mode 18.  There are
  103. two cases to consider -- one for modes 13 and 14, and the other for mode 16.
  104.  
  105. In modes 13 and 14, palettes 0 to 7 contain the values 0 to 7, but palettes 8
  106. to 15 contain the values 16 to 23.  Hence, if you want to use fg_getdacs and
  107. fg_setdacs in these modes, we recommend including the following code after
  108. calling fg_setmode.
  109.  
  110.    char RGBvalues[3];
  111.    int i;
  112.  
  113.    for (i = 8; i < 16; i++)
  114.    {
  115.       fg_getdacs(i+8,1,RGBvalues);
  116.       fg_setdacs(i,1,RGBvalues);
  117.       fg_palette(i,i);
  118.    }
  119.  
  120. The above code fragment will set the values of DACs 8 to 15 to the values of
  121. DACs 16 to 23.  It also sets palettes 8 to 15 to point to DACs 8 to 15.  You
  122. can then ignore the palette-DAC indirection because setting DAC register N
  123. affects pixels of color N.
  124.  
  125. In mode 16, palette 6 is initially assigned the value 20, and palettes 8 to 15
  126. are assigned the values 56 to 63.  All other palettes point to the DAC of the
  127. same number.  Hence, if you want to use fg_getdacs and fg_setdacs in mode 16,
  128. we recommend including the following code after calling fg_setmode.
  129.  
  130.    char RGBvalues[3];
  131.    int i;
  132.  
  133.    fg_getdacs(20,1,RGBvalues);
  134.    fg_setdacs(6,1,RGBvalues);
  135.    fg_palette(6,6);
  136.  
  137.    for (i = 8; i < 16; i++)
  138.    {
  139.       fg_getdacs(i+48,1,RGBvalues);
  140.       fg_setdacs(i,1,RGBvalues);
  141.       fg_palette(i,i);
  142.    }
  143.  
  144. The above code fragment will set the values of DAC 6 to the values of DAC 20,
  145. and also DACs 8 to 15 to the values of DACs 56 to 63.  It also sets palettes
  146. 6 and 8-15 to point to the identically-numbered DACs.  You can then ignore
  147. the palette-DAC indirection because setting DAC register N affects pixels of
  148. color N.
  149.  
  150. While this might all seem complicated at first, it really isn't once you
  151. understand the relationship between palettes and DACs.  The ability to select
  152. colors from a palette of 256K colors instead of 16 or 64 is well worth the
  153. extra effort.
  154.  
  155. ------------------------------------------------------------------------------
  156.               Vertical Retrace Synchronization With fg_transfer
  157. ------------------------------------------------------------------------------
  158.  
  159. Fastgraph 2.12 and Fastgraph/Light 1.12 include a new version of fg_transfer
  160. that allows you to synchronize video memory accesses with the vertical retrace
  161. interval.  If you use fg_transfer inside a tight loop to display the frames of
  162. an animation sequence and don't synchronize the fg_transfer calls with the
  163. vertical retrace, you may notice a flickering or bleeding effect.  This is
  164. especially true in 256-color graphics modes when transferring large or very
  165. wide regions.
  166.  
  167. To synchronize fg_transfer with the vertical retrace, include the following
  168. statements immediately before each call to fg_transfer:
  169.  
  170. Borland C++, Turbo C, Turbo C++, and Power C:
  171.  
  172.     while(inportb(0x03DA) & 8);
  173.     while((inportb(0x03DA) & 8) == 0);
  174.  
  175. Microsoft C and QuickC:
  176.  
  177.     while(inpb(0x03DA) & 8);
  178.     while((inpb(0x03DA) & 8) == 0);
  179.  
  180. QuickBASIC:
  181.  
  182.     WHILE (INP(&h03DA) AND 8) <> 0
  183.     WEND
  184.     WHILE (INP(&h03DA) AND 8) = 0
  185.     WEND
  186.  
  187. Turbo Pascal:
  188.  
  189.     asm
  190.       mov     dx,03DAh
  191.     @1:
  192.       in      al,dx
  193.       test    al,8
  194.       jz      @1
  195.     @2:
  196.       in      al,dx
  197.       test    al,8
  198.       jnz     @2
  199.     end;
  200.  
  201. If you are using a monochrome display mode, use the port address 03BA hex
  202. instead of 03DA hex.
  203.  
  204. The vertical retrace synchronization described above introduces a delay, which
  205. of course slows down animation sequences.  What we really need is a guarantee
  206. that no two transfers occur to the same area within the same vertical retrace
  207. interval.  While synchronizing each fg_transfer call does guarantee this, the
  208. delay so introduced may be more than what is actually needed.
  209.  
  210. In some cases, you can instead force a small delay in each animation frame.
  211. The delay should be chosen so it is long enough to avoid vertical retrace
  212. conflicts, yet short enough not to degrade the animation speed.  Evidence
  213. suggests a delay of 9 milliseconds (about one-sixth of a 55 ms clock tick)
  214. works well.  You can achieve such a delay by calling fg_stall(delay/6), where
  215. "delay" is the value returned by the fg_measure function on a particular
  216. system.
  217.  
  218. Which of these two techniques works best depends to a great extent on your
  219. application.  We suggest trying each method to determine which one works best
  220. in the specific context of your application.
  221.  
  222. ------------------------------------------------------------------------------
  223.                                 New Functions
  224. ------------------------------------------------------------------------------
  225.  
  226. FG_PCXHEAD
  227.  
  228. Prototype
  229.  
  230.    int fg_pcxhead (char *pcx_file, char *pcx_header);
  231.    function FGpcxhead% (pcx_file$, pcx_header$)
  232.    integer*2 function fg_pcxhead (character*(*) pcx_file,
  233.       integer*1 pcx_header)
  234.    function fg_pcxhead (pcx_file : string; var pcx_header : byte) : integer;
  235.  
  236. Description
  237.  
  238.    Read a PCX file header.
  239.  
  240. Parameters
  241.  
  242.    pcx_file     The name of the PCX file, terminated by a zero byte.
  243.  
  244.    pcx_header   The buffer to receive the 128-byte PCX file header.
  245.  
  246. Return value
  247.  
  248.     0   Success
  249.    -1   The specified file does not exist.
  250.    -2   The specified file is not a PCX file.
  251.  
  252. Restrictions
  253.  
  254.    none
  255.  
  256.  
  257. FG_PCXMODE
  258.  
  259. Prototype
  260.  
  261.    int fg_pcxmode (char *pcx_header);
  262.    function FGpcxmode% (pcx_header$)
  263.    integer*2 function fg_pcxmode (integer*1 pcx_header)
  264.    function fg_pcxmode (var pcx_header : byte) : integer;
  265.  
  266. Description
  267.  
  268.    Determine the optimal video mode for the PCX image associated with
  269.    the specified PCX file header.
  270.  
  271. Parameters
  272.  
  273.    pcx_header   The buffer containing the 128-byte PCX file header.
  274.  
  275. Return value
  276.  
  277.    >0   The optimal video mode for displaying the PCX image.
  278.    -1   The pcx_header buffer does not contain a valid PCX file header.
  279.    -2   Cannot determine a compatible video mode.
  280.  
  281. Restrictions
  282.  
  283.    none
  284.