home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
flash-c1.zip
/
CH2_2.DOC
< prev
next >
Wrap
Text File
|
1990-02-11
|
28KB
|
1,236 lines
..pgno26
..foot63A2-##
..head02L──────────────────────────────────────────────────────────────────────
..head04L──────────────────────────────────────────────────────────────────────
..head03AGetScrn
■ Description
Read the character and attribute bytes starting from specified
position on the screen into the buffer.
■ Declaration
void FPENTRY GetScrn( INT x, INT y, INT NWords, CHAR PTR Buffer );
x column to begin reading data from the screen.
y row to begin reading data from the screen.
NWords number of words to read from the display screen.
Buffer data area where the data from the display screen will be
placed.
■ Remarks
This procedure provides additional checks for vertical and
horizontal retrace periods on a CGA video adapter. This is to
eliminate the snow effect that is produced from direct moves to or
from the video display. These checks may be turned off through the
global variable CheckSnow.
■ See Also
PutScrn
■ Example
#include <fpclib.h>
main()
{
char Buffer[160];
VioInit();
GetScrn( 1, 1, 80, Buffer );
}
In the above example the size of Buffer must be at least 160 bytes
long. A copy of row one on the screen will be placed into Buffer.
Buffer will contain both the character and attribute byte values for
each cell on the video display.
..page
..head03AGetVideoCols
■ Description
Get the number of columns per line for the current display mode.
■ Declaration
INT FPENTRY GetVideoCols( void );
■ See Also
GetVideoInfo
■ Example
#include <fpclib.h>
main()
{
VioInit();
printf("Total number of columns = %d\n", GetVideoCols() );
}
GetVidoCols should return either 40 or 80 depending on the video
mode the system is in.
..page
..head03AGetVideoInfo
■ Description
Gets general video display informtion.
■ Declaration
void FPENTRY GetVideoInfo( INT PTR BaseSeg, INT PTR Cols,
INT PTR Pg, INT PTR Mode );
BaseSeg returns the base segment address of the current video
page.
Cols returns the number of display columns available for the
current video mode.
Pg returns the active display page for the video display.
This will always be zero for the monochrome display
adapter.
Mode returns the current video display mode.
■ See Also
GetVideoCols, GetVideoMode, GetVideoPage
■ Example
#include <fpclib.h>
main()
{
int BaseSeg, Mode, NCols, Pg;
VioInit();
ClrWin( 1, 1, 80, 25, 7 );
GotoxyAbs( 1, 1 );
GetVideoInfo( &BaseSeg, &NCols, &Pg, &Mode );
printf("BaseSeg = %4X\n", BaseSeg );
printf("Number of columns = %u \n", NCols );
printf("Active display page = %u \n", Pg );
printf("Current video mode = %u \n", Mode );
}
This example will display the video information to the screen. The
current video mode should return a value from 0-15, the number of
columns will be either 40 or 80, and the active video display page
will be a value from 0-7.
..page
..head03AGetVideoMode
■ Description
Gets the current video mode.
■ Declaration
INT FPENTRY GetVideoMode( void );
■ Remarks
Returns an integer giving the current video mode the system is in.
Use the guide on video modes under InitVideo.
■ See Also
GetVideoInfo
■ Example
#include <fpclib.h>
main()
{
VioInit();
printf("Current video mode = %u", GetVideoMode() );
}
This example will display the current video mode the system is in.
..page
..head03AGetVideoPage
■ Description
Gets the active display page currently in use.
■ Declaration
INT FPENTRY GetVideoPage( void );
■ Remarks
On monochrome displays GetVideoPage will always return a zero.
■ See Also
GetVideoInfo
■ Example
#include <fpclib.h>
main()
{
VioInit();
printf("Current video page = %u", GetVideoPage() );
}
This example will display the current video page on the system. It
should be a value in the range of 0-7.
..page
..head03AGotoxyAbs
■ Description
Position the cursor at the specified position on the screen without
regards to the global variables WindMin and WindMax.
■ Declaration
void FPENTRY GotoxyAbs( INT x, INT y );
x column number to place the cursor in.
y row number to place the cursor in.
■ Remarks
This procedure will place the cursor at the specified x,y
coordinates on the screen. GotoxyAbs is NOT sensitive to the global
variables WindMin and WindMax.
■ See Also
WhereXAbs, WhereYAbs
■ Example
#include <fpclib.h>
main()
{
VioInit();
WindowFP( 10, 10, 50, 24 );
GotoxyAbs( 1, 1 );
}
Even though the upper left corner of the defined window is row 10,
column 10, GotoxyAbs will still place the cursor in row 1 column 1
on the screen.
..page
..head03AHideCursor
■ Description
Hides the cursor from view of the video display.
■ Declaration
void FPENTRY HideCursor( void );
■ Remarks
This function turns on the fifth bit of the current cursor size.
■ Example
#include <fpclib.h>
main()
{
VioInit();
HideCursor();
}
This example will hide the cursor from view of the video display.
..page
..head03AInitVideo
■ Description
Initialize the video mode.
■ Declaration
void FPENTRY InitVideo( INT Mode );
Mode gives the video mode to initialize.
■ Remarks
To set the screen to the appropriate video mode use the following
table as a guide.
Mode Type Colors Adapter
───────────────────────────────────────────────────
| 0 | Text - 40 x 25 B/W | b/w | CGA |
| 1 | Text - 40 x 25 COLOR | 16 | CGA |
| 2 | Text - 80 x 25 B/W | b/w | CGA |
| 3 | Text - 80 x 25 COLOR | 16 | CGA |
| 4 | Graphics - 320 x 200 | 4 | CGA |
| 5 | Graphics - 320 x 200 | 4 grey | CGA |
| 6 | Graphics - 640 x 200 | b/w | CGA |
| 7 | Text - 80 x 25 | 16 | MDA |
| 8 | Graphics - 160 x 200 | 16 | PCjr |
| 9 | Graphics - 320 x 200 | 4,64 | PCjr |
| 10 | Graphics - 640 x 200 | 16 | PCjr,EGA |
| 13 | Graphics - 320 x 200 | 16 | EGA |
| 14 | Graphics - 640 x 200 | 16 | EGA |
| 15 | Graphics - 640 x 350 | 4 | EGA |
───────────────────────────────────────────────────
■ Example
#include <fpclib.h>
main()
{
VioInit();
InitVideo( 3 );
}
This example will initialize the video mode to 80 x 25 color text.
..page
..head03APutFrameAttr
■ Description
Write the data in the buffer to the attribute byte in the specified
area on the screen.
■ Declaration
void FPENTRY PutFrameAttr( INT x1, INT y1,
INT x2, INT y2, CHAR PTR Buffer );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Buffer data buffer that contains the information to display on
the screen.
■ See Also
GetFrameAttr, PutFrameCell, PutFrameChar
■ Example
#include <fpclib.h>
main()
{
char buffer[2000];
VioInit();
memset( buffer, 7, sizeof( buffer ) );
PutFrameAttr( 1, 1, 80, 25, buffer );
}
In this example the first statment fills the buffer array with the
value of 7. This will be the attribute character placed on the
screen for each attribute position. Then the PutFrameAttr statement
places each byte in the buffer on the display screen.
Normally PutFrameAttr is used as the inverse or complement of the
procedure GetFrameAttr. Using GetFrameAttr would save the attribute
bytes for a section of the screen to be later restored with
PutFrameAttr.
..page
..head03APutFrameCell
■ Description
Write the data in the buffer to the character and attribute bytes in
the specified area on the screen.
■ Declaration
void FPENTRY PutFrameCell( INT x1, INT y1,
INT x2, INT y2, CHAR PTR Buffer );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Buffer data buffer that contains the information to display on
the screen.
■ See Also
GetFrameCell, PutFrameAttr, PutFrameChar
■ Example
#include <fpclib.h>
main()
{
char buffer[2100];
int i;
VioInit();
for ( i = 1; i < 26; i++ ) {
FillRowCell( 1, i, 80, (i+64) << 8 + i );
GetFrameCell( 10, 10, 80, 25, Buffer );
ClrWin( 1, 1, 80, 25, 7 );
ColorMsg( 1, 1, 7, "Press any key to continue...");
GetKey();
PutFrameCell( 1, 1, 71, 16, Buffer );
}
In this example the first statment retrieves a section of the
display screen and places 2100 bytes in the data variable Buffer.
The screen is then cleared to remove the display data from the
screen. PutFrameCell restores the data saved from GetFrameCell and
places the data onto another portion of the display screen.
..page
..head03APutFrameChar
■ Description
Write the data in the buffer to the character byte in the specified
area on the screen.
■ Declaration
void FPENTRY PutFrameChar( INT x1, INT y1,
INT x2, INT y2, CHAR PTR Buffer );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Buffer data buffer that contains the information to display on
the screen.
■ See Also
GetFrameChar, PutFrameAttr, PutFrameChar
■ Example
#include <fpclib.h>
main()
{
char buffer[2000];
VioInit();
memset( Buffer, 'A', sizeof( buffer ) );
PutFrameChar( 1, 1, 80, 25, Buffer );
}
In this example the first statment fills the buffer array with the
letter A. This will be the character to be placed on the screen for
each character position. Then the PutFrameChar statement places each
character from the buffer to the display screen.
Normally PutFrameChar is used as the inverse of the GetFrameChar
procedure. Using GetFrameChar would allow the character bytes for a
section of the screen to be saved and later restored with
PutFrameChar.
..page
..head03APutScrn
■ Description
Displays the data in the buffer to the specified screen position in
character attribute byte form.
■ Declaration
void FPENTRY PutScrn( INT x, INT y, INT NWords, CHAR PTR Buffer );
x column to begin display of screen data.
y row to begin display of screen data.
NWords number of words to read from the display screen.
Buffer data buffer to place the screen information.
■ Remarks
This procedure provides additional checks for vertical and
horizontal retrace periods on a CGA video adapter. This is to
eliminate the snow effect that is produced from direct moves to or
from the video display. These checks may be turned off through the
global variable CHECKSNOW.
■ See Also
GetScrn
..page
■ Example
#include <fpclib.h>
main()
{
char buffer[1920];
int i;
VioInit();
ClrWin( 1, 1, 80, 25, 7 );
/* place screen divider line in middle of screen */
FillRowChar( 1, 13, 80, '-' );
/* place characters and attributes to the screen */
for ( i = 14; i < 26; i++ )
FillRowCell( 1, i, 80, (i+64) << 8 + i );
/* save the screen data */
GetScrn( 1, 14, 960, Buffer );
ColorMsg( 1, 1, 7, "Press any key to continue...");
GetKey();
/* restore screen data to a different location */
PutScrn( 1, 1, 960, Buffer );
}
In this example the size of Buffer is 1920 bytes long. The 960 words
in the lower half of the screen are placed into the data buffer with
the call to GetScrn. The call PutScrn will then place the data
buffer information on the screen starting at row one column one.
Both the attribute and character bytes will be written to the
screen. The Buffer variable may be subscripted to use a different
starting point for the buffers contents.
..page
..head03ARvsAttr
■ Description
Reverses the video attribute byte passed.
■ Declaration
INT FPENTRY RvsAttr( INT Attr );
Attr value in the range 0-255 giving the screen color to be
reversed.
■ Remarks
RvsAttr exchanges the three foreground and background attribute bits
of the parmaeter value passed in. The blink and intensity bits of
the byte remain unchanged.
■ Example
Foreground color --> white.
Background color --> black.
If the above is true for the foreground and background colors then
after calling RvsAttr the foreground and background colors will be
as follows:
Foreground color --> black.
Background color --> white.
#include <fpclib.h>
main()
{
VioInit();
printf("Attribute value 7 reversed = %u\n", RvsAttr( 7 ) );
}
..page
..head03AScrollDown
■ Description
Scroll the specified portion of the screen down N lines filling in
new lines with spaces and the specified attribute.
■ Declaration
void FPENTRY ScrollDown( INT x1, INT y1,
INT x2, INT y2,
INT Attr, INT NRows );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Attr value in the range 0-255. It defines the display
attribute to be used when filling in the blank lines at
the top of the window.
NRows number of lines the specified portion of the screen is
to be scrolled.
■ Remarks
If you use a value of zero for the number of lines to scroll, the
window area defined by the x1,y1,x2,y2 coordinates will be cleared
to the color defined by the Attribute variable.
■ See Also
ScrollLeft, ScrollRight, ScrollUp
..page
■ Example
#include <fpclib.h>
main()
{
int i;
VioInit();
ClrWin( 1, 1, 80, 25, 7 );
for ( i = 1; i < 26; i++ )
FillRowChar( 1, i, 80, 64+i );
ScrollDown( 4, 5, 15, 20, 48, 1 );
}
In this example one line will be scrolled down in the window with
the top row being filled in with cyan on a Color/Graphics Adapter.
..page
..head03AScrollLeft
■ Description
Scroll the specified portion of the screen left N columns filling in
new columns with spaces and the specified attribute.
■ Declaration
void FPENTRY ScrollLeft( INT x1, INT y1,
INT x2, INT y2,
INT Attr, INT NCols );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Attr value in the range 0-255. It defines the display
attribute to be used when filling in the blank columns
on the right side of the window.
NCols number of columns the specified portion of the screen is
to be scrolled.
■ Remarks
If you use a value of zero for the number of lines to scroll, the
window area defined by the x1,y1,x2,y2 coordinates will be cleared
to the color defined by the Attribute variable.
■ See Also
ScrollDown, ScrollRight, ScrollUp
..page
■ Example
#include <fpclib.h>
main()
{
int i;
VioInit();
ClrWin( 1, 1, 80, 25, 7 );
for ( i = 1; i < 26; i++ )
FillRowChar( 1, i, 80, 64+i );
ScrollLeft( 4, 5, 15, 20, 48, 1 );
}
In this example one column will be scrolled left in the window with
the right column being filled in with cyan on a Color/Graphics
Adapter.
..page
..head03AScrollRight
■ Description
Scroll the specified portion of the screen right N columns filling
in new columns with spaces and the specified attribute.
■ Declaration
void FPENTRY ScrollRight( INT x1, INT y1,
INT x2, INT y2,
INT Attr, INT NCols );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Attr value in the range 0-255. It defines the display
attribute to be used when filling in the blank columns
on the left side of the window.
NCols number of columns the specified portion of the screen is
to be scrolled.
■ Remarks
If you use a value of zero for the number of lines to scroll, the
window area defined by the x1,y1,x2,y2 coordinates will be cleared
to the color defined by the Attribute variable.
■ See Also
ScrollDown, ScrollLeft, ScrollUp
..page
■ Example
#include <fpclib.h>
main()
{
int i;
VioInit();
ClrWin( 1, 1, 80, 25, 7 );
for ( i = 1; i < 26; i++ )
FillRowChar( 1, i, 80, 64+i );
ScrollRight( 4, 5, 15, 20, 48, 1 );
}
In this example one column will be scrolled right in the window with
the left column being filled in with cyan on a Color/Graphics
Adapter.
..page
..head03AScrollUp
■ Description
Scroll the specified portion of the screen up N lines filling in new
lines with spaces and the specified attribute.
■ Declaration
void FPENTRY ScrollUp( INT x1, INT y1,
INT x2, INT y2,
INT Attr, INT NRows );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Attr value in the range 0-255. It defines the display
attribute to be used when filling in the blank lines at
the bottom of the window.
NRows number of lines the specified portion of the screen is
to be scrolled.
■ Remarks
If you use a value of zero for the number of lines to scroll, the
window area defined by the x1,y1,x2,y2 coordinates will be cleared
to the color defined by the Attribute variable.
■ See Also
ScrollDown, ScrollLeft, ScrollRight
..page
■ Example
#include <fpclib.h>
main()
{
int i;
VioInit();
ClrWin( 1, 1, 80, 25, 7 );
for ( i = 1; i < 26; i++ )
FillRowChar( 1, i, 80, 64+i );
ScrollUp( 4, 5, 15, 20, 48, 1 );
}
In this example one line will be scrolled up in the window with the
bottom row being filled in with cyan on a Color/Graphics Adapter.
..page
..head03ASetCursorSize
■ Description
Set the size of the cursor.
■ Declaration
void FPENTRY SetCursorSize( INT StScan, INT SpScan );
StScan starting scan line to be used for the cursor.
SpScan ending scan line to be used for the cursor.
■ Remarks
The scan lines are numbered from zero at the top (StScan) to N at
the bottom (SpScan) where N applies to the following video adapters:
7 - Color/Graphics Adapter
14 - Monochrome Adapter
- 0 --
- 1 |
- 2 |
- 3 |---> Scan lines for a Color/Graphics
- 4 | display adapter.
- 5 |
- 6 |
- 7 --
■ See Also
GetCursorSize
..page
■ Example
The following examples are for the Color/Graphics Adapter:
#include <fpclib.h>
main()
{
VioInit();
SetCursorSize( 32, 32 ); /* hides the cursor */
SetCursorSize( 0 , 7 ); /* cursor covers entire cell */
SetCursorSize( 6 , 7 ); /* cursor size normal */
}
The first SetCursorSize statment makes the cursor invisible on the
screen. The second SetCursorSize will cover the entire character
cell on a color/graphic display and will cover half of the cell on a
monochrome display. If the display was a monochrome display and the
entire character cell was to be covered by the cursor then the
parameters should be (0,13).
..page
..head03ASetVideoPage
■ Description
Set the active display page.
■ Declaration
void FPENTRY SetVideoPage( INT PageNo );
PageNo active display page to use.
■ Remarks
Active display pages available for various display cards.
0 - Monochrome
0-7 - Color/Graphics 40 column text mode
0-3 - Color/Graphics 80 column text mode
0 - Color/Graphics Hi Resolution Graphics mode
■ See Also
GetVideoPage
■ Example
The following examples are for the Color/Graphics Adapter because
the monochrome display only has one page available.
#include <fpclib.h>
main()
{
int i;
VioInit();
SetVideoPage( 0 ); /* default video page - page 1 */
SetVideoPage( 1 ); /* another page - page 2 */
}
The first statement will set the video display to the default
display page and the second statement will switch the video
display to page one. This function is not intended for use with a
monochrome display adapter.
..page
..head03AShowCursor
■ Description
Shows the cursor on the video display.
■ Declaration
void FPENTRY ShowCursor( void );
■ Remarks
This function turns off the fifth bit of the current cursor size.
■ Example
#include <fpclib.h>
main()
{
VioInit();
HideCursor();
printf( "press any key to display the cursor\n" );
GetKey();
ShowCursor();
}
This example will hide the cursor from view of the video display
and then wait until the user presses a key. Once a key has been
pressed the program will then turn the cursor back on.
..page
..head03AVioInit
■ Description
Initializes the Video units global variables.
■ Declaration
void FPENTRY VioInit( void );
■ Remarks
This function must be executed once before any video functions can
be used. If at some time you wish to reset the global variables to
their default settings you may use this procedure to complete that
task.
■ Example
#include <fpclib.h>
main()
{
VioInit();
}
This example initializes the video display variables needed for the
video library routines.
..page
..head03AWhereXAbs
■ Description
Returns the column the cursor is in.
■ Declaration
INT FPENTRY WhereXAbs( void );
■ Remarks
This function will return an integer giving the column number the
cursor is on. This routine is not sensitive to the currently
defined window.
■ See Also
GotoxyAbs, WhereYAbs
■ Example
#include <fpclib.h>
main()
{
VioInit();
printf("The cursor is in column %u", WhereXAbs() );
}
The column number of the cursor when WhereXAbs was called will be
displayed to the screen.
..page
..head03AWhereYAbs
■ Description
Returns the row the cursor is on.
■ Declaration
INT FPENTRY WhereYAbs( void );
■ Remarks
This function will return an integer giving the row number the
cursor is on. This routine is not sensitive to the currently
defined window.
■ See Also
GotoxyXAbs, WhereXAbs
■ Example
#include <fpclib.h>
main()
{
VioInit();
printf("The cursor is in row %u", WhereYAbs() );
}
The row number of of the cursor when WhereYAbs was called will be
displayed to the screen.
..page
..head03AWindowFP
■ Description
Set the window coordinate variables WindMin and WindMax.
■ Declaration
void FPENTRY WindowFP( INT x1, INT y1, INT x2, INT y2 );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
■ Remarks
This function sets the window coordinates in the WindMin and WindMax
global variables which FrameWin uses for framing windows on the
display screen.
■ See Also
FrameWin
■ Example
#include <fpclib.h>
main()
{
VioInit();
WindowFP( 1, 1, 80, 25 );
FrameWin( 'L', 'R', 'l', 'r', 'h', 'v', 7 );
}
This example will set the window coordinates to the upper left and
lower right corners of the video display.
..page
..head03AWriteSt
■ Description
Display a string on the screen
■ Declaration
void FPENTRY WriteSt( CHAR PTR String );
Sting string expression to display on screen.
■ Remarks
WriteSt positions the cursor after the newly displayed string.
WriteSt is NOT sensitive to the currently defined window and will
wrap around to the next row of column one of the physical screen
when necessary. WriteSt will not scroll the screen if the data to be
displayed is to extend beyond the last row of the screen. WriteSt
uses the attribute byte defined by the global variable TextAttr.
■ See Also
WriteStLn
■ Example
#include <fpclib.h>
main()
{
int i;
VioInit();
GotoxyAbs( 1, 1 ); /* position curor in upper left corner */
for ( i = 1; i < 50; i++ )
WriteSt("test string ");
}
This example will position the cursor in the upper left corner of
the display screen and then will proceed to display the string "test
string" fifty times. Example of the intented output follows:
test string test string test string test string ...
..page
..head03AWriteStln
■ Description
Display a string on the screen
■ Declaration
void FPENTRY WriteStln( CHAR PTR String );
Sting string expression to display on screen.
■ Remarks
WriteStln positions the cursor in column one on the next line of the
display screen after the data has been displayed. WriteStln is NOT
sensitive to the currently defined window and will wrap around to
the next row of column one of the physical screen when necessary.
WriteStln will not scroll the screen if the data to be displayed is
to extend beyond the last row of the screen. WriteStln uses the
attribute byte defined by the global variable TextAttr.
■ See Also
WriteSt
■ Example
#include <fpclib.h>
main()
{
int i;
VioInit();
GotoxyAbs( 1, 1 ); /* position curor in upper left corner */
for ( i = 1; i < 24; i++ )
WriteSt("test string ");
}
This example will position the cursor in the upper left corner of
the display screen and then on each line will display the string
"test string" on the first 24 lines of the display.
..page