Dec 072017
Fast Video routines for Turbo C.
File FASTVI.ZIP from The Programmer’s Corner in
Category C Source Code
Fast Video routines for Turbo C.
File Name File Size Zip Size Zip Type
FASTVID.C 8580 2024 deflated
FASTVID.DOC 8791 3354 deflated
FASTVID.H 2002 641 deflated
FASTVID.OBJ 2666 1672 deflated

Download File FASTVI.ZIP Here

Contents of the FASTVID.DOC file

FASTVID.C version 1.0

by Scott Friedman - May 1987

I would really like to hear from you if you have a chance to try
these routines out. At the present time I am releasing these routines into
the PUBLIC DOMAIN. However, I eventually plan to release an entire set of
functions that will be ShareWare and ask a small registration fee, like ten
dollars or so, for future updates and a manual with examples and so on.
Anyway, that's later, for now I would like to hear any comments you might have
so please send them to me either on Compuserve or through the US Mail.

Compusreve : Scott Friedman [74017,1331]


Scott Friedman
3700 Greenleaf St.
Skokie, IL. 60076-2357

FASTVID is a set of no nonsense text display routines for use with
Borlands Turbo C compiler. For version 1.0 I have included about 30 of my
text routines ( there are around 100+ total ) to start with. In later
versions I will include the others. These functions, however, are the
building blocks for all of the others; so these get released first. Basically,
these are simple, small, and FAST. I think the best two features are that
they do not require a lot of understanding to use and that they don't take up
a lot of room when you include them. The object module that would be used to
link the FASTVID 1.0 routines is under 3k.

Below are descriptions of all of the routines included in the FASTVID
"library". After which is a short explaination of how to include the routines
into your own programs.

void InitText ( void ) - InitText is the function you need to call first
whenever you use FASTVID. This routines sets-up the internal data
structure that most of the routines use. It also sets the video
mode to 3 ( 25x80 color ) for CGA/EGA and 7 ( mono ) for Monochrome
monitors. Lastly it clears the screen to black.

void UsesBios ( byte YN ) - UsesBios is used to tell FASTVID that you want
it to use the ROM BIOS routines to display text. Why you would do
this I'm not sure, but it's included for completeness. You're prob-
ably asking "what's a BYTE?". If you're not, look in the parameter
list for UseBios. the BYTE data type is functionally equivalent to
an unsigned char. You can use BYTE, which is declared in FASTVID.H,
or unsigned char interchangably. the YN parameter is for either
YES or NO which are also defined in FASTVID.H. The default is NO.

example: UseBios ( YES ); ----> Yes, use the Bios routines.
UseBios ( NO ); -----> No, write directly to the screen.

void HaveSnow ( byte YN ) - HaveSnow is potentially a bit more useful than
UseBios. HaveSnow is used to tell FASTVID that it's creating snow
on your screen when it writes to the display. When you send this
function a YES the FASTVID display routines will wait for the display
to do a verticle retrace before it writes to your display. The
default is not to wait for the display to retrace.

int EgaInstalled ( void ) - EgaInstalled returns either YES or NO depending
on whether or not you have one in your machine.

void SetCursor ( byte Start, byte End ) - SetCursor is NOT used to move the
cursor around the screen. It is used to change the way the cursor
appears on the screen. This is accomplished by setting the starting
and ending scan lines for the cursor. Generally, this is not a very
useful routine, the only place I have ever seen it used effectivly
is for marking the difference between INSERT and OVERWRITE modes in
word processors and editors.

void HideCursor ( void ) - Does exactly what it says. This is a better way
to hide the cursor than giving SetCursor weird values or positioning
the cursor off the screen, both of which can be unpredictable.

void ShowCursor ( void ) - Opposite of HideCursor.

int GetVideoMode ( void ) - Returns the current video mode. Refer to your
DOS references for the different modes and what they represent.

void SetVideoMode ( byte Mode ) - Allows you to change the current video
mode. For those of you new to "Video Modes" remember that all the
modes listed cannot be used by all display cards.

