home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
PROGRAMM
/
FGL112B.ZIP
/
USERAPP.DOC
< prev
Wrap
Text File
|
1992-10-05
|
48KB
|
1,371 lines
Appendix A
Fastgraph Utilities
258 Fastgraph User's Guide
Overview
This appendix describes utilities for creating and managing pixel run
files used with the fg_dispfile routine. By default, the Fastgraph
installation procedure places these utilities in the \FG directory. To use
these utilities, you must either (1) copy the .EXE file from \FG to your
current directory, (2) make \FG your current directory, or (3) include the
\FG directory in your DOS path specification.
SNAPSHOT Utility
The SNAPSHOT utility is a terminate and stay resident program (TSR) to
capture graphic images. It stores the image in Fastgraph's standard pixel
run format. To load SNAPSHOT, just enter the command SNAPSHOT at the DOS
prompt, and you'll see messages similar to the following if SNAPSHOT loads
successfully.
C> SNAPSHOT
SNAPSHOT Version 1.01
Copyright (c) 1991 Ted Gruber Software. All Rights Reserved.
Press <alt>-<left shift> to activate.
After SNAPSHOT loads, control returns to the DOS prompt. At this point,
you can use any method whatsoever to display a graphic image and then press
the Alt and left shift keys at the same time to capture the image. You don't
need to load SNAPSHOT for each image capture, just once per system boot.
SNAPSHOT uses about 14,000 bytes of conventional memory once loaded.
To illustrate the use of SNAPSHOT, suppose you have drawn and saved an
image with a commercial paint program, and you want to incorporate this image
into a Fastgraph application. Once you load SNAPSHOT, start the paint
program and retrieve your image. Then press the Alt and left shift keys
simultaneously and wait for the success tone (three quick medium-pitched
sounds). Finally, exit the paint program to return to the DOS prompt.
The sequence described in the preceding paragraph will store the
captured image in Fastgraph's standard pixel run format, in a file named
SNAPSHOT.nnn in the current directory. The file type nnn will be the first
sequence of digits that does not result in a duplicate file name. That is,
if there are no captured image files in the current directory, SNAPSHOT will
use the file name SNAPSHOT.000. The next time you capture an image, SNAPSHOT
will store it in SNAPSHOT.001, then SNAPSHOT.002, and so forth. If you
rename or delete one of these files, SNAPSHOT will again use that file name.
For example, if you delete SNAPSHOT.000 but keep SNAPSHOT.001, SNAPSHOT will
store the next image it captures in SNAPSHOT.000.
If SNAPSHOT is unable to capture the image, it will produce its error
tone (a single low-pitched sound). The most common cause of this is trying
to capture an image from a text video mode, but it also will occur if there
is not enough disk space or if all 1,000 image file names are already being
used.
Appendix A: Fastgraph Utilities 259
CLIP Utility
The SNAPSHOT utility described in the previous section captures the
entire screen. While this might be desirable in some cases, other times
you'll just need a portion of the screen. CLIP is an interactive utility
that you can use to reduce the size of any image stored in Fastgraph's
standard or packed pixel run format. The syntax of the command for invoking
the CLIP utility from the DOS prompt is
CLIP input_file output_file options
where input_file is the name of the original image file, and output_file is
the name of the new image file. CLIP does not modify the input_file in any
way, but it will overwrite the output_file if an identically named file
exists in the current directory. The options list specifies one or more
optional switches as shown below.
option meaning
/M:mode Specifies the video mode number in which to
display the image. The mode value must be an
integer between 0 and 23. If that video mode
is a text mode, an unsupported graphics mode,
or an unavailable graphics mode, CLIP
displays an error message stating this. If
the /M switch is not present, CLIP uses the
first available video mode from the list 16,
15, 19, 13, 9, 4, 12.
/P Indicates the input_file is in Fastgraph's
packed pixel run format. If the /P switch is
not present, CLIP assumes it is in standard
pixel run format. The output_file will be in
the same format as the input_file.
/W:width Specifies the image width in pixels. The
width value must be an integer between 1 and
the horizontal resolution of the selected
video mode. If the /W switch is not present,
CLIP uses the horizontal resolution of the
selected video mode.
For example, if you wanted to create the image file PARTIAL.PPR from the
packed pixel run file SCREEN.PPR, and use the native 320 by 200 EGA graphics
video mode (mode 13), you would start CLIP with the following command.
CLIP PARTIAL.PPR SCREEN.PPR /P /M:13
Because no /W switch appears in the above command and the horizontal
resolution of mode 13 is 320 pixels, CLIP assumes the image width is 320
pixels.
260 Fastgraph User's Guide
When CLIP displays the image and the plus-shaped cursor, you are ready
to define one corner of the clipping region (that part of the image used to
create the output_file). To do this, use the directional keys on the numeric
keypad to move the cursor to the desired position, then press the Enter key.
You are then ready to define the clipping region's opposite corner. Again,
use the directional keys to move the cursor to the desired position. When
defining the second corner, however, CLIP uses a rectangular box instead of
the plus-shaped cursor to simplify marking the clipping region's boundaries.
After you press Enter to define the second corner, CLIP creates the
output_file and displays the resulting image width and the number of pixel
runs the image contains.
CLIP includes some features that may help you define the clipping
region. You can change the distance the cursor moves in response to the
directional keys, display the current (x,y) pixel coordinates of the cursor,
and change the cursor color. The following table explains the keystrokes
that CLIP recognizes when you are defining the clipping region.
key meaning
F1 Displays the (x,y) coordinate bar at the top
of the screen. If the coordinate bar is
already on, F1 removes it.
F2 Displays the (x,y) coordinate bar at the
bottom of the screen. If the coordinate bar
is already on, F2 removes it.
F3 Changes the cursor or box color from white to
black, or from black to white.
F4 Displays a summary of the keys CLIP
recognizes when defining the clipping region.
KP1 Moves the cursor one unit down and to the
left.
KP2 Moves the cursor one unit down.
KP3 Moves the cursor one unit down and to the
right.
KP4 Moves the cursor one unit to the left.
KP6 Moves the cursor one unit to the right.
KP7 Moves the cursor one unit up and to the left.
KP8 Moves the cursor one unit up.
KP9 Moves the cursor one unit up and to the
right.
+ Increases the unit of cursor movement by one
pixel. The default cursor movement is one
pixel.
- Decreases the unit of cursor movement by one
pixel.
Enter Defines a corner of the clipping region
at the cursor position.
Esc Exits to DOS without creating the
output_file. CLIP will first issue an "Exit
to DOS?" prompt in case you pressed the Esc
key accidentally.
Appendix A: Fastgraph Utilities 261
The CLIP utility requires two video pages to run. Thus, you cannot use
it in video modes 17, 18, and 23 because they have only one physical video
page and no virtual video pages.
CONVERT Utility
The CONVERT utility lets you translate files between Fastgraph's
supported image file formats. The syntax of the command for invoking CONVERT
from the DOS prompt is
CONVERT input_file output_file
where input_file is the name of the original image file, and output_file is
the name of the new translated image file. CONVERT does not modify the
input_file in any way, but it will overwrite the output_file if an
identically named file exists in the current directory.
By default, the file type of the input_file and output_file determine
the image format of that file. If the file type is .PPR, CONVERT assumes the
image is in Fastgraph's packed pixel run format. If the file type is .SPR,
CONVERT assumes it is in the Fastgraph's standard pixel run format. If your
image files use other file types, you can explicitly specify the file's image
format by appending one of the switches /PPR or /SPR to the file name. The
input_file and output_file must not both specify the same image format
(CONVERT will display an error message if this is so).
The following command will translate the standard pixel run file
PICTURE.SPR to packed format. The packed image will be stored in the file
PICTURE.IMG, so we must append the switch /PPR to tell CONVERT that it will
be a packed file.
CONVERT PICTURE.SPR PICTURE.IMG/PPR
EDITSPR Utility
The EDITSPR utility changes all pixel runs of one color to another color
in an image file stored in Fastgraph's standard pixel run (.SPR) format. The
syntax of the command for invoking the EDITSPR utility from the DOS command
prompt is
EDITSPR input_file output_file
where input_file is the name of the original image file, and output_file is
the name of the new image file. EDITSPR does not modify the input_file in
any way, but it will overwrite the output_file if an identically named file
exists in the current directory.
After it reads the pixel runs from the input_file, EDITSPR will perform
the requested color changes. It does this iteratively by asking for an old
color value followed by a new color value (each value must be between 0 and
262 Fastgraph User's Guide
255). EDITSPR then finds the pixel runs of the old color value and changes
them to the new color value. Following this, EDITSPR displays a message
stating how many pixel runs it changed. This process repeats until you enter
a negative number for either color value.
EDITSPR will next combine adjacent pixel runs of like colors. For
example, suppose the original image file contained a color 1 pixel run of
length 50, followed by a color 2 pixel run of length 20, followed by another
color 1 pixel run of length 10. If you changed all color 2 pixel runs to
color 1, EDITSPR will combine these three pixel runs into a single run of
length 80.
Finally, EDITSPR will close the output_file.
GrabRGB Utility
The GrabRGB utility is a terminate and stay resident program (TSR) to
capture the current red, green, and blue color components of video DAC
registers in the 256-color MCGA and VGA graphics modes. You can use GrabRGB
together with Fastgraph's SNAPSHOT utility to preserve the original colors of
a captured image.
To load GrabRGB, just enter the command GRABRGB at the DOS prompt.
After GrabRGB loads, control returns to the DOS prompt. At this point, you
can use any method whatsoever to display a 256-color graphic image and then
press the Alt and right shift keys at the same time to capture the current
DAC values. You don't need to load GrabRGB for each image, just once per
system boot. GrabRGB uses about 15,000 bytes of conventional memory once
loaded.
To illustrate the use of GrabRGB, suppose you have drawn and saved a
256-color image with a commercial paint program, and you want to incorporate
this image into a Fastgraph application. Once you load SNAPSHOT and GrabRGB,
start the paint program and retrieve your image. Then press the Alt and left
shift keys to capture the image with SNAPSHOT. After SNAPSHOT's success tone
(three quick medium-pitched sounds), press Alt and right shift to capture the
RGB components of each DAC register with GrabRGB, and wait for GrabRGB's
success tone. Finally, exit the paint program and return to the DOS prompt.
The sequence described in the preceding paragraph will write the RGB
color components for each DAC register to a file named GRABRGB.nnn in the
current directory. The file type nnn will be the first sequence of digits
that does not result in a duplicate file name. That is, if there are no
GrabRGB output files in the current directory, GrabRGB will use the file name
GRABRGB.000. The next time you use GrabRGB, it will store the RGB
information in GRABRGB.001, then GRABRGB.002, and so forth. If you rename or
delete one of these files, GrabRGB will again use that file name. For
example, if you delete GRABRGB.000 but keep GRABRGB.001, GrabRGB will next
use the file name GRABRGB.000.
If GrabRGB is unable to obtain the RGB components of each DAC register,
it will produce its error tone (a single low-pitched sound). The most common
cause of this is trying to capture an image from a text video mode, or from a
graphics video mode with fewer than 256 colors. It also will occur if there
is not enough disk space or if all 1,000 output file names are already being
used.
Appendix A: Fastgraph Utilities 263
Each line in the output file created by GrabRGB is of the form
nnn,rr,gg,bb,
where nnn is a DAC register index (between 0 and 255), rr is the red
component of that DAC register, gg is the green component, and bb is the blue
component. Each color component is between 0 and 63. You can edit and
reformat these lines as necessary for inclusion in a C initializer list, a
QuickBASIC or FORTRAN data statement, or a Turbo Pascal array-type constant
list. Such an array of RGB components, but without the nnn indices, is in
the format expected by fg_setdacs.
By default, GrabRGB captures information for all 256 DAC registers. If
you want to consider only the DAC registers with color components different
from their initial values, just include the /D option when you load GrabRGB
(that is, use the command GRABRGB /D). If you specify the /D option and all
256 DACs use their default values, the output file will contain a message
stating this.
HERCFIX Utility
The HERCFIX utility allows you to use SNAPSHOT (and possibly other TSRs)
with programs that do not update the BIOS data area when establishing the
720x348 Hercules graphics mode. If you use SNAPSHOT with such a program, it
will think the monochrome text mode (video mode 7) is active and will produce
its low-pitched error tone when activated.
If this occurs, use HERCFIX to load the application from which you are
trying to capture the image. To do this, enter
HERCFIX command
at the DOS prompt, where command is the command that starts the application.
For example, suppose you use the command PAINTER /H to run a commercial paint
program in Hercules graphics mode. To load the paint program with HERCFIX,
you would enter the command HERCFIX PAINTER /H.
264 Fastgraph User's Guide
Appendix B
Using Fastgraph
from Assembly Language
266 Fastgraph User's Guide
Fastgraph uses the same naming and calling conventions as Microsoft C
and Turbo C. The details of these conventions that are important to assembly
language programming are summarized below. If you are calling Fastgraph
routines from an assembly language program, the program must follow these
conventions.
All arrays and pointers are passed by reference
All other items are passed by value
Arguments are pushed onto the stack in reverse order
16-bit function values are returned in the AX register
32-bit function values are returned in the DX:AX register pair
Fastgraph routine names are prefixed with an underscore character
The small and medium model Fastgraph libraries pass arrays and pointers by
near reference, while the large model library does so by far reference. This
is consistent with the run-time libraries for the supported compilers.
All Fastgraph routines preserve the BP, DS, DI, and SI registers. The
contents of any other registers are unknown upon return from a Fastgraph
routine (except for the AX register, which will either contain zero or the
routine's return value).
The following DOS commands show how to assemble a program (using the
Microsoft Macro Assembler) and then link it with Fastgraph. In all cases,
we'll assume the file EXAMPLE.ASM contains the source code for the program.
The resulting executable file will be called EXAMPLE.EXE.
small memory model
MASM EXAMPLE.ASM;
LINK /CP:4096 /E EXAMPLE,,NUL.MAP,FGS
medium memory model
MASM EXAMPLE.ASM;
LINK /CP:4096 /E EXAMPLE,,NUL.MAP,FGM
large memory model
MASM EXAMPLE.ASM;
LINK /CP:4096 /E EXAMPLE,,NUL.MAP,FGL
Example B-1 calls the fg_getmode, fg_setmode, fg_reset, and fg_version
routines from an assembly language program. The fg_getmode routine returns
its function value in the AX register. The fg_setmode routine has a single
argument, while fg_reset has no arguments. The fg_version routine has two
arguments, both passed by reference. Notice how they are pushed on the stack
in reverse order. This example would work with either the medium or large
memory model Fastgraph libraries. To make it work with the small model
library, all you would need to do is change the word "far" to "near" in the
EXTRN declarations, and change the name of the code segment from "main_TEXT"
to "_TEXT".
Appendix B: Using Fastgraph from Assembly Language 267
Example B-1.
EXTRN _fg_getmode:far ; Fastgraph's GETMODE routine
EXTRN _fg_reset:far ; Fastgraph's RESET routine
EXTRN _fg_setmode:far ; Fastgraph's SETMODE routine
EXTRN _fg_version:far ; Fastgraph's VERSION routine
stackseg SEGMENT stack ; suppress the linker's
stackseg ENDS ; "no stack segment" error message
_DATA SEGMENT word public 'DATA'
major dw ? ; major version number
minor dw ? ; minor version number
old_mode dw ? ; original video mode
_DATA ENDS
dgroup GROUP _DATA
ASSUME cs:main_TEXT,ds:dgroup
main_TEXT SEGMENT byte public 'CODE'
start: mov ax,_DATA ; load segment location
mov ds,ax ; into DS register
call _fg_getmode ; AX = current video mode
mov old_mode,ax ; save it
mov ax,4 ; use video mode 4
push ax ; pass argument to SETMODE
call _fg_setmode ; establish CGA four-color mode
add sp,2 ; remove SETMODE argument
push old_mode ; pass argument to SETMODE
call _fg_setmode ; restore original video mode
add sp,2 ; remove SETMODE argument
call _fg_reset ; restore screen attributes
lea ax,minor ; get address of minor variable
push ax ; pass argument #2 to VERSION
lea ax,major ; get address of major variable
push ax ; pass argument #1 to VERSION
call _fg_version ; get the Fastgraph version number
add sp,4 ; remove VERSION arguments
mov ah,76 ; function 76: terminate process
xor al,al ; errorlevel 0
int 21h ; exit to DOS
main_TEXT ENDS
END start
268 Fastgraph User's Guide
Appendix C
Interrupts and Fastgraph
270 Fastgraph User's Guide
Interrupts Used by Fastgraph
DOS maintains an interrupt vector table that contains the addresses of
256 interrupt handlers, or routines, that perform various functions. The
handlers are usually referenced by their hexadecimal interrupt number,
between 00 and FF. Of these, only interrupts 60 through 66 and F1 through FF
are not used by DOS, the ROM BIOS, or other software and are thus available
for user applications.
Certain Fastgraph routines use some of the available interrupts.
Namely, the fg_music routine uses interrupt 60, the asynchronous sound
routines (fg_musicb, fg_sounds, and fg_voices) use interrupts 60 and 61, and
all Fastgraph/Light routines use interrupt 62. If your program defines its
own interrupt handlers, it must not use any of the interrupts reserved for
Fastgraph (unless, of course, it doesn't use any of the Fastgraph routines
that would create a conflict).
Extending the Time-of-Day Interrupt
As mentioned in Chapter 14, the BIOS time-of-day clock is incremented by
an interrupt handler. The routine that does this is interrupt 08, a hardware
interrupt automatically activated 18.2 times per second. After incrementing
the clock, interrupt 08 invokes interrupt 1C, which by default references a
"do-nothing" interrupt handler. While changing interrupt 08 can be tricky,
it is fairly straightforward to define our own handler for interrupt 1C.
This handler also will be executed automatically 18.2 times per second.
Example C-1 illustrates how to do this.
When we discussed joysticks in Chapter 12, we said there were two ways
to monitor joystick button status. One is to intersperse calls to the
fg_button routine at strategic places in your program and then take necessary
action depending on the button status. However, the problem with this scheme
is the chance of missing a button press -- if you press the joystick button
and then release it between calls to fg_button, the program will not detect
the joystick activity. A preferable method is to call fg_button from a
handler for interrupt 1C, which essentially provides continuous monitoring of
the joystick buttons. When we need the button status within our program, all
we need to do is examine a global variable.
Example C-1 consists of a main program (written in C) and an assembly
language subroutine named int1C (suitable for the medium memory model). The
main program calls int1C to define a handler for interrupt 1C. In response
to any keystroke (except Escape), the program displays the button press
information for each joystick since the previous keystroke (refer to the
discussion of the fg_button routine for the meanings of the status values).
When you press the Escape key, the program exits to DOS, but not before
calling int1C to restore the original interrupt 1C handler.
Example C-1 (main program).
#include <fastgraf.h>
#include <stdio.h>
void main(void);
#define ESC 27
Appendix C: Interrupts and Fastgraph 271
int status1, status2;
void main()
{
unsigned char key, aux;
int1C(1);
status1 = 0;
status2 = 0;
do {
printf("\n");
printf("Joystick 1 status: %d\n",status1);
printf("Joystick 2 status: %d\n",status2);
status1 = 0;
status2 = 0;
fg_getkey(&key,&aux);
}
while (key != ESC);
int1C(0);
}
We'll now examine the int1C assembly language subroutine. It actually
consists of three parts: a portion to enable our interrupt handler, our
handler itself, and a portion to disable the handler. When we call int1C
with a nonzero argument, it saves the original data segment (so we can access
the global variables within the handler), saves the original handler's
address (called the vector) for interrupt 1C, and then enables our handler,
which takes the form of a far procedure.
The handler routine then begins to be activated at 18.2 times per
second. After saving all the important registers, the handler calls the
Fastgraph routine fg_button twice, once for each joystick. The return values
are logically ORed with the status1 and status2 C global variables to update
the button status information. Finally, the handler restores the original
registers and returns control to the point of the interrupt.
Before the main program exits, it calls int1C with a zero argument to
restore the original handler for interrupt 1C. No provision is made in the
program to check if we had previously defined our own handler (and hence
saved the original interrupt 1C vector), but this could be added with little
difficulty.
Example C-1 (assembly language subroutine).
EXTRN _status1:word ; C global variable for button 1 status
EXTRN _status2:word ; C global variable for button 2 status
EXTRN _fg_button:far ; Fastgraph routine
272 Fastgraph User's Guide
int1C_TEXT SEGMENT byte public 'CODE'
ASSUME cs:int1C_TEXT
int1C_CS dw ? ; holds original INT 1C segment address
int1C_IP dw ? ; holds original INT 1C offset
orig_DS dw ? ; holds original data segment
_int1C PROC far
PUBLIC _int1C
push bp ; save caller's BP register
mov bp,sp ; make BP point to argument list
push si ; save caller's SI register
push di ; save caller's DI register
mov dx,[bp+6] ; get the flag parameter
or dx,dx ; replace the old interrupt handler?
jz replace ; yes, branch to that processing
; define a new handler for INT 1C
define: mov ax,ds ; put current data segment in AX
mov cs:orig_DS,ax ; save it in the control information area
mov al,1Ch ; interrupt vector to save
mov ah,53 ; function 53: get interrupt vector
int 21h ; get the interrupt vector
mov cs:int1C_CS,es; save the segment
mov cs:int1C_IP,bx; save the offset
Appendix C: Interrupts and Fastgraph 273
push ds ; save our DS register
mov dx,offset handler ; get offset of interrupt handler
mov ax,seg handler; get segment of interrupt handler
mov ds,ax ; put it in DS
mov al,1Ch ; interrupt vector to change
mov ah,37 ; function 37: set interrupt vector
int 21h ; change the INT 1C vector to our handler
pop ds ; restore our DS register
jmp short return ; return to the caller
; replace the original handler for INT 1C
replace: push ds ; save our DS register
mov dx,cs:int1C_IP; put original INT 1C offset in DX
mov ds,cs:int1C_CS; put original INT 1C segment in DS
mov ah,37 ; function 37: set interrupt vector
mov al,1Ch ; interrupt vector 1C
int 21h ; restore original INT 1C vector
pop ds ; restore our DS register
return: xor ax,ax ; in case int1C was called as a function
pop di ; restore our DI register
pop si ; restore our SI register
pop bp ; restore our BP register
ret
_int1C ENDP
274 Fastgraph User's Guide
handler PROC far ; interrupt handler that replaces INT 1C
cli ; disable interrupts while handler active
push ax ; save registers that may be altered
push bx
push cx
push dx
push di
push si
push ds
push es
mov ds,cs:orig_DS ; retrieve the original data segment
mov ax,1 ; use joystick 1
push ax ; pass joystick number to button routine
call _fg_button ; AX = button status for joystick 1
add sp,2 ; remove the argument
or _status1,ax ; update status variable for joystick 1
mov ax,2 ; use joystick 2
push ax ; pass joystick number to button routine
call _fg_button ; AX = button status for joystick 2
add sp,2 ; remove the argument
or _status2,ax ; update status variable for joystick 2
pop es ; restore altered registers
Appendix C: Interrupts and Fastgraph 275
pop ds
pop si
pop di
pop dx
pop cx
pop bx
pop ax
iret ; return from the interrupt routine
handler ENDP
int1C_TEXT ENDS
END
The example just presented is not meant to be a tutorial on interrupts;
there are many good references on DOS that explain them in detail. However,
an example specific to Fastgraph should be helpful.
276 Fastgraph User's Guide
Appendix D
Contents of the
Compiler-Specific Libraries
278 Fastgraph User's Guide
For each of the supported Fastgraph compilers except QuickBASIC, there
is a compiler-specific Fastgraph library (also called the extended Fastgraph
library) that contains the following routines:
fg_circlew fg_getworld fg_rectw fg_setworld
fg_clprect fg_initw fg_restorew fg_swchar
fg_dashrw fg_moverw fg_savew fg_swlength
fg_dashw fg_movew fg_setangle fg_swtext
fg_drawrw fg_paintw fg_setclipw fg_xscreen
fg_draww fg_panw fg_setratio fg_xworld
fg_drectw fg_pointw fg_setsize fg_yscreen
fg_ellipsew fg_polygonw fg_setsizew fg_yworld
These routines use the world space coordinate system, either directly or
internally. Note that none of them are included in Fastgraph/Light.
As mentioned in Chapter 1, if your program uses any of these routines,
you must link it with the standard Fastgraph library (FGx.LIB) and the
compiler-specific Fastgraph library (FGcccx.LIB).
Index 279
I n d e x
8253-5 programmable timer chip 234
Active page 119
Animation 188
dynamic frame 194
dynamic page flipping 196
page flipping 196
simple 188
static frame 192
static page flipping 196
summary 198
XOR 190
ANSI.SYS 28, 29
Assembly language 266
Attribute 48, 104, 105
Available memory 254
Background color 49, 50
Bit maps 136
CGA 141, 142, 149
EGA 144, 151
filler bits 137
Hercules 144
MCGA 145
memory requirements 172
mode-independent 136
mode-specific 140
PCjr 143, 151
retrieving 169
subscript order 137, 138, 147
Tandy 143, 151
text modes 146
VGA 144, 145, 151
Bit-mapped characters 114
Borland C++ 3, 7
Byte boundary 174, 175
CapsLock 212-214
CGA palettes 51
Character cells 18
Character space 40, 100
Characters
bit-mapped 114
hardware 101
software 108
Circles 83, 84
Clearing the screen 76
CLIP 259, 260
/M option 259
/P option 259
/W option 259
Clipping 76
Clock tick 248-250
Clock tick interrupt 239, 241, 248
Closed shapes 83
Color 48
Color indices 69
280 Fastgraph User's Guide
Color number 50
Color value 50
Compilation 5
Compiler-specific Fastgraph library 278
CONVERT 261
/PPR switch 261
/SPR switch 261
Coordinate conversion 44, 107
Current color 50
Cursor mask 220, 222
Dash pattern 82
Delay units 249, 250
Display patterns 158
CGA 159, 160
EGA 161
Hercules 161
MCGA 162, 163
PCjr 160
Tandy 160
VGA 162, 163
Dithering 88
Dithering matrix 89
alignment 94
CGA 89, 90
EGA 92
Hercules 91
MCGA 93
PCjr 91
Tandy 91
VGA 92, 93
EDITSPR 261, 262
Ellipses 83, 84
EMM386.EXE 129
EMS 129
Expanded memory 129
Expanded Memory Manager 129
Extended Fastgraph library 278
Extended memory 129
Fade 66, 67
FASTGRAF.BI 6
FASTGRAF.H 5
Fastgraph 2
Fastgraph routines
fg_allocate 122, 124, 125, 127, 129, 132, 175, 178, 254
fg_alloccms 129
fg_allocems 129, 132
fg_allocxms 129, 132
fg_automode 33, 34, 36, 77, 84, 86, 206
fg_bestmode 30, 34, 35, 36, 95, 122, 124, 125
fg_box 87, 96
fg_boxdepth 87, 88, 96
fg_button 228, 229, 231, 270, 271
fg_capslock 213, 231
fg_chgattr 104, 114
fg_chgtext 104, 114
fg_circle 84, 85, 96
Fastgraph routines (continued)
fg_circlew 84, 96
fg_clipmask 166, 167, 184
fg_clpimage 148, 149, 150, 166, 167, 169, 184
fg_clprect 86, 96, 188, 195, 196
fg_clprectw 86, 96
fg_copypage 129, 131, 133, 175, 176, 184
fg_cursor 28, 36, 73, 105, 178
fg_dash 82, 96
fg_dashrel 82, 97
fg_dashrw 82, 97
fg_dashw 82, 97
fg_defcolor 70, 73, 94
fg_dispfile 157, 158, 184, 198, 258
fg_display 153-158, 184, 198
fg_displayp 154, 155, 156-158, 184, 198
fg_disppcx 164, 166, 184
fg_draw 79, 80, 97, 204
fg_drawmap 114, 136, 138-141, 152, 166, 168-172, 181, 185, 198,
222, 226
fg_drawmask 166, 167, 168, 185
fg_drawrel 79, 80, 95, 97
fg_drawrw 79, 97
fg_draww 79, 97
fg_drect 88, 89, 92, 93, 94, 97
fg_drectw 89, 94, 97
fg_drwimage 114, 141, 142-144, 146, 147, 148-150, 152, 166,
167-169, 172, 185, 198, 226
fg_egacheck 32, 36
fg_ellipse 84, 85, 97, 192
fg_ellipsew 84, 97
fg_erase 76, 97
fg_fadein 200, 201, 208
fg_fadeout 200, 208
fg_flipmask 166, 167, 185
fg_flpimage 149, 150, 166, 167, 169, 185
fg_freepage 122, 124, 125, 129, 132, 133, 254
fg_getaddr 127, 128, 133
fg_getattr 105, 114
fg_getchar 105, 114
fg_getclock 249, 251
fg_getcolor 49-51, 57, 73
fg_getdacs 66, 67, 73
fg_gethpage 176, 185
fg_getimage 105, 169, 172, 173, 185, 198
fg_getindex 73
fg_getkey 212, 231
fg_getlines 31, 36
fg_getmap 169-173, 181, 185, 198
fg_getmaxx 41, 42, 44, 86
fg_getmaxy 41, 42, 44, 86
fg_getmode 30, 36, 266
fg_getpage 127, 133
fg_getpixel 76, 77, 97
fg_getrgb 65, 66, 73
fg_getvpage 127, 133
fg_getworld 43, 44
fg_getxjoy 228-231
282 Fastgraph User's Guide
Fastgraph routines (continued)
fg_getxpos 79, 97
fg_getyjoy 228-231
fg_getypos 79, 97
fg_hush 240, 242, 244
fg_hushnext 240, 242, 243, 244
fg_imagesiz 172, 173, 185
fg_initems 129, 132, 133
fg_initjoy 132, 227, 228, 231
fg_initw 42, 44, 79, 108, 109
fg_initxms 129, 132, 133
fg_intjoy 229-231
fg_intkey 212, 213, 229, 231, 242, 248, 249
fg_locate 101-103, 107, 114, 120, 126, 173
fg_makepcx 164, 166, 185
fg_maprgb 68, 73
fg_measure 250, 251
fg_memavail 254, 256
fg_mousebut 218, 219, 231
fg_mousecur 220, 221, 231
fg_mouseini 132, 215, 216, 219, 231
fg_mouselim 216, 217, 231
fg_mousemov 216, 217, 231
fg_mousepos 218, 219, 231
fg_mouseptr 220, 225, 231
fg_mousespd 217, 231
fg_mousevis 216, 217, 219, 232
fg_move 79, 80, 82, 95, 98, 139, 140, 156, 170, 173, 181, 204
fg_moverel 79, 80, 98
fg_moverw 79, 98
fg_movew 79, 98
fg_music 237-239, 242, 244, 270
fg_musicb 242-244, 270
fg_numlock 213, 232
fg_paint 95, 98, 204
fg_paintw 95, 98
fg_palette 51-60, 62, 64, 65, 68, 69, 74
fg_palettes 69, 74
fg_pan 205-208
fg_panw 205, 206, 208
fg_pattern 158, 159, 163, 185
fg_playing 240, 243, 244
fg_point 76, 77, 98
fg_pointw 76, 98
fg_polygon 83, 98
fg_polygonw 83, 98
fg_quiet 234, 236, 237, 244
fg_rect 60, 65, 86, 87, 88, 98, 107, 120, 138, 141, 178, 188, 195
fg_rectw 86, 98, 113
fg_reset 29, 30, 36, 266
fg_resize 131-133, 207, 208
fg_restore 176-180, 185, 195, 201
fg_restorew 177, 185
fg_resume 243, 244
fg_revimage 149, 150, 166, 167, 169, 185
fg_revmask 166, 167, 185
Index 283
Fastgraph routines (continued)
fg_save 176-180, 185
fg_savew 177, 185
fg_scrlock 213, 232
fg_scroll 202-204, 208
fg_setangle 112, 114
fg_setattr 48-50, 74, 101, 102, 104, 114, 120, 121, 123, 125
fg_setcaps 214, 232
fg_setclip 76, 98, 148
fg_setclipw 76, 98
fg_setcolor 28, 49, 50, 51-60, 62, 64, 65, 74, 76, 79, 82, 92, 93,
101, 104, 108, 115, 120, 121, 123, 125, 138, 189, 190, 202,
203
fg_setdacs 66, 67, 74, 263
fg_setfunc 190, 255, 256
fg_sethpage 176, 177, 178, 185, 200, 202
fg_setlines 31, 36
fg_setmode 28, 30, 37, 50, 51, 57, 64, 69, 70, 76, 77, 79, 84, 86,
91, 92, 101, 102, 104, 109, 119, 120, 126, 132, 151, 159, 160,
161, 162, 210, 215, 227, 266
fg_setnum 214, 232
fg_setpage 119, 120, 133, 177
fg_setratio 109, 111, 115
fg_setrgb 53, 56, 60, 62, 64-66, 68, 73, 74, 163
fg_setsize 109, 115
fg_setsizew 109, 115
fg_setvpage 119, 128, 133, 196, 216
fg_setworld 42-44, 109
fg_sound 234-237, 239, 240, 245
fg_sounds 239, 240, 242, 245, 270
fg_stall 249-251
fg_suspend 243-245
fg_swchar 108-113, 115
fg_swlength 113, 115
fg_swtext 112, 113, 115
fg_tcmask 183, 185
fg_tcxfer 183, 186
fg_testmode 29, 30, 35, 37, 120, 122, 151, 177, 236
fg_text 28, 101, 102, 103, 104, 108, 115, 119
fg_transfer 179, 180, 181-183, 186, 194, 195, 196, 201
fg_version 5, 266
fg_voice 235-237, 239, 240, 241, 245
fg_voices 240-242, 245, 270
fg_waitfor 66, 188, 194, 196, 204, 206, 213, 217, 237, 248-251
fg_waitkey 29, 212, 232
fg_where 102, 103, 115, 126
fg_xalpha 44, 107, 115
fg_xconvert 44, 45, 107, 115
fg_xscreen 44, 45, 77
fg_xworld 44, 45, 79
fg_yalpha 44, 107, 115
fg_yconvert 44, 45, 107, 115
fg_yscreen 44, 45, 77
fg_yworld 44, 45, 79
Fastgraph/Light 2
Fastgraph/Light Video Driver 2, 16
284 Fastgraph User's Guide
FGDRIVER 16
/U option 16
FGTP unit 6
FGTPX unit 6
Filler bits 137
Foreground color 48, 49
FORTRAN see Microsoft FORTRAN
Game port 227
GrabRGB 158, 262, 263
/D option 263
output file format 263
Graphics cursor 79
Graphics modes 18, 21, 50
CGA 21, 51, 52
EGA 23, 56, 58, 59
extended VGA 24
Hercules 22, 54, 55
MCGA 24, 61, 64
native EGA 23
native VGA 24
PCjr 22, 53
Tandy 53
Tandy 1000 22
VGA 24, 61, 63, 64
Hardware characters 101
graphics modes 105
side effects 106
text modes 101
HERCFIX 263
Hidden page 119, 176
HIMEM.SYS 129
Hot spot 224
Image array 147
Image transfer routines 175
Images 136
clipped 148
regular 141
reversed 149
reversed clipped 149
INCLUDE environment variable 5, 6
Input devices 210
INSTALL program 4
/L option 4
Installation 4
Interrupts 270
INTRFACE.FOR 6
Joystick 227
button status 228, 229, 270
calibration 228
characteristics 228
horizontal position 228
initialize 227
keyboard emulation 229
special considerations 230
vertical position 228
Index 285
Keyboard 210
extended codes 210
standard codes 210
Keyboard buffer 212, 249
Keyboard state light 214
Lines
dashed 82
solid 79
Linking 5
Logical pages 129
creating 129
releasing 129
Masking map 166, 167
Memory models 3
large 3
medium 3
small 3
Memory update function 255
Mickeys 217
Microsoft C 3, 8
Microsoft FORTRAN 3, 9
Microsoft Mouse 215
Microsoft QuickBASIC 3, 10
Microsoft QuickC 3, 11
Mode X 26
Mouse 214
button status 218
CGA Considerations 226
cursor 216, 220
cursor mask 220, 222
cursor visibility 216
default cursor 222
hot spot 224
initialize 215
limits 216
position 216, 218
screen mask 220, 222
screen updates 216
speed 217
Mouse cursor 216, 220
graphics modes 222
hot spot 224
text modes 220
Mouse driver 215
Music 237
asynchronous 242
restarting 243
stopping 242
suspending 243
synchronous 237
Music commands 237
Music string 237, 242
Musical notes 237
Naming conventions 4
NumLock 212-214
Overscan 51
Packed pixel run map 154, 155
286 Fastgraph User's Guide
Palette 19
Palette number 53, 56, 58, 59, 62
Palette registers 53, 56, 58, 59, 61, 63, 69, 70
Palette value 53, 56, 58, 59
Palettes 53, 56, 58, 59, 61, 63
Panning 131, 207
PC Paintbrush 164
PCOPTION environment variable 5
PCX file
creating 164
displaying 164
video mode compatibility 165
PCX images 164
Periodic noise 236
Physical pages 118
Pixel bleeding 226
Pixel run 152
Pixel run file 156-158, 258
Pixel run map 152, 153, 158
Pixels 18
Points 76
Polygons 83
Power C 3, 13
Put_string 103
QuickBASIC see Microsoft QuickBASIC
QuickC see Microsoft QuickC
Real-time operations 248
Rectangles
dithered 88
solid 86
unfilled 87
Region fill 95
Register preservation 266
Resolution 18
Reverse video 104
RGB color mapping 68
Screen dissolving 200
Screen mask 220, 222
Screen origin 205
Screen space 40, 41
Scrolling 202
circular 202
end-off 202
Scrolling increment 202
Scrolling region 202
ScrollLock 212, 213
Shadow 104
Sliding tone 235
SNAPSHOT 158, 258, 259, 262, 263
error tone 258
image files 258
success tone 258
Software characters 108
alternate font 108, 109, 112
angle 112
aspect ratio 109
Software characters (continued)
font change operator (\) 109
primary font 108, 109
size 109
string length 113
subscript operator (\v) 110
superscript operator (\^) 110
underline operator (_) 110
Sound 234
asynchronous 239
disk accesses during 239
duration 234
frequency 234
PCjr 234
stopping 242
synchronous 234
Tandy 234
volume 234
Sound effects 234-236
Splitter cable 227Standard color set 50
Strlen 103
Stroke characters 108
Texas Instruments SN76496A sound chip 234
Text cursor 28, 101, 126
Text modes 18, 19, 48
43 lines 31
50 lines 31
color 48
monochrome 49
TI sound chip 234
Transparent color 183
Turbo C 3, 14
Turbo C++ 3, 14
Turbo Pascal 3, 15
Utilities 258
Vector characters 108
Video DAC registers 61, 62, 63-66, 69
Video modes 18
mode 00 20
mode 01 20
mode 02 20
mode 03 20
mode 04 21
mode 05 21
mode 06 22
mode 07 20
mode 09 22
mode 11 23
mode 12 23
mode 13 23
mode 14 24
mode 15 24
mode 16 24
mode 17 25
mode 18 25
mode 19 25
mode 20 25
Index 287
Video modes (continued)
mode 21 25
mode 22 26
mode 23 26
mode X 26
summary 18
Video page 118
Video page resizing 207
Video pages 19
active 119
hidden 119, 176
information 127
logical 129
physical 118
resizing 131
segment address 127
virtual 118, 122
visual 119
Video subsystem 19
Virtual colors 69, 70
Virtual pages 118
creating 122
releasing 122
special considerations 128
Visual effects 201
Visual page 119
Warbling 235
White noise 236
World space 40, 42
XMS 129