void Gotoxy ( int Col, int Row ) - This routine will move the cursor for the
direct screen display mode ( UseBios ( NO ) ).

void GotoxyB ( int Col, int Row ) - This is the BIOS move cursor. The
difference is thay Gotoxy does not actually "move" the cursor, it
just updates the FASTVID col and row. GotoxyB changes FASTVID's col
and row as well as moving the BIOS cursor ( the one you see ).

void Getxy ( int *Col, int *Row ) - Returns the current location of the
FASTVID cursor.

void GetxyB ( int *Col, int *Row ) - Returns the current location of the
BIOS cursor.

byte Attr ( byte Foreground, byte Background ) - This routine will combine
a foreground and background color defined in FASTVID.H into a single
attribute byte you can use with other functions that require just
an attribute byte instead of a seperate foreground and background.

example: Cls ( Attr ( WHITE, BLUE ) ); ---> Clears screen to Blue.

void SetAttribute ( byte Attribute ) - Sets the defualt FASTVID attribute
to be use with normal display routines. This a function that you
might use Attr with.

byte GetAttribute ( byte Attribute ) - Returns the current FASTVID attribute.

void FlipAttribute ( byte Attribute, int Number ) - Changes the display
to the specified attribute starting at the current cursor position
and extending for Number positions.

void AtFlipAttribute ( int Col, int Row, byte Attribute, int Number )
Same as above except that you can specify the starting location.

void SetPage ( byte Page ) - Allows you to select which video page your
display adapter puts on your monitor.

byte GetPage ( void ) - Returns the current display page.

void SetBorder ( byte Color ) - Lets you change the border color on your

void Scroll ( byte Direction, byte NumOfLines, byte Attribute,
int x1, int y1, int x2, int y2 ) - Allows you to scroll port-
ions of your display up or down by specifying a direction ( UP, DOWN )
the number of lines you want to scroll, an attribute for the blank
lines created by scrolling, and the coordinates describing the area
to scroll; x1,y1 being the upper left corner and x2,y2 the lower right.

void Cls ( byte Attribute ) - Clear the screen using the specifyed attribute.

void Box ( int Left, int Top, int Right, int Bottom, byte Style ) - Simple
way of creating boxes out of the extended IBM charater set. All you
need to do is fill in the coordinates of the sides and the style of
box you want displayed. There are 4 styles: single line, double line,
and two single and double combinations. The styles go from 0 to 3.
Take a look at the _F structure in FASTVID.H to see how its set up.
You can declare an extern variable Frame in your program to have
to this predefined array. I have found it much easier to draw with
these characters by using this array structure.

example to include Frame in you code:

extern _F Frame; ----> That's it!

void Say ( char *Text ) - This is the heart of FASTVID.C, it will display
the specified NULL terminated string of characters at the current
cursor position. To have formatted text al la printf use the sprintf
function and pass the result to Say.

void AtSay ( int Col, int Row, char *Text ) - Same as Say except you can
specify a Column and Row as well.

void AtSayA ( int Col, int Row, char *Text, byte Attribute ) - Again, same
as above except you can also specify an attribute for the text to be
be displayed. Note, this attribute does not affect the FASTVID
default attribute set by SetAttribute.

void SayC ( char Character ) - Writes the specified character to the display
at the current cursor position.

void AtSayC ( int Col, int Row, char Character ) - Same as SayC, but allows
you to move the cursor as well.

void SayCN ( char Character, int Number ) - Displays the specified character
at the current cursor position and repeats that charater for Number
more screen positions.

void AtSayCN ( int Col, int Row, char Character, int Number ) - Same as SayCN
but, again, you can specify a Column and Row to start at.

void AtSayCNV ( int Col, int Row, char Character, int Number ) - Don't con-
fuse this with AtSayCN, this routine allows you to replicate a charater
verically instead of horizontally. Col and Row specify a starting loc-
ation and Character is repeated Number of times DOWNWARD.

End of document.

 December 7, 2017  Add comments

Leave a Reply