Dec 072017
 
FlashPac C Library V3.61. Direct Video functons for fast screen I/O. Include bios video for ega & vga. BIOS Mouse support includes interrupt hander for queuing mouse events BIOS, DOS keyboard, and general DOS support funct

Full Description of File


FlashPac C Library V3.61-Direct Video
functions for fast screen I/O. Includes bios
video for ega & vga. BIOS Mouse support
includes interrupt handler for queuing mouse
events. BIOS, DOS keyboard, and general DOS
support functions. Also includes FPCWin which
provides CORE functions needed for
implementing message based programs.


File FPCLIB36.ZIP from The Programmer’s Corner in
Category C Source Code
FlashPac C Library V3.61. Direct Video functons for fast screen I/O. Include bios video for ega & vga. BIOS Mouse support includes interrupt hander for queuing mouse events BIOS, DOS keyboard, and general DOS support funct
File Name File Size Zip Size Zip Type
DEMOS 0 0 stored
DEMO.C 16949 3136 deflated
DEMO.DSK 1343 557 deflated
DEMO.PRJ 5844 1453 deflated
DISKDEMO.C 1744 563 deflated
DISKDEMO.PRJ 65 43 deflated
FPGETKEY.C 144 130 deflated
GETVOL.C 380 218 deflated
GETVOL.PRJ 34 30 deflated
KBDDEMO.C 4285 992 deflated
KBDDEMO.PRJ 60 42 deflated
PRTDEMO.C 2738 715 deflated
PRTDEMO.PRJ 34 29 deflated
TCSETS.PAS 1261 493 deflated
VGADEMO1.EXE 14035 8184 deflated
VGADEMO2.EXE 21067 12261 deflated
VIODEMO.C 34722 5104 deflated
VIODEMO.MAK 251 113 deflated
VIODEMO.PRJ 60 42 deflated
DESCRIBE.DOC 7517 2549 deflated
EXAMPLES 0 0 stored
EXAMPLE.C 8244 1354 deflated
EXAMPLE.EXE 14873 7767 deflated
FPGETKEY.C 144 130 deflated
MAKEFILE 249 114 deflated
FILE_ID.DIZ 343 237 deflated
HISTORY.DOC 5681 1798 deflated
INCLUDE 0 0 stored
FPCLIB.H 19139 3360 deflated
FPCWIN.H 19272 3853 deflated
LIBBCC 0 0 stored
FPCLIB.LIB 86855 31647 deflated
FPCWIN.LIB 23040 10924 deflated
MAKEFILE 434 180 deflated
TEST.C 4376 1134 deflated
LIBMSC 0 0 stored
FPCLIB.LIB 86855 31647 deflated
FPCWIN.LIB 29741 10534 deflated
MAKEFILE 260 149 deflated
TEST.C 4376 1134 deflated
TEST.LNK 31 28 deflated
LICENSE.DOC 5843 2068 deflated
MANUAL.DOC 237864 35883 deflated
MISCPGMS 0 0 stored
CURSOR.EXE 3376 2297 deflated
DOSMEM.EXE 4240 3171 deflated
RENSUB.EXE 3024 2109 deflated
TOUCH.EXE 9254 5679 deflated
PACKING.LST 3784 1098 deflated
README.1ST 3684 1246 deflated
REGISTER.DOC 2469 527 deflated
SYSOP.DOC 6692 2525 deflated
VENDOR.DOC 9790 3331 deflated
WARRANTY.DOC 2286 951 deflated

Download File FPCLIB36.ZIP Here

Contents of the MANUAL.DOC file


FlashPac C Library V3.61-Direct Video
functions for fast screen I/O. Includes bios
video for ega & vga. BIOS Mouse support
includes interrupt handler for queuing mouse
events. BIOS, DOS keyboard, and general DOS
support functions. Also includes FPCWin which
provides CORE functions needed for
implementing message based programs.




+--------------------------------+
| |
| +--------------------------+ |
| | | |
| | FlashPac C Library | |
| | | |
| | Reference Guide | |
| | | |
| | V3.61 | |
| | |
| +--------------------------+ |
| |
+--------------------------------+





SimpleSoft
1209 Poplar St
La Crescent, MN 55947


Technical Support: (507) 895-8237
CompuServ Id: 70253,1270



_______
____|__ | (R)
--| | |-------------------
| ____|__ | Association of
| | |_| Shareware
|__| o | Professionals
-----| | |---------------------
|___|___| MEMBER



OMBUDSMAN STATEMENT
-------------------
The ASP Board has set up an office of Ombudsman and appointed an ASP
member as Ombudsman. The Ombudsman's sole role is to mediate
disputes between ASP members and their customers. The Ombudsman
reports to the Board situa tions where he/she feels Board action or
knowledge is appropriate.

"Kevin Dahl is a member of the Association of Shareware Professionals
(ASP). ASP wants to make sure that the shareware principle works for
you. If you are unable to resolve a shareware-related problem with an
ASP member by contacting the member directly, ASP may be able to
help. The ASP Ombudsman can help you resolve a dispute or problem
with an ASP member, but does not provide technical support for
members' products. Please write to the ASP Ombudsman at 545 Grover
Road, Muskegon, MI 49442 or send a CompuServe message via CompuServe
Mail to ASP Ombudsman 70007,3536."


Technical Support
-----------------
To contact SimpleSoft for information about dealer pricing volume
discounts, site licensing, the status of shipment of the product, the
latest version number, or for technical information, call:

SimpleSoft
(507) 895-8237
Between 5:30pm and 9:00pm CST, weekdays.

or write:
Kevin Dahl
SimpleSoft
1209 Poplar St
La Crescent, MN 55947

or use CIS Mail,
CompuServe ID number: 70253,1270

You may call for technical support between the hours of 7:30am to
9:30pm CST. During the hours 8:00am to 5:30pm you will either get my
wife or an answering machine. If you call and leave a message I will
return your call as soon as I can. Generally, the best hours to call
are from 5:30pm to 9:30pm weekdays. Weekends are a tossup.

Turbo C is a trademark of Borland International. Microsoft and
MS-DOS are regis tered trademarks of Microsoft Corporation. IBM is a
registered trademark and PC/XT, PC/AT, PS/2, PC-DOS, OS/2 and PM are
trademarks of International Business Machines Corporation.

Chapter 1
Introduction

+--------------------------------+
| |
| Welcome to version 3.61 of the |
| FlashPac Library. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

Getting Started
---------------
This is a reference manual for the FlashPac C Video library. This
implementation is for use with Microsoft C or Turbo C in MS-DOS. A
working knowledge of C and personal computers is assumed.

The FlashPac C Library written in assembler provides over 40 Direct
Video routines to save and restore screen data, frame windows, display
strings, change attributes, edit data fields plus more. Bios Video
support for cursor control, hardware detection, font selection, font
definition, etc. Several mouse support functions including get/set
mouse cursor position, set mouse x,y range and also a mouse interrupt
handler for queuing mouse events. Bios and DOS keyboard support for
total keyboard control. Dos support functions to get/ set file time
and date, get/set clock time and date, get/set dta, critical interrupt
handler plus more.. In addition the FPCWin library included is a set
of C and assembler functions that implement the basic elements for a
programmer to create a message based application.

The functions in chapter 2 are referred to as FPCWin functions. The
functions in FPCWin contain the core functions necessary to implement
a message based program. The current implementation will relieve the
software engineer from writing the functions required to obtain
information about the next system event, i.e. mouse and keyboard
events. Mouse and keyboard events are automatically queued into the
system queue and may be retrieved anytime with a call to WinGetMsg.
WinGetMsg allows the developer to retrieve the messages in the exact
same order as they were placed into the queue or retrieve the next
message of a specified type, such as the next mouse event.


Installation
------------
The FlashPac C library consists of two files:
FPCLIB.H
FPCLIB.LIB

Place the header file "FPCLIB.H" in the subdirectory that contains
the header files for your compiler and place "FPCLIB.LIB" in the
subdirectory that where the library files are in. You are now ready
to use the FlashPac C library.

Compiling and Linking a test program

To compile and link "DEMO.C" and "GETKEY.C" modules use the
instructions for the appropriate compiler.


Turbo C
-------
Integrated environment:
1. Select the large memory model under the Options,
compiler menu.
2. Create a project file with the following three lines:
demo (demo.c)
getkey (getkey.c)
fpclib.lib
3. Select the project file under the compile menu option select
build all to create an executable file called demo.exe

Command Line:
C>tcc -IC:\INC -LC:\lib -ml demo.c getkey.c \lib\fpclib.lib

-IC:\INC C:\INC is the include subdirectory for header files
-LC:\LIB C:\LIB is the library subdirectory for Turbo C libraries
-ml selects large memory model
\lib is the subdirectory where fpclib.lib is located


Microsoft C
-----------
C>cl /AL /F 4000 demo.c getkey.c \lib\fpclib.lib

/AL selects large memory model
/F 4000 create a 16K stack area
\lib is the subdirectory where fpclib.lib is located

Chapter 2
FPCWin

+--------------------------------+
| |
| The functions in this section |
| perform windowing functions |
| that follow the conventions |
| used by OS/2 PM. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

Overview

The set of functions in this chapter describe the parts of FPCWin that
let you create and use a message queue. The system will collect all
keyboard and mouse events and place them in the system message queue.
Messages can be retrieved in the order they were placed in the queue.
An applications message queue is provided for your own use. The
declarations are defined in fpcwin.h.

Declarations

#define FPENTRY pascal far
#define PTR far *

typedef char CHAR;
typedef short SHORT;

typedef char CHAR; /* ch*/
typedef short SHORT; /* s*/
typedef long LONG; /* l*/

typedef unsigned char UCHAR; /* uch*/
typedef unsigned short USHORT; /* us*/
typedef unsigned long ULONG; /* ul*/

typedef unsigned char BYTE; /* b*/

typedef unsigned char *PSZ;
typedef unsigned char *PCH;

typedef BYTE *PBYTE;

typedef CHAR *PCHAR;
typedef SHORT *PSHORT;
typedef LONG *PLONG;

typedef UCHAR *PUCHAR;
typedef USHORT *PUSHORT;
typedef ULONG *PULONG;

typedef unsigned short BOOL; /* f*/
typedef BOOL *PBOOL;

typedef unsigned short SHANDLE;
typedef void far *LHANDLE;
typedef void far *MPARAM; /* msg param*/

typedef LHANDLE HWND; /* hwnd*/
typedef HWND *PHWND;
typedef LHANDLE HMQ; /* hmq*/
typedef LHANDLE HAB; /* hab*/

typedef VOID FAR *MPARAM; /* mp*/
typedef MPARAM FAR *PMPARAM; /* pmp*/

typedef VOID FAR *MRESULT; /* mres*/
typedef MRESULT FAR *PMRESULT; /* pmres*/

typedef USHORT HMODULE; /* hmod*/
typedef HMODULE FAR *PHMODULE;

typedef VOID FAR *PVOID;

----------------------------------------------------------------------
WinCreateMsgQueue
----------------------------------------------------------------------

Description This function creates a message queue for the current
pro cess. It must be called after WinInitialize but
before any other FPCWin functions. This function can
only be called once per process.

Summary HMQ WinCreateMsgQueue( hab, cmsg );
HAB hab Specifies a handle to the
anchor block.
SHORT cmsg Specifies the maximum size
of the queue. The default
queue may be specified by
using the constant
DEFAULT_QUEUE_SIZE.

Returns Returns a handle to the message queue if successful, or
NULL is unable to create a new message queue.

Remarks The default queue size is ten messages. The program
should create a larger queue if ten messages is the
system is losing messages.

Example See program example 1.

Source queues.asm

----------------------------------------------------------------------
WinDestroyMsgQueue
----------------------------------------------------------------------

Description This function destoys the message queue. This function
should be called if any program uses a message queue
created by WinCreateMsgQueue.

Summary BOOL WinDestroyMsgQueue( hmq );
HMQ hmq Handle to the message queue
to be destroyed.

Returns Returns TRUE is successful or FALSE is an error
occurred.

Example See program example 1.

Source queues.asm

----------------------------------------------------------------------
WinGetMsg
----------------------------------------------------------------------

Description This function retrieves the next message from the
message queue hat conforms to the filtering criteria.

Summary BOOL WinGetMsg( hab, qmsg, hwndFilter,
msgFilterFirst, msgFilterLast );
HAB hab Anchor block handle.
PQMSG qmsg Points to the QMSG structure
that will contain the
returned message. QMSG is
defined in the following
form:

typedef struct _QMSG {
HWND hwnd;
USHORT msg;
MPARAM mp1;
MPARAM mp2;
ULONG time;
POINTL ptl;
} QMSG;
HWND hwndFilter Window filter identifier.
USHORT msgFilterFirst Specifies first message.
USHORT msgFilterLast Specifies last message.

Returns If the message retrieved is not WM_QUIT then TRUE is
returned, otherwise FALSE is returned.

Remarks Filtering allows a program to process messages in an
order that is different from the one in the message
queue. Use fil tering to retrieve messages of a
particular type, rather than retrieving other types of
messages at an inconvenient place

in the program logic. For example, when a mouse
button down message is retrieved, the program can use
filtering to wait for the mouse button up message
without processing other messages.

When the hwndFilter parameter is not NULL, it limits
the system to returning a message to a specific window
or its child windows.

The msgFilterFirst and msgFilterLast parameters are
used to restrict the range of message types that may be
returned. If msgFilterFirst and msgFilterLast are both
zero, all mes sages are returned. If msgFilterFirst is
less than msgFilterLast then o

nly those messages that lie in that range will be
returned. If msgFilterFirst is greater than
msgFilterLast, all messages except the ones that lie
between msgFilterFirst and msgFilterLast will be
returned.

For example, using the constants WM_MOUSEFIRST and
WM_MOUSELAST for msgFilterFirst and msgFilterLast can
be used to filter out all messages except mouse
messages.

Example See program example 1.

Source queues.asm

----------------------------------------------------------------------
WinInitialize
----------------------------------------------------------------------

Description This function initializes the

Summary HAB WinInitialize( fsOptions );
USHORT fsOptions Specifies initialization
options. This parameter must
be zero.

Returns If the initialization process is successful the Handle
Anchor Block is returned, otherwise NULL is returned if
an error occurred.

Remarks the initialization process sets up pointers for a
message queue in the main thread of the system. In
addition, the video parameters are set, the window is
cleared, and the mouse, keyboard and timer interrupt
handlers are initialized.

Example See program example 1.

Source queues.asm

----------------------------------------------------------------------
WinPeekMsg
----------------------------------------------------------------------

Description This function is used to inspect the message queue.

Summary BOOL WinPeekMsg( hab, qmsg, hwndFilter, msgFilterFirst,
msgFilterLast , fs );
HAB hab Anchor block handle.
PQMSG qmsg Points to the QMSG structure
that will contain the
returned
message. QMSG is defined in the following
form:

typedef struct _QMSG {
HWND hwnd;
USHORT msg;
MPARAM mp1;
MPARAM mp2;
ULONG time;
POINTL ptl;
} QMSG;

HWND hwndFilter Window filter identifier.
USHORT msgFilterFirst Specifies first message.
USHORT msgFilterLast Specifies last message.
USHORT fs Specifies if the message
should be left in the queue
or removed from the queue.
If PM_REMOVE is specified
then the message is removed
from the queue. If
PM_NOREMOVE or nothing is
specified then the message
is not removed from the qu

eue.T msgFilterLast Specifies last message.

Returns If a message is available TRUE is returned, otherwise
FALSE is returned.

Remarks This function is the same as WinGetMsg except that is
doesn't wait for a message if one is not in the queue
and it also allows for letting a message remain in the
queue.

Example See program example 1.

Source queues.asm

----------------------------------------------------------------------
WinPostMsg
----------------------------------------------------------------------

Description This function will post a message to the message queue
for the specified window.

Summary BOOL WinPostMsg( hwnd, msg, mp1, mp2 );
HWND hwnd Identifies window to post
mes sage to. If NULL then
the message is posted to the
queue associated with the
current thread.
USHORT msg Message to be posted.
MPARAM mp1 First message parameter.
MPARAM mp2 Second message parameter.

Returns TRUE if successful or FALSE if an error occurred.

Remarks WinPostMsg returns immediately.

Example See program example 1.

Source queues.asm

----------------------------------------------------------------------
WinTerminate
----------------------------------------------------------------------

Description This function terminates the programs use of FPCWin and
releases all of the associated resources. This
function has to be called prior to termination of your
program.

Summary HAB WinInitialize( hab );
HAB hab Handle to the anchor block.

Returns TRUE if successful or FALSE if an error occurred.

Example See program example 1.

Source queues.asm



Chapter 3
Direct Video

+--------------------------------+
| |
| The functions in this section |
| perform direct reads & writes |
| of text data to the screen. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

Declarations

#define FAR far
#define FPENTRY pascal far
#define PTR far *

typedef char CHAR;
typedef unsigned char BYTE;
typedef signed int INT;
typedef unsigned int UINT;
typedef signed short int INT2;
typedef unsigned short int UINT2;
typedef long INT4;
typedef unsigned long UINT4;
typedef float REAL4;
typedef double REAL8;
typedef unsigned int WORD;

BYTE CheckSnow enables or disables snow-checking when reading or
writing data directly to video memory.

BYTE TextAttr global variable that contains the currently
selected video attribute.

INT2 InsMode global variable used by EditSt to indicate if the
cursor is in insert or overwrite mode.

INT2 VioBaseSeg contains the base segment address of the current
video page.

INT2 VioCols contains the screen width which is the total number
of characters per line.

INT2 VioCursor contains the size of the cursor with the starting
scan line in the high byte and the ending scan line
in the low byte.

INT2 VioPage contains the active video page in use. The value
should always be zero for a monochrome adapter.

INT2 WindMax defines the lower right corner of the window that
is currenlty defined thru the use of the Window
function.

INT2 WindMin defines the upper left corner of the window that is
currently defined thru the use of the Window
function.

----------------------------------------------------------------------
BorderColor
----------------------------------------------------------------------

Description Sets the color for the border screen.

Summary VOID BorderColor( Color );
INT Color defines color of the border
on the screen.

Remarks The following colors are allowed for the border color
on a Color Graphics Adapter. BorderColor has no effect
on a monochrome display.

0 Black 8 Gray
1 Blue 9 Light Blue
2 Green 10 Light Green
3 Cyan 11 Light Cyan
4 Red 12 Light Red
5 Magenta 13 Light Magenta
6 Brown 14 Yellow
7 White 15 High-intensity White

Example See program example 2.

Source border.asm

----------------------------------------------------------------------
ClrWin
----------------------------------------------------------------------

Description Clear window area with the specified color.

Summary VOID ClrWin( x1, y1, x2, y2, Attr );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
INT Attr integer in the range 0-255
defining the foreground and
background byte combination
for the color of the window.

Remarks This procedure will blank the window area for the
window coordinates that are passed. ClrWin does not
move the cursor from its current position.

Example See program examples 2-7

Source clrwin.asm

----------------------------------------------------------------------
ColorMsg
----------------------------------------------------------------------

Description Display string on the screen using the color attribute
specified.

Summary VOID ColorMsg( x, y, Attr, Msg );
INT x column to begin display of
message.
INT y row to begin display of mes
sage.
INT Attr integer in the range 0-255.
It is the color to use for
displaying the message.
CHAR *Msg string message to be
displayed.

Remarks ColorMsg is NOT sensitive to Turbo's currently defined
win dow and will wrap around to column one on the next
line of the screen when necessary. ColorMsg will not
scroll the screen if the data to be displayed is to
extend beyond the last row

of the screen.

See Also DspMsg, WriteSt, WriteStln

Example See program examples 2,3

Source colormsg.asm

----------------------------------------------------------------------
DspMsg
----------------------------------------------------------------------

Description Display string on the screen without changing the color
attribute that is currently on the display screen.

Summary VOID DspMsg( x, y, Msg );
INT x column to begin display of
message.
INT y row to begin display of mes
sage.
CHAR *Msg string message to display.

Remarks DspMsg is NOT sensitive to Turbo's currently defined
win dow and will wrap around to column one on the next
line of the screen when necessary. DspMsg will not
scroll the screen if the data to be displayed is to
extend beyond the last row of

the screen.

See Also ColorMsg, WriteSt, WriteStln

Example See program examples 2,6,7

Source dspmsg.asm

----------------------------------------------------------------------
EditSt
----------------------------------------------------------------------

Description Edit an existing or null string from the keyboard.

Summary VOID EditSt( Row, StCol, SpCol, Len, ChCase, FillCh,
AutoSkip, ErrTone, ErrDur, VCSet, TCSet, ChOfs, TE, St
);
INT Row defines row to edit string
on.
INT StCol defines left or start column
of field to edit. This value
must be less than or equal
to SpCol.
INT SpCol defines right or stop column
of the field to edit. This
value must be greater than
or equal to StCol.
INT Len integer in the range of
1-255. It is the maximum
length of the string to be
edited.
INT ChCase integer in the range 1-3.
The
Case Mode indicator defines how a
character is displayed on
the screen and stored in the
string variable being
edited.
1 = Do nothing to character
2 = Convert all chars to
upper case
3 = Convert all chars to
lower case
INT FillCh integer in the range of
0-255. This defines the
ascii character that is
displayed in the field for
undefined character
positions in the field being
edited.
INT AutoSkip integer indicating if an
auto exit is desired when
the last charac ter in the
field has been typed.
0 - No auto exit
1 - Auto exit after last
char in field is entered.
UINT ErrTone integer in units giving the
fre quency for beeping the
speaker.
UINT ErrDur integer in units giving the
length of time the speaker
is to beep.
CHAR *VCSet set of valid characters,
[0..255], that will be
accepted for data entry.
CHAR *TCSet set of extended keyboard
char acters, [0..255], that
are allowed to terminate
this procedure. (Refer to
appendix C for a listing of
these codes.)
INT *CharOfs an integer that indicates
the beginning cursor
position within the string.
If CharOfs is a 1 then
editing will begin in the
first column of the field
input area. If ChOfs is 256
or greater than the length
of the string to be

edited, the cursor will be
positioned after the last
character in the string. On
exit from EditSt ChOfs will
contain the cursor position
within the string.
INT *TE is the terminating element
number that terminated the
string input procedure. TE
will be in the range of
0-255 which corresponds to
the element number in
appendix C.
CHAR *St string buffer area to
receive the input data.

Remarks The maximum length of the string to edit is 255
characters. The data will be entered on one line. If
the maximum length of the string exceeds the number of
display columns, (SpCol-StCol+1), the string will
scroll horizontally on the screen

within the StCol and SpCol columns.

Edit Keys Keys The following gives an explanation of the editing
keys that may be used with EditSt, provided the key
pressed is not defined in the terminating character
set. EditSt calls the function GetKey, in the unit
SSGetKey, which returns

an integer. This integer is a value from
0-384 which corre sponds to an element
number that is defined in Appendix C. The
function GetKey is provided with a table
that maps the key element numbers to the
index number. Example, If the cursor is
to

move right one character position using
the
Ctrl-D key combination the value for Ctrl-D index
key (ele ment number 136) must map to the
right arrow key (element number 77). The
initialization of the Ctrl-D key for
KeyTable[136] would be 77.

LeftArr will move the cursor left one character
position on the screen until the StCol is
reached. If the beginning of the string
has not been reached the string will be
scrolled on the screen within the StCol
and SpCol boundaries.

RightArr will move the cursor right one character
position on the screen until the end of
the string is reached. If the cursor is
in the SpCol and there is still more in
the string that can be displayed the
string will then be scrolle

d within the StCol and SpCol boundaries.

Home will place the cursor in the StCol on the
screen and positioned under the first
character in the edit string.

End will position the cursor after the last
character in the edit string.

BackSpace If the StCol is displaying the first
character in the string being edited the
cursor will move to the left one column
and delete the character in that column.
If the character being displayed in the
StCol is not the first cha

r acter in the string being edited the
cursor will remain in the same column
position and delete the character to the
left of the cursor and pull the string
towards the cursor.

Esc will blank the string currently in the
field. If the field is already blank the
procedure will restore the string that was
passed to this procedure.

Tab will move the cursor to the right five
column positions if the SpCol has not been
reached. If the StCol has been reached
then the string display will be shifted
right.

^LeftArrow will move the cursor to the left five
column positions if the StCol has not been
reached. If the cursor is in the StCol
then only the display string will be
adjusted to reflect the move ment of the
cursor.

Del removes the character the cur sor is under
and decrements the string length by one.
All the characters to the right of the
cursor position are moved left one
position within the string and display
area.

^X will delete all characters from the
current string position to the end of the
string. All deleted characters will be
replaced with the FillCh that was
specified when calling this procedure.

Example See program example 3

Source editst.asm

----------------------------------------------------------------------
FillColAttr
----------------------------------------------------------------------

Description Display a column of attribute bytes on the screen.

Summary VOID FillColAttr( x, y, NRows, Attr );
INT x defines column to begin
display of attribute.
INT y defines row to begin display
of attribute.
INT NRows integer in the range 1-25
for the number of rows to
display the attribute byte

on.
INT Attr integer in the range 0-255.
It is the attribute byte to
be dis played on the screen.

Remarks FillColAttr always acts on the entire screen and is NOT
sensitive to Turbo's currently defined window.

See Also FillColCell, FillColChar

Example See program example 4

Source fcolbyte.asm

----------------------------------------------------------------------
FillColCell
----------------------------------------------------------------------

Description Fill a column on the screen with a character.

Summary VOID FillColCell( x, y, NRows, Cell );
INT x defines column to begin
display of data.
INT y defines row to begin display
of data.
INT NRows integer in the range 1-25
for the number of rows to
display the character and
attribute bytes on the
screen.
INT Cell integer in the range
0-0xffff. This is the
character and attribute word
combination where the high
order byte is the character
and the low order byte is
the attribute to be
displayed.

Remarks FillColCell always acts on the entire screen.

See Also FillColAttr, FillColChar

Example See program example 5

Source fcolcell.asm

----------------------------------------------------------------------
FillColChar
----------------------------------------------------------------------

Description Fill a column on the screen with a character.

Summary VOID FillColChar( x, y, NRows, Ch );
INT x defines column to begin
display of character.
INT y defines row to begin display
of character.
INT NRows integer in the range 1-25
for the number of rows to
display the character on.
CHAR Ch char in the range 0-255. It
is the
character to be displayed on the screen.

Remarks FillColChar always acts on the entire screen and is NOT
sensitive to compiler's predefined window.

See Also FillColAttr, FillColCell

Example See program example 4

Source fcolbyte.asm

----------------------------------------------------------------------
FillFrameAttr
----------------------------------------------------------------------

Description Fill the frame area defined by x1,y1,x2,y2 coordinates
with the attribute byte defined.

Summary VOID FillFrameAttr( x1, y1, x2, y2, Attr );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
INT Attr integer in the range 0-255.
It is the attribute to be
displayed on the screen in
the specified frame area.

See Also FillFrameCell, FillFrameChar

Example See program example 6

Source frambyte.asm

----------------------------------------------------------------------
FillFrameCell
----------------------------------------------------------------------

Description Fill the frame area defined by x1,y1,x2,y2 coordinates
with the cell defined.

Summary VOID FillFrameCell( x1, y1, x2, y2, Cell );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
INT Cell integer in the range 0-255.
This is the character and
attribute word combination
where the high byte is the
character and the low byte
is the attribute for the
cell to be displayed on the
screen in the specified
frame area.

See Also FillFrameAttr, FillFrameChar

Example See program example 7

Source framcell.asm

----------------------------------------------------------------------
FillFrameChar
----------------------------------------------------------------------

Description Fill the frame area defined by x1,y1,x2,y2 coordinates
with the character byte defined.

Summary VOID FillFrameChar( x1, y1, x2, y2, Ch );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
CHAR Ch character that will be
displayed on the screen in
the specified frame area.

See Also FillFrameAttr, FillFrameCell

Example See program example 6

Source frambyte.asm

----------------------------------------------------------------------
FillRowAttr
----------------------------------------------------------------------

Description Write N copies of the attribute byte on the screen
starting at the specified x,y coordinates.

Summary VOID FillRowAttr( x, y, NBytes, Attr );
INT x defines column to begin
display of attribute byte.
INT y defines row to begin display
of attribute byte.
INT NBytes gives number of times to
display the attribute byte
on the screen.
INT Attr integer in the range 0-255.
It is
the attribute byte to be dis played on the
screen.

Remarks FillRowAttr always acts on the entire screen and is NOT
sensitive to any compiler specific defined window.

See Also FillRowCell, FillFrameChar

Example See program example

Source frowbyte.asm

----------------------------------------------------------------------
FillRowCell
----------------------------------------------------------------------

Description Write N copies of the character and attribute byte on
the screen starting at the specified x,y coordinates.

Summary VOID FillRowCell( x, y, NWords, Cell );
INT x defines column to begin
display of cell word.
INT y defines row to begin display
of cell word.
INT NWords gives the number times to
dis play the character and
attribute bytes on the
screen.
INT2 Cell character and attribute
bytes to be displayed on the
screen.

Remarks FillRowCell always acts on the entire screen and is NOT
sensitive to any compiler specific defined window.

See Also FillRowAttr, FillFrameChar

Example See program example 9

Source frowcell.asm

----------------------------------------------------------------------
FillRowChar
----------------------------------------------------------------------

Description Write N copies of the character byte on the screen
starting at the specified x,y coordinates.

Summary VOID FillRowChar( x, y, NBytes, Ch );
INT x defines column to begin
display of character.
INT y defines row to begin display
of character.
INT NBytes gives number of times to
display the character on the
screen.
CHAR Ch value in the range 0-255.
It' the value or ascii
character to be displayed.

Remarks FillRowChar always acts on the entire screen and is NOT
sensitive to any compiler specific defined window.

See Also FillRowAttr, FillFrameCell

Example See program example 4,5

Source frowbyte.asm

----------------------------------------------------------------------
FrameWin
----------------------------------------------------------------------

Description Frames the window currently defined by the global
variables WindMax and WindMin with the specified
characters.

Summary VOID FrameWin( UL, UR, LL, LR, Hor, Ver, Attr );
CHAR UL char in upper left corner of
win dow.
CHAR UR char in upper right corner
of window.
CHAR LL char in lower left corner of
win dow.
CHAR LR char in lower right corner
of window.
CHAR Hor horizontal char for top and
bot tom rows of window.
CHAR Ver vertical char for left and
right columns of window.
INT Attr attribute color to use for
window frame display.

Remarks FrameWin will outline the window that is currently
defined by the global variables WindMin and WindMax
with the charac ters passed. The coordinates given by
WindMin and WindMax are used to frame the window area.

Once the window frame has been displayed WindMin and
WindMax will be adjusted so the window will fit within
the framed area. (e.g. if the current window is
defined as 1,1,80,25 then after FrameWin the current
window will be 2,2,79,24).

Example See program examples 3-9

Source framewin.asm

----------------------------------------------------------------------
GetCursorSize
----------------------------------------------------------------------

Description Reports the starting and ending scan lines of the
current cursor.

Summary INT2 GetCursorSize( VOID );

Returns Gets the cursor size by reporting the starting scan
line in the high byte and the ending scan line in the
low byte of the word.

Example See program example 10.

Source gcursize.asm

----------------------------------------------------------------------
GetFrameAttr
----------------------------------------------------------------------

Description Read the attribute bytes for the specified area on the
screen into the buffer area.

Summary VOID GetFrameAttr( x1, y1, x2, y2, Buffer );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
CHAR *Buffer data area where data from
screen will be placed.

See Also GetFrameCell, GetFrameChar

Example See program example

Source gframbyt.asm

----------------------------------------------------------------------
GetFrameCell
----------------------------------------------------------------------

Description Read the character and attributes bytes for the
specified area on the screen into the buffer area.

Summary VOID GetFrameCell( x1, y1, x2, y2, Buffer );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
CHAR *Buffer data area where data from
screen will be placed.

See Also GetFrameAttr, GetFrameChar

Example See program example

Source gframbyt.asm

----------------------------------------------------------------------
GetFrameChar
----------------------------------------------------------------------

Description Read the character bytes for the specified area on the
screen into the buffer area.

Summary VOID GetFrameChar( x1, y1, x2, y2, Buffer );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
CHAR *Buffer data area where data from
screen will be placed.

See Also GetFrameAttr, GetFrameCell

Example See program example

Source gframbyt.asm

----------------------------------------------------------------------
GetScrn
----------------------------------------------------------------------

Description Read the character and attribute bytes starting from
speci fied position on the screen into the buffer.

Summary VOID GetScrn( x, y, NWords, Buffer );
INT x column to begin reading data
from the screen.
INT y row to begin reading data
from the screen.
INT NWords number of words to read from
the display screen.
CHAR *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 o

ff through the global variable CheckSnow.

See Also PutScrn

Example See program example

Source gscrn.asm

----------------------------------------------------------------------
GetVideoCols
----------------------------------------------------------------------

Description Get the number of columns per line for the current
display mode.

Summary INT GetVideoCols( VOID );

Remarks GetVideoCols will return the number of columns on the
screen.

See Also GetVideoInfo

Example See program example

Source gviocols.asm

----------------------------------------------------------------------
GetVideoInfo
----------------------------------------------------------------------

Description Gets general video display informtion.

Summary VOID GetVideoInfo( BaseSeg, Cols, Pg, Mode );
INT *BaseSeg returns the base segment
address of the current video
page.
INT *Cols returns the number of
display columns available
for the cur rent video mode.
INT *Pg returns the active display
page for the video display.
This will always be zero for
the mono chrome display
adapter.
INT *Mode returns the current video
display mode.

See Also GetVideoCols, GetVideoMode, GetVideoPage

Example See program example

Source gvioinfo.asm

----------------------------------------------------------------------
GetVideoMode
----------------------------------------------------------------------

Description Gets the current video mode.

Summary INT 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 See program example

Source gviomode.asm

----------------------------------------------------------------------
GetVideoPage
----------------------------------------------------------------------

Description Gets the active display page currently in use.

Summary INT GetVideoPage( VOID );

Remarks On monochrome displays GetVideoPage will always return
a zero.

See Also GetVideoInfo

Example See program example

Source gviopage.asm

----------------------------------------------------------------------
GotoxyAbs
----------------------------------------------------------------------

Description Position the cursor at the specified position on the
screen without regards to the global variables WindMin
and Wind Max.

Summary VOID GotoxyAbs( x, y );
INT x column number to place the
cursor in.
INT 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 See program examples 2-5

Source gotoxyab.asm

----------------------------------------------------------------------
HideCursor
----------------------------------------------------------------------

Description Hides the cursor from view of the video display.

Summary VOID HideCursor( VOID );

Remarks This function turns on the fifth bit of the current
cursor size.

Example See program example

Source hcursor.asm

----------------------------------------------------------------------
InitVideo
----------------------------------------------------------------------

Description Initialize the video mode.

Summary VOID InitVideo( Mode );
INT Mode gives the video mode to
initial ize.

Remarks To set the screen to the appropriate video mode use the
fol lowing 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 See program example

Source initvio.asm

----------------------------------------------------------------------
PutFrameAttr
----------------------------------------------------------------------

Description Write the data in the buffer to the attribute byte in
the speci fied area on the screen.

Summary VOID PutFrameAttr( x1, y1,x2, y2, Buffer );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
CHAR *Buffer data buffer that contains
the information to display
on the screen.

See Also GetFrameAttr, PutFrameCell, PutFrameChar

Example See program example

Source pframbyt.asm

----------------------------------------------------------------------
PutFrameCell
----------------------------------------------------------------------

Description Write the data in the buffer to the character and
attribute bytes in the specified area on the screen.

Summary VOID PutFrameCell( x1, y1, x2, y2, Buffer );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
CHAR *Buffer data buffer that contains
the information to display
on the screen.

See Also GetFrameCell, PutFrameAttr, PutFrameChar

Example See program example

Source pframbyt.asm

----------------------------------------------------------------------
PutFrameChar
----------------------------------------------------------------------

Description Write the data in the buffer to the character byte in
the specified area on the screen.

Summary VOID PutFrameChar( x1, y1, x2, y2, Buffer );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
CHAR *Buffer data buffer that contains
the information to display
on the screen.

See Also GetFrameChar, PutFrameAttr, PutFrameChar

Example See program example

Source pframbyt.asm

----------------------------------------------------------------------
PutScrn
----------------------------------------------------------------------

Description Displays the data in the buffer to the specified screen
posi tion in character attribute byte form.

Summary VOID PutScrn( x, y, NWords, Buffer );
INT x column to begin display of
screen data.
INT y row to begin display of
screen data.
INT NWords number of words to read from
the display screen.
CHAR *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 o

ff through the global variable CheckSnow.

See Also GetScrn

Example See program example

Source pscrn.asm

----------------------------------------------------------------------
RvsAttr
----------------------------------------------------------------------

Description Reverses the video attribute byte passed.

Summary INT RvsAttr( Attr );
INT 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 parameter value passed in. The
blink and intensity bits of the byte remain unchanged.

Example See program example

Source rvsattr.asm

----------------------------------------------------------------------
ScrollDown
----------------------------------------------------------------------

Description Scroll the specified portion of the screen down N lines
filling in new lines with spaces and the specified
attribute.

Summary VOID ScrollDown( x1, y1, x2, y2, Attr, NRows );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
INT 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.
INT 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

Example See program example

Source scrollvt.asm

----------------------------------------------------------------------
ScrollLeft
----------------------------------------------------------------------

Description Scroll the specified portion of the screen left N
columns fill ing in new columns with spaces and the
specified attribute.

Summary VOID ScrollLeft( x1, y1, x2, y2, Attr, NCols );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
INT Attr value in the range 0-255. It
defines the display
attribute to be used
when filling in the
blankcolumns on the right
side of the window.
INT NCols number of columns the speci
fied portion of the screen
is to be scrolled.

Remarks If a value of zero for the number of lines to scroll is
used, 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

Example See program example

Source scrolllt.asm

----------------------------------------------------------------------
ScrollRight
----------------------------------------------------------------------

Description Scroll the specified portion of the screen right N
columns fill ing in new columns with spaces and the
specified attribute.

Summary VOID ScrollRight( x1, y1, x2, y2, Attr, NCols );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
INT 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.
INT NCols number of columns the speci
fied 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

Example See program example

Source scrollrt.asm

----------------------------------------------------------------------
ScrollUp
----------------------------------------------------------------------

Description Scroll the specified portion of the screen up N lines
filling in new lines with spaces and the specified
attribute.

Summary VOID ScrollUp( x1, y1, x2, y2, Attr, NRows );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
INT 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.
INT 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

Example See program example

Source scrollvt.asm

----------------------------------------------------------------------
SetCursorSize
----------------------------------------------------------------------

Description Set the size of the cursor.

Summary VOID SetCursorSize( StScan, SpScan );
INT StScan starting scan line to be
used for the cursor.
INT 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 follow ing 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

Example See program example

Source scursize.asm

----------------------------------------------------------------------
SetVideoPage
----------------------------------------------------------------------

Description Set the active display page.

Summary VOID SetVideoPage( PageNo );
INT 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 See program example

Source sviopage.asm

----------------------------------------------------------------------
ShowCursor
----------------------------------------------------------------------

Description Shows the cursor on the video display.

Summary VOID ShowCursor( VOID );

Remarks This function turns off the fifth bit of the current
cursor size.

Example See program example

Source scursor.asm

----------------------------------------------------------------------
VioInit
----------------------------------------------------------------------

Description Initializes the Video units global variables.

Summary VOID VioInit( VOID );

Remarks This function must be executed once before any video
func tions 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 See program examples 2-7

Source vioinit.asm

----------------------------------------------------------------------
WhereXAbs
----------------------------------------------------------------------

Description Returns the column the cursor is in.

Summary INT 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 See program example

Source wherexab.asm

----------------------------------------------------------------------
WhereYAbs
----------------------------------------------------------------------

Description Returns the row the cursor is on.

Summary INT 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 See program example

Source whereyab.asm

----------------------------------------------------------------------
WindowFP
----------------------------------------------------------------------

Description Set the window coordinate variables WindMin and
WindMax.

Summary VOID WindowFP( x1, y1, x2, y2 );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT 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 See program example 3-7

Source windowfp.asm

----------------------------------------------------------------------
WriteSt
----------------------------------------------------------------------

Description Display a string on the screen

Summary VOID WriteSt( String );
CHAR *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 physi cal screen when necessary.
WriteSt will not scroll the sc

reen 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 See program example 3

Source wrtst.asm

----------------------------------------------------------------------
WriteStln
----------------------------------------------------------------------

Description Display a string on the screen

Summary VOID WriteStln( String );
CHAR *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 physi

cal 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 See program example 3

Source wrtstln.asm



Chapter 4
BIOS Video

+--------------------------------+
| |
| This section supports video |
| BIOS functions. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

----------------------------------------------------------------------
bvCurEmulation[VGA]
----------------------------------------------------------------------

Description Enables or disables cursor emulation for the currently
active display. When cursor emulation is enabled, the
ROM BIOS automatically remaps INT 10H Function 01H
cursor starting scan and ending scan lines for the
current character cell


dimensions.
Summary INT2 bvCurEmulation( setting );
INT2 setting 0 - enables emulation
1 - disable emulation

Returns 12h - if function is supported.

Example See program example

Source b101234d.asm

----------------------------------------------------------------------
bvDefPalLoad[MCGA][VGA]
----------------------------------------------------------------------

Description Enables or disables loading of a default palette when a
video display mode is selected.

Summary INT2 bvDefPalLoad( setting );
INT2 setting 0 - enables default palette
load ing
1 - disable default palette
load ing

Returns 12h - if function is supported.

Example See program example

Source b101231d.asm

----------------------------------------------------------------------
bvGetBorder[VGA]
----------------------------------------------------------------------

Description Obtain current color of the border.

Summary INT2 bvGetBorder( VOID );

Returns The attribute value of the border color.

Example See program example

Source b101008d.asm

----------------------------------------------------------------------
bvGetColorPgMode[VGA]
----------------------------------------------------------------------

Description Gets paging mode for specified color registers and the
cur rent color page.

Summary VOID bvGetColorPgMode( colorpg, pgmode );
INT2 *colorpg color page to get
information on
INT2 *pgmode 00 - if 4 pages of 64
registers
01 - if 16 pages of 16
registers

See Also bvSetColorPgMode

Example See program example

Source b10101ad.asm

----------------------------------------------------------------------
bvGetColorReg[MCGA][VGA]
----------------------------------------------------------------------

Description Sets paging mode for color registers

Summary VOID bvGetColorReg( colorreg, green, blue, red );
INT2 colorreg color register
INT2 *green green color value
INT2 *blue blue color value
INT2 *red red color value

Example See program example

Source b101015d.asm

----------------------------------------------------------------------
bvGetColorRegBlk[MCGA][VGA]
----------------------------------------------------------------------

Description Reads the set of red, green and blue colors associated
with each set of color registers.

Summary VOID bvGetColorRegBlk( startreg, regcount, colortbl );
UINT2 startreg first color register
INT2 regcount number of registers
INT2 colortbl[][3] color table consists of 3
bytes for each register.
Each group of 3 bytes will
specify the red, green, and
blue values, respec tively
for the associated register.

Example See program example

Source b101017d.asm

----------------------------------------------------------------------
bvGetConfigInfo[EGA][VGA]
----------------------------------------------------------------------

Description Returns configuration information for the active video
sys tem.

Summary VOID bvGetConfigInfo( dsptype, egamem, fbits, swset );
INT2 *dsptype 0 - color
1 - monochrome
INT2 *egamem 0 - 64K
1 - 128K
2 - 192K
3 - 256K
INT2 *fbits feature bits
INT2 *swset switch setting

Remarks The feature bits are set from input status register
zero in response to an output on the specified feature
control regis ter bits:

Feature Feature control Input Status
Bit(s) Output Bit Bit
0 0 5
1 0 6
2 1 5
3 1 6
4-7 not used

The bits in the switch settings byte indicate the state
of the EGA's configuration DIP switch (1=off, 0=on).

Bit Significance
0 configuration switch 1
1 configuration switch 2
2 configuration switch 3
3 configuration switch 4
4-7 not used

Example See program example

Source b101210d.asm

----------------------------------------------------------------------
bvGetCurPos[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Returns the current position of the cursor on the
display.

Summary VOID bvGetCurPos( pg, row, col );
INT2 pg page to get cursor position
for
INT2 *row row (y coordinate)
INT2 *col col (x coordinate)

Example See program example

Source b100300d.asm

----------------------------------------------------------------------
bvGetCurType[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Returns starting and ending scan lines for the cursor
in text modes.

Summary VOID bvGetCurType( pg, stscan, spscan );
INT2 pg page to get cursor position
for
INT2 *stscan starting scan line for
cursor
INT2 *spscan ending scan line for cursor

Example See program example

Source b1003x0d.asm

----------------------------------------------------------------------
bvGetFontInfo[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Returns a pointer to the character definition table for
a font, and the bytes per character and rows for that
font.

Summary VOID bvGetFontInfo( fontcode, points, scnrows, fonttbl
);
INT2 fontcode defines font table to
retrieve information on
UINT2 *points bytes per character
INT2 *scnrows rows per screen
VOID *fonttbl address of font table
requested

Remarks Font
Code Description

00 current Int 1FH contents
01 current Int 43H contents
02 ROM 8x14 font (EGA, VGA only)
03 ROM 8x8 font (characters 00H-7FH)
04 ROM 8x8 font (characters 80H-FFH)
05 ROM alternate 9x14 font (EGA, VGA only)
06 ROM 8x16 font (MCGA, VGA only)
07 ROM alternate 9x16 font (VGA only)

Example See program example

Source b101130d.asm

----------------------------------------------------------------------
bvGetMode[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Return current display mode, active page and number of
columns for the active display page.

Summary VOID bvGetMode( mode, cols, pg );
INT2 *mode current display mode
INT2 *cols number of column on page
INT2 *pg active display page

Example See program example

Source b100f00d.asm

----------------------------------------------------------------------
bvGetPalBorder[VGA]
----------------------------------------------------------------------

Description Obtain contents of all palette registers and color of
border.

Summary VOID bvGetPalBorder( buf );
CHAR buf[17] Bytes 00-0Fh will contain
the
palette values. Byte 10h will contain the
border color.

Example See program example

Source b101009d.asm

----------------------------------------------------------------------
bvGetPalReg[VGA]
----------------------------------------------------------------------

Description Return the color associated with the specified register
pal ette.

Summary INT2 bvGetPalReg( reg );
INT2 reg return the color for this
palette register.

Returns Color for the specified palette register.

Example See program example

Source b101007d.asm

----------------------------------------------------------------------
bvGrayScaleSum[MCGA] [VGA]
----------------------------------------------------------------------

Description Enables or disables gray-scale summing for active
display.

Summary INT2 bvGrayScaleSum( setting );
INT2 setting 0 - enables access
1 - disable access
Return 12h is returned if this function
is supported.

Example See program example

Source b101233d.asm

----------------------------------------------------------------------
bvLoad8x14Font01[EGA] [VGA]
----------------------------------------------------------------------

Description Provides the default 8x14 font table in text modes.

Summary VOID bvLoad8x14Font01( block );
INT2 block specifies the block of
character generator RAM. (0
or 1).

Remarks If this function is used on an MCGA then the BIOS will
execute the function bvLoad8x16Font04.

Example See program example

Source b101101d.asm

----------------------------------------------------------------------
bvLoad8x14Font11[EGA] [VGA]
----------------------------------------------------------------------

Description Provides the default 8x14 font table in text modes.

Summary VOID bvLoad8x14Font11( block );
INT2 block specifies the block of
character generator RAM. (0
or 1).

Remarks Page zero must be active and if this function is used
at any other time than immediately after a set mode,
the results will be unpredictable.

If this function is used on an MCGA then the BIOS will
execute the function bvLoad8x16Font04.

Example See program example

Source b101101d.asm

----------------------------------------------------------------------
bvLoad8x16Font04[MCGA] [VGA]
----------------------------------------------------------------------

Description Provides the default 8x16 font table in text modes.

Summary VOID bvLoad8x16Font04( block );
INT2 block specifies the block of
character generator RAM.

Remarks On a MCGA, a call to this function should be followed
with a call to bvSetBlkSpec.

Example See program example

Source b101104d.asm

----------------------------------------------------------------------
bvLoad8x16Font14[MCGA] [VGA]
----------------------------------------------------------------------

Description Provides the default 8x16 font table in text modes.

Summary VOID bvLoad8x16Font14( block );
INT2 block specifies the block of
character generator RAM.

Remarks Page zero must be active and if this function is used
at any other time than immediately after a set mode,
the results will be unpredictable.

If this function is used on an MCGA then the BIOS will
execute the function bvLoad8x16Font04.

Example See program example

Source b101104d.asm

----------------------------------------------------------------------
bvLoad8x8Font02[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Provides the default 8x8 font table in text modes.

Summary VOID bvLoad8x8Font02( block );
INT2 block specifies the block of
character generator RAM.

Remarks On a MCGA, a call to this function should be followed
with a call to bvSetBlkSpec.

Example See program example

Source b101102d.asm

----------------------------------------------------------------------
bvLoad8x8Font12[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Provides the default 8x8 font table in text modes.

Summary VOID bvLoad8x8Font12( block );
INT2 block specifies the block of
character generator RAM.

Remarks Page zero must be active and if function is used at any
other time than immediately after a set mode, the
results will be unpredictable. If this function is
used on an MCGA then the BIOS will execute the function
bvLoad8x16Font02.

Example See program example

Source b101102d.asm

----------------------------------------------------------------------
bvLoadUsrFont00[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Loads the users text font table into the specified
block of character generator RAM.

Summary VOID bvLoadUsrFont00( pts, block, chcnt, startch,
fonttbl );
INT2 pts bytes per character
INT2 block specifies block of character
generator RAM.
UINT2 chcnt characters in table
UINT2 startch first character in table
VOID *fonttbl font table address

Remarks On a MCGA, a call to this function should be followed
with a call to bvSetBlkSpec.

Example See program example

Source b101100d.asm

----------------------------------------------------------------------
bvLoadUsrFont10[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Loads the users text font table into specified block of
char acter generator RAM.

Summary VOID bvLoadUsrFont10( pts, block, chcnt, startch,
fonttbl );
INT2 pts bytes per character
INT2 block specifies block of character
generator RAM.
UINT2 chcnt characters in table
UINT2 startch first character in table
VOID *fonttbl font table address

Remarks Page zero must be active and if this function is used
at any other time than immediately after a set mode,
the results will be unpredictable.

If this function is used on an MCGA then the BIOS will
execute the function bvLoadUsrFont00.

Example See program example

Source b101100d.asm

----------------------------------------------------------------------
bvReadCell[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Read the cell the cursor is positioned on for its
character and attribute values.

Summary VOID bvReadCell( ch, attr, pg );
INT2 *ch will contain the character
of the cell.
INt2 *attr will contain the attribute
value of the cell.
INT2 *pg the page the cell to read is
on.

Remarks The page to read from does not have to be the active
page, if the video display supports multiple pages.

Example See program example

Source b100800d.asm

----------------------------------------------------------------------
bvReadPix[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Read pixel from the specified graphics coordinates.

Summary INT2 bvReadPix( row, col, pg );
INT2 row row for pixel to be read
from
INT2 col col for pixel to be read
from
INT2 pg page to read pixel from

Returns The pixel value at for the coordinates requested.

Example See program example

Source b100d00d.asm

----------------------------------------------------------------------
bvScnRefresh[VGA]
----------------------------------------------------------------------

Description Enables or disables the video refresh for the currently
active display.

Summary INT2 bvScnRefresh( setting );

INT2 setting 0 - enables refresh
1 - disable refresh

Returns 12h is returned if this function is supported.

Example See program example

Source b101236d.asm

----------------------------------------------------------------------
bvScrollDn[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Scrolls the contents of the window on the active
display page down by the specified number of lines.

Summary VOID bvScrollDn( top, left, bottom, right, lines, attr
);
INT2 top top row of window
INT2 left left column of window
INT2 bottom bottom row of window
INT2 right right column of window
INT2 lines number of lines to scroll
INT2 attr attribute to use for blanked
area

Remarks If the number of lines to scroll is zero, the entire
window will be blanked.

Example See program example

Source b1006xxd.asm

----------------------------------------------------------------------
bvScrollUp[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Scrolls the contents of the window on the active
display page up by the specified number of lines.

Summary VOID bvScrollUp( top, left, bottom, right, lines, attr
);
INT2 top top row of window
INT2 left left column of window
INT2 bottom bottom row of window
INT2 right right column of window
INT2 lines number of lines to scroll
INT2 attr attribute to use for blanked
area

Remarks If the number of lines to scroll is zero, the entire
window will be blanked.

Example See program example

Source b1006xxd.asm

----------------------------------------------------------------------
bvSet1FhFontPtr[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Sets the Int 1Fh pointer to the user's font table. The
table is used for character codes 80H-FFH) in graphics
modes 04H-06H.

Summary VOID bvSet1FhFontPtr( fonttbl );
VOID *fonttbl pointer to the font table

Remarks If this function is used at any other time than
immediately after a set mode, the results will be
unpredictable.

Example See program example

Source b101120d.asm

----------------------------------------------------------------------
bvSet43h8x14Font[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Sets the vector for Int 43h to point to the ROM BIOS
default 8x14 font and updates the video ROM BIOS data
area.

Summary VOID bvSet43h8x14Font( spec, scnrows );
INT2 spec must be a value from 0-3 to
specify the number of
character rows on the
screen.

Specifier Descriptionx14Font(spec, scnrows );
00 use scnrows var
01 14 rows
02 25 rows
03 43 rows

INT2 scnrows number of rows per screen
when spec(ifier) is zero.

Remarks If this function is used at any other time than
immediately after a set mode, the results will be
unpredictable. When this function is used on the MCGA,
the BIOS substitutes function call bvSet43h8x16Font.

Example See program example

Source b101122d.asm

----------------------------------------------------------------------
bvSet43h8x16Font[MCGA] [VGA]
----------------------------------------------------------------------

Description Sets the vector for Int 43h to point to the ROM BIOS
default 8x16 font and updates the video ROM BIOS data
area.

Summary VOID bvSet43h8x16Font( spec, scnrows );
INT2 spec must be a value from 0-3 to
specify the number of
character rows on the
screen.

Specifier Descriptionx16Font(spec, scnrows );
00 use scnrows var
01 14 rows
02 25 rows
03 43 rows

INT2 scnrows number of rows per screen
when spec(ifier) is zero.

Remarks If this function is used at any other time than
immediately after a set mode, the results will be
unpredictable.

Example See program example

Source b101124d.asm

----------------------------------------------------------------------
bvSet43h8x8Font[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Sets the vector for Int 43h to point to the ROM BIOS
default 8x8 font and updates the video ROM BIOS data
area.

Summary VOID bvSet43h8x8Font( spec, scnrows );
INT2 spec must be a value from 0-3 to
specify the number of
character rows on the
screen.

Specifier Descriptionx8Font(spec, scnrows );
00 use scnrows var
01 14 rows
02 25 rows
03 43 rows

INT2 scnrows number of rows per screen
when spec(ifier) is zero.

Remarks If this function is used at any other time than
immediately after a set mode, the results will be
unpredictable.

Example See program example

Source b101123d.asm

----------------------------------------------------------------------
bvSet43hUsrFont[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Sets the vector for Int 43h to point to the user's font
table and update the video ROM BIOS data area.

Summary VOID bvSet43hUsrFont( rows, points, scnrows, fonttbl );
INT2 rows character rows specifier
UINT2 points bytes per character
INT2 scnrows rows per screen
VOID *fonttbl pointer to the user font
table

Remarks If this function is used at any other time than
immediately after a set mode, the results will be
unpredictable.

Example See program example

Source b101121d.asm

----------------------------------------------------------------------
bvSetAltPrtSc[EGA] [VGA]
----------------------------------------------------------------------

Description Selects an alternate print-screen routine for the EGA
and VGA that works properly if the screen length is not
25 lines.

Summary VOID bvSetAltPrtSc( VOID );

Example See program example

Source b101220d.asm

----------------------------------------------------------------------
bvSetBlink[PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Determines if the significant bit in an attribute will
display either blinking or intensified.

Summary VOID bvSetBlink( state );
INT2 state 0 - enables intensity
1 - enables blinking

Example See program example

Source b101003d.asm

----------------------------------------------------------------------
bvSetBlkSpec[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Determines character blocks selected by bit 3 of the
charac ter attribute bytes in alphanumeric display
modes.

Summary VOID bvSetBlkSpec( block );
INT2 block select code for char
generator block

Remarks EGA, MCGA
Bits Description
0,1 indicates which 1 of 4 256 character tables is used when
bit 3 of character's attribute byte is zero.

2,3 indicate which table is used when bit 3 is set on.

VGA
Bits Description
0,1,4 specify 1 of 8 tables when bit 3 is zero.
2,3,5 specify table when attribute bit 3 is one.

Example See program example

Source b101103d.asm

----------------------------------------------------------------------
bvSetBorder[PCjr] [EGA] [VGA]
----------------------------------------------------------------------

Description Controls the color of the screen border.

Summary VOID bvSetBorder( color );
INT2 color color of border. Range
(0-63).

Example See program example

Source b101001d.asm

----------------------------------------------------------------------
bvSetColorPgMode[VGA]
----------------------------------------------------------------------

Description Sets paging mode for color registers

Summary VOID bvSetColorPgMode( pgstate );
INT2 pgstate 00 - sets 4 pages of 64
registers
01 - sets 16 pages of 16
regis ters

Remarks This function is invalid for graphics video mode 13H
(320x200, 256 colors).

Example See program example

Source b101013d.asm

----------------------------------------------------------------------
bvSetColorReg[MCGA] [VGA]
----------------------------------------------------------------------

Description Set red-green-blue values for a color register

Summary VOID bvSetColorReg( colorreg, green, blue, red );
UINT2 colorreg color register
INT2 green green color value
INT2 blue blue color value
INT2 red red color value

Remarks When gray-scale summing is on, the gray-scale weighted
values are calculated as described under the function
bvSetGrayScale and stored into the components of the
color register.

Example See program example

Source b101010d.asm

----------------------------------------------------------------------
bvSetColorRegBlk[MCGA] [VGA]
----------------------------------------------------------------------

Description Set a series of consecutive color registers.

Summary VOID bvSetColorRegBlk( startreg, regcount, colortbl );
UINT2 startreg first color register
INT2 regcount number of registers
BYTE colortbl[][3] color table that consists of
3 bytes for every register.
Each group of 3 bytes will
specify the red, green, and
blue values, respectively
for the associated register.

Remarks When gray-scale summing is on, the gray-scale weighted
values are calculated as described under the function
bvSetGrayScale and stored into the components of the
color register.

Example See program example

Source b101012d.asm

----------------------------------------------------------------------
bvSetColorRegPg[VGA]
----------------------------------------------------------------------

Description Set a color register page.

Summary VOID bvSetColorRegPg( pg );
INT2 pg color register page to
select.

Remarks This function is invalid for graphics video mode 13H
(320x200, 256 colors).

Example See program example

Source b101013d.asm

----------------------------------------------------------------------
bvSetCurPos[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Sets cursor position for the selected page.

Summary VOID bvSetCurPos( pg, row, col );
INT2 pg page to set cursor position
INT2 row row (y coordinate)
INT2 col col (x coordinate)

Example See program example

Source b100200d.asm

----------------------------------------------------------------------
bvSetCurType[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Selects starting and ending scan lines for the cursor
in text modes.

Summary VOID bvSetCurType( StScan, SpScan );
INT2 StScan starting scan line for
cursor
INT2 SpScan ending scan line for cursor

Remarks In text modes, the hardware causes the cursor to blink,
which cannot be disabled. In graphics mode, the
cursor is not available.

The scan line ranges for the cursor are:

Mode Start End
7 0 12
0-3 0 7

For example, the X's would be the position of the
cursor on a text row using scan lines 6 and 7 for a CGA
display.

0 --
1 --
2 --
3 --
4 --
5 --
6 -- XX
7 -- XX

In text modes 0-3 the EGA, MCGA, and VGA provide cursor
emulation for the starting and ending scan lines. The
staring and ending values are remapped from an 8x8
cell to the true character cell dimension.

One technique used to hide the cursor is by passing in
the value 32H or 00100000B) for the starting and ending
scan lines.

Example See program example

Source b100100d.asm

----------------------------------------------------------------------
bvSetGrayScale[MCGA] [VGA]
----------------------------------------------------------------------

Description Sets red, green and blue values of one or more color
regis ters into the gray-scale equivalents.

Summary VOID bvSetGrayScale( startreg, regcount );
UINT2 startreg first color register
INT2 regcount number of registers

Remarks For the range of color registers specified, each
register is read and each new color value is calculated
as 30% red + 59% green + 11% blue.

Example See program example

Source b10101bd.asm

----------------------------------------------------------------------
bvSetMode[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Set video display mode.

Summary VOID bvSetMode( mode, clear );
UINT mode video mode to set
UINT clear 0 - clear display buffer
for new mode.
1 - do not clear display
buffer for new mode. This
parameter is ignored on PC's
and PC/XT's with a cga or
monochrome dis play adapter.

Remarks The video modes applicable for the various video
adapters are as follows:

Text/
Mode Resolution Colors Graphics MDA CGA PCjr EGA MCGA VGA
00h 40x25 16 text x x x x x
01h 40x25 16 text x x x x x
02h 80x25 16 text x x x x x
03h 80x25 16 text x x x x x
04h 320x200 4 graphics x x x x x
05h 320x200 4 graphics x x x x x
06h 640x200 2 graphics x x x x x
07h 80x25 2* text x x x
08h 160x200 16 graphics x
09h 320x200 16 graphics x
0Ah 640x200 4 graphics x
0Bh reserved
0Ch reserved
0Dh 320x200 16 graphics x x
0Eh 640x200 16 graphics x x
0Fh 640x350 2* graphics x x
10h 640x350 4 graphics x**
10h 640x350 16 graphics x*** x
11h 640x480 2 graphics x x
12h 640x480 16 graphics x
13h 320x200 256 graphics x x

* Monochrome monitor only.
** EGA with 64 KB of RAM.
*** EGA with 128 KB or more of RAM.

On the PC/AT, PCjr, and PS/2, if the "clear" parameter
is set, the display buffer is not cleared when a new
mode is selected. This capability is only available
on PC or PC/XT when an EGA or VGA adapter is installed.

Example See program example

Source b1000xxd.asm

----------------------------------------------------------------------
bvSetPage[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Select active display page

Summary VOID bvSetPage( pg );
INT2 pg page to select.

Example See program example

Source b100500d.asm

----------------------------------------------------------------------
bvSetPalBorder[PCjr] [EGA] [VGA]
----------------------------------------------------------------------

Description Sets palette registers and border color

Summary VOID bvSetPalBorder( list );
CHAR list[17] Bytes 0-15 are the color
values to be loaded into the
appropriate palette
registers. Byte 16 is
stored in the border color
regis ter.

Example See program example

Source b100500d.asm

----------------------------------------------------------------------
bvSetPalReg[PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Sets appropriate palette register to a displayable
color.

Summary VOID bvSetPalReg( color, reg );
INT2 color color value
INT2 reg palette register

Remarks For MCGA the color must be 07h and the reg variable
must be 012h.

Example See program example

Source b101000d.asm

----------------------------------------------------------------------
bvSetScanLines[VGA]
----------------------------------------------------------------------

Description Selects the number of scan lines for text modes. The
selected value takes effect the next time the
bvSetMode function is called to select the display
mode.

Summary INT2 bvSetScanLines( scancode );
INT2 scancode 0 - 200 scan lines
1 - 350 scan lines
2 - 400 scan lines

Returns 18 - VGA is active
00 - VGA is not active

Example See program example

Source b101230d.asm

----------------------------------------------------------------------
bvSetState0B[CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description In text mode the border color is set. Graphics mode
sets the border and background color.

Summary VOID bvSetState0B( color );
INT2 color color to set background,
border

Example See program example

Source b100b00d.asm

----------------------------------------------------------------------
bvSwDsp[VGA]
----------------------------------------------------------------------

Description Allows selection of one of two video adapters in the
system, when memory usage or port addresses conflict
between the two adapters.

Summary UINT bvSwDsp( setting, buffer );
INT2 setting 0 - disable initial video
adapter
1 - enable system board
video adapter
2 - disable active video
adapter
3 - enable inactive video
adapter
CHAR *buffer 128-byte buffer to use if
setting is 1, 2, or 3.

Returns 18 - Function is supported.


Remarks If the function is called with setting set to 0 or 2
then the video adapter state information is stored in
the buffer vari able. If the function is called with
setting set to 3 then the information in the buffer
variable will be used to restore the video adapter
state.

Example See program example

Source b101235d.asm

----------------------------------------------------------------------
bvVioAccess[MCGA] [VGA]
----------------------------------------------------------------------

Description Enables or disables CPU access to the video adapter's
I/O ports and video refresh buffer.

Summary INT2 bvVioAccess( setting );
INT2 setting 0 - enables access
1 - disable access

Returns 18 - Function is supported.

Example See program example

Source b101232d.asm

----------------------------------------------------------------------
bvWrtNCell[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Write a character and attribute to the display at the
current cursor position for n times.

Summary VOID bvWrtNCell( ch, attr, count, pg );
INT2 ch character
INT2 attr attribute
INT2 count number of cells to
replication
INT2 pg page to write cell to

Remarks The cursor position is not updated are the character
attribute values are displayed.

In graphics mode the replication factor given in count
will display character attribute combinations only for
the current row.

All characters will display something, including the
bell, backspace, carriage return and the line feed.
These control characters are NOT recognized as special
characters and will not affect the cursor position.

The character definition tables is stored in the vector
for the bvSet43hxxxxFont functions for the EGA, MCGA
and VGA displays in graphics modes.

Example See program example

Source b100900d.asm

----------------------------------------------------------------------
bvWrtNChar[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Write a character to the display at the current cursor
position for n times.

Summary VOID bvWrtNChar( ch, count, pg );
INT2 ch character
INT2 count number of cells to
replication
INT2 pg page to write cell to

Example See program example

Source b100a00d.asm

----------------------------------------------------------------------
bvWrtPix[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Display pixel at the specified graphics coordinates

Summary VOID bvWrtPix( row, col, pixval, pg );
INT2 row row for pixel to be
displayed on
INT2 col col for pixel to be
displayed on
INT2 pixval color of pixel
INT2 pg page to display pixel on

Example See program example

Source b100c00d.asm

----------------------------------------------------------------------
bvWrtTTYChar[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Write character at the current cursor position using
the color specified (if in graphics mode).

Summary VOID bvWrtTTYChar( ch, pg, color );
INT2 ch character to display
INT2 pg page to display the
character on
INT2 color color of character if in
graphics mode

Example See program example .

Source b100e00d.asm

----------------------------------------------------------------------
bvWrtTTYStr[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Displays a string to the video buffer starting at the
specified location.

Summary VOID bvWrtTTYStr( mode, row, col, len, pg, attr, st );
INT2 mode 0 - use attr, st is chars
only, cursor not updated
1 - use attr, st is chars
only, cursor updated
2 - st is char, attr; cursor
not updated
3 - st is char, attr; cursor
updatede attr, st is chars only, cursor
updated
INT2 row y coordinate
INT2 col x coordinate
INT2 len length of st
INT2 pg display page to display
string on.
INT2 attr attribute is mode is 0 or 1
CHAR *st string to display on the
screen

Example See program example

Source b1013xxd.asm



Chapter 5
Mouse

+--------------------------------+
| |
| The functions in this section |
| support the mouse device. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

Global Variables

UINT NEvents contains the number of events waiting in the mouse event handler
queue.
----------------------------------------------------------------------
mButtonPress [2.00+]
----------------------------------------------------------------------

Description Returns the current button status information.

Summary INT2 MButtonPress( Button, ButPress, x, y );
INT2 Button specifies button to check.
0 - left button
1 - right button
2 - middle button
INT2 *ButPress number of button presses
since the last call to
MButtonPress.
INT2 *x column the mouse cursor was
in the last time the button
was pressed.
INT2 *y row the mouse cursor was in
the last time the button was
pressed.

Remarks MButtonPress will return an integer indicating the
current state of the mouse button requested. 0 is
returned when the button is released and 1 when button
pressed.

Example See program example

Source mbutinfo.asm

----------------------------------------------------------------------
mButtonRel [2.00+]
----------------------------------------------------------------------

Description Returns the current button status information.

Summary INT2 MButtonRel( Button, ButPress, x, y );
INT2 Button specifies the button to
check.
0 - left button
1 - right button
2 - middle button
INT2 *ButPress number of button releases
since the last call to
MButtonRel.
INT2 *x column the mouse cursor was
in the last time the button
was released.
INT2 *y row the mouse cursor was in
the last time the button was
released.

Remarks MButtonReleased will return an integer indicating the
current state of the mouse button requested. 0 is
returned when the button is released and 1 when button
pressed.

Example See program example

Source mbutinfo.asm

----------------------------------------------------------------------
mGetPos [2.00+]
----------------------------------------------------------------------

Description Returns the current button status and the location of
the mouse cursor.

Summary VOID MGetPos( Button, x, y );
INT2 *Button returns the status of each
button by its corresponding
bit value. If a bit is 0 then
that button is up. If a bit
is 1 then that button is
pressed.

Bit Value Button
0 1 left
1 2 right
2 4 middle

INT2 *x column the mouse cursor is
in.
INT2 *y row the mouse cursor is in.

Remarks In 80 column text mode the upper left corner of the
screen is 1,1 and the lower right corner is 80,25.

Example See program example

Source mgetpos.asm

----------------------------------------------------------------------
mGetSpeed [2.00+]
----------------------------------------------------------------------

Description Returns the distance the mouse has moved since the last
call to this routine.

Summary VOID MGetSpeed( HorCnt, VerCnt );
INT2 *HorCnt returns horizontal step
count since last call.
INT2 *VerCnt returns vertical step count
since last call.

Remarks The step count is always in the range -32768 to 32767.
A positive value specifies movements to the right and
down while negative values specify movements to the
left and up. After the call is completed the step
counts are reset to zero.

Example See program example

Source mgspeed.asm

----------------------------------------------------------------------
mGraphCursor [2.00+]
----------------------------------------------------------------------

Description Defines the shape and color of the mouse cursor when in
graphics mode.

Summary VOID MGraphCursor( XHotSpot, YHotSpot, CMaskSeg,
CMaskOfs );
INT2 XHotSpot a value in the range -16 to
16 used to define the X
pixel within or outside the
cursor block
INT2 YHotSpot a value in the range -16 to
16 used to define the Y
pixel within or outside the
cursor block.
UINT2 CMaskSeg the segment of the cursor
mask description variable.
UINT2 CMaskOfs the offset of the cursor
mask description variable.

Remarks The cursor mask variable is two arrays of 16 words
each. The first 16 words define the screen mask and
the second 16 words define the cursor mask. Each array
of 16 words defines the set of pixels that are 16x16.

The screen mask is used to determine which pixels
become part of the cursor shape while the cursor mask
is used to determine the color/shape of the cursor.

Example See program example

Source mgraphcu.asm

----------------------------------------------------------------------
mHideCursor [2.00+]
----------------------------------------------------------------------

Description Removes the mouse cursor from the screen.

Summary VOID MHideCursor( VOID );

Remarks Although the mouse cursor is hidden from view its
motion is still tracked.

Example See program example

Source mhidecur.asm

----------------------------------------------------------------------
mInitEventHandler [2.00+]
----------------------------------------------------------------------

Description Initializes the mouse interrupt event handler.

Summary VOID MInitEventHandler( EventMask );
INT2 EventMask defines the event types the
mouse event handler will place in its
queue.

Remarks Each bit in the event mask corresponds to a specific
event:

Bit Value Event
0 1 cursor position moved
1 2 left button pressed
2 4 left button released
3 8 right button pressed
4 16 right button released
5 32 middle button pressed
6 64 middle button released
7-15 not used

Example See program example

Source minithan.asm

----------------------------------------------------------------------
mPollQue [2.00+]
----------------------------------------------------------------------

Description Returns a copy of the oldest event in the mouse event
queue. The event queue is left unchanged.

Summary VOID MPollQue( Event, ButStat, x, y );
INT2 *Event an integer describing the
event that occurred (See
MInitEventHandler).
INT2 *ButStat button status at time of
event.
INT2 *x column mouse cursor was
located in at the time of
event.
INT2 *y row mouse cursor was located
in at the time of event.

Remarks If the number of events in the queue is zero when this
pro cedure is called the values in the return variables
will be -1. Use the global variable NEvents to
determine if an event is in the queue.

Example See program example

Source mpollque.asm

----------------------------------------------------------------------
mResetMouse [2.00+]
----------------------------------------------------------------------

Description Determines if the mouse hardware and software are
installed.

Summary INT2 MResetMouse( NBut );
INT2 NBut returns the number of
buttons on the mouse.

Remarks MResetMouse will return:
0 - Mouse hardware and software are not installed.
-1 - Mouse hardware and software are installed.

Every call to MResetMouse will also reset the position
of the mouse cursor to the middle of the video display.

Example See program example

Source mresetm.asm

----------------------------------------------------------------------
mRetQue [2.00+]
----------------------------------------------------------------------

Description Returns the oldest event in the mouse event queue and
removes the event from the queue.

Summary VOID MRetQue( Event, ButStat , x, y );
INT2 *Event returns the event that
occurred (see
MInitEventHandler).
INT2 *ButStat button status at the time of
this event.
INT2 *x column mouse cursor was
located in at time of event.
INT2 *y row mouse cursor was located
in at time of event.

Remarks If the number of events in the queue is zero when this
pro cedure is called the values in the return variables
will be -1. Use the global variable NEvents to
determine if an event is in the queue.

Example See program example

Source mretque.asm

----------------------------------------------------------------------
mSetEvent [2.00+]
----------------------------------------------------------------------

Description Simulates a mouse event.

Summary VOID MRetQue( Event, ButStat, x, y );
INT *Event event that should occur (see
MInitEventHandler).
INT *ButStat button status for this
event.
INT *x column of the mouse cursor
for this event.
INT *y row of the mouse cursor for
this event.

Remarks If the number of events in the queue is less than the
maxi mum number of events allowed in the queue then the
event will be placed as the newest or last mouse event
to occur. All global and local variables used for this
procedure will be upd

ated exactly the same as if an actual mouse event had
occurred.

Example See program example

Source msetevnt.asm

----------------------------------------------------------------------
mSetPos [2.00+]
----------------------------------------------------------------------

Description Set the position of the mouse cursor.

Summary VOID MSetPos( x, y );
INT2 x column to put mouse cursor
in
INT2 y row to put mouse cursor in

Remarks Checks for valid X and Y values are NOT performed. In
80 column text mode the upper left corner of the screen
is 1,1 and the lower right corner is 80,25.

Example See program example

Source msetpos.asm

----------------------------------------------------------------------
mSetSpeed [2.00+]
----------------------------------------------------------------------

Description Sets mouse motion to screen pixel ratio.

Summary VOID MSetSpeed( HorCnt, VerCnt );
INT2 HorCnt the horizontal step ratio.
The value is in the range of
1 to 32767 where the ratio
will be HorCnt steps to 8
pixels hori zontally.
INT2 VerCnt the vertical step ratio.
The value is in the range of
1 to 32767 where the ratio
will be VerCnt steps to 8
pixels verti cally.

Remarks The step values refer to the amount of mouse movement.

Example See program example

Source msspeed.asm

----------------------------------------------------------------------
mSetXRange [2.00+]
----------------------------------------------------------------------

Description Sets the column boundaries the mouse cursor will be
allowed to move within.

Summary VOID MSetXRange( Min, Max );
INT2 Min left col boundary for mouse
cursor.
INT2 Max right col boundary for mouse
cursor.

Remarks Range checks are not performed on the parameters.

Example See program example

Source msetxy.asm

----------------------------------------------------------------------
mSetYRange [2.00+]
----------------------------------------------------------------------

Description Sets the row boundaries the mouse cursor will be
allowed to move within.

Summary VOID MSetYRange( Min, Max );
INT2 Min top row boundary for mouse
cursor.
INT2 Max bottom row boundary for
mouse cursor.

Remarks Range checks are not performed on the parameters.

Example See program example

Source msetxy.asm

----------------------------------------------------------------------
mShowCursor [2.00+]
----------------------------------------------------------------------

Description Display the mouse cursor on the screen

Summary VOID MShowCursor( VOID );

Example See program example

Source mshowcur.asm

----------------------------------------------------------------------
mTextCursor [2.00+]
----------------------------------------------------------------------

Description Defines the mouse text cursor

Summary VOID MTextCursor( CType, SMask, CMask );
INT2 CType selects the type of mouse
cur sor to use.
0 - software cursor
1 - hardware cursor
INT2 SMask if the software cursor is
selected the screen mask is
defined. If the hardware
cursor is selected the
starting scan line is
defined.
INT2 CMask if the software cursor is
selected the cursor mask is
defined. If the hardware
cursor is selected the
ending scan line is defined.

Remarks The screen mask is an integer that defines which of the
character attributes are preserved. The cursor mask is
used to determine which of the characteristics are
changed by the cursor. See SetCursor Size in chapter
two for a description of

the starting and ending scan lines.

Example See program example

Source mtextcur.asm



Chapter 6
Keyboard

+--------------------------------+
| |
| The functions in this section |
| support the keyboard. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

----------------------------------------------------------------------
BiosKbdClr[PC][AT][PS/2]
----------------------------------------------------------------------

Description Clear the keyboard buffer.

Summary VOID BiosKbdClr( VOID );

Remarks BiosKbdClr uses the BIOS to clear any characters in the
keyboard buffer waiting to be read.

See Also DosKbdClr

Example See program example

Source bkbdclr.asm

----------------------------------------------------------------------
BiosKbdGetElmt[PC][AT][PS/2]
----------------------------------------------------------------------

Description Returns an integer value for the key pressed on the key
board.

Summary INT2 BiosKbdGetElmt( VOID );

Remarks BiosKbdGetElmt will return an integer in the range of
0-388. Use Appendix C as a guide to find the keyboard
element code this function returns for a particular key
pressed on the keyboard. When using DOS function calls
there is not any meth

od available to distinguish the difference between some
keystrokes and key combinations. An example of this is
the Enter key and the Ctrl-M keys, both return a value
of 145. Key combinations using the control key with an
alpha char acter and all oth

er ASCII characters will be offset by 132.

See Also BiosKbdRead, DosKbdGetElmt, DosKbdRead

Example See program example 2

Source bkbdelmt.asm

----------------------------------------------------------------------
BiosKbdHit[PC][AT][PS/2]
----------------------------------------------------------------------

Description Reports if a keystroke is waiting to be read from the
key board buffer.

Summary INT2 BiosKbdHit( VOID );

Remarks Using the BIOS services BiosKbdHit checks the keyboard
status to determine if a key is waiting to be read from
the keyboard buffer.

See Also DosKbdHit

Example See program example

Source bkbdhit.asm

----------------------------------------------------------------------
BiosKbdRead[PC][AT][PS/2]
----------------------------------------------------------------------

Description Read a character from the keyboard.

Summary VOID BiosKbdRead( Ch );
CHAR *Ch returns a string of length
zero, one, or two bytes long
defining the key or key
combination pressed from the
keyboard.

Remarks BiosKbdRead reads a single character from the keyboard
buffer. BiosKbdRead will return a zero, one, or two
charac ter string. A null string indicates that Ctrl-
Break was pressed. A one character string indicates a
normal ASCII character w

as read from the keyboard. A two-character string
indicates a special extended keyboard code. Refer to
appendix B for a list of the extended keyboard codes.
The data type definition for BiosKbdRead is an untyped
variable using a minimum of three b

ytes.

See Also BiosKbdGetElmt, DosKbdGetElmt, DosKbdRead

Example See program example

Source bkbdread.asm

----------------------------------------------------------------------
BiosKbdStat[PC][AT][PS/2]
----------------------------------------------------------------------

Description Get the keyboard status byte

Summary INT2 BiosKbdStat( VOID );

Returns BiosKbdStat returns the keyboard status byte as
follows:


Bits
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |

Bit Key Pressed
0 Right Shift
1 Left Shift
2 Control
3 Alternate
4 Scroll Lock
5 Num Lock
6 Caps Lock
7 Insert

A one in the bit position means the condition is true
and a zero in the bit position means the condition is
false.

Example See program example

Source bkbdstat.asm

----------------------------------------------------------------------
bkeGetKbdFlags[AT][PS/2]
----------------------------------------------------------------------

Description Return the status of the enhanced keyboard shift and
toggle keys.

Summary UINT2 bkeGetKbdFlags( VOID );

Returns bkeGetKbdFlags returns a word to describe the state of
the various shift and toggle keys on the enhanced
keyboard.


Bits
|F|E|D|C|B|A|9|8|7|6|5|4|3|2|1|0|

Bit Status of key
0 right shift key down
1 left shift key down
2 left or right control key down
3 left or right alternate key down
4 scroll lock on
5 num lock on
6 caps lock on
7 insert on
8 left ctrl key down
9 left alt key down
A right control key down
B right alt key down
C scroll key down
D num lock key down
E caps lock key down
F sysreq key down

A one in the bit position means the condition is true
and a zero in the bit position means the condition is
false.

Example See program example

Source b161200d.asm

----------------------------------------------------------------------
bkeGetKbdStatus[AT][PS/2]
----------------------------------------------------------------------

Description This function returns a character and scan code from
the keyboard buffer if one is waiting or returns a -1
if the key board buffer is empty.

Summary UINT2 bkeGetKbdStatus( VOID );

Returns -1 if no character is waiting in the keyboard buffer.

hi byte - scan code if a character is waiting to be read
lo byte - ASCII character if a character is waiting to
be read

Remarks The ASCII character and scan code returned by this
function is not removed from the keyboard buffer. A
call to bkeReadCh will be required to remove the ASCII
character and scan code from the keyboard buffer.

This function is for use with the enhance keyboard to
allow testing for the additional F11, F12, and cursor
control keys.

Example See program example

Source b161100d.asm

----------------------------------------------------------------------
bkeReadCh[AT][PS/2]
----------------------------------------------------------------------

Description Read character and scan code from keyboard buffer.

Summary UINT2 bkeGetKbdFlags( VOID );

Returns hi byte - scan code
lo byte - ascii character

Remarks This function is for use with the enhanced keyboard so
the scan codes can be obtained for the additional F11,
F12, and cursor control keys.

Example See program example

Source b161000d.asm

----------------------------------------------------------------------
bkGetKbdFlags[PC][AT][PS/2]
----------------------------------------------------------------------

Description Returns the flags byte that describes the state of the
key board toggle and shift keys.

Summary UINT2 bkGetKbdFlags( VOID );

Returns bkGetKbdFlags returns a byte to describe the state of
the various shift and toggle keys on the keyboard.


Bits
|7|6|5|4|3|2|1|0|

Bit Status of key
0 right shift key down
1 left shift key down
2 left or right control key down
3 left or right alternate key down
4 scroll lock on
5 num lock on
6 caps lock on
7 insert on

A one in the bit position means the condition is true
and a zero in the bit position means the condition is
false.

Example See program example

Source b160200d.asm

----------------------------------------------------------------------
bkGetKbdStatus[PC][AT][PS/2]
----------------------------------------------------------------------

Description This function returns a character and scan code from
the keyboard buffer if one is waiting or returns a -1
if the key board buffer is empty.

Summary UINT2 bkGetKbdStatus( VOID );

Returns -1 if no character is waiting in the keyboard buffer.

hi byte - scan code if a character is waiting to be read
lo byte - ascii character if a character is waiting to
be read

Remarks The ascii character and scan code returned by this
function is not removed from the keyboard buffer. A
call to bkeReadCh will be required to remove the ascii
character and scan code from the keyboard buffer.

Example See program example

Source b160100d.asm

----------------------------------------------------------------------
bkPushKeyCodes[AT][PS/2]
----------------------------------------------------------------------

Description Put a keyboard scan code and ascii character in the key
board buffer.

Summary UINT2 bkPushKeyCodes( scancode, ascii );
INT2 scancode keyboard scan code to place
in keyboard buffer.
INT2 ascii ascii character value to
place in keyboard buffer.

Returns 0 - operation successful

1 - operation unsuccessful
Example See program example

Source b160500d.asm

----------------------------------------------------------------------
bkReadCh[PC][AT][PS/2]
----------------------------------------------------------------------

Description Read character and scan code from keyboard buffer.

Summary UINT2 bkGetKbdFlags( VOID );

Returns hi byte - scan code
lo byte - ascii character

Example See program example

Source b160000d.asm

----------------------------------------------------------------------
bkSetRepeatRate[AT][PS/2]
----------------------------------------------------------------------

Description Sets the ROM BIOS keyboard typing rate.

Summary VOID bkSetRepeatRate( Delay, Repeat );
INT2 Delay A value 0-3 that sets the
amount of delay before the
first repeat key is
generated. See table A
below.
INT2 Repeat A value in the range 0-31
that specifies the repeat
rate in characters per
second. See table B below.

Remarks Table A
-------------------
Value Delay(msec)
0 250
1 500
2 750
3 1000

Table B
--------------------------
Value Repeate rate (cps)
00 30.0
01 26.7
02 24.0
03 21.8
04 20.0
05 18.5
06 17.1
07 16.0
08 15.0
09 13.3
10 12.0
11 10.9
12 10.0
13 9.2
14 8.6
15 8.0
16 7.5
17 6.7
18 6.0
19 5.5
20 5.0
21 4.6
22 4.3
23 4.0
24 3.7
25 3.3
26 3.0
27 2.7
28 2.5
29 2.3
30 2.1
31 2.0

Example See program example

Source b160305d.asm

----------------------------------------------------------------------
DosKbdClr[2.0+]
----------------------------------------------------------------------

Description Clear the keyboard buffer.

Summary VOID DosKbdClr( VOID );

Remarks DosKbdClr uses DOS to clear any characters in the key
board buffer waiting to be read.

See Also BiosKbdClr

Example See program example

Source dkbdclr.asm

----------------------------------------------------------------------
DosKbdGetElmt[2.0+]
----------------------------------------------------------------------

Description Returns an integer value for the key pressed on the key
board.

Summary INT2 DosKbdGetElmt( VOID );

Returns DosKbdGetElmt will return an integer in the range of
0-388. Use Appendix C to find the keyboard element
code this function returns for a particular key pressed
on the key board. Key combinations using the control
key with an alpha character and all other ascii
characters will be offset by 132.

See Also BiosKbdGetElmt, BiosKbdRead, DosKbdRead

Example See program example

Source dkbdelmt.asm

----------------------------------------------------------------------
DosKbdHit[2.0+]
----------------------------------------------------------------------

Description Reports if a keystroke is waiting to be read from the
key board buffer.

Summary INT2 DosKbdHit( VOID );

Returns 0 or FALSE if a key is not in the keyboard buffer.
1 or TRUE if a key is waiting to be read from the
keyboard buffer.

Remarks DosKbdHit checks the keyboard status to determine if a
key is waiting to be read from the keyboard buffer.

See Also BiosKbdHit

Example See program example

Source dkbdhit.asm

----------------------------------------------------------------------
DosKbdRead[2.0+]
----------------------------------------------------------------------

Description Read a character from the keyboard.

Summary VOID DosKbdRead( Ch );
CHAR *Ch returns a string of length
zero, one, or two bytes long
defining the key or key
combination pressed from the
keyboard.

Remarks DosKbdRead reads a single character from the keyboard
buffer. DosKbdRead will return a zero, one, or two
character string. A null string indicates Ctrl- Break
was pressed. A one character string indicates an ascii
character and a two-charac

ter string indicates a special extended keyboard code.
Refer to appendix B for a list of the extended key
board codes. The data type definition for DosKbdRead
is an untyped variable using a minimum of three bytes.

See Also BiosKbdGetElmt, BiosKbdRead, DosKbdGetElmt

Example See program example

Source dkbdread.asm

----------------------------------------------------------------------
GetKey[2.0+]
----------------------------------------------------------------------

Description Returns a keystroke and maps it into a keyboard element

number for EditSt.
Summary INT2 GetKey( VOID );

Remarks This function may call other functions and procedures.
The only restriction is that it must return an integer
value that is in the table found in Appendix C if the
function EditSt is used. If EditSt is not used the
only restriction is that

an integer must be returned.

Example See program example 6,7

Source fpgetkey.asm


Chapter 7
DOS

+--------------------------------+
| |
| This section supports gen |
| eral DOS function calls. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

----------------------------------------------------------------------
dChDir[2.0+]
----------------------------------------------------------------------

Description Change to specified directory

Summary INT dChDir( Path );
CHAR *Path path to change to

Returns 0 - function successfully changed path

Example See program example

Source d213B00d.asm

----------------------------------------------------------------------
dCloseFile[2.0+]
----------------------------------------------------------------------

Description Closes any file that was previously opened or created
with a call to dCreateFile or dOpenFile.

Summary INT dCloseFile( Handle );
INT2 Handle handle of the file to close

Returns 0 if the function successfully closed file otherwise
the error code is returned.

Example See program example

Source d213E00d.asm

----------------------------------------------------------------------
dCreateFile[2.0+]
----------------------------------------------------------------------

Description Creates a new file in the specified or default
directory on the specified or default drive. If the
file already exists then the file is truncated to
length zero.

Summary INT dCreateFile( Path, Attr, Handle );
CHAR *Path path and filename of file to
cre ate
INT2 Attr attribute to create file
with
INT2 *Handle returns the handle of the
file created

Returns 0 is returned if function successfully created the file
other wise the error code is returned.

Example See program example

Source d213C00d.asm

----------------------------------------------------------------------
dCreateNewPsp[1.1+]
----------------------------------------------------------------------

Description Copies current programs psp to a specified segment
address in free memory before updating the psp to make
it usable by another program.

Summary VOID dCreateNewPsp( Segment );
UINT2 Segment Segment of the new psp

Example See program example

Source d212600d.asm

----------------------------------------------------------------------
dDelFile[2.0+]
----------------------------------------------------------------------

Description Delete specified file from the disk.

Summary INT dDelFile( FileSpec );
CHAR *FileSpec ASCIIZ string containing the
drive path and filename of
the file to be deleted.

Returns 0 - file deleted ok
1 - error trying to delete file

Example See program example

Source d214100d.asm

----------------------------------------------------------------------
dDiskReset[1.1+]
----------------------------------------------------------------------

Description Flush all file buffers. All data in the MS-DOS buffers
are physically written to the disk. The disk directory
is NOT updated.

Summary VOID dDiskReset( VOID );

Example See program example

Source d210D00d.asm

----------------------------------------------------------------------
dGetBreakStatus[2.0+]
----------------------------------------------------------------------

Description Get the status of the systems break flag that
influences ctrl-c checking.

Summary INT dGetBreakStatus( VOID );

Returns 0 - Break flag is OFF
1 - Break flag is ON

Example See program example

Source d213300d.asm

----------------------------------------------------------------------
dGetBusyFlag[2.0+]
----------------------------------------------------------------------

Description Get the address of the MS-DOS busy flag


Summary VOID dGetBusyFlag( dSeg, dOfs );
UINT2 *dSeg returns segment of dos busy
flag var
UINT2 *dOfs returns offset of dos busy
flag var

Remarks This dos function is not documented and does work a
little differently between the different flavors of
dos.

Example See program example

Source d213400u.asm

----------------------------------------------------------------------
dGetCurrentDisk[1.1+]
----------------------------------------------------------------------

Description Get the number of the default disk drive.

Summary INT2 dGetCurrentDisk( VOID );

Returns An integer representing the drive code of the default
disk drive where 0=A, 1=B, etc.

Example See program example

Source d211900d.asm

----------------------------------------------------------------------
dGetDate[1.1+]
----------------------------------------------------------------------

Description Use Dos to retrieve the system date

Summary VOID dGetDate( Month, Day, Year, DayOfWk );
INT2 *Month returns the month of the
year
INT2 *Day returns the day of the month
INT2 *Year returns the year (1980 thru
2099)
INT2 *DayOfWk returns the day of the week
( 0-6 ) where 0=Sunday,
1=Monday,..., 6=Saturday.

Example See program example

Source d212A00d.asm

----------------------------------------------------------------------
dGetDriveData[2.0+]
----------------------------------------------------------------------

Description Retrieve information about the default disk drive

Summary INT dGetDriveData( Drive, Sectors, MediaSeg,
MediaOfs, SectorSize, Clusters );
INT2 Drive drive code of the drive to
get the data on. (0=default,
1=A, 2=B, etc.)
UINT2 *Sectors Number of sectors per
cluster
UINT2 *MediaSeg Segment of the media id byte
UINT2 *MediaOfs Offset of the media id byte
UINT2 *SectorSize Number of bytes per sector
UINT2 *Clusters Number of clusters on the
drive

Returns 0 - unsuccessful (invalid drive, etc)
1 - successful

Example See program example

Source d211C00d.asm

----------------------------------------------------------------------
dGetDrvAllocInfo[2.0]
----------------------------------------------------------------------

Description Get information about a specified disk drive.

Summary INT dGetDrvAllocInfo( Drive, Sectors, AvailClusters,
BytesInSec, TotalClusters );
UINT Drive disk drive code (0=default,
1=A, etc)
UINT *Sectors number of sectors in a
cluster
UINT *AvailClusters number of available clusters
UINT *BytesInSec number of bytes in a sector
UINT *TotalClusters number of clusters in drive

Returns 0 - function unable to obtain information for drive
1 - function successfully obtained information

Example See program example

Source d213600d.asm

----------------------------------------------------------------------
dGetDta[2.0+]
----------------------------------------------------------------------

Description Gets the current address of the disk transfer area
being used for file related functions.

Summary VOID dGetDta( Segment, Offset );
UINT2 *Segment Segment of the DTA
UINT2 *Offset Offset of the DTA

Example See program example

Source d212F00d.asm

----------------------------------------------------------------------
dGetFileAttr[2.0+]
----------------------------------------------------------------------

Description Gets the attribute for the specified file.

Summary INT dGetFileAttr( FileSpec, Attr );
CHAR *FileSpec handle of file to set file
pointer
INT2 *Attr relative position to set
location of pointer from

Returns 0 - file attribute obtained ok
1 - error trying to obtain files attribute

Example See program example

Source d214300d.asm

----------------------------------------------------------------------
dGetIntVec[2.0+]
----------------------------------------------------------------------

Description Get the address of the specified Interrupt

Summary VOID dGetIntVec( dInt, dSeg, dOfs );
UINT2 dInt interrupt vector to retrieve
UINT2 *dSeg returns the segment of the
interrupt specified
UINT2 *dOfs returns the offset of the
interrupt specified

Example See program example

Source d2135xxd.asm

----------------------------------------------------------------------
dGetTime[1.1+]
----------------------------------------------------------------------

Description Use Dos to retrieve the system time

Summary VOID dGetTime( Hour, Minute, Seconds, Hundredths );
INT2 *Hour hour (0-23)
INT2 *Minute minutes (0-59)
INT2 *Seconds seconds (0-59)
INT2 *Hundredths hundredths of a second
(0-99)

Example See program example

Source dd212C00d.asm

----------------------------------------------------------------------
dGetVersion[2.0+]
----------------------------------------------------------------------

Description Get the version number of the MS-DOS operating system.

Summary VOID dGetVersion( Major, Minor );
INT2 *Major Major version number
INT2 *Minor Minor version number

Example See program example

Source d213000d.asm

----------------------------------------------------------------------
dMkDir[2.0+]
----------------------------------------------------------------------

Description Create directory using specified path

Summary INT2 dMkDir( Path );
CHAR *Path ascii string of path to
create

Example See program example

Source d213900d.asm

----------------------------------------------------------------------
dOpenFile[2.0+]
----------------------------------------------------------------------

Description Opens any existing file in the specified or default
directory on the specified or default drive.

Summary INT dOpenFile( Path, Mode, Handle );
CHAR *Path name of file to create
INT2 Mode access mode of file
INT2 *Handle returns handle of file
created

Returns 0 - function successfully changed path

Remarks Value Access
0 read
1 write
2 read/write

Example See program example

Source d213D00d.asm

----------------------------------------------------------------------
dReadFile[2.0+]
----------------------------------------------------------------------

Description Read specified number of bytes from file into data
buffer

Summary INT dReadFile( Handle, NBytes, Buffer, BytesRead );
INT Handle valid file handle of file to
read from
UINT2 NBytes number of bytes to read
VOID *Buffer data area to place data read
from file
UINT2 *BytesRead number of actual bytes read

Returns 0 - file read performed ok
1 - error trying to read file

Example See program example

Source d213F00d.asm

----------------------------------------------------------------------
dRmDir[2.0+]
----------------------------------------------------------------------

Description Remove specified directory

Summary INT dRmDir( Path );
CHAR *Path path to remove

Returns 0 - function successfully created path
n - error code

Example See program example

Source d213A00d.asm

----------------------------------------------------------------------
dSelectDisk[1.1+]
----------------------------------------------------------------------

Description Sets the specified drive to the default drive and
returns the number of logical drives in the system.

Summary INT2 dSelectDisk( Drive );
INT2 Drive drive number (0=A, 1=B, etc)

Returns The number of logical drives.

Example See program example

Source d210E00d.asm

----------------------------------------------------------------------
dSetBreakFlag[2.0+]
----------------------------------------------------------------------

Description Sets the break flag to ON or OFF

Summary VOID dSetBreakFlag( flag );
INT flag 0 - to set break flag OFF
1 - to set break flag ON

Example See program example

Source d213301d.asm

----------------------------------------------------------------------
dSetDate[1.1+]
----------------------------------------------------------------------

Description Use Dos to set the system to a specified date

Summary INT dSetDate( Month, Day, Year );
INT Month month of year (1-12)
INT Day day of month (1-31)
INT Year year 1980-2099

Returns 0 - invalid date
1 - date set successfully
Example See program example

Source d213301d.asm

----------------------------------------------------------------------
dSetDta[1.1+]
----------------------------------------------------------------------

Description Sets the address of the disk transfer area to be used
for file related functions.

Summary VOID dSetDta( Segment, Offset );
UINT2 Segment Segment of the new DTA
UINT2 Offset Offset of the new DTA

Example See program example

Source d211A00d.asm

----------------------------------------------------------------------
dSetFileAttr[2.0+]
----------------------------------------------------------------------

Description Sets file position relative to beginning of file,
current file position, or end of file.

Summary INT dGetFileAttr( FileSpec, Attr );
CHAR *FileSpec handle of file to set file
pointer
INT2 *Attr relative position to set
location of pointer from

Returns 0 - file attribute obtained ok
1 - error trying to obtain files attribute

Example See program example

Source d214301d.asm

----------------------------------------------------------------------
dSetFilePos[2.0+]
----------------------------------------------------------------------

Description Sets file position relative to beginning of file,
current file position, or end of file.

Summary INT dSetFilePos( Handle, Method, Ofs );
INT2 Handle handle of file to set file
pointer
INT Method relative starting position
to set location of pointer
INT4 *Ofs number of bytes to move
pointer. returns the
absolute file position from
the beginning of the file.

Returns 0 - file pointer moved ok
1 - error trying to move file pointer

Remarks Method Description
0 beginning of file
1 current location of file pointer
2 EOF location

Example See program example

Source d214200d.asm

----------------------------------------------------------------------
dSetInt[1.1+]
----------------------------------------------------------------------

Description Initialize the systems interrupt vector to point to a
user defined interrupt handling routine.

Summary VOID dSetInt( Intr, Segment, Offset );
UINT2 Intr Interrupt number
UINT2 Segment Segment of the new interrupt
routine
UINT2 Offset Offset of the new interrupt
rou tine

Example See program example

Source d2125xxd.asm

----------------------------------------------------------------------
dSetTime[1.1+]
----------------------------------------------------------------------

Description Use Dos to set the system clock to a specified time

Summary VOID dSetTime( Hour, Minute, Seconds, Hundredths );
INT2 Hour hour (0-23)
INT2 Minute minute (0-59)
INT2 Seconds seconds (0-59)
INT2 Hundredths hundredths of a second
(0-99)
Return 0 - invalid time
1 - time set successfully

Example See program example

Source d212D00d.asm

----------------------------------------------------------------------
dSetVerityFlag[1.1+]
----------------------------------------------------------------------

Description Turns the automatic read-after-write verification ON or
OFF.

Summary VOID dSetVerifyFlag( VerifyOpt );
INT2 VerifyOpt 0 - Turn OFF verify flag
1 - Turn ON verify flag

Example See program example

Source d212E00d.asm

----------------------------------------------------------------------
dWriteFile[2.0+]
----------------------------------------------------------------------

Description Write specified number of bytes to file from data
buffer

Summary INT dWriteFile( Handle, NBytes, Buffer, BytesWritten );
INT Handle valid file handle of file to
write to
UINT NBytes number of bytes to write
VOID *Buffer data area containing data to
write
UINT *BytesWritten number of actual bytes
written
Return 0 - file write operation
performed ok
1 - error trying to write file

Example See program example

Source d214000d.asm



Chapter 8
DOS I/O

+--------------------------------+
| |
| This section supports DOS |
| file functions, including |
| func tions to handle critical |
| errors. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+


Global Structures
typedef TFindRec
{
UINT2Attr;
UINT2Time;
UINT2Date;
UINT4Size;
UCHARName[13];
} TFindRec;


INT2 DosErrNo the error code for function result errors.

INT2 CErrCode the error code for critical errors.

INT2 CErrType contains the type of device for the critical error.
0 = Block device
1 = Character device

INT2 CErrDrive contains the number of the disk drive where the
critical error occurred. If the critical error is
not a disk drive the value will then remain as -1.

CHAR CErrDevice[9] contains the name of the device in error.

----------------------------------------------------------------------
CloseFile
----------------------------------------------------------------------

Description Closes a file and flushes all file buffers for a file.

Summary VOID CloseFile( Handle );
INT2 Handle the handle number of a file
that was opened using the
OpenFile operation.

Remarks If an error occurred DosErrNo will contain one of the
follow ing error codes.

DosErrNo Description
6 Invalid file handle

Example See program example

Source closefil.asm

----------------------------------------------------------------------
CreateFile
----------------------------------------------------------------------

Description Opens an existing file or creates a new file if it does
not exist.

Summary VOID CreateFile( Path, Attr, Handle );
CHAR *Path filename of file to be
opened or created.
INT2 Attr mode to set the file's
attribute to.
INT2 *Handle returns an integer that this
file is associated with for
access.

Remarks This operation will open a new or existing file for
read/write access. CreateFile assumes that the file is
opened as an output file and will set the length of any
existing file to zero. If any errors occur DosErrNo
will have the error code.

DosErrNo Description
3 Path not found
4 No handle available
5 Access denied
6 Invalid file handle

Example See program example

Source creatfil.asm

----------------------------------------------------------------------
DosFindFirst
----------------------------------------------------------------------

Description Find the first file that matches the given filespec and
attributes.

Summary VOID DosFindFirst( Path, Attr, FindRec );
CHAR *Path path and filename of file to
search for.
INT2 Attr attributes of files to
include in search
TFindRec FindRec result of search is returned
in a variable of TFindRec.
(See Global Structures page
8-1).

Remarks This operation will search for the specified file. The
charac ters * and ? may be used for the filespec. If
any errors occur the error code will be set in
DosErrNo.

DosErrNo Description
2 Directory not found
3 Path not found
18 No more files

The search attribute values may be one or any
combination of values. (e.g. to search for a hidden
system file use value 6).

Bit(s) Value Description
0 1 read-only
1 2 hidden
2 4 system
3 8 volume label
4 16 directory
5 32 archive
6-15 reserved

See Also DosFindNext

Example See program example

Source findf.asm

----------------------------------------------------------------------
DosFindNext
----------------------------------------------------------------------

Description Returns the next file entry that matches the filespec
and attributes used in a previous call to DosFindFirst.

Summary VOID DosFindNext( FindRec );
TFindRec FindRec the result of the search is
returned in the variable of
TFindRec. (See Global Struc
tures page 8-1).

Remarks DosFindNext must be called after DosFindFirst and
before any other calls that transfer data into the DTA
at the time of the call to DosFindFirst.

DosErrNo Description
18 No more files

See Also DosFindFirst

Example See program example

Source findn.asm

----------------------------------------------------------------------
FSeek
----------------------------------------------------------------------

Description Change the logical read/write position of the file
pointer.

Summary UINT4 FSeek( Handle, Origin, Offset );
INT Handle file handle that was
assigned to a file using
either the OpenFile or
CreateFile operation.
INT Origin gives the starting location
to use when moving the file
pointer.

Method Description
0 beginning of file
1 current location of file ptr
2 EOF location
INT4 Offset gives the number of bytes to
move the file pointer.

Remarks This operation will move the file pointer for the
specified number of bytes given. On return this
function reports the number of bytes the file pointer
is from the beginning of the file. If any errors occur
DosErrNo will have the error code.

DosErrNo Description
1 Invalid method code
6 Invalid file handle

Example See program example

Source fseek.asm

----------------------------------------------------------------------
GetDir
----------------------------------------------------------------------

Description Returns an asciiz string that describes the current
path from the root of the specified drive.

Summary VOID GetDir( Drive, Path );
INT2 Drive Number of the drive to get
the current path, where
drive code is 0=default,
1=A, 2=B, etc.
CHAR *Path Path is the buffer area that
will contain the asciiz
string of the current
directory.

Example See program example

Source getdir.asm

----------------------------------------------------------------------
GetDrive
----------------------------------------------------------------------

Description Reports the current default disk drive

Summary INT2 GetDrive( VOID );

Remarks GetDrive returns an integer to indicate which disk
drive is the current default drive where:
Drive A = 1
Drive B = 2
Drive C = 3

Example See program example

Source getdrive.asm

----------------------------------------------------------------------
GetDTA
----------------------------------------------------------------------

Description Returns the current disk transfer area

Summary VOID GetDTA( Segment, Offset );
UINT2 Segment returns segment of current
DTA.
UINT2 Offset returns offset of current
DTA.

Example See program example

Source getdta.asm

----------------------------------------------------------------------
GetFileSize
----------------------------------------------------------------------

Description Report the number of bytes in a disk file.

Summary INT4 GetFileSize( Handle );
INT Handle gives a file handle that was
assigned to a file using the
OpenFile or CreateFile opera
tion.

Remarks GetFileSize reports the number of bytes in the file
associ ated with the handle number.

Example See program example

Source gfilsize.asm

----------------------------------------------------------------------
GetNDrvs
----------------------------------------------------------------------

Description Report the number of disk drives.

Summary INT2 GetNDrvs( VOID );

Remarks GetNDrvs reports the total number of diskette and fixed
disk drives installed for the current system.

Example See program example

Source getndrvs.asm

----------------------------------------------------------------------
OpenFile
----------------------------------------------------------------------

Description Open the file given in the string passed.

Summary VOID OpenFile( Path, Attr, Handle );
CHAR *Path path and filename of file to
open.
INT2 Attr type of access allowed for
this file.

Access Description
0 Read Only
1 Write Only
2 Read/write
INT2 *Handle returns an integer that
repre sents the file handle
that is associated with the
file given in Path. The
file handle is to be used
when any operations on the
file are to take place.

Remarks If an error occurred DosErrNo will contain one of the
follow ing error codes.

DosErrNo Description
2 File not found
4 No handle available
5 access denied
12 invalid access code

See Also CreateFile

Example See program example

Source openfile.asm

----------------------------------------------------------------------
ReadFile
----------------------------------------------------------------------

Description Read a file or device for a specified number of bytes.

Summary VOID ReadFile( Handle, NBytes, Buffer, RBytes );
INT2 Handle file handle associated with
the appropriate file or
device for read operation.
INT2 NBytes number of bytes to read from
file or device.
CHAR *Buffer buffer area to place data
read.
UINT2 *RBytes returns number of bytes
actually read from the file
or device. If RBytes is
zero then an attempt was
made to read from the end of
a file.

Remarks If an error occurred DosErrNo will contain one of the
follow ing error codes.

DosErrNo Description
5 Access denied
6 Invalid handle

Example See program example

Source readfile.asm

----------------------------------------------------------------------
ResetDisk
----------------------------------------------------------------------

Description Resets the disk and flushes all file buffers.

Summary VOID ResetDisk( VOID );

Remarks This routine does not close any files. To ensure that
the length of a file is recorded properly in the file
directory you should first close the file before using
this routine.

Example See program example

Source resetdsk.asm

----------------------------------------------------------------------
ResetErrCodes
----------------------------------------------------------------------

Description Resets global variables that indicate device errors to
their initial settings.

Summary VOID ResetErrCodes( VOID );

Remarks The following variables are set as followings:

DosErrNo = 0
CErrCode = 0
CErrType = -1
CErrDrive = -1
CErrDevice = ''

See Also SetInt24

Example See program example

Source setint24.asm

----------------------------------------------------------------------
RestInt24
----------------------------------------------------------------------

Description Uninstalls or restores the programs critical interrupt
error handler.

Summary VOID RestInt24( VOID );

Remarks This procedure will uninstall the critical interrupt
error han dler that was installed with the SetInt24
procedure. This procedure uses the SegInt24 and
OfsInt24 variables to restore the interrupt handler in
use before the interrupt handler was installed.

Example See program example

Source setint24.asm

----------------------------------------------------------------------
SetDTA
----------------------------------------------------------------------

Description Set the file attribute for the file specified.

Summary VOID SetDTA( Segment, Offset );
UINT2 Segment segment address for new DTA.
UINT2 Offset offset within segment for
new DTA.

Example See program example

Source setdta.asm

----------------------------------------------------------------------
SetInt24
----------------------------------------------------------------------

Description Initializes the critical error handler routine and its
global variables for use with your system.

Summary VOID SetInt24( VOID );

Remarks Only one call needs to be made to this routine for a
program that wants to use the critical error handler
routine. In the event of a critical error, the
variables DosErrNo, CErrCode, CErrType, CErrDrive and
CErrDevice are set to the appro pr

iate values. Refer to the global variable section at
the beginning of this chapter for a description of each
variable name.

The following are the I/O error values that are set in
the CErrCode global variable. These codes
match the same codes DOS function 59h (Get Extended
Error Code) return. Note that all values are
hexadecimal.

Error
Code Description
13 Write-protect error
14 Unknown unit
15 Disk drive not ready
16 Unknown command
17 Data error (bad CRC)
18 A bad request structure length
19 Data seek error
1A Unknown media type
1B Disk sector not found
1C Printer is out of paper
1D Write fault
1E Read fault
1F General failure

See Also ResetErrCodes, RestInt24

Example See program example

Source setint24.asm

----------------------------------------------------------------------
WriteFile
----------------------------------------------------------------------

Description Write to a file or device for a specified number of
bytes.

Summary VOID WriteFile( Handle, NBytes, Buffer, WBytes );
INT2 Handle file handle associated with
a file or device for read
operation to act on.
INT2 NBytes number of bytes to write to
file or device.
CHAR *Buffer data area that contains the
data that is to be written
to the file or device.
UINT2 *WBytes returns actual number of
bytes written out to the
file or device.

Remarks DosErrNo will contain one of the following error codes
when an error occurs.

DosErrNo Description
5 Access denied
6 Invalid handle
20 insufficient disk space

Example See program example

Source writefile.asm



Chapter 9
Printer

+--------------------------------+
| |
| The functions in this section |
| use the BIOS and DOS to |
| support the printer. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

----------------------------------------------------------------------
BiosPrtChar
----------------------------------------------------------------------

Description Send a character to the printer.

Summary VOID BiosPrtChar( Ch, PrtNo );
CHAR Ch character to print.
INT2 PrtNo printer number of printer to
print to.

Remarks PrtNo 1 = LPT1:
PrtNo 2 = LPT2:
PrtNo 3 = LPT3:

Example See program example

Source bprtchar.asm

----------------------------------------------------------------------
BiosPrtInit
----------------------------------------------------------------------

Description Initialize the printer

Summary INT2 BiosPrtInit( PrtNo );
INT2 PrtNo number of printer to
initialize.

Returns This functions returns the status of the printer after
the initialization process is completed.

Example See program example

Source bprtinit.asm

----------------------------------------------------------------------
BiosPrtStatus
----------------------------------------------------------------------

Description Returns the current status of the printer.

Summary INT2 BiosPrtStat( PrtNo );
INT2 PrtNo an integer representing the
printer number to check
status on.

Returns PrtStatus will return an integer giving the status of
the printer using the following bit values.


Bit Value Description
0 1 Time-out
1 2 Not used
2 4 Not used
3 8 I/O error
4 16 Printer selected
5 32 Out-of-paper signal
6 64 Acknowledgment from printer
7 128 Printer not busy

Example See program example

Source bprtstat.asm

----------------------------------------------------------------------
DosPrtChar
----------------------------------------------------------------------

Description Send a character to the printer.

Summary VOID DosPrtChar( Ch );
CHAR Ch character to print.

See Also BiosPrtChar, BiosPrtStat

Example See program example

Source prtchar.asm



Appendix A
Keyboard Return Codes

+--------------------------------+
| |
| This appendix lists the key |
| board codes for all the key |
| combinations on the key board |
| as they are interpreted by |
| the function ReadKbd. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

The ReadKbd function will return all key information into either a
one or two character code.

To understand the table below assume St is a two character string.
St[0] is the length of the character code returned. If the length of
St is one then a normal ASCII character was pressed, otherwise an
extended code is generated. Notice that some

of the keyboard codes do produce a two character code with the first
character being null.

If the length of St is one then a normal ASCII character code was
read from the keyboard. This covers the ASCII values 32-127.

If the length of St is two then one of the keys that are usually used
for cursor control was read from the keyboard. If this is the case
then St[1] will be either a 0 or 27 depending on the key combination
read from the keyboard.

Use of the switch statement works well with this type of setup to
determine which keyboard keys were read.

switch Ch[1] {
case 0 : printf( "Control code used." ); break;
case 27 : printf( "Control code used." ); break;
default : if ( Ch[1] >= 32 && Ch[1] <= 127 )
printf( "Printable code used." );
};

Key
Pressed CH[0] CH[1] CH[2]
------- ----- ----- -----
(space) 1 32 0
! 1 33 0
" 1 34 0
# 1 35 0
$ 1 36 0
% 1 37 0
& 1 38 0
' 1 39 0
( 1 40 0
) 1 41 0
* 1 42 0
+ 1 43 0
, 1 44 0
- 1 45 0
/ 1 47 0
0 1 48 0
1 1 49 0
2 1 50 0
3 1 51 0
4 1 52 0
5 1 53 0
6 1 54 0
7 1 55 0
8 1 56 0
9 1 57 0
: 1 58 0
; 1 59 0
< 1 60 0
= 1 61 0
? 1 63 0
@ 1 64 0
A 1 65 0
B 1 66 0
C 1 67 0
D 1 68 0
E 1 69 0
F 1 70 0
G 1 71 0
H 1 72 0
I 1 73 0
J 1 74 0
K 1 75 0
L 1 76 0
M 1 77 0
N 1 78 0
O 1 79 0
P 1 80 0
Q 1 81 0
R 1 82 0
S 1 83 0
T 1 84 0
U 1 85 0
V 1 86 0
W 1 87 0
X 1 88 0
Y 1 89 0
Z 1 90 0
[ 1 91 0
\ 1 92 0
] 1 93 0
^ 1 94 0
_ 1 95 0
` 1 96 0
a 1 97 0
b 1 98 0
c 1 99 0
d 1 100 0
e 1 101 0
f 1 102 0
g 1 103 0
h 1 104 0
i 1 105 0
j 1 106 0
k 1 107 0
l 1 108 0
m 1 109 0
n 1 110 0
o 1 111 0
p 1 112 0
q 1 113 0
r 1 114 0
s 1 115 0
t 1 116 0
u 1 117 0
v 1 118 0
w 1 119 0
x 1 120 0
y 1 121 0
z 1 122 0
{ 1 123 0
| 1 124 0
} 1 125 0
~ 1 126 0
Ctrl-Break 2 27 0
Esc 2 27 1
Ctrl-2 2 27 3
BackSp 2 27 8
Tab 2 27 9
Ctrl-Enter 2 27 10
Enter 2 27 13
Ctrl-BS 2 27 14
Shft-Tab 2 27 15
Alt-Q 2 27 16
Alt-W 2 27 17
Alt-E 2 27 18
Alt-R 2 27 19
Alt-T 2 27 20
Alt-Y 2 27 21
Alt-U 2 27 22
Alt-I 2 27 23
Alt-O 2 27 24
Alt-P 2 27 25
Alt-A 2 27 30
Alt-S 2 27 31
Alt-D 2 27 32
Alt-F 2 27 33
Alt-G 2 27 34
Alt-H 2 27 35
Alt-J 2 27 36
Alt-K 2 27 37
Alt-L 2 27 38
Alt-Z 2 27 44
Alt-X 2 27 45
Alt-C 2 27 46
Alt-V 2 27 47
Alt-B 2 27 48
Alt-N 2 27 49
Alt-M 2 27 50
F1 2 27 59
F2 2 27 60
F3 2 27 61
F4 2 27 62
F5 2 27 63
F6 2 27 64
F7 2 27 65
F8 2 27 66
F9 2 27 67
F10 2 27 68
Home 2 27 71
UArr 2 27 72
PgUp 2 27 73
LArr 2 27 75
RArr 2 27 77
End 2 27 79
DArr 2 27 80
PgDn 2 27 81
Ins 2 27 82
Del 2 27 83
Shft-F1 2 27 84
Shft-F2 2 27 85
Shft-F3 2 27 86
Shft-F4 2 27 87
Shft-F5 2 27 88
Shft-F6 2 27 89
Shft-F7 2 27 90
Shft-F8 2 27 91
Shft-F9 2 27 92
Shft-F10 2 27 93
Ctrl-F1 2 27 94
Ctrl-F2 2 27 95
Ctrl-F3 2 27 96
Ctrl-F4 2 27 97
Ctrl-F5 2 27 98
Ctrl-F6 2 27 99
Ctrl-F7 2 27 100
Ctrl-F8 2 27 101
Ctrl-F9 2 27 102
Ctrl-F10 2 27 103
Alt-F1 2 27 104
Alt-F2 2 27 105
Alt-F3 2 27 106
Alt-F4 2 27 107
Alt-F5 2 27 108
Alt-F6 2 27 109
Alt-F7 2 27 110
Alt-F8 2 27 111
Alt-F9 2 27 112
Alt-F10 2 27 113
Ctrl-LArr 2 27 115
Ctrl-RArr 2 27 116
Ctrl-End 2 27 117
Ctrl-PgDn 2 27 118
Ctrl-Home 2 27 119
Alt-1 2 27 120
Alt-2 2 27 121
Alt-3 2 27 122
Alt-4 2 27 123
Alt-5 2 27 124
Alt-6 2 27 125
Alt-7 2 27 126
Alt-8 2 27 127
Alt-9 2 27 128
Alt-0 2 27 129
Alt-- 2 27 130
Alt-= 2 27 131
Ctrl-PgUp 2 27 132
Ctrl-A 2 0 1
Ctrl-B 2 0 2
Ctrl-C 2 0 3
Ctrl-D 2 0 4
Ctrl-E 2 0 5
Ctrl-F 2 0 6
Ctrl-G 2 0 7
Ctrl-H 2 0 8
Ctrl-I 2 0 9
Ctrl-J 2 0 10
Ctrl-K 2 0 11
Ctrl-L 2 0 12
Ctrl-M 2 0 13
Ctrl-N 2 0 14
Ctrl-O 2 0 15
Ctrl-P 2 0 16
Ctrl-Q 2 0 17
Ctrl-R 2 0 18
Ctrl-S 2 0 19
Ctrl-T 2 0 20
Ctrl-U 2 0 21
Ctrl-V 2 0 22
Ctrl-W 2 0 23
Ctrl-X 2 0 24
Ctrl-Y 2 0 25
Ctrl-Z 2 0 26
Ctrl-[ 2 0 27
Ctrl-\ 2 0 28
Ctrl-] 2 0 29
Ctrl-6 2 0 30
Ctrl-- 2 0 31

Appendix B
Keyboard Element Codes

+--------------------------------+
| |
| This appendix lists the ele |
| ment codes for all the key |
| combinations on the key board |
| as they are interpreted by |
| the function EditSt. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+


The EditSt function will return all key information as an integer
representing an element code.

An array of 32 bytes is required for this table.

char TSet[32];

The unit or element number in the set defines which key or key
combination was pressed. This table was created for use as the
Terminating Character Set with the procedures EditSt.

Use the value in the column ELEMENT NUMBER to determine the element
number or bit number for a terminating key.


Element
Key code AH AL Number
-------- --- --- -------
Ctrl-Break 0 0 0
Esc 1 27 1
not used 2
Ctrl-2 3 0 3
not used 4
not used 5
not used 6
not used 7
BackSp 14 8 8
Tab 15 9 9
Ctrl-Enter 28 10 10
not used 11
not used 12
Enter 28 13 13
Ctrl-BS 14 127 14
Shft-Tab 15 0 15
Alt-Q 16 0 16
Alt-W 17 0 17
Alt-E 18 0 18
Alt-R 19 0 19
Alt-T 20 0 20
Alt-Y 21 0 21
Alt-U 22 0 22
Alt-I 23 0 23
Alt-O 24 0 24
Alt-P 25 0 25
not used 26
not used 27
not used 28
not used 29
Alt-A 30 0 30
Alt-S 31 0 31
Alt-D 32 0 32
Alt-F 33 0 33
Alt-G 34 0 34
Alt-H 35 0 35
Alt-J 36 0 36
Alt-K 37 0 37
Alt-L 38 0 38
not used 39
not used 40
not used 41
not used 42
not used 43
Alt-Z 44 0 44
Alt-X 45 0 45
Alt-C 46 0 46
Alt-V 47 0 47
Alt-B 48 0 48
Alt-N 49 0 49
Alt-M 50 0 50
not used 51
not used 52
not used 53
not used 54
not used 55
not used 56
not used 57
not used 58
F1 59 0 59
F2 60 0 60
F3 61 0 61
F4 62 0 62
F5 63 0 63
F6 64 0 64
F7 65 0 65
F8 66 0 66
F9 67 0 67
F10 68 0 68
not used 69
not used 70
Home 71 0 71
UArr 72 0 72
PgUp 73 0 73
not used 74
LArr 75 0 75
not used 76
RArr 77 0 77
not used 78
End 79 0 79
DArr 80 0 80
PgDn 81 0 81
Ins 82 0 82
Del 83 0 83
Shft-F1 84 0 84
Shft-F2 85 0 85
Shft-F3 86 0 86
Shft-F4 87 0 87
Shft-F5 88 0 88
Shft-F6 89 0 89
Shft-F7 90 0 90
Shft-F8 91 0 91
Shft-F9 92 0 92
Shft-F10 93 0 93
Ctrl-F1 94 0 94
Ctrl-F2 95 0 95
Ctrl-F3 96 0 96
Ctrl-F4 97 0 97
Ctrl-F5 98 0 98
Ctrl-F6 99 0 99
Ctrl-F7 100 0 100
Ctrl-F8 101 0 101
Ctrl-F9 102 0 102
Ctrl-F10 103 0 103
Alt-F1 104 0 104
Alt-F2 105 0 105
Alt-F3 106 0 106
Alt-F4 107 0 107
Alt-F5 108 0 108
Alt-F6 109 0 109
Alt-F7 110 0 110
Alt-F8 111 0 111
Alt-F9 112 0 112
Alt-F10 113 0 113
not used 114
Ctrl-LArr 115 0 115
Ctrl-RArr 116 0 116
Ctrl-End 117 0 117
Ctrl-PgDn 118 0 118
Ctrl-Home 119 0 119
Alt-1 120 0 120
Alt-2 121 0 121
Alt-3 122 0 122
Alt-4 123 0 123
Alt-5 124 0 124
Alt-6 125 0 125
Alt-7 126 0 126
Alt-8 127 0 127
Alt-9 128 0 128
Alt-0 129 0 129
Alt-- 130 0 130
Alt-= 131 0 131
Ctrl-PgUp 132 0 132


AL+ Element
Key code 132 AL Number
-------- --- --- -------
Ctrl-A 133 1 133
Ctrl-B 134 2 134
Ctrl-C 135 3 135
Ctrl-D 136 4 136
Ctrl-E 137 5 137
Ctrl-F 138 6 138
Ctrl-G 139 7 139
Ctrl-H 140 8 140
Ctrl-I 141 9 141
Ctrl-J 142 10 142
Ctrl-K 143 11 143
Ctrl-L 144 12 144
Ctrl-M 145 13 145
Ctrl-N 146 14 146
Ctrl-O 147 15 147
Ctrl-P 148 16 148
Ctrl-Q 149 17 149
Ctrl-R 150 18 150
Ctrl-S 151 19 151
Ctrl-T 152 20 152
Ctrl-U 153 21 153
Ctrl-V 154 22 154
Ctrl-W 155 23 155
Ctrl-X 156 24 156
Ctrl-Y 157 25 157
Ctrl-Z 158 26 158
Ctrl-[ 159 27 159
Ctrl-\ 160 28 160
Ctrl-] 161 29 161
Ctrl-6 162 30 162
Ctrl-- 163 31 163
(space) 164 32 164
! 165 33 165
" 166 34 166
# 167 35 167
$ 168 36 168
% 169 37 169
& 170 38 170
' 171 39 171
( 172 40 172
) 173 41 173
* 174 42 174
+ 175 43 175
, 176 44 176
- 177 45 177
/ 179 47 179
0 180 48 180
1 181 49 181
2 182 50 182
3 183 51 183
4 184 52 184
5 185 53 185
6 186 54 186
7 187 55 187
8 188 56 188
9 189 57 189
: 190 58 190
; 191 59 191
< 192 60 192
= 193 61 193
> 194 62 194
? 195 63 195
@ 196 64 196
A 197 65 197
B 198 66 198
C 199 67 199
D 200 68 200
E 201 69 201
F 202 70 202
G 203 71 203
H 204 72 204
I 205 73 205
J 206 74 206
K 207 75 207
L 208 76 208
M 209 77 209
N 210 78 210
O 211 79 211
P 212 80 212
Q 213 81 213
R 214 82 214
S 215 83 215
T 216 84 216
U 217 85 217
V 218 86 218
' 219 87 219
X 220 88 220
Y 221 89 221
Z 222 90 222
[ 223 91 223
\ 224 92 224
] 225 93 225
_ 227 95 227
` 228 96 228
a 229 97 229
b 230 98 230
c 231 99 231
d 232 100 232
e 233 101 233
f 234 102 234
g 235 103 235
h 236 104 236
i 237 105 237
j 238 106 238
k 239 107 239
l 240 108 240
m 241 109 241
n 242 110 242
o 243 111 243
p 244 112 244
q 245 113 245
r 246 114 246
s 247 115 247
t 248 116 248
u 249 117 249
v 250 118 250
w 251 119 251
x 252 120 252
y 253 121 253
z 254 122 254
{ 255 123 255
| 256 124 256
} 257 125 257
~ 258 126 258
259 127 259

Appendix C
Keyboard Codes

+--------------------------------+
| |
| This appendix lists the key |
| board codes that are returned |
| in the AH and AL registers |
| when the BIOS is used to |
| retrieve the next keyboard |
| code stored in the system |
| keyboard buffer. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

This appendix lists the keyboard codes that are returned by the
computer system when a key or key combination is pressed. The column
headings AH and AL refer to the hi and lo registers within the AX
register. These are the actual values returned by
the BIOS interrupt 16H in assemlby language.

Key
Pressed AH AL
------- --- ---
(space) 57 32
! 2 33
" 40 34
# 4 35
$ 5 36
% 6 37
& 8 38
' 40 39
( 10 40
) 11 41
* 9 42
+ 13 43
, 51 44
- 12 45
/ 53 47
0 11 48
1 2 49
2 3 50
3 4 51
4 5 52
5 6 53
6 7 54
7 8 55
8 9 56
9 10 57
: 39 58
; 39 59
< 51 60
= 13 61

> 52 62
? 53 63
@ 3 64
A 30 65
B 48 66
C 46 67
D 32 68
E 18 69
F 33 70
G 34 71
H 35 72
I 23 73
J 36 74
K 37 75
L 38 76
M 50 77
N 49 78
O 24 79
P 25 80
Q 26 81
R 19 82
S 31 83
T 20 84
U 22 85
V 47 86
W 17 87
X 48 88
Y 21 89
Z 44 90
[ 26 91
\ 43 92
] 27 93
^ 7 94
_ 12 95
` 41 96
a 30 97
b 48 98
c 46 99
d 32 100
e 18 101
f 33 102
g 34 103
h 35 104
i 23 105
j 36 106
k 37 107
l 38 108
m 50 109
n 49 110
o 24 111
p 25 112
q 16 113
r 19 114
s 31 115
t 20 116
u 22 117
v 47 118
w 17 119
x 48 120
y 21 121
z 44 122
{ 26 123
| 43 124
} 27 125
~ 41 126
Ctrl-2 3 0
BackSp 14 8
Tab 15 9
Ctrl-Enter 28 10
Enter 28 13
Shft-Tab 15 0
Alt-Q 16 0
Alt-W 17 0
Alt-E 18 0
Alt-R 19 0
Alt-T 20 0
Alt-Y 21 0
Alt-U 22 0
Alt-I 23 0
Alt-O 24 0
Alt-P 25 0
Esc 1 27
Alt-A 30 0
Alt-S 31 0
Alt-D 32 0
Alt-F 33 0
Alt-G 34 0
Alt-H 35 0
Alt-J 36 0
Alt-K 37 0
Alt-L 38 0
Alt-Z 44 0
Alt-X 45 0
Alt-C 46 0
Alt-V 47 0
Alt-B 48 0
Alt-N 49 0
Alt-M 50 0
F1 59 0
F2 60 0
F3 61 0
F4 62 0
F5 63 0
F6 64 0
F7 65 0
F8 66 0
F9 67 0
F10 68 0
Home 71 0
UArr 72 0
PgUp 73 0
LArr 75 0
RArr 77 0
End 79 0
DArr 80 0
PgDn 81 0
Ins 82 0
Del 83 0
Shft-F1 84 0
Shft-F2 85 0
Shft-F3 86 0
Shft-F4 87 0
Shft-F5 88 0
Shft-F6 89 0
Shft-F7 90 0
Shft-F8 91 0
Shft-F9 92 0
Shft-F10 93 0
Ctrl-F1 94 0
Ctrl-F2 95 0
Ctrl-F3 96 0
Ctrl-F4 97 0
Ctrl-F5 98 0
Ctrl-F6 99 0
Ctrl-F7 100 0
Ctrl-F8 101 0
Ctrl-F9 102 0
Ctrl-F10 103 0
Alt-F1 104 0
Alt-F2 105 0
Alt-F3 106 0
Alt-F4 107 0
Alt-F5 108 0
Alt-F6 109 0
Alt-F7 110 0
Alt-F8 111 0
Alt-F9 112 0
Alt-F10 113 0
Ctrl-LArr 115 0
Ctrl-RArr 116 0
Ctrl-End 117 0
Ctrl-PgDn 118 0
Ctrl-Home 119 0
Alt-1 120 0
Alt-2 121 0
Alt-3 122 0
Alt-4 123 0
Alt-5 124 0
Alt-6 125 0
Alt-7 126 0
Alt-8 127 0
Alt-9 128 0
Alt-0 129 0
Alt-- 130 0
Alt-= 131 0
Ctrl-PgUp 132 0
Ctrl-A 30 1
Ctrl-B 48 2
Ctrl-C 46 3
Ctrl-D 32 4
Ctrl-E 18 5
Ctrl-F 33 6
Ctrl-G 34 7
Ctrl-H 35 8
Ctrl-I 23 9
Ctrl-J 36 10
Ctrl-K 37 11
Ctrl-L 38 12
Ctrl-M 50 13
Ctrl-N 49 14
Ctrl-O 24 15
Ctrl-P 25 16
Ctrl-Q 16 17
Ctrl-R 19 18
Ctrl-S 31 19
Ctrl-T 20 20
Ctrl-U 22 21
Ctrl-V 47 22
Ctrl-W 17 23
Ctrl-X 45 24
Ctrl-Y 21 25
Ctrl-Z 44 26
Ctrl-[ 26 27
Ctrl-\ 43 28
Ctrl-] 27 29
Ctrl-6 7 30
Ctrl-- 12 31
Ctrl-BS 14 127
Ctrl-Break 0 0

Appendix D
Keyboard Scan Codes

+--------------------------------+
| |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+



FUNCTION KEYS NUMERIC KEYPAD

Key Scan Code Key Scan Code
---- --------- ---- ---------
F1 59 7 71
F2 60 8 72
F3 61 9 73
F4 62 - 74
F5 63 4 75
F6 64 5 76
F7 65 6 77
F8 66 + 78
F9 67 1 79
F10 68 2 80
3 81
0 82
. 83


CONTROL KEYS

Key Scan Code
------ ---------
Esc 1
Ctrl 29
Backspace 14
Left Shft 42
Num Lock 69
Right Shft 54
Scroll Lock 70
Alt 56
Tab 15
Caps Lock 58
Enter 28


LETTER, NUMBER, AND PUNCTUATION KEYS

Key Scan Code
---- ---------
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
0 11
- 12
= 13
Q 16
W 17
E 18
R 19
T 20
Y 21
U 22
I 23
O 24
P 25
[ 26
] 27
A 30
S 31
D 32
F 33
G 34
H 35
J 36
K 37
L 38
; 39
' 40
` 41
\ 43
Z 44
X 45
C 46
V 47
B 48
N 49
M 50
, 51
. 52
/ 53
(PrtSc) 55


Contents of the README.1ST file


FlashPac C Library V3.61-Direct Video
functions for fast screen I/O. Includes bios
video for ega & vga. BIOS Mouse support
includes interrupt handler for queuing mouse
events. BIOS, DOS keyboard, and general DOS
support functions. Also includes FPCWin which
provides CORE functions needed for
implementing message based programs.




+--------------------------------+
| |
| +--------------------------+ |
| | | |
| | FlashPac C Library | |
| | | |
| | Reference Guide | |
| | | |
| | V3.61 | |
| | |
| +--------------------------+ |
| |
+--------------------------------+





SimpleSoft
1209 Poplar St
La Crescent, MN 55947


Technical Support: (507) 895-8237
CompuServ Id: 70253,1270



_______
____|__ | (R)
--| | |-------------------
| ____|__ | Association of
| | |_| Shareware
|__| o | Professionals
-----| | |---------------------
|___|___| MEMBER



OMBUDSMAN STATEMENT
-------------------
The ASP Board has set up an office of Ombudsman and appointed an ASP
member as Ombudsman. The Ombudsman's sole role is to mediate
disputes between ASP members and their customers. The Ombudsman
reports to the Board situa tions where he/she feels Board action or
knowledge is appropriate.

"Kevin Dahl is a member of the Association of Shareware Professionals
(ASP). ASP wants to make sure that the shareware principle works for
you. If you are unable to resolve a shareware-related problem with an
ASP member by contacting the member directly, ASP may be able to
help. The ASP Ombudsman can help you resolve a dispute or problem
with an ASP member, but does not provide technical support for
members' products. Please write to the ASP Ombudsman at 545 Grover
Road, Muskegon, MI 49442 or send a CompuServe message via CompuServe
Mail to ASP Ombudsman 70007,3536."


Technical Support
-----------------
To contact SimpleSoft for information about dealer pricing volume
discounts, site licensing, the status of shipment of the product, the
latest version number, or for technical information, call:

SimpleSoft
(507) 895-8237
Between 5:30pm and 9:00pm CST, weekdays.

or write:
Kevin Dahl
SimpleSoft
1209 Poplar St
La Crescent, MN 55947

or use CIS Mail,
CompuServe ID number: 70253,1270

You may call for technical support between the hours of 7:30am to
9:30pm CST. During the hours 8:00am to 5:30pm you will either get my
wife or an answering machine. If you call and leave a message I will
return your call as soon as I can. Generally, the best hours to call
are from 5:30pm to 9:30pm weekdays. Weekends are a tossup.

Turbo C is a trademark of Borland International. Microsoft and
MS-DOS are regis tered trademarks of Microsoft Corporation. IBM is a
registered trademark and PC/XT, PC/AT, PS/2, PC-DOS, OS/2 and PM are
trademarks of International Business Machines Corporation.

Chapter 1
Introduction

+--------------------------------+
| |
| Welcome to version 3.61 of the |
| FlashPac Library. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

Getting Started
---------------
This is a reference manual for the FlashPac C Video library. This
implementation is for use with Microsoft C or Turbo C in MS-DOS. A
working knowledge of C and personal computers is assumed.

The FlashPac C Library written in assembler provides over 40 Direct
Video routines to save and restore screen data, frame windows, display
strings, change attributes, edit data fields plus more. Bios Video
support for cursor control, hardware detection, font selection, font
definition, etc. Several mouse support functions including get/set
mouse cursor position, set mouse x,y range and also a mouse interrupt
handler for queuing mouse events. Bios and DOS keyboard support for
total keyboard control. Dos support functions to get/ set file time
and date, get/set clock time and date, get/set dta, critical interrupt
handler plus more.. In addition the FPCWin library included is a set
of C and assembler functions that implement the basic elements for a
programmer to create a message based application.

The functions in chapter 2 are referred to as FPCWin functions. The
functions in FPCWin contain the core functions necessary to implement
a message based program. The current implementation will relieve the
software engineer from writing the functions required to obtain
information about the next system event, i.e. mouse and keyboard
events. Mouse and keyboard events are automatically queued into the
system queue and may be retrieved anytime with a call to WinGetMsg.
WinGetMsg allows the developer to retrieve the messages in the exact
same order as they were placed into the queue or retrieve the next
message of a specified type, such as the next mouse event.


Installation
------------
The FlashPac C library consists of two files:
FPCLIB.H
FPCLIB.LIB

Place the header file "FPCLIB.H" in the subdirectory that contains
the header files for your compiler and place "FPCLIB.LIB" in the
subdirectory that where the library files are in. You are now ready
to use the FlashPac C library.

Compiling and Linking a test program

To compile and link "DEMO.C" and "GETKEY.C" modules use the
instructions for the appropriate compiler.


Turbo C
-------
Integrated environment:
1. Select the large memory model under the Options,
compiler menu.
2. Create a project file with the following three lines:
demo (demo.c)
getkey (getkey.c)
fpclib.lib
3. Select the project file under the compile menu option select
build all to create an executable file called demo.exe

Command Line:
C>tcc -IC:\INC -LC:\lib -ml demo.c getkey.c \lib\fpclib.lib

-IC:\INC C:\INC is the include subdirectory for header files
-LC:\LIB C:\LIB is the library subdirectory for Turbo C libraries
-ml selects large memory model
\lib is the subdirectory where fpclib.lib is located


Microsoft C
-----------
C>cl /AL /F 4000 demo.c getkey.c \lib\fpclib.lib

/AL selects large memory model
/F 4000 create a 16K stack area
\lib is the subdirectory where fpclib.lib is located

Chapter 2
FPCWin

+--------------------------------+
| |
| The functions in this section |
| perform windowing functions |
| that follow the conventions |
| used by OS/2 PM. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

Overview

The set of functions in this chapter describe the parts of FPCWin that
let you create and use a message queue. The system will collect all
keyboard and mouse events and place them in the system message queue.
Messages can be retrieved in the order they were placed in the queue.
An applications message queue is provided for your own use. The
declarations are defined in fpcwin.h.

Declarations

#define FPENTRY pascal far
#define PTR far *

typedef char CHAR;
typedef short SHORT;

typedef char CHAR; /* ch*/
typedef short SHORT; /* s*/
typedef long LONG; /* l*/

typedef unsigned char UCHAR; /* uch*/
typedef unsigned short USHORT; /* us*/
typedef unsigned long ULONG; /* ul*/

typedef unsigned char BYTE; /* b*/

typedef unsigned char *PSZ;
typedef unsigned char *PCH;

typedef BYTE *PBYTE;

typedef CHAR *PCHAR;
typedef SHORT *PSHORT;
typedef LONG *PLONG;

typedef UCHAR *PUCHAR;
typedef USHORT *PUSHORT;
typedef ULONG *PULONG;

typedef unsigned short BOOL; /* f*/
typedef BOOL *PBOOL;

typedef unsigned short SHANDLE;
typedef void far *LHANDLE;
typedef void far *MPARAM; /* msg param*/

typedef LHANDLE HWND; /* hwnd*/
typedef HWND *PHWND;
typedef LHANDLE HMQ; /* hmq*/
typedef LHANDLE HAB; /* hab*/

typedef VOID FAR *MPARAM; /* mp*/
typedef MPARAM FAR *PMPARAM; /* pmp*/

typedef VOID FAR *MRESULT; /* mres*/
typedef MRESULT FAR *PMRESULT; /* pmres*/

typedef USHORT HMODULE; /* hmod*/
typedef HMODULE FAR *PHMODULE;

typedef VOID FAR *PVOID;

----------------------------------------------------------------------
WinCreateMsgQueue
----------------------------------------------------------------------

Description This function creates a message queue for the current
pro cess. It must be called after WinInitialize but
before any other FPCWin functions. This function can
only be called once per process.

Summary HMQ WinCreateMsgQueue( hab, cmsg );
HAB hab Specifies a handle to the
anchor block.
SHORT cmsg Specifies the maximum size
of the queue. The default
queue may be specified by
using the constant
DEFAULT_QUEUE_SIZE.

Returns Returns a handle to the message queue if successful, or
NULL is unable to create a new message queue.

Remarks The default queue size is ten messages. The program
should create a larger queue if ten messages is the
system is losing messages.

Example See program example 1.

Source queues.asm

----------------------------------------------------------------------
WinDestroyMsgQueue
----------------------------------------------------------------------

Description This function destoys the message queue. This function
should be called if any program uses a message queue
created by WinCreateMsgQueue.

Summary BOOL WinDestroyMsgQueue( hmq );
HMQ hmq Handle to the message queue
to be destroyed.

Returns Returns TRUE is successful or FALSE is an error
occurred.

Example See program example 1.

Source queues.asm

----------------------------------------------------------------------
WinGetMsg
----------------------------------------------------------------------

Description This function retrieves the next message from the
message queue hat conforms to the filtering criteria.

Summary BOOL WinGetMsg( hab, qmsg, hwndFilter,
msgFilterFirst, msgFilterLast );
HAB hab Anchor block handle.
PQMSG qmsg Points to the QMSG structure
that will contain the
returned message. QMSG is
defined in the following
form:

typedef struct _QMSG {
HWND hwnd;
USHORT msg;
MPARAM mp1;
MPARAM mp2;
ULONG time;
POINTL ptl;
} QMSG;
HWND hwndFilter Window filter identifier.
USHORT msgFilterFirst Specifies first message.
USHORT msgFilterLast Specifies last message.

Returns If the message retrieved is not WM_QUIT then TRUE is
returned, otherwise FALSE is returned.

Remarks Filtering allows a program to process messages in an
order that is different from the one in the message
queue. Use fil tering to retrieve messages of a
particular type, rather than retrieving other types of
messages at an inconvenient place

in the program logic. For example, when a mouse
button down message is retrieved, the program can use
filtering to wait for the mouse button up message
without processing other messages.

When the hwndFilter parameter is not NULL, it limits
the system to returning a message to a specific window
or its child windows.

The msgFilterFirst and msgFilterLast parameters are
used to restrict the range of message types that may be
returned. If msgFilterFirst and msgFilterLast are both
zero, all mes sages are returned. If msgFilterFirst is
less than msgFilterLast then o

nly those messages that lie in that range will be
returned. If msgFilterFirst is greater than
msgFilterLast, all messages except the ones that lie
between msgFilterFirst and msgFilterLast will be
returned.

For example, using the constants WM_MOUSEFIRST and
WM_MOUSELAST for msgFilterFirst and msgFilterLast can
be used to filter out all messages except mouse
messages.

Example See program example 1.

Source queues.asm

----------------------------------------------------------------------
WinInitialize
----------------------------------------------------------------------

Description This function initializes the

Summary HAB WinInitialize( fsOptions );
USHORT fsOptions Specifies initialization
options. This parameter must
be zero.

Returns If the initialization process is successful the Handle
Anchor Block is returned, otherwise NULL is returned if
an error occurred.

Remarks the initialization process sets up pointers for a
message queue in the main thread of the system. In
addition, the video parameters are set, the window is
cleared, and the mouse, keyboard and timer interrupt
handlers are initialized.

Example See program example 1.

Source queues.asm

----------------------------------------------------------------------
WinPeekMsg
----------------------------------------------------------------------

Description This function is used to inspect the message queue.

Summary BOOL WinPeekMsg( hab, qmsg, hwndFilter, msgFilterFirst,
msgFilterLast , fs );
HAB hab Anchor block handle.
PQMSG qmsg Points to the QMSG structure
that will contain the
returned
message. QMSG is defined in the following
form:

typedef struct _QMSG {
HWND hwnd;
USHORT msg;
MPARAM mp1;
MPARAM mp2;
ULONG time;
POINTL ptl;
} QMSG;

HWND hwndFilter Window filter identifier.
USHORT msgFilterFirst Specifies first message.
USHORT msgFilterLast Specifies last message.
USHORT fs Specifies if the message
should be left in the queue
or removed from the queue.
If PM_REMOVE is specified
then the message is removed
from the queue. If
PM_NOREMOVE or nothing is
specified then the message
is not removed from the qu

eue.T msgFilterLast Specifies last message.

Returns If a message is available TRUE is returned, otherwise
FALSE is returned.

Remarks This function is the same as WinGetMsg except that is
doesn't wait for a message if one is not in the queue
and it also allows for letting a message remain in the
queue.

Example See program example 1.

Source queues.asm

----------------------------------------------------------------------
WinPostMsg
----------------------------------------------------------------------

Description This function will post a message to the message queue
for the specified window.

Summary BOOL WinPostMsg( hwnd, msg, mp1, mp2 );
HWND hwnd Identifies window to post
mes sage to. If NULL then
the message is posted to the
queue associated with the
current thread.
USHORT msg Message to be posted.
MPARAM mp1 First message parameter.
MPARAM mp2 Second message parameter.

Returns TRUE if successful or FALSE if an error occurred.

Remarks WinPostMsg returns immediately.

Example See program example 1.

Source queues.asm

----------------------------------------------------------------------
WinTerminate
----------------------------------------------------------------------

Description This function terminates the programs use of FPCWin and
releases all of the associated resources. This
function has to be called prior to termination of your
program.

Summary HAB WinInitialize( hab );
HAB hab Handle to the anchor block.

Returns TRUE if successful or FALSE if an error occurred.

Example See program example 1.

Source queues.asm



Chapter 3
Direct Video

+--------------------------------+
| |
| The functions in this section |
| perform direct reads & writes |
| of text data to the screen. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

Declarations

#define FAR far
#define FPENTRY pascal far
#define PTR far *

typedef char CHAR;
typedef unsigned char BYTE;
typedef signed int INT;
typedef unsigned int UINT;
typedef signed short int INT2;
typedef unsigned short int UINT2;
typedef long INT4;
typedef unsigned long UINT4;
typedef float REAL4;
typedef double REAL8;
typedef unsigned int WORD;

BYTE CheckSnow enables or disables snow-checking when reading or
writing data directly to video memory.

BYTE TextAttr global variable that contains the currently
selected video attribute.

INT2 InsMode global variable used by EditSt to indicate if the
cursor is in insert or overwrite mode.

INT2 VioBaseSeg contains the base segment address of the current
video page.

INT2 VioCols contains the screen width which is the total number
of characters per line.

INT2 VioCursor contains the size of the cursor with the starting
scan line in the high byte and the ending scan line
in the low byte.

INT2 VioPage contains the active video page in use. The value
should always be zero for a monochrome adapter.

INT2 WindMax defines the lower right corner of the window that
is currenlty defined thru the use of the Window
function.

INT2 WindMin defines the upper left corner of the window that is
currently defined thru the use of the Window
function.

----------------------------------------------------------------------
BorderColor
----------------------------------------------------------------------

Description Sets the color for the border screen.

Summary VOID BorderColor( Color );
INT Color defines color of the border
on the screen.

Remarks The following colors are allowed for the border color
on a Color Graphics Adapter. BorderColor has no effect
on a monochrome display.

0 Black 8 Gray
1 Blue 9 Light Blue
2 Green 10 Light Green
3 Cyan 11 Light Cyan
4 Red 12 Light Red
5 Magenta 13 Light Magenta
6 Brown 14 Yellow
7 White 15 High-intensity White

Example See program example 2.

Source border.asm

----------------------------------------------------------------------
ClrWin
----------------------------------------------------------------------

Description Clear window area with the specified color.

Summary VOID ClrWin( x1, y1, x2, y2, Attr );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
INT Attr integer in the range 0-255
defining the foreground and
background byte combination
for the color of the window.

Remarks This procedure will blank the window area for the
window coordinates that are passed. ClrWin does not
move the cursor from its current position.

Example See program examples 2-7

Source clrwin.asm

----------------------------------------------------------------------
ColorMsg
----------------------------------------------------------------------

Description Display string on the screen using the color attribute
specified.

Summary VOID ColorMsg( x, y, Attr, Msg );
INT x column to begin display of
message.
INT y row to begin display of mes
sage.
INT Attr integer in the range 0-255.
It is the color to use for
displaying the message.
CHAR *Msg string message to be
displayed.

Remarks ColorMsg is NOT sensitive to Turbo's currently defined
win dow and will wrap around to column one on the next
line of the screen when necessary. ColorMsg will not
scroll the screen if the data to be displayed is to
extend beyond the last row

of the screen.

See Also DspMsg, WriteSt, WriteStln

Example See program examples 2,3

Source colormsg.asm

----------------------------------------------------------------------
DspMsg
----------------------------------------------------------------------

Description Display string on the screen without changing the color
attribute that is currently on the display screen.

Summary VOID DspMsg( x, y, Msg );
INT x column to begin display of
message.
INT y row to begin display of mes
sage.
CHAR *Msg string message to display.

Remarks DspMsg is NOT sensitive to Turbo's currently defined
win dow and will wrap around to column one on the next
line of the screen when necessary. DspMsg will not
scroll the screen if the data to be displayed is to
extend beyond the last row of

the screen.

See Also ColorMsg, WriteSt, WriteStln

Example See program examples 2,6,7

Source dspmsg.asm

----------------------------------------------------------------------
EditSt
----------------------------------------------------------------------

Description Edit an existing or null string from the keyboard.

Summary VOID EditSt( Row, StCol, SpCol, Len, ChCase, FillCh,
AutoSkip, ErrTone, ErrDur, VCSet, TCSet, ChOfs, TE, St
);
INT Row defines row to edit string
on.
INT StCol defines left or start column
of field to edit. This value
must be less than or equal
to SpCol.
INT SpCol defines right or stop column
of the field to edit. This
value must be greater than
or equal to StCol.
INT Len integer in the range of
1-255. It is the maximum
length of the string to be
edited.
INT ChCase integer in the range 1-3.
The
Case Mode indicator defines how a
character is displayed on
the screen and stored in the
string variable being
edited.
1 = Do nothing to character
2 = Convert all chars to
upper case
3 = Convert all chars to
lower case
INT FillCh integer in the range of
0-255. This defines the
ascii character that is
displayed in the field for
undefined character
positions in the field being
edited.
INT AutoSkip integer indicating if an
auto exit is desired when
the last charac ter in the
field has been typed.
0 - No auto exit
1 - Auto exit after last
char in field is entered.
UINT ErrTone integer in units giving the
fre quency for beeping the
speaker.
UINT ErrDur integer in units giving the
length of time the speaker
is to beep.
CHAR *VCSet set of valid characters,
[0..255], that will be
accepted for data entry.
CHAR *TCSet set of extended keyboard
char acters, [0..255], that
are allowed to terminate
this procedure. (Refer to
appendix C for a listing of
these codes.)
INT *CharOfs an integer that indicates
the beginning cursor
position within the string.
If CharOfs is a 1 then
editing will begin in the
first column of the field
input area. If ChOfs is 256
or greater than the length
of the string to be

edited, the cursor will be
positioned after the last
character in the string. On
exit from EditSt ChOfs will
contain the cursor position
within the string.
INT *TE is the terminating element
number that terminated the
string input procedure. TE
will be in the range of
0-255 which corresponds to
the element number in
appendix C.
CHAR *St string buffer area to
receive the input data.

Remarks The maximum length of the string to edit is 255
characters. The data will be entered on one line. If
the maximum length of the string exceeds the number of
display columns, (SpCol-StCol+1), the string will
scroll horizontally on the screen

within the StCol and SpCol columns.

Edit Keys Keys The following gives an explanation of the editing
keys that may be used with EditSt, provided the key
pressed is not defined in the terminating character
set. EditSt calls the function GetKey, in the unit
SSGetKey, which returns

an integer. This integer is a value from
0-384 which corre sponds to an element
number that is defined in Appendix C. The
function GetKey is provided with a table
that maps the key element numbers to the
index number. Example, If the cursor is
to

move right one character position using
the
Ctrl-D key combination the value for Ctrl-D index
key (ele ment number 136) must map to the
right arrow key (element number 77). The
initialization of the Ctrl-D key for
KeyTable[136] would be 77.

LeftArr will move the cursor left one character
position on the screen until the StCol is
reached. If the beginning of the string
has not been reached the string will be
scrolled on the screen within the StCol
and SpCol boundaries.

RightArr will move the cursor right one character
position on the screen until the end of
the string is reached. If the cursor is
in the SpCol and there is still more in
the string that can be displayed the
string will then be scrolle

d within the StCol and SpCol boundaries.

Home will place the cursor in the StCol on the
screen and positioned under the first
character in the edit string.

End will position the cursor after the last
character in the edit string.

BackSpace If the StCol is displaying the first
character in the string being edited the
cursor will move to the left one column
and delete the character in that column.
If the character being displayed in the
StCol is not the first cha

r acter in the string being edited the
cursor will remain in the same column
position and delete the character to the
left of the cursor and pull the string
towards the cursor.

Esc will blank the string currently in the
field. If the field is already blank the
procedure will restore the string that was
passed to this procedure.

Tab will move the cursor to the right five
column positions if the SpCol has not been
reached. If the StCol has been reached
then the string display will be shifted
right.

^LeftArrow will move the cursor to the left five
column positions if the StCol has not been
reached. If the cursor is in the StCol
then only the display string will be
adjusted to reflect the move ment of the
cursor.

Del removes the character the cur sor is under
and decrements the string length by one.
All the characters to the right of the
cursor position are moved left one
position within the string and display
area.

^X will delete all characters from the
current string position to the end of the
string. All deleted characters will be
replaced with the FillCh that was
specified when calling this procedure.

Example See program example 3

Source editst.asm

----------------------------------------------------------------------
FillColAttr
----------------------------------------------------------------------

Description Display a column of attribute bytes on the screen.

Summary VOID FillColAttr( x, y, NRows, Attr );
INT x defines column to begin
display of attribute.
INT y defines row to begin display
of attribute.
INT NRows integer in the range 1-25
for the number of rows to
display the attribute byte

on.
INT Attr integer in the range 0-255.
It is the attribute byte to
be dis played on the screen.

Remarks FillColAttr always acts on the entire screen and is NOT
sensitive to Turbo's currently defined window.

See Also FillColCell, FillColChar

Example See program example 4

Source fcolbyte.asm

----------------------------------------------------------------------
FillColCell
----------------------------------------------------------------------

Description Fill a column on the screen with a character.

Summary VOID FillColCell( x, y, NRows, Cell );
INT x defines column to begin
display of data.
INT y defines row to begin display
of data.
INT NRows integer in the range 1-25
for the number of rows to
display the character and
attribute bytes on the
screen.
INT Cell integer in the range
0-0xffff. This is the
character and attribute word
combination where the high
order byte is the character
and the low order byte is
the attribute to be
displayed.

Remarks FillColCell always acts on the entire screen.

See Also FillColAttr, FillColChar

Example See program example 5

Source fcolcell.asm

----------------------------------------------------------------------
FillColChar
----------------------------------------------------------------------

Description Fill a column on the screen with a character.

Summary VOID FillColChar( x, y, NRows, Ch );
INT x defines column to begin
display of character.
INT y defines row to begin display
of character.
INT NRows integer in the range 1-25
for the number of rows to
display the character on.
CHAR Ch char in the range 0-255. It
is the
character to be displayed on the screen.

Remarks FillColChar always acts on the entire screen and is NOT
sensitive to compiler's predefined window.

See Also FillColAttr, FillColCell

Example See program example 4

Source fcolbyte.asm

----------------------------------------------------------------------
FillFrameAttr
----------------------------------------------------------------------

Description Fill the frame area defined by x1,y1,x2,y2 coordinates
with the attribute byte defined.

Summary VOID FillFrameAttr( x1, y1, x2, y2, Attr );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
INT Attr integer in the range 0-255.
It is the attribute to be
displayed on the screen in
the specified frame area.

See Also FillFrameCell, FillFrameChar

Example See program example 6

Source frambyte.asm

----------------------------------------------------------------------
FillFrameCell
----------------------------------------------------------------------

Description Fill the frame area defined by x1,y1,x2,y2 coordinates
with the cell defined.

Summary VOID FillFrameCell( x1, y1, x2, y2, Cell );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
INT Cell integer in the range 0-255.
This is the character and
attribute word combination
where the high byte is the
character and the low byte
is the attribute for the
cell to be displayed on the
screen in the specified
frame area.

See Also FillFrameAttr, FillFrameChar

Example See program example 7

Source framcell.asm

----------------------------------------------------------------------
FillFrameChar
----------------------------------------------------------------------

Description Fill the frame area defined by x1,y1,x2,y2 coordinates
with the character byte defined.

Summary VOID FillFrameChar( x1, y1, x2, y2, Ch );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
CHAR Ch character that will be
displayed on the screen in
the specified frame area.

See Also FillFrameAttr, FillFrameCell

Example See program example 6

Source frambyte.asm

----------------------------------------------------------------------
FillRowAttr
----------------------------------------------------------------------

Description Write N copies of the attribute byte on the screen
starting at the specified x,y coordinates.

Summary VOID FillRowAttr( x, y, NBytes, Attr );
INT x defines column to begin
display of attribute byte.
INT y defines row to begin display
of attribute byte.
INT NBytes gives number of times to
display the attribute byte
on the screen.
INT Attr integer in the range 0-255.
It is
the attribute byte to be dis played on the
screen.

Remarks FillRowAttr always acts on the entire screen and is NOT
sensitive to any compiler specific defined window.

See Also FillRowCell, FillFrameChar

Example See program example

Source frowbyte.asm

----------------------------------------------------------------------
FillRowCell
----------------------------------------------------------------------

Description Write N copies of the character and attribute byte on
the screen starting at the specified x,y coordinates.

Summary VOID FillRowCell( x, y, NWords, Cell );
INT x defines column to begin
display of cell word.
INT y defines row to begin display
of cell word.
INT NWords gives the number times to
dis play the character and
attribute bytes on the
screen.
INT2 Cell character and attribute
bytes to be displayed on the
screen.

Remarks FillRowCell always acts on the entire screen and is NOT
sensitive to any compiler specific defined window.

See Also FillRowAttr, FillFrameChar

Example See program example 9

Source frowcell.asm

----------------------------------------------------------------------
FillRowChar
----------------------------------------------------------------------

Description Write N copies of the character byte on the screen
starting at the specified x,y coordinates.

Summary VOID FillRowChar( x, y, NBytes, Ch );
INT x defines column to begin
display of character.
INT y defines row to begin display
of character.
INT NBytes gives number of times to
display the character on the
screen.
CHAR Ch value in the range 0-255.
It' the value or ascii
character to be displayed.

Remarks FillRowChar always acts on the entire screen and is NOT
sensitive to any compiler specific defined window.

See Also FillRowAttr, FillFrameCell

Example See program example 4,5

Source frowbyte.asm

----------------------------------------------------------------------
FrameWin
----------------------------------------------------------------------

Description Frames the window currently defined by the global
variables WindMax and WindMin with the specified
characters.

Summary VOID FrameWin( UL, UR, LL, LR, Hor, Ver, Attr );
CHAR UL char in upper left corner of
win dow.
CHAR UR char in upper right corner
of window.
CHAR LL char in lower left corner of
win dow.
CHAR LR char in lower right corner
of window.
CHAR Hor horizontal char for top and
bot tom rows of window.
CHAR Ver vertical char for left and
right columns of window.
INT Attr attribute color to use for
window frame display.

Remarks FrameWin will outline the window that is currently
defined by the global variables WindMin and WindMax
with the charac ters passed. The coordinates given by
WindMin and WindMax are used to frame the window area.

Once the window frame has been displayed WindMin and
WindMax will be adjusted so the window will fit within
the framed area. (e.g. if the current window is
defined as 1,1,80,25 then after FrameWin the current
window will be 2,2,79,24).

Example See program examples 3-9

Source framewin.asm

----------------------------------------------------------------------
GetCursorSize
----------------------------------------------------------------------

Description Reports the starting and ending scan lines of the
current cursor.

Summary INT2 GetCursorSize( VOID );

Returns Gets the cursor size by reporting the starting scan
line in the high byte and the ending scan line in the
low byte of the word.

Example See program example 10.

Source gcursize.asm

----------------------------------------------------------------------
GetFrameAttr
----------------------------------------------------------------------

Description Read the attribute bytes for the specified area on the
screen into the buffer area.

Summary VOID GetFrameAttr( x1, y1, x2, y2, Buffer );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
CHAR *Buffer data area where data from
screen will be placed.

See Also GetFrameCell, GetFrameChar

Example See program example

Source gframbyt.asm

----------------------------------------------------------------------
GetFrameCell
----------------------------------------------------------------------

Description Read the character and attributes bytes for the
specified area on the screen into the buffer area.

Summary VOID GetFrameCell( x1, y1, x2, y2, Buffer );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
CHAR *Buffer data area where data from
screen will be placed.

See Also GetFrameAttr, GetFrameChar

Example See program example

Source gframbyt.asm

----------------------------------------------------------------------
GetFrameChar
----------------------------------------------------------------------

Description Read the character bytes for the specified area on the
screen into the buffer area.

Summary VOID GetFrameChar( x1, y1, x2, y2, Buffer );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
CHAR *Buffer data area where data from
screen will be placed.

See Also GetFrameAttr, GetFrameCell

Example See program example

Source gframbyt.asm

----------------------------------------------------------------------
GetScrn
----------------------------------------------------------------------

Description Read the character and attribute bytes starting from
speci fied position on the screen into the buffer.

Summary VOID GetScrn( x, y, NWords, Buffer );
INT x column to begin reading data
from the screen.
INT y row to begin reading data
from the screen.
INT NWords number of words to read from
the display screen.
CHAR *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 o

ff through the global variable CheckSnow.

See Also PutScrn

Example See program example

Source gscrn.asm

----------------------------------------------------------------------
GetVideoCols
----------------------------------------------------------------------

Description Get the number of columns per line for the current
display mode.

Summary INT GetVideoCols( VOID );

Remarks GetVideoCols will return the number of columns on the
screen.

See Also GetVideoInfo

Example See program example

Source gviocols.asm

----------------------------------------------------------------------
GetVideoInfo
----------------------------------------------------------------------

Description Gets general video display informtion.

Summary VOID GetVideoInfo( BaseSeg, Cols, Pg, Mode );
INT *BaseSeg returns the base segment
address of the current video
page.
INT *Cols returns the number of
display columns available
for the cur rent video mode.
INT *Pg returns the active display
page for the video display.
This will always be zero for
the mono chrome display
adapter.
INT *Mode returns the current video
display mode.

See Also GetVideoCols, GetVideoMode, GetVideoPage

Example See program example

Source gvioinfo.asm

----------------------------------------------------------------------
GetVideoMode
----------------------------------------------------------------------

Description Gets the current video mode.

Summary INT 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 See program example

Source gviomode.asm

----------------------------------------------------------------------
GetVideoPage
----------------------------------------------------------------------

Description Gets the active display page currently in use.

Summary INT GetVideoPage( VOID );

Remarks On monochrome displays GetVideoPage will always return
a zero.

See Also GetVideoInfo

Example See program example

Source gviopage.asm

----------------------------------------------------------------------
GotoxyAbs
----------------------------------------------------------------------

Description Position the cursor at the specified position on the
screen without regards to the global variables WindMin
and Wind Max.

Summary VOID GotoxyAbs( x, y );
INT x column number to place the
cursor in.
INT 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 See program examples 2-5

Source gotoxyab.asm

----------------------------------------------------------------------
HideCursor
----------------------------------------------------------------------

Description Hides the cursor from view of the video display.

Summary VOID HideCursor( VOID );

Remarks This function turns on the fifth bit of the current
cursor size.

Example See program example

Source hcursor.asm

----------------------------------------------------------------------
InitVideo
----------------------------------------------------------------------

Description Initialize the video mode.

Summary VOID InitVideo( Mode );
INT Mode gives the video mode to
initial ize.

Remarks To set the screen to the appropriate video mode use the
fol lowing 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 See program example

Source initvio.asm

----------------------------------------------------------------------
PutFrameAttr
----------------------------------------------------------------------

Description Write the data in the buffer to the attribute byte in
the speci fied area on the screen.

Summary VOID PutFrameAttr( x1, y1,x2, y2, Buffer );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
CHAR *Buffer data buffer that contains
the information to display
on the screen.

See Also GetFrameAttr, PutFrameCell, PutFrameChar

Example See program example

Source pframbyt.asm

----------------------------------------------------------------------
PutFrameCell
----------------------------------------------------------------------

Description Write the data in the buffer to the character and
attribute bytes in the specified area on the screen.

Summary VOID PutFrameCell( x1, y1, x2, y2, Buffer );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
CHAR *Buffer data buffer that contains
the information to display
on the screen.

See Also GetFrameCell, PutFrameAttr, PutFrameChar

Example See program example

Source pframbyt.asm

----------------------------------------------------------------------
PutFrameChar
----------------------------------------------------------------------

Description Write the data in the buffer to the character byte in
the specified area on the screen.

Summary VOID PutFrameChar( x1, y1, x2, y2, Buffer );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
CHAR *Buffer data buffer that contains
the information to display
on the screen.

See Also GetFrameChar, PutFrameAttr, PutFrameChar

Example See program example

Source pframbyt.asm

----------------------------------------------------------------------
PutScrn
----------------------------------------------------------------------

Description Displays the data in the buffer to the specified screen
posi tion in character attribute byte form.

Summary VOID PutScrn( x, y, NWords, Buffer );
INT x column to begin display of
screen data.
INT y row to begin display of
screen data.
INT NWords number of words to read from
the display screen.
CHAR *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 o

ff through the global variable CheckSnow.

See Also GetScrn

Example See program example

Source pscrn.asm

----------------------------------------------------------------------
RvsAttr
----------------------------------------------------------------------

Description Reverses the video attribute byte passed.

Summary INT RvsAttr( Attr );
INT 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 parameter value passed in. The
blink and intensity bits of the byte remain unchanged.

Example See program example

Source rvsattr.asm

----------------------------------------------------------------------
ScrollDown
----------------------------------------------------------------------

Description Scroll the specified portion of the screen down N lines
filling in new lines with spaces and the specified
attribute.

Summary VOID ScrollDown( x1, y1, x2, y2, Attr, NRows );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
INT 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.
INT 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

Example See program example

Source scrollvt.asm

----------------------------------------------------------------------
ScrollLeft
----------------------------------------------------------------------

Description Scroll the specified portion of the screen left N
columns fill ing in new columns with spaces and the
specified attribute.

Summary VOID ScrollLeft( x1, y1, x2, y2, Attr, NCols );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
INT Attr value in the range 0-255. It
defines the display
attribute to be used
when filling in the
blankcolumns on the right
side of the window.
INT NCols number of columns the speci
fied portion of the screen
is to be scrolled.

Remarks If a value of zero for the number of lines to scroll is
used, 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

Example See program example

Source scrolllt.asm

----------------------------------------------------------------------
ScrollRight
----------------------------------------------------------------------

Description Scroll the specified portion of the screen right N
columns fill ing in new columns with spaces and the
specified attribute.

Summary VOID ScrollRight( x1, y1, x2, y2, Attr, NCols );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
INT 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.
INT NCols number of columns the speci
fied 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

Example See program example

Source scrollrt.asm

----------------------------------------------------------------------
ScrollUp
----------------------------------------------------------------------

Description Scroll the specified portion of the screen up N lines
filling in new lines with spaces and the specified
attribute.

Summary VOID ScrollUp( x1, y1, x2, y2, Attr, NRows );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT y2 bottom row of window.
INT 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.
INT 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

Example See program example

Source scrollvt.asm

----------------------------------------------------------------------
SetCursorSize
----------------------------------------------------------------------

Description Set the size of the cursor.

Summary VOID SetCursorSize( StScan, SpScan );
INT StScan starting scan line to be
used for the cursor.
INT 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 follow ing 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

Example See program example

Source scursize.asm

----------------------------------------------------------------------
SetVideoPage
----------------------------------------------------------------------

Description Set the active display page.

Summary VOID SetVideoPage( PageNo );
INT 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 See program example

Source sviopage.asm

----------------------------------------------------------------------
ShowCursor
----------------------------------------------------------------------

Description Shows the cursor on the video display.

Summary VOID ShowCursor( VOID );

Remarks This function turns off the fifth bit of the current
cursor size.

Example See program example

Source scursor.asm

----------------------------------------------------------------------
VioInit
----------------------------------------------------------------------

Description Initializes the Video units global variables.

Summary VOID VioInit( VOID );

Remarks This function must be executed once before any video
func tions 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 See program examples 2-7

Source vioinit.asm

----------------------------------------------------------------------
WhereXAbs
----------------------------------------------------------------------

Description Returns the column the cursor is in.

Summary INT 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 See program example

Source wherexab.asm

----------------------------------------------------------------------
WhereYAbs
----------------------------------------------------------------------

Description Returns the row the cursor is on.

Summary INT 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 See program example

Source whereyab.asm

----------------------------------------------------------------------
WindowFP
----------------------------------------------------------------------

Description Set the window coordinate variables WindMin and
WindMax.

Summary VOID WindowFP( x1, y1, x2, y2 );
INT x1 left column of window.
INT y1 top row of window.
INT x2 right column of window.
INT 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 See program example 3-7

Source windowfp.asm

----------------------------------------------------------------------
WriteSt
----------------------------------------------------------------------

Description Display a string on the screen

Summary VOID WriteSt( String );
CHAR *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 physi cal screen when necessary.
WriteSt will not scroll the sc

reen 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 See program example 3

Source wrtst.asm

----------------------------------------------------------------------
WriteStln
----------------------------------------------------------------------

Description Display a string on the screen

Summary VOID WriteStln( String );
CHAR *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 physi

cal 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 See program example 3

Source wrtstln.asm



Chapter 4
BIOS Video

+--------------------------------+
| |
| This section supports video |
| BIOS functions. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

----------------------------------------------------------------------
bvCurEmulation[VGA]
----------------------------------------------------------------------

Description Enables or disables cursor emulation for the currently
active display. When cursor emulation is enabled, the
ROM BIOS automatically remaps INT 10H Function 01H
cursor starting scan and ending scan lines for the
current character cell


dimensions.
Summary INT2 bvCurEmulation( setting );
INT2 setting 0 - enables emulation
1 - disable emulation

Returns 12h - if function is supported.

Example See program example

Source b101234d.asm

----------------------------------------------------------------------
bvDefPalLoad[MCGA][VGA]
----------------------------------------------------------------------

Description Enables or disables loading of a default palette when a
video display mode is selected.

Summary INT2 bvDefPalLoad( setting );
INT2 setting 0 - enables default palette
load ing
1 - disable default palette
load ing

Returns 12h - if function is supported.

Example See program example

Source b101231d.asm

----------------------------------------------------------------------
bvGetBorder[VGA]
----------------------------------------------------------------------

Description Obtain current color of the border.

Summary INT2 bvGetBorder( VOID );

Returns The attribute value of the border color.

Example See program example

Source b101008d.asm

----------------------------------------------------------------------
bvGetColorPgMode[VGA]
----------------------------------------------------------------------

Description Gets paging mode for specified color registers and the
cur rent color page.

Summary VOID bvGetColorPgMode( colorpg, pgmode );
INT2 *colorpg color page to get
information on
INT2 *pgmode 00 - if 4 pages of 64
registers
01 - if 16 pages of 16
registers

See Also bvSetColorPgMode

Example See program example

Source b10101ad.asm

----------------------------------------------------------------------
bvGetColorReg[MCGA][VGA]
----------------------------------------------------------------------

Description Sets paging mode for color registers

Summary VOID bvGetColorReg( colorreg, green, blue, red );
INT2 colorreg color register
INT2 *green green color value
INT2 *blue blue color value
INT2 *red red color value

Example See program example

Source b101015d.asm

----------------------------------------------------------------------
bvGetColorRegBlk[MCGA][VGA]
----------------------------------------------------------------------

Description Reads the set of red, green and blue colors associated
with each set of color registers.

Summary VOID bvGetColorRegBlk( startreg, regcount, colortbl );
UINT2 startreg first color register
INT2 regcount number of registers
INT2 colortbl[][3] color table consists of 3
bytes for each register.
Each group of 3 bytes will
specify the red, green, and
blue values, respec tively
for the associated register.

Example See program example

Source b101017d.asm

----------------------------------------------------------------------
bvGetConfigInfo[EGA][VGA]
----------------------------------------------------------------------

Description Returns configuration information for the active video
sys tem.

Summary VOID bvGetConfigInfo( dsptype, egamem, fbits, swset );
INT2 *dsptype 0 - color
1 - monochrome
INT2 *egamem 0 - 64K
1 - 128K
2 - 192K
3 - 256K
INT2 *fbits feature bits
INT2 *swset switch setting

Remarks The feature bits are set from input status register
zero in response to an output on the specified feature
control regis ter bits:

Feature Feature control Input Status
Bit(s) Output Bit Bit
0 0 5
1 0 6
2 1 5
3 1 6
4-7 not used

The bits in the switch settings byte indicate the state
of the EGA's configuration DIP switch (1=off, 0=on).

Bit Significance
0 configuration switch 1
1 configuration switch 2
2 configuration switch 3
3 configuration switch 4
4-7 not used

Example See program example

Source b101210d.asm

----------------------------------------------------------------------
bvGetCurPos[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Returns the current position of the cursor on the
display.

Summary VOID bvGetCurPos( pg, row, col );
INT2 pg page to get cursor position
for
INT2 *row row (y coordinate)
INT2 *col col (x coordinate)

Example See program example

Source b100300d.asm

----------------------------------------------------------------------
bvGetCurType[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Returns starting and ending scan lines for the cursor
in text modes.

Summary VOID bvGetCurType( pg, stscan, spscan );
INT2 pg page to get cursor position
for
INT2 *stscan starting scan line for
cursor
INT2 *spscan ending scan line for cursor

Example See program example

Source b1003x0d.asm

----------------------------------------------------------------------
bvGetFontInfo[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Returns a pointer to the character definition table for
a font, and the bytes per character and rows for that
font.

Summary VOID bvGetFontInfo( fontcode, points, scnrows, fonttbl
);
INT2 fontcode defines font table to
retrieve information on
UINT2 *points bytes per character
INT2 *scnrows rows per screen
VOID *fonttbl address of font table
requested

Remarks Font
Code Description

00 current Int 1FH contents
01 current Int 43H contents
02 ROM 8x14 font (EGA, VGA only)
03 ROM 8x8 font (characters 00H-7FH)
04 ROM 8x8 font (characters 80H-FFH)
05 ROM alternate 9x14 font (EGA, VGA only)
06 ROM 8x16 font (MCGA, VGA only)
07 ROM alternate 9x16 font (VGA only)

Example See program example

Source b101130d.asm

----------------------------------------------------------------------
bvGetMode[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Return current display mode, active page and number of
columns for the active display page.

Summary VOID bvGetMode( mode, cols, pg );
INT2 *mode current display mode
INT2 *cols number of column on page
INT2 *pg active display page

Example See program example

Source b100f00d.asm

----------------------------------------------------------------------
bvGetPalBorder[VGA]
----------------------------------------------------------------------

Description Obtain contents of all palette registers and color of
border.

Summary VOID bvGetPalBorder( buf );
CHAR buf[17] Bytes 00-0Fh will contain
the
palette values. Byte 10h will contain the
border color.

Example See program example

Source b101009d.asm

----------------------------------------------------------------------
bvGetPalReg[VGA]
----------------------------------------------------------------------

Description Return the color associated with the specified register
pal ette.

Summary INT2 bvGetPalReg( reg );
INT2 reg return the color for this
palette register.

Returns Color for the specified palette register.

Example See program example

Source b101007d.asm

----------------------------------------------------------------------
bvGrayScaleSum[MCGA] [VGA]
----------------------------------------------------------------------

Description Enables or disables gray-scale summing for active
display.

Summary INT2 bvGrayScaleSum( setting );
INT2 setting 0 - enables access
1 - disable access
Return 12h is returned if this function
is supported.

Example See program example

Source b101233d.asm

----------------------------------------------------------------------
bvLoad8x14Font01[EGA] [VGA]
----------------------------------------------------------------------

Description Provides the default 8x14 font table in text modes.

Summary VOID bvLoad8x14Font01( block );
INT2 block specifies the block of
character generator RAM. (0
or 1).

Remarks If this function is used on an MCGA then the BIOS will
execute the function bvLoad8x16Font04.

Example See program example

Source b101101d.asm

----------------------------------------------------------------------
bvLoad8x14Font11[EGA] [VGA]
----------------------------------------------------------------------

Description Provides the default 8x14 font table in text modes.

Summary VOID bvLoad8x14Font11( block );
INT2 block specifies the block of
character generator RAM. (0
or 1).

Remarks Page zero must be active and if this function is used
at any other time than immediately after a set mode,
the results will be unpredictable.

If this function is used on an MCGA then the BIOS will
execute the function bvLoad8x16Font04.

Example See program example

Source b101101d.asm

----------------------------------------------------------------------
bvLoad8x16Font04[MCGA] [VGA]
----------------------------------------------------------------------

Description Provides the default 8x16 font table in text modes.

Summary VOID bvLoad8x16Font04( block );
INT2 block specifies the block of
character generator RAM.

Remarks On a MCGA, a call to this function should be followed
with a call to bvSetBlkSpec.

Example See program example

Source b101104d.asm

----------------------------------------------------------------------
bvLoad8x16Font14[MCGA] [VGA]
----------------------------------------------------------------------

Description Provides the default 8x16 font table in text modes.

Summary VOID bvLoad8x16Font14( block );
INT2 block specifies the block of
character generator RAM.

Remarks Page zero must be active and if this function is used
at any other time than immediately after a set mode,
the results will be unpredictable.

If this function is used on an MCGA then the BIOS will
execute the function bvLoad8x16Font04.

Example See program example

Source b101104d.asm

----------------------------------------------------------------------
bvLoad8x8Font02[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Provides the default 8x8 font table in text modes.

Summary VOID bvLoad8x8Font02( block );
INT2 block specifies the block of
character generator RAM.

Remarks On a MCGA, a call to this function should be followed
with a call to bvSetBlkSpec.

Example See program example

Source b101102d.asm

----------------------------------------------------------------------
bvLoad8x8Font12[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Provides the default 8x8 font table in text modes.

Summary VOID bvLoad8x8Font12( block );
INT2 block specifies the block of
character generator RAM.

Remarks Page zero must be active and if function is used at any
other time than immediately after a set mode, the
results will be unpredictable. If this function is
used on an MCGA then the BIOS will execute the function
bvLoad8x16Font02.

Example See program example

Source b101102d.asm

----------------------------------------------------------------------
bvLoadUsrFont00[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Loads the users text font table into the specified
block of character generator RAM.

Summary VOID bvLoadUsrFont00( pts, block, chcnt, startch,
fonttbl );
INT2 pts bytes per character
INT2 block specifies block of character
generator RAM.
UINT2 chcnt characters in table
UINT2 startch first character in table
VOID *fonttbl font table address

Remarks On a MCGA, a call to this function should be followed
with a call to bvSetBlkSpec.

Example See program example

Source b101100d.asm

----------------------------------------------------------------------
bvLoadUsrFont10[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Loads the users text font table into specified block of
char acter generator RAM.

Summary VOID bvLoadUsrFont10( pts, block, chcnt, startch,
fonttbl );
INT2 pts bytes per character
INT2 block specifies block of character
generator RAM.
UINT2 chcnt characters in table
UINT2 startch first character in table
VOID *fonttbl font table address

Remarks Page zero must be active and if this function is used
at any other time than immediately after a set mode,
the results will be unpredictable.

If this function is used on an MCGA then the BIOS will
execute the function bvLoadUsrFont00.

Example See program example

Source b101100d.asm

----------------------------------------------------------------------
bvReadCell[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Read the cell the cursor is positioned on for its
character and attribute values.

Summary VOID bvReadCell( ch, attr, pg );
INT2 *ch will contain the character
of the cell.
INt2 *attr will contain the attribute
value of the cell.
INT2 *pg the page the cell to read is
on.

Remarks The page to read from does not have to be the active
page, if the video display supports multiple pages.

Example See program example

Source b100800d.asm

----------------------------------------------------------------------
bvReadPix[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Read pixel from the specified graphics coordinates.

Summary INT2 bvReadPix( row, col, pg );
INT2 row row for pixel to be read
from
INT2 col col for pixel to be read
from
INT2 pg page to read pixel from

Returns The pixel value at for the coordinates requested.

Example See program example

Source b100d00d.asm

----------------------------------------------------------------------
bvScnRefresh[VGA]
----------------------------------------------------------------------

Description Enables or disables the video refresh for the currently
active display.

Summary INT2 bvScnRefresh( setting );

INT2 setting 0 - enables refresh
1 - disable refresh

Returns 12h is returned if this function is supported.

Example See program example

Source b101236d.asm

----------------------------------------------------------------------
bvScrollDn[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Scrolls the contents of the window on the active
display page down by the specified number of lines.

Summary VOID bvScrollDn( top, left, bottom, right, lines, attr
);
INT2 top top row of window
INT2 left left column of window
INT2 bottom bottom row of window
INT2 right right column of window
INT2 lines number of lines to scroll
INT2 attr attribute to use for blanked
area

Remarks If the number of lines to scroll is zero, the entire
window will be blanked.

Example See program example

Source b1006xxd.asm

----------------------------------------------------------------------
bvScrollUp[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Scrolls the contents of the window on the active
display page up by the specified number of lines.

Summary VOID bvScrollUp( top, left, bottom, right, lines, attr
);
INT2 top top row of window
INT2 left left column of window
INT2 bottom bottom row of window
INT2 right right column of window
INT2 lines number of lines to scroll
INT2 attr attribute to use for blanked
area

Remarks If the number of lines to scroll is zero, the entire
window will be blanked.

Example See program example

Source b1006xxd.asm

----------------------------------------------------------------------
bvSet1FhFontPtr[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Sets the Int 1Fh pointer to the user's font table. The
table is used for character codes 80H-FFH) in graphics
modes 04H-06H.

Summary VOID bvSet1FhFontPtr( fonttbl );
VOID *fonttbl pointer to the font table

Remarks If this function is used at any other time than
immediately after a set mode, the results will be
unpredictable.

Example See program example

Source b101120d.asm

----------------------------------------------------------------------
bvSet43h8x14Font[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Sets the vector for Int 43h to point to the ROM BIOS
default 8x14 font and updates the video ROM BIOS data
area.

Summary VOID bvSet43h8x14Font( spec, scnrows );
INT2 spec must be a value from 0-3 to
specify the number of
character rows on the
screen.

Specifier Descriptionx14Font(spec, scnrows );
00 use scnrows var
01 14 rows
02 25 rows
03 43 rows

INT2 scnrows number of rows per screen
when spec(ifier) is zero.

Remarks If this function is used at any other time than
immediately after a set mode, the results will be
unpredictable. When this function is used on the MCGA,
the BIOS substitutes function call bvSet43h8x16Font.

Example See program example

Source b101122d.asm

----------------------------------------------------------------------
bvSet43h8x16Font[MCGA] [VGA]
----------------------------------------------------------------------

Description Sets the vector for Int 43h to point to the ROM BIOS
default 8x16 font and updates the video ROM BIOS data
area.

Summary VOID bvSet43h8x16Font( spec, scnrows );
INT2 spec must be a value from 0-3 to
specify the number of
character rows on the
screen.

Specifier Descriptionx16Font(spec, scnrows );
00 use scnrows var
01 14 rows
02 25 rows
03 43 rows

INT2 scnrows number of rows per screen
when spec(ifier) is zero.

Remarks If this function is used at any other time than
immediately after a set mode, the results will be
unpredictable.

Example See program example

Source b101124d.asm

----------------------------------------------------------------------
bvSet43h8x8Font[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Sets the vector for Int 43h to point to the ROM BIOS
default 8x8 font and updates the video ROM BIOS data
area.

Summary VOID bvSet43h8x8Font( spec, scnrows );
INT2 spec must be a value from 0-3 to
specify the number of
character rows on the
screen.

Specifier Descriptionx8Font(spec, scnrows );
00 use scnrows var
01 14 rows
02 25 rows
03 43 rows

INT2 scnrows number of rows per screen
when spec(ifier) is zero.

Remarks If this function is used at any other time than
immediately after a set mode, the results will be
unpredictable.

Example See program example

Source b101123d.asm

----------------------------------------------------------------------
bvSet43hUsrFont[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Sets the vector for Int 43h to point to the user's font
table and update the video ROM BIOS data area.

Summary VOID bvSet43hUsrFont( rows, points, scnrows, fonttbl );
INT2 rows character rows specifier
UINT2 points bytes per character
INT2 scnrows rows per screen
VOID *fonttbl pointer to the user font
table

Remarks If this function is used at any other time than
immediately after a set mode, the results will be
unpredictable.

Example See program example

Source b101121d.asm

----------------------------------------------------------------------
bvSetAltPrtSc[EGA] [VGA]
----------------------------------------------------------------------

Description Selects an alternate print-screen routine for the EGA
and VGA that works properly if the screen length is not
25 lines.

Summary VOID bvSetAltPrtSc( VOID );

Example See program example

Source b101220d.asm

----------------------------------------------------------------------
bvSetBlink[PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Determines if the significant bit in an attribute will
display either blinking or intensified.

Summary VOID bvSetBlink( state );
INT2 state 0 - enables intensity
1 - enables blinking

Example See program example

Source b101003d.asm

----------------------------------------------------------------------
bvSetBlkSpec[EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Determines character blocks selected by bit 3 of the
charac ter attribute bytes in alphanumeric display
modes.

Summary VOID bvSetBlkSpec( block );
INT2 block select code for char
generator block

Remarks EGA, MCGA
Bits Description
0,1 indicates which 1 of 4 256 character tables is used when
bit 3 of character's attribute byte is zero.

2,3 indicate which table is used when bit 3 is set on.

VGA
Bits Description
0,1,4 specify 1 of 8 tables when bit 3 is zero.
2,3,5 specify table when attribute bit 3 is one.

Example See program example

Source b101103d.asm

----------------------------------------------------------------------
bvSetBorder[PCjr] [EGA] [VGA]
----------------------------------------------------------------------

Description Controls the color of the screen border.

Summary VOID bvSetBorder( color );
INT2 color color of border. Range
(0-63).

Example See program example

Source b101001d.asm

----------------------------------------------------------------------
bvSetColorPgMode[VGA]
----------------------------------------------------------------------

Description Sets paging mode for color registers

Summary VOID bvSetColorPgMode( pgstate );
INT2 pgstate 00 - sets 4 pages of 64
registers
01 - sets 16 pages of 16
regis ters

Remarks This function is invalid for graphics video mode 13H
(320x200, 256 colors).

Example See program example

Source b101013d.asm

----------------------------------------------------------------------
bvSetColorReg[MCGA] [VGA]
----------------------------------------------------------------------

Description Set red-green-blue values for a color register

Summary VOID bvSetColorReg( colorreg, green, blue, red );
UINT2 colorreg color register
INT2 green green color value
INT2 blue blue color value
INT2 red red color value

Remarks When gray-scale summing is on, the gray-scale weighted
values are calculated as described under the function
bvSetGrayScale and stored into the components of the
color register.

Example See program example

Source b101010d.asm

----------------------------------------------------------------------
bvSetColorRegBlk[MCGA] [VGA]
----------------------------------------------------------------------

Description Set a series of consecutive color registers.

Summary VOID bvSetColorRegBlk( startreg, regcount, colortbl );
UINT2 startreg first color register
INT2 regcount number of registers
BYTE colortbl[][3] color table that consists of
3 bytes for every register.
Each group of 3 bytes will
specify the red, green, and
blue values, respectively
for the associated register.

Remarks When gray-scale summing is on, the gray-scale weighted
values are calculated as described under the function
bvSetGrayScale and stored into the components of the
color register.

Example See program example

Source b101012d.asm

----------------------------------------------------------------------
bvSetColorRegPg[VGA]
----------------------------------------------------------------------

Description Set a color register page.

Summary VOID bvSetColorRegPg( pg );
INT2 pg color register page to
select.

Remarks This function is invalid for graphics video mode 13H
(320x200, 256 colors).

Example See program example

Source b101013d.asm

----------------------------------------------------------------------
bvSetCurPos[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Sets cursor position for the selected page.

Summary VOID bvSetCurPos( pg, row, col );
INT2 pg page to set cursor position
INT2 row row (y coordinate)
INT2 col col (x coordinate)

Example See program example

Source b100200d.asm

----------------------------------------------------------------------
bvSetCurType[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Selects starting and ending scan lines for the cursor
in text modes.

Summary VOID bvSetCurType( StScan, SpScan );
INT2 StScan starting scan line for
cursor
INT2 SpScan ending scan line for cursor

Remarks In text modes, the hardware causes the cursor to blink,
which cannot be disabled. In graphics mode, the
cursor is not available.

The scan line ranges for the cursor are:

Mode Start End
7 0 12
0-3 0 7

For example, the X's would be the position of the
cursor on a text row using scan lines 6 and 7 for a CGA
display.

0 --
1 --
2 --
3 --
4 --
5 --
6 -- XX
7 -- XX

In text modes 0-3 the EGA, MCGA, and VGA provide cursor
emulation for the starting and ending scan lines. The
staring and ending values are remapped from an 8x8
cell to the true character cell dimension.

One technique used to hide the cursor is by passing in
the value 32H or 00100000B) for the starting and ending
scan lines.

Example See program example

Source b100100d.asm

----------------------------------------------------------------------
bvSetGrayScale[MCGA] [VGA]
----------------------------------------------------------------------

Description Sets red, green and blue values of one or more color
regis ters into the gray-scale equivalents.

Summary VOID bvSetGrayScale( startreg, regcount );
UINT2 startreg first color register
INT2 regcount number of registers

Remarks For the range of color registers specified, each
register is read and each new color value is calculated
as 30% red + 59% green + 11% blue.

Example See program example

Source b10101bd.asm

----------------------------------------------------------------------
bvSetMode[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Set video display mode.

Summary VOID bvSetMode( mode, clear );
UINT mode video mode to set
UINT clear 0 - clear display buffer
for new mode.
1 - do not clear display
buffer for new mode. This
parameter is ignored on PC's
and PC/XT's with a cga or
monochrome dis play adapter.

Remarks The video modes applicable for the various video
adapters are as follows:

Text/
Mode Resolution Colors Graphics MDA CGA PCjr EGA MCGA VGA
00h 40x25 16 text x x x x x
01h 40x25 16 text x x x x x
02h 80x25 16 text x x x x x
03h 80x25 16 text x x x x x
04h 320x200 4 graphics x x x x x
05h 320x200 4 graphics x x x x x
06h 640x200 2 graphics x x x x x
07h 80x25 2* text x x x
08h 160x200 16 graphics x
09h 320x200 16 graphics x
0Ah 640x200 4 graphics x
0Bh reserved
0Ch reserved
0Dh 320x200 16 graphics x x
0Eh 640x200 16 graphics x x
0Fh 640x350 2* graphics x x
10h 640x350 4 graphics x**
10h 640x350 16 graphics x*** x
11h 640x480 2 graphics x x
12h 640x480 16 graphics x
13h 320x200 256 graphics x x

* Monochrome monitor only.
** EGA with 64 KB of RAM.
*** EGA with 128 KB or more of RAM.

On the PC/AT, PCjr, and PS/2, if the "clear" parameter
is set, the display buffer is not cleared when a new
mode is selected. This capability is only available
on PC or PC/XT when an EGA or VGA adapter is installed.

Example See program example

Source b1000xxd.asm

----------------------------------------------------------------------
bvSetPage[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Select active display page

Summary VOID bvSetPage( pg );
INT2 pg page to select.

Example See program example

Source b100500d.asm

----------------------------------------------------------------------
bvSetPalBorder[PCjr] [EGA] [VGA]
----------------------------------------------------------------------

Description Sets palette registers and border color

Summary VOID bvSetPalBorder( list );
CHAR list[17] Bytes 0-15 are the color
values to be loaded into the
appropriate palette
registers. Byte 16 is
stored in the border color
regis ter.

Example See program example

Source b100500d.asm

----------------------------------------------------------------------
bvSetPalReg[PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Sets appropriate palette register to a displayable
color.

Summary VOID bvSetPalReg( color, reg );
INT2 color color value
INT2 reg palette register

Remarks For MCGA the color must be 07h and the reg variable
must be 012h.

Example See program example

Source b101000d.asm

----------------------------------------------------------------------
bvSetScanLines[VGA]
----------------------------------------------------------------------

Description Selects the number of scan lines for text modes. The
selected value takes effect the next time the
bvSetMode function is called to select the display
mode.

Summary INT2 bvSetScanLines( scancode );
INT2 scancode 0 - 200 scan lines
1 - 350 scan lines
2 - 400 scan lines

Returns 18 - VGA is active
00 - VGA is not active

Example See program example

Source b101230d.asm

----------------------------------------------------------------------
bvSetState0B[CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description In text mode the border color is set. Graphics mode
sets the border and background color.

Summary VOID bvSetState0B( color );
INT2 color color to set background,
border

Example See program example

Source b100b00d.asm

----------------------------------------------------------------------
bvSwDsp[VGA]
----------------------------------------------------------------------

Description Allows selection of one of two video adapters in the
system, when memory usage or port addresses conflict
between the two adapters.

Summary UINT bvSwDsp( setting, buffer );
INT2 setting 0 - disable initial video
adapter
1 - enable system board
video adapter
2 - disable active video
adapter
3 - enable inactive video
adapter
CHAR *buffer 128-byte buffer to use if
setting is 1, 2, or 3.

Returns 18 - Function is supported.


Remarks If the function is called with setting set to 0 or 2
then the video adapter state information is stored in
the buffer vari able. If the function is called with
setting set to 3 then the information in the buffer
variable will be used to restore the video adapter
state.

Example See program example

Source b101235d.asm

----------------------------------------------------------------------
bvVioAccess[MCGA] [VGA]
----------------------------------------------------------------------

Description Enables or disables CPU access to the video adapter's
I/O ports and video refresh buffer.

Summary INT2 bvVioAccess( setting );
INT2 setting 0 - enables access
1 - disable access

Returns 18 - Function is supported.

Example See program example

Source b101232d.asm

----------------------------------------------------------------------
bvWrtNCell[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Write a character and attribute to the display at the
current cursor position for n times.

Summary VOID bvWrtNCell( ch, attr, count, pg );
INT2 ch character
INT2 attr attribute
INT2 count number of cells to
replication
INT2 pg page to write cell to

Remarks The cursor position is not updated are the character
attribute values are displayed.

In graphics mode the replication factor given in count
will display character attribute combinations only for
the current row.

All characters will display something, including the
bell, backspace, carriage return and the line feed.
These control characters are NOT recognized as special
characters and will not affect the cursor position.

The character definition tables is stored in the vector
for the bvSet43hxxxxFont functions for the EGA, MCGA
and VGA displays in graphics modes.

Example See program example

Source b100900d.asm

----------------------------------------------------------------------
bvWrtNChar[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Write a character to the display at the current cursor
position for n times.

Summary VOID bvWrtNChar( ch, count, pg );
INT2 ch character
INT2 count number of cells to
replication
INT2 pg page to write cell to

Example See program example

Source b100a00d.asm

----------------------------------------------------------------------
bvWrtPix[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Display pixel at the specified graphics coordinates

Summary VOID bvWrtPix( row, col, pixval, pg );
INT2 row row for pixel to be
displayed on
INT2 col col for pixel to be
displayed on
INT2 pixval color of pixel
INT2 pg page to display pixel on

Example See program example

Source b100c00d.asm

----------------------------------------------------------------------
bvWrtTTYChar[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Write character at the current cursor position using
the color specified (if in graphics mode).

Summary VOID bvWrtTTYChar( ch, pg, color );
INT2 ch character to display
INT2 pg page to display the
character on
INT2 color color of character if in
graphics mode

Example See program example .

Source b100e00d.asm

----------------------------------------------------------------------
bvWrtTTYStr[MDA] [CGA] [PCjr] [EGA] [MCGA] [VGA]
----------------------------------------------------------------------

Description Displays a string to the video buffer starting at the
specified location.

Summary VOID bvWrtTTYStr( mode, row, col, len, pg, attr, st );
INT2 mode 0 - use attr, st is chars
only, cursor not updated
1 - use attr, st is chars
only, cursor updated
2 - st is char, attr; cursor
not updated
3 - st is char, attr; cursor
updatede attr, st is chars only, cursor
updated
INT2 row y coordinate
INT2 col x coordinate
INT2 len length of st
INT2 pg display page to display
string on.
INT2 attr attribute is mode is 0 or 1
CHAR *st string to display on the
screen

Example See program example

Source b1013xxd.asm



Chapter 5
Mouse

+--------------------------------+
| |
| The functions in this section |
| support the mouse device. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

Global Variables

UINT NEvents contains the number of events waiting in the mouse event handler
queue.
----------------------------------------------------------------------
mButtonPress [2.00+]
----------------------------------------------------------------------

Description Returns the current button status information.

Summary INT2 MButtonPress( Button, ButPress, x, y );
INT2 Button specifies button to check.
0 - left button
1 - right button
2 - middle button
INT2 *ButPress number of button presses
since the last call to
MButtonPress.
INT2 *x column the mouse cursor was
in the last time the button
was pressed.
INT2 *y row the mouse cursor was in
the last time the button was
pressed.

Remarks MButtonPress will return an integer indicating the
current state of the mouse button requested. 0 is
returned when the button is released and 1 when button
pressed.

Example See program example

Source mbutinfo.asm

----------------------------------------------------------------------
mButtonRel [2.00+]
----------------------------------------------------------------------

Description Returns the current button status information.

Summary INT2 MButtonRel( Button, ButPress, x, y );
INT2 Button specifies the button to
check.
0 - left button
1 - right button
2 - middle button
INT2 *ButPress number of button releases
since the last call to
MButtonRel.
INT2 *x column the mouse cursor was
in the last time the button
was released.
INT2 *y row the mouse cursor was in
the last time the button was
released.

Remarks MButtonReleased will return an integer indicating the
current state of the mouse button requested. 0 is
returned when the button is released and 1 when button
pressed.

Example See program example

Source mbutinfo.asm

----------------------------------------------------------------------
mGetPos [2.00+]
----------------------------------------------------------------------

Description Returns the current button status and the location of
the mouse cursor.

Summary VOID MGetPos( Button, x, y );
INT2 *Button returns the status of each
button by its corresponding
bit value. If a bit is 0 then
that button is up. If a bit
is 1 then that button is
pressed.

Bit Value Button
0 1 left
1 2 right
2 4 middle

INT2 *x column the mouse cursor is
in.
INT2 *y row the mouse cursor is in.

Remarks In 80 column text mode the upper left corner of the
screen is 1,1 and the lower right corner is 80,25.

Example See program example

Source mgetpos.asm

----------------------------------------------------------------------
mGetSpeed [2.00+]
----------------------------------------------------------------------

Description Returns the distance the mouse has moved since the last
call to this routine.

Summary VOID MGetSpeed( HorCnt, VerCnt );
INT2 *HorCnt returns horizontal step
count since last call.
INT2 *VerCnt returns vertical step count
since last call.

Remarks The step count is always in the range -32768 to 32767.
A positive value specifies movements to the right and
down while negative values specify movements to the
left and up. After the call is completed the step
counts are reset to zero.

Example See program example

Source mgspeed.asm

----------------------------------------------------------------------
mGraphCursor [2.00+]
----------------------------------------------------------------------

Description Defines the shape and color of the mouse cursor when in
graphics mode.

Summary VOID MGraphCursor( XHotSpot, YHotSpot, CMaskSeg,
CMaskOfs );
INT2 XHotSpot a value in the range -16 to
16 used to define the X
pixel within or outside the
cursor block
INT2 YHotSpot a value in the range -16 to
16 used to define the Y
pixel within or outside the
cursor block.
UINT2 CMaskSeg the segment of the cursor
mask description variable.
UINT2 CMaskOfs the offset of the cursor
mask description variable.

Remarks The cursor mask variable is two arrays of 16 words
each. The first 16 words define the screen mask and
the second 16 words define the cursor mask. Each array
of 16 words defines the set of pixels that are 16x16.

The screen mask is used to determine which pixels
become part of the cursor shape while the cursor mask
is used to determine the color/shape of the cursor.

Example See program example

Source mgraphcu.asm

----------------------------------------------------------------------
mHideCursor [2.00+]
----------------------------------------------------------------------

Description Removes the mouse cursor from the screen.

Summary VOID MHideCursor( VOID );

Remarks Although the mouse cursor is hidden from view its
motion is still tracked.

Example See program example

Source mhidecur.asm

----------------------------------------------------------------------
mInitEventHandler [2.00+]
----------------------------------------------------------------------

Description Initializes the mouse interrupt event handler.

Summary VOID MInitEventHandler( EventMask );
INT2 EventMask defines the event types the
mouse event handler will place in its
queue.

Remarks Each bit in the event mask corresponds to a specific
event:

Bit Value Event
0 1 cursor position moved
1 2 left button pressed
2 4 left button released
3 8 right button pressed
4 16 right button released
5 32 middle button pressed
6 64 middle button released
7-15 not used

Example See program example

Source minithan.asm

----------------------------------------------------------------------
mPollQue [2.00+]
----------------------------------------------------------------------

Description Returns a copy of the oldest event in the mouse event
queue. The event queue is left unchanged.

Summary VOID MPollQue( Event, ButStat, x, y );
INT2 *Event an integer describing the
event that occurred (See
MInitEventHandler).
INT2 *ButStat button status at time of
event.
INT2 *x column mouse cursor was
located in at the time of
event.
INT2 *y row mouse cursor was located
in at the time of event.

Remarks If the number of events in the queue is zero when this
pro cedure is called the values in the return variables
will be -1. Use the global variable NEvents to
determine if an event is in the queue.

Example See program example

Source mpollque.asm

----------------------------------------------------------------------
mResetMouse [2.00+]
----------------------------------------------------------------------

Description Determines if the mouse hardware and software are
installed.

Summary INT2 MResetMouse( NBut );
INT2 NBut returns the number of
buttons on the mouse.

Remarks MResetMouse will return:
0 - Mouse hardware and software are not installed.
-1 - Mouse hardware and software are installed.

Every call to MResetMouse will also reset the position
of the mouse cursor to the middle of the video display.

Example See program example

Source mresetm.asm

----------------------------------------------------------------------
mRetQue [2.00+]
----------------------------------------------------------------------

Description Returns the oldest event in the mouse event queue and
removes the event from the queue.

Summary VOID MRetQue( Event, ButStat , x, y );
INT2 *Event returns the event that
occurred (see
MInitEventHandler).
INT2 *ButStat button status at the time of
this event.
INT2 *x column mouse cursor was
located in at time of event.
INT2 *y row mouse cursor was located
in at time of event.

Remarks If the number of events in the queue is zero when this
pro cedure is called the values in the return variables
will be -1. Use the global variable NEvents to
determine if an event is in the queue.

Example See program example

Source mretque.asm

----------------------------------------------------------------------
mSetEvent [2.00+]
----------------------------------------------------------------------

Description Simulates a mouse event.

Summary VOID MRetQue( Event, ButStat, x, y );
INT *Event event that should occur (see
MInitEventHandler).
INT *ButStat button status for this
event.
INT *x column of the mouse cursor
for this event.
INT *y row of the mouse cursor for
this event.

Remarks If the number of events in the queue is less than the
maxi mum number of events allowed in the queue then the
event will be placed as the newest or last mouse event
to occur. All global and local variables used for this
procedure will be upd

ated exactly the same as if an actual mouse event had
occurred.

Example See program example

Source msetevnt.asm

----------------------------------------------------------------------
mSetPos [2.00+]
----------------------------------------------------------------------

Description Set the position of the mouse cursor.

Summary VOID MSetPos( x, y );
INT2 x column to put mouse cursor
in
INT2 y row to put mouse cursor in

Remarks Checks for valid X and Y values are NOT performed. In
80 column text mode the upper left corner of the screen
is 1,1 and the lower right corner is 80,25.

Example See program example

Source msetpos.asm

----------------------------------------------------------------------
mSetSpeed [2.00+]
----------------------------------------------------------------------

Description Sets mouse motion to screen pixel ratio.

Summary VOID MSetSpeed( HorCnt, VerCnt );
INT2 HorCnt the horizontal step ratio.
The value is in the range of
1 to 32767 where the ratio
will be HorCnt steps to 8
pixels hori zontally.
INT2 VerCnt the vertical step ratio.
The value is in the range of
1 to 32767 where the ratio
will be VerCnt steps to 8
pixels verti cally.

Remarks The step values refer to the amount of mouse movement.

Example See program example

Source msspeed.asm

----------------------------------------------------------------------
mSetXRange [2.00+]
----------------------------------------------------------------------

Description Sets the column boundaries the mouse cursor will be
allowed to move within.

Summary VOID MSetXRange( Min, Max );
INT2 Min left col boundary for mouse
cursor.
INT2 Max right col boundary for mouse
cursor.

Remarks Range checks are not performed on the parameters.

Example See program example

Source msetxy.asm

----------------------------------------------------------------------
mSetYRange [2.00+]
----------------------------------------------------------------------

Description Sets the row boundaries the mouse cursor will be
allowed to move within.

Summary VOID MSetYRange( Min, Max );
INT2 Min top row boundary for mouse
cursor.
INT2 Max bottom row boundary for
mouse cursor.

Remarks Range checks are not performed on the parameters.

Example See program example

Source msetxy.asm

----------------------------------------------------------------------
mShowCursor [2.00+]
----------------------------------------------------------------------

Description Display the mouse cursor on the screen

Summary VOID MShowCursor( VOID );

Example See program example

Source mshowcur.asm

----------------------------------------------------------------------
mTextCursor [2.00+]
----------------------------------------------------------------------

Description Defines the mouse text cursor

Summary VOID MTextCursor( CType, SMask, CMask );
INT2 CType selects the type of mouse
cur sor to use.
0 - software cursor
1 - hardware cursor
INT2 SMask if the software cursor is
selected the screen mask is
defined. If the hardware
cursor is selected the
starting scan line is
defined.
INT2 CMask if the software cursor is
selected the cursor mask is
defined. If the hardware
cursor is selected the
ending scan line is defined.

Remarks The screen mask is an integer that defines which of the
character attributes are preserved. The cursor mask is
used to determine which of the characteristics are
changed by the cursor. See SetCursor Size in chapter
two for a description of

the starting and ending scan lines.

Example See program example

Source mtextcur.asm



Chapter 6
Keyboard

+--------------------------------+
| |
| The functions in this section |
| support the keyboard. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

----------------------------------------------------------------------
BiosKbdClr[PC][AT][PS/2]
----------------------------------------------------------------------

Description Clear the keyboard buffer.

Summary VOID BiosKbdClr( VOID );

Remarks BiosKbdClr uses the BIOS to clear any characters in the
keyboard buffer waiting to be read.

See Also DosKbdClr

Example See program example

Source bkbdclr.asm

----------------------------------------------------------------------
BiosKbdGetElmt[PC][AT][PS/2]
----------------------------------------------------------------------

Description Returns an integer value for the key pressed on the key
board.

Summary INT2 BiosKbdGetElmt( VOID );

Remarks BiosKbdGetElmt will return an integer in the range of
0-388. Use Appendix C as a guide to find the keyboard
element code this function returns for a particular key
pressed on the keyboard. When using DOS function calls
there is not any meth

od available to distinguish the difference between some
keystrokes and key combinations. An example of this is
the Enter key and the Ctrl-M keys, both return a value
of 145. Key combinations using the control key with an
alpha char acter and all oth

er ASCII characters will be offset by 132.

See Also BiosKbdRead, DosKbdGetElmt, DosKbdRead

Example See program example 2

Source bkbdelmt.asm

----------------------------------------------------------------------
BiosKbdHit[PC][AT][PS/2]
----------------------------------------------------------------------

Description Reports if a keystroke is waiting to be read from the
key board buffer.

Summary INT2 BiosKbdHit( VOID );

Remarks Using the BIOS services BiosKbdHit checks the keyboard
status to determine if a key is waiting to be read from
the keyboard buffer.

See Also DosKbdHit

Example See program example

Source bkbdhit.asm

----------------------------------------------------------------------
BiosKbdRead[PC][AT][PS/2]
----------------------------------------------------------------------

Description Read a character from the keyboard.

Summary VOID BiosKbdRead( Ch );
CHAR *Ch returns a string of length
zero, one, or two bytes long
defining the key or key
combination pressed from the
keyboard.

Remarks BiosKbdRead reads a single character from the keyboard
buffer. BiosKbdRead will return a zero, one, or two
charac ter string. A null string indicates that Ctrl-
Break was pressed. A one character string indicates a
normal ASCII character w

as read from the keyboard. A two-character string
indicates a special extended keyboard code. Refer to
appendix B for a list of the extended keyboard codes.
The data type definition for BiosKbdRead is an untyped
variable using a minimum of three b

ytes.

See Also BiosKbdGetElmt, DosKbdGetElmt, DosKbdRead

Example See program example

Source bkbdread.asm

----------------------------------------------------------------------
BiosKbdStat[PC][AT][PS/2]
----------------------------------------------------------------------

Description Get the keyboard status byte

Summary INT2 BiosKbdStat( VOID );

Returns BiosKbdStat returns the keyboard status byte as
follows:


Bits
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |

Bit Key Pressed
0 Right Shift
1 Left Shift
2 Control
3 Alternate
4 Scroll Lock
5 Num Lock
6 Caps Lock
7 Insert

A one in the bit position means the condition is true
and a zero in the bit position means the condition is
false.

Example See program example

Source bkbdstat.asm

----------------------------------------------------------------------
bkeGetKbdFlags[AT][PS/2]
----------------------------------------------------------------------

Description Return the status of the enhanced keyboard shift and
toggle keys.

Summary UINT2 bkeGetKbdFlags( VOID );

Returns bkeGetKbdFlags returns a word to describe the state of
the various shift and toggle keys on the enhanced
keyboard.


Bits
|F|E|D|C|B|A|9|8|7|6|5|4|3|2|1|0|

Bit Status of key
0 right shift key down
1 left shift key down
2 left or right control key down
3 left or right alternate key down
4 scroll lock on
5 num lock on
6 caps lock on
7 insert on
8 left ctrl key down
9 left alt key down
A right control key down
B right alt key down
C scroll key down
D num lock key down
E caps lock key down
F sysreq key down

A one in the bit position means the condition is true
and a zero in the bit position means the condition is
false.

Example See program example

Source b161200d.asm

----------------------------------------------------------------------
bkeGetKbdStatus[AT][PS/2]
----------------------------------------------------------------------

Description This function returns a character and scan code from
the keyboard buffer if one is waiting or returns a -1
if the key board buffer is empty.

Summary UINT2 bkeGetKbdStatus( VOID );

Returns -1 if no character is waiting in the keyboard buffer.

hi byte - scan code if a character is waiting to be read
lo byte - ASCII character if a character is waiting to
be read

Remarks The ASCII character and scan code returned by this
function is not removed from the keyboard buffer. A
call to bkeReadCh will be required to remove the ASCII
character and scan code from the keyboard buffer.

This function is for use with the enhance keyboard to
allow testing for the additional F11, F12, and cursor
control keys.

Example See program example

Source b161100d.asm

----------------------------------------------------------------------
bkeReadCh[AT][PS/2]
----------------------------------------------------------------------

Description Read character and scan code from keyboard buffer.

Summary UINT2 bkeGetKbdFlags( VOID );

Returns hi byte - scan code
lo byte - ascii character

Remarks This function is for use with the enhanced keyboard so
the scan codes can be obtained for the additional F11,
F12, and cursor control keys.

Example See program example

Source b161000d.asm

----------------------------------------------------------------------
bkGetKbdFlags[PC][AT][PS/2]
----------------------------------------------------------------------

Description Returns the flags byte that describes the state of the
key board toggle and shift keys.

Summary UINT2 bkGetKbdFlags( VOID );

Returns bkGetKbdFlags returns a byte to describe the state of
the various shift and toggle keys on the keyboard.


Bits
|7|6|5|4|3|2|1|0|

Bit Status of key
0 right shift key down
1 left shift key down
2 left or right control key down
3 left or right alternate key down
4 scroll lock on
5 num lock on
6 caps lock on
7 insert on

A one in the bit position means the condition is true
and a zero in the bit position means the condition is
false.

Example See program example

Source b160200d.asm

----------------------------------------------------------------------
bkGetKbdStatus[PC][AT][PS/2]
----------------------------------------------------------------------

Description This function returns a character and scan code from
the keyboard buffer if one is waiting or returns a -1
if the key board buffer is empty.

Summary UINT2 bkGetKbdStatus( VOID );

Returns -1 if no character is waiting in the keyboard buffer.

hi byte - scan code if a character is waiting to be read
lo byte - ascii character if a character is waiting to
be read

Remarks The ascii character and scan code returned by this
function is not removed from the keyboard buffer. A
call to bkeReadCh will be required to remove the ascii
character and scan code from the keyboard buffer.

Example See program example

Source b160100d.asm

----------------------------------------------------------------------
bkPushKeyCodes[AT][PS/2]
----------------------------------------------------------------------

Description Put a keyboard scan code and ascii character in the key
board buffer.

Summary UINT2 bkPushKeyCodes( scancode, ascii );
INT2 scancode keyboard scan code to place
in keyboard buffer.
INT2 ascii ascii character value to
place in keyboard buffer.

Returns 0 - operation successful

1 - operation unsuccessful
Example See program example

Source b160500d.asm

----------------------------------------------------------------------
bkReadCh[PC][AT][PS/2]
----------------------------------------------------------------------

Description Read character and scan code from keyboard buffer.

Summary UINT2 bkGetKbdFlags( VOID );

Returns hi byte - scan code
lo byte - ascii character

Example See program example

Source b160000d.asm

----------------------------------------------------------------------
bkSetRepeatRate[AT][PS/2]
----------------------------------------------------------------------

Description Sets the ROM BIOS keyboard typing rate.

Summary VOID bkSetRepeatRate( Delay, Repeat );
INT2 Delay A value 0-3 that sets the
amount of delay before the
first repeat key is
generated. See table A
below.
INT2 Repeat A value in the range 0-31
that specifies the repeat
rate in characters per
second. See table B below.

Remarks Table A
-------------------
Value Delay(msec)
0 250
1 500
2 750
3 1000

Table B
--------------------------
Value Repeate rate (cps)
00 30.0
01 26.7
02 24.0
03 21.8
04 20.0
05 18.5
06 17.1
07 16.0
08 15.0
09 13.3
10 12.0
11 10.9
12 10.0
13 9.2
14 8.6
15 8.0
16 7.5
17 6.7
18 6.0
19 5.5
20 5.0
21 4.6
22 4.3
23 4.0
24 3.7
25 3.3
26 3.0
27 2.7
28 2.5
29 2.3
30 2.1
31 2.0

Example See program example

Source b160305d.asm

----------------------------------------------------------------------
DosKbdClr[2.0+]
----------------------------------------------------------------------

Description Clear the keyboard buffer.

Summary VOID DosKbdClr( VOID );

Remarks DosKbdClr uses DOS to clear any characters in the key
board buffer waiting to be read.

See Also BiosKbdClr

Example See program example

Source dkbdclr.asm

----------------------------------------------------------------------
DosKbdGetElmt[2.0+]
----------------------------------------------------------------------

Description Returns an integer value for the key pressed on the key
board.

Summary INT2 DosKbdGetElmt( VOID );

Returns DosKbdGetElmt will return an integer in the range of
0-388. Use Appendix C to find the keyboard element
code this function returns for a particular key pressed
on the key board. Key combinations using the control
key with an alpha character and all other ascii
characters will be offset by 132.

See Also BiosKbdGetElmt, BiosKbdRead, DosKbdRead

Example See program example

Source dkbdelmt.asm

----------------------------------------------------------------------
DosKbdHit[2.0+]
----------------------------------------------------------------------

Description Reports if a keystroke is waiting to be read from the
key board buffer.

Summary INT2 DosKbdHit( VOID );

Returns 0 or FALSE if a key is not in the keyboard buffer.
1 or TRUE if a key is waiting to be read from the
keyboard buffer.

Remarks DosKbdHit checks the keyboard status to determine if a
key is waiting to be read from the keyboard buffer.

See Also BiosKbdHit

Example See program example

Source dkbdhit.asm

----------------------------------------------------------------------
DosKbdRead[2.0+]
----------------------------------------------------------------------

Description Read a character from the keyboard.

Summary VOID DosKbdRead( Ch );
CHAR *Ch returns a string of length
zero, one, or two bytes long
defining the key or key
combination pressed from the
keyboard.

Remarks DosKbdRead reads a single character from the keyboard
buffer. DosKbdRead will return a zero, one, or two
character string. A null string indicates Ctrl- Break
was pressed. A one character string indicates an ascii
character and a two-charac

ter string indicates a special extended keyboard code.
Refer to appendix B for a list of the extended key
board codes. The data type definition for DosKbdRead
is an untyped variable using a minimum of three bytes.

See Also BiosKbdGetElmt, BiosKbdRead, DosKbdGetElmt

Example See program example

Source dkbdread.asm

----------------------------------------------------------------------
GetKey[2.0+]
----------------------------------------------------------------------

Description Returns a keystroke and maps it into a keyboard element

number for EditSt.
Summary INT2 GetKey( VOID );

Remarks This function may call other functions and procedures.
The only restriction is that it must return an integer
value that is in the table found in Appendix C if the
function EditSt is used. If EditSt is not used the
only restriction is that

an integer must be returned.

Example See program example 6,7

Source fpgetkey.asm


Chapter 7
DOS

+--------------------------------+
| |
| This section supports gen |
| eral DOS function calls. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

----------------------------------------------------------------------
dChDir[2.0+]
----------------------------------------------------------------------

Description Change to specified directory

Summary INT dChDir( Path );
CHAR *Path path to change to

Returns 0 - function successfully changed path

Example See program example

Source d213B00d.asm

----------------------------------------------------------------------
dCloseFile[2.0+]
----------------------------------------------------------------------

Description Closes any file that was previously opened or created
with a call to dCreateFile or dOpenFile.

Summary INT dCloseFile( Handle );
INT2 Handle handle of the file to close

Returns 0 if the function successfully closed file otherwise
the error code is returned.

Example See program example

Source d213E00d.asm

----------------------------------------------------------------------
dCreateFile[2.0+]
----------------------------------------------------------------------

Description Creates a new file in the specified or default
directory on the specified or default drive. If the
file already exists then the file is truncated to
length zero.

Summary INT dCreateFile( Path, Attr, Handle );
CHAR *Path path and filename of file to
cre ate
INT2 Attr attribute to create file
with
INT2 *Handle returns the handle of the
file created

Returns 0 is returned if function successfully created the file
other wise the error code is returned.

Example See program example

Source d213C00d.asm

----------------------------------------------------------------------
dCreateNewPsp[1.1+]
----------------------------------------------------------------------

Description Copies current programs psp to a specified segment
address in free memory before updating the psp to make
it usable by another program.

Summary VOID dCreateNewPsp( Segment );
UINT2 Segment Segment of the new psp

Example See program example

Source d212600d.asm

----------------------------------------------------------------------
dDelFile[2.0+]
----------------------------------------------------------------------

Description Delete specified file from the disk.

Summary INT dDelFile( FileSpec );
CHAR *FileSpec ASCIIZ string containing the
drive path and filename of
the file to be deleted.

Returns 0 - file deleted ok
1 - error trying to delete file

Example See program example

Source d214100d.asm

----------------------------------------------------------------------
dDiskReset[1.1+]
----------------------------------------------------------------------

Description Flush all file buffers. All data in the MS-DOS buffers
are physically written to the disk. The disk directory
is NOT updated.

Summary VOID dDiskReset( VOID );

Example See program example

Source d210D00d.asm

----------------------------------------------------------------------
dGetBreakStatus[2.0+]
----------------------------------------------------------------------

Description Get the status of the systems break flag that
influences ctrl-c checking.

Summary INT dGetBreakStatus( VOID );

Returns 0 - Break flag is OFF
1 - Break flag is ON

Example See program example

Source d213300d.asm

----------------------------------------------------------------------
dGetBusyFlag[2.0+]
----------------------------------------------------------------------

Description Get the address of the MS-DOS busy flag


Summary VOID dGetBusyFlag( dSeg, dOfs );
UINT2 *dSeg returns segment of dos busy
flag var
UINT2 *dOfs returns offset of dos busy
flag var

Remarks This dos function is not documented and does work a
little differently between the different flavors of
dos.

Example See program example

Source d213400u.asm

----------------------------------------------------------------------
dGetCurrentDisk[1.1+]
----------------------------------------------------------------------

Description Get the number of the default disk drive.

Summary INT2 dGetCurrentDisk( VOID );

Returns An integer representing the drive code of the default
disk drive where 0=A, 1=B, etc.

Example See program example

Source d211900d.asm

----------------------------------------------------------------------
dGetDate[1.1+]
----------------------------------------------------------------------

Description Use Dos to retrieve the system date

Summary VOID dGetDate( Month, Day, Year, DayOfWk );
INT2 *Month returns the month of the
year
INT2 *Day returns the day of the month
INT2 *Year returns the year (1980 thru
2099)
INT2 *DayOfWk returns the day of the week
( 0-6 ) where 0=Sunday,
1=Monday,..., 6=Saturday.

Example See program example

Source d212A00d.asm

----------------------------------------------------------------------
dGetDriveData[2.0+]
----------------------------------------------------------------------

Description Retrieve information about the default disk drive

Summary INT dGetDriveData( Drive, Sectors, MediaSeg,
MediaOfs, SectorSize, Clusters );
INT2 Drive drive code of the drive to
get the data on. (0=default,
1=A, 2=B, etc.)
UINT2 *Sectors Number of sectors per
cluster
UINT2 *MediaSeg Segment of the media id byte
UINT2 *MediaOfs Offset of the media id byte
UINT2 *SectorSize Number of bytes per sector
UINT2 *Clusters Number of clusters on the
drive

Returns 0 - unsuccessful (invalid drive, etc)
1 - successful

Example See program example

Source d211C00d.asm

----------------------------------------------------------------------
dGetDrvAllocInfo[2.0]
----------------------------------------------------------------------

Description Get information about a specified disk drive.

Summary INT dGetDrvAllocInfo( Drive, Sectors, AvailClusters,
BytesInSec, TotalClusters );
UINT Drive disk drive code (0=default,
1=A, etc)
UINT *Sectors number of sectors in a
cluster
UINT *AvailClusters number of available clusters
UINT *BytesInSec number of bytes in a sector
UINT *TotalClusters number of clusters in drive

Returns 0 - function unable to obtain information for drive
1 - function successfully obtained information

Example See program example

Source d213600d.asm

----------------------------------------------------------------------
dGetDta[2.0+]
----------------------------------------------------------------------

Description Gets the current address of the disk transfer area
being used for file related functions.

Summary VOID dGetDta( Segment, Offset );
UINT2 *Segment Segment of the DTA
UINT2 *Offset Offset of the DTA

Example See program example

Source d212F00d.asm

----------------------------------------------------------------------
dGetFileAttr[2.0+]
----------------------------------------------------------------------

Description Gets the attribute for the specified file.

Summary INT dGetFileAttr( FileSpec, Attr );
CHAR *FileSpec handle of file to set file
pointer
INT2 *Attr relative position to set
location of pointer from

Returns 0 - file attribute obtained ok
1 - error trying to obtain files attribute

Example See program example

Source d214300d.asm

----------------------------------------------------------------------
dGetIntVec[2.0+]
----------------------------------------------------------------------

Description Get the address of the specified Interrupt

Summary VOID dGetIntVec( dInt, dSeg, dOfs );
UINT2 dInt interrupt vector to retrieve
UINT2 *dSeg returns the segment of the
interrupt specified
UINT2 *dOfs returns the offset of the
interrupt specified

Example See program example

Source d2135xxd.asm

----------------------------------------------------------------------
dGetTime[1.1+]
----------------------------------------------------------------------

Description Use Dos to retrieve the system time

Summary VOID dGetTime( Hour, Minute, Seconds, Hundredths );
INT2 *Hour hour (0-23)
INT2 *Minute minutes (0-59)
INT2 *Seconds seconds (0-59)
INT2 *Hundredths hundredths of a second
(0-99)

Example See program example

Source dd212C00d.asm

----------------------------------------------------------------------
dGetVersion[2.0+]
----------------------------------------------------------------------

Description Get the version number of the MS-DOS operating system.

Summary VOID dGetVersion( Major, Minor );
INT2 *Major Major version number
INT2 *Minor Minor version number

Example See program example

Source d213000d.asm

----------------------------------------------------------------------
dMkDir[2.0+]
----------------------------------------------------------------------

Description Create directory using specified path

Summary INT2 dMkDir( Path );
CHAR *Path ascii string of path to
create

Example See program example

Source d213900d.asm

----------------------------------------------------------------------
dOpenFile[2.0+]
----------------------------------------------------------------------

Description Opens any existing file in the specified or default
directory on the specified or default drive.

Summary INT dOpenFile( Path, Mode, Handle );
CHAR *Path name of file to create
INT2 Mode access mode of file
INT2 *Handle returns handle of file
created

Returns 0 - function successfully changed path

Remarks Value Access
0 read
1 write
2 read/write

Example See program example

Source d213D00d.asm

----------------------------------------------------------------------
dReadFile[2.0+]
----------------------------------------------------------------------

Description Read specified number of bytes from file into data
buffer

Summary INT dReadFile( Handle, NBytes, Buffer, BytesRead );
INT Handle valid file handle of file to
read from
UINT2 NBytes number of bytes to read
VOID *Buffer data area to place data read
from file
UINT2 *BytesRead number of actual bytes read

Returns 0 - file read performed ok
1 - error trying to read file

Example See program example

Source d213F00d.asm

----------------------------------------------------------------------
dRmDir[2.0+]
----------------------------------------------------------------------

Description Remove specified directory

Summary INT dRmDir( Path );
CHAR *Path path to remove

Returns 0 - function successfully created path
n - error code

Example See program example

Source d213A00d.asm

----------------------------------------------------------------------
dSelectDisk[1.1+]
----------------------------------------------------------------------

Description Sets the specified drive to the default drive and
returns the number of logical drives in the system.

Summary INT2 dSelectDisk( Drive );
INT2 Drive drive number (0=A, 1=B, etc)

Returns The number of logical drives.

Example See program example

Source d210E00d.asm

----------------------------------------------------------------------
dSetBreakFlag[2.0+]
----------------------------------------------------------------------

Description Sets the break flag to ON or OFF

Summary VOID dSetBreakFlag( flag );
INT flag 0 - to set break flag OFF
1 - to set break flag ON

Example See program example

Source d213301d.asm

----------------------------------------------------------------------
dSetDate[1.1+]
----------------------------------------------------------------------

Description Use Dos to set the system to a specified date

Summary INT dSetDate( Month, Day, Year );
INT Month month of year (1-12)
INT Day day of month (1-31)
INT Year year 1980-2099

Returns 0 - invalid date
1 - date set successfully
Example See program example

Source d213301d.asm

----------------------------------------------------------------------
dSetDta[1.1+]
----------------------------------------------------------------------

Description Sets the address of the disk transfer area to be used
for file related functions.

Summary VOID dSetDta( Segment, Offset );
UINT2 Segment Segment of the new DTA
UINT2 Offset Offset of the new DTA

Example See program example

Source d211A00d.asm

----------------------------------------------------------------------
dSetFileAttr[2.0+]
----------------------------------------------------------------------

Description Sets file position relative to beginning of file,
current file position, or end of file.

Summary INT dGetFileAttr( FileSpec, Attr );
CHAR *FileSpec handle of file to set file
pointer
INT2 *Attr relative position to set
location of pointer from

Returns 0 - file attribute obtained ok
1 - error trying to obtain files attribute

Example See program example

Source d214301d.asm

----------------------------------------------------------------------
dSetFilePos[2.0+]
----------------------------------------------------------------------

Description Sets file position relative to beginning of file,
current file position, or end of file.

Summary INT dSetFilePos( Handle, Method, Ofs );
INT2 Handle handle of file to set file
pointer
INT Method relative starting position
to set location of pointer
INT4 *Ofs number of bytes to move
pointer. returns the
absolute file position from
the beginning of the file.

Returns 0 - file pointer moved ok
1 - error trying to move file pointer

Remarks Method Description
0 beginning of file
1 current location of file pointer
2 EOF location

Example See program example

Source d214200d.asm

----------------------------------------------------------------------
dSetInt[1.1+]
----------------------------------------------------------------------

Description Initialize the systems interrupt vector to point to a
user defined interrupt handling routine.

Summary VOID dSetInt( Intr, Segment, Offset );
UINT2 Intr Interrupt number
UINT2 Segment Segment of the new interrupt
routine
UINT2 Offset Offset of the new interrupt
rou tine

Example See program example

Source d2125xxd.asm

----------------------------------------------------------------------
dSetTime[1.1+]
----------------------------------------------------------------------

Description Use Dos to set the system clock to a specified time

Summary VOID dSetTime( Hour, Minute, Seconds, Hundredths );
INT2 Hour hour (0-23)
INT2 Minute minute (0-59)
INT2 Seconds seconds (0-59)
INT2 Hundredths hundredths of a second
(0-99)
Return 0 - invalid time
1 - time set successfully

Example See program example

Source d212D00d.asm

----------------------------------------------------------------------
dSetVerityFlag[1.1+]
----------------------------------------------------------------------

Description Turns the automatic read-after-write verification ON or
OFF.

Summary VOID dSetVerifyFlag( VerifyOpt );
INT2 VerifyOpt 0 - Turn OFF verify flag
1 - Turn ON verify flag

Example See program example

Source d212E00d.asm

----------------------------------------------------------------------
dWriteFile[2.0+]
----------------------------------------------------------------------

Description Write specified number of bytes to file from data
buffer

Summary INT dWriteFile( Handle, NBytes, Buffer, BytesWritten );
INT Handle valid file handle of file to
write to
UINT NBytes number of bytes to write
VOID *Buffer data area containing data to
write
UINT *BytesWritten number of actual bytes
written
Return 0 - file write operation
performed ok
1 - error trying to write file

Example See program example

Source d214000d.asm



Chapter 8
DOS I/O

+--------------------------------+
| |
| This section supports DOS |
| file functions, including |
| func tions to handle critical |
| errors. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+


Global Structures
typedef TFindRec
{
UINT2Attr;
UINT2Time;
UINT2Date;
UINT4Size;
UCHARName[13];
} TFindRec;


INT2 DosErrNo the error code for function result errors.

INT2 CErrCode the error code for critical errors.

INT2 CErrType contains the type of device for the critical error.
0 = Block device
1 = Character device

INT2 CErrDrive contains the number of the disk drive where the
critical error occurred. If the critical error is
not a disk drive the value will then remain as -1.

CHAR CErrDevice[9] contains the name of the device in error.

----------------------------------------------------------------------
CloseFile
----------------------------------------------------------------------

Description Closes a file and flushes all file buffers for a file.

Summary VOID CloseFile( Handle );
INT2 Handle the handle number of a file
that was opened using the
OpenFile operation.

Remarks If an error occurred DosErrNo will contain one of the
follow ing error codes.

DosErrNo Description
6 Invalid file handle

Example See program example

Source closefil.asm

----------------------------------------------------------------------
CreateFile
----------------------------------------------------------------------

Description Opens an existing file or creates a new file if it does
not exist.

Summary VOID CreateFile( Path, Attr, Handle );
CHAR *Path filename of file to be
opened or created.
INT2 Attr mode to set the file's
attribute to.
INT2 *Handle returns an integer that this
file is associated with for
access.

Remarks This operation will open a new or existing file for
read/write access. CreateFile assumes that the file is
opened as an output file and will set the length of any
existing file to zero. If any errors occur DosErrNo
will have the error code.

DosErrNo Description
3 Path not found
4 No handle available
5 Access denied
6 Invalid file handle

Example See program example

Source creatfil.asm

----------------------------------------------------------------------
DosFindFirst
----------------------------------------------------------------------

Description Find the first file that matches the given filespec and
attributes.

Summary VOID DosFindFirst( Path, Attr, FindRec );
CHAR *Path path and filename of file to
search for.
INT2 Attr attributes of files to
include in search
TFindRec FindRec result of search is returned
in a variable of TFindRec.
(See Global Structures page
8-1).

Remarks This operation will search for the specified file. The
charac ters * and ? may be used for the filespec. If
any errors occur the error code will be set in
DosErrNo.

DosErrNo Description
2 Directory not found
3 Path not found
18 No more files

The search attribute values may be one or any
combination of values. (e.g. to search for a hidden
system file use value 6).

Bit(s) Value Description
0 1 read-only
1 2 hidden
2 4 system
3 8 volume label
4 16 directory
5 32 archive
6-15 reserved

See Also DosFindNext

Example See program example

Source findf.asm

----------------------------------------------------------------------
DosFindNext
----------------------------------------------------------------------

Description Returns the next file entry that matches the filespec
and attributes used in a previous call to DosFindFirst.

Summary VOID DosFindNext( FindRec );
TFindRec FindRec the result of the search is
returned in the variable of
TFindRec. (See Global Struc
tures page 8-1).

Remarks DosFindNext must be called after DosFindFirst and
before any other calls that transfer data into the DTA
at the time of the call to DosFindFirst.

DosErrNo Description
18 No more files

See Also DosFindFirst

Example See program example

Source findn.asm

----------------------------------------------------------------------
FSeek
----------------------------------------------------------------------

Description Change the logical read/write position of the file
pointer.

Summary UINT4 FSeek( Handle, Origin, Offset );
INT Handle file handle that was
assigned to a file using
either the OpenFile or
CreateFile operation.
INT Origin gives the starting location
to use when moving the file
pointer.

Method Description
0 beginning of file
1 current location of file ptr
2 EOF location
INT4 Offset gives the number of bytes to
move the file pointer.

Remarks This operation will move the file pointer for the
specified number of bytes given. On return this
function reports the number of bytes the file pointer
is from the beginning of the file. If any errors occur
DosErrNo will have the error code.

DosErrNo Description
1 Invalid method code
6 Invalid file handle

Example See program example

Source fseek.asm

----------------------------------------------------------------------
GetDir
----------------------------------------------------------------------

Description Returns an asciiz string that describes the current
path from the root of the specified drive.

Summary VOID GetDir( Drive, Path );
INT2 Drive Number of the drive to get
the current path, where
drive code is 0=default,
1=A, 2=B, etc.
CHAR *Path Path is the buffer area that
will contain the asciiz
string of the current
directory.

Example See program example

Source getdir.asm

----------------------------------------------------------------------
GetDrive
----------------------------------------------------------------------

Description Reports the current default disk drive

Summary INT2 GetDrive( VOID );

Remarks GetDrive returns an integer to indicate which disk
drive is the current default drive where:
Drive A = 1
Drive B = 2
Drive C = 3

Example See program example

Source getdrive.asm

----------------------------------------------------------------------
GetDTA
----------------------------------------------------------------------

Description Returns the current disk transfer area

Summary VOID GetDTA( Segment, Offset );
UINT2 Segment returns segment of current
DTA.
UINT2 Offset returns offset of current
DTA.

Example See program example

Source getdta.asm

----------------------------------------------------------------------
GetFileSize
----------------------------------------------------------------------

Description Report the number of bytes in a disk file.

Summary INT4 GetFileSize( Handle );
INT Handle gives a file handle that was
assigned to a file using the
OpenFile or CreateFile opera
tion.

Remarks GetFileSize reports the number of bytes in the file
associ ated with the handle number.

Example See program example

Source gfilsize.asm

----------------------------------------------------------------------
GetNDrvs
----------------------------------------------------------------------

Description Report the number of disk drives.

Summary INT2 GetNDrvs( VOID );

Remarks GetNDrvs reports the total number of diskette and fixed
disk drives installed for the current system.

Example See program example

Source getndrvs.asm

----------------------------------------------------------------------
OpenFile
----------------------------------------------------------------------

Description Open the file given in the string passed.

Summary VOID OpenFile( Path, Attr, Handle );
CHAR *Path path and filename of file to
open.
INT2 Attr type of access allowed for
this file.

Access Description
0 Read Only
1 Write Only
2 Read/write
INT2 *Handle returns an integer that
repre sents the file handle
that is associated with the
file given in Path. The
file handle is to be used
when any operations on the
file are to take place.

Remarks If an error occurred DosErrNo will contain one of the
follow ing error codes.

DosErrNo Description
2 File not found
4 No handle available
5 access denied
12 invalid access code

See Also CreateFile

Example See program example

Source openfile.asm

----------------------------------------------------------------------
ReadFile
----------------------------------------------------------------------

Description Read a file or device for a specified number of bytes.

Summary VOID ReadFile( Handle, NBytes, Buffer, RBytes );
INT2 Handle file handle associated with
the appropriate file or
device for read operation.
INT2 NBytes number of bytes to read from
file or device.
CHAR *Buffer buffer area to place data
read.
UINT2 *RBytes returns number of bytes
actually read from the file
or device. If RBytes is
zero then an attempt was
made to read from the end of
a file.

Remarks If an error occurred DosErrNo will contain one of the
follow ing error codes.

DosErrNo Description
5 Access denied
6 Invalid handle

Example See program example

Source readfile.asm

----------------------------------------------------------------------
ResetDisk
----------------------------------------------------------------------

Description Resets the disk and flushes all file buffers.

Summary VOID ResetDisk( VOID );

Remarks This routine does not close any files. To ensure that
the length of a file is recorded properly in the file
directory you should first close the file before using
this routine.

Example See program example

Source resetdsk.asm

----------------------------------------------------------------------
ResetErrCodes
----------------------------------------------------------------------

Description Resets global variables that indicate device errors to
their initial settings.

Summary VOID ResetErrCodes( VOID );

Remarks The following variables are set as followings:

DosErrNo = 0
CErrCode = 0
CErrType = -1
CErrDrive = -1
CErrDevice = ''

See Also SetInt24

Example See program example

Source setint24.asm

----------------------------------------------------------------------
RestInt24
----------------------------------------------------------------------

Description Uninstalls or restores the programs critical interrupt
error handler.

Summary VOID RestInt24( VOID );

Remarks This procedure will uninstall the critical interrupt
error han dler that was installed with the SetInt24
procedure. This procedure uses the SegInt24 and
OfsInt24 variables to restore the interrupt handler in
use before the interrupt handler was installed.

Example See program example

Source setint24.asm

----------------------------------------------------------------------
SetDTA
----------------------------------------------------------------------

Description Set the file attribute for the file specified.

Summary VOID SetDTA( Segment, Offset );
UINT2 Segment segment address for new DTA.
UINT2 Offset offset within segment for
new DTA.

Example See program example

Source setdta.asm

----------------------------------------------------------------------
SetInt24
----------------------------------------------------------------------

Description Initializes the critical error handler routine and its
global variables for use with your system.

Summary VOID SetInt24( VOID );

Remarks Only one call needs to be made to this routine for a
program that wants to use the critical error handler
routine. In the event of a critical error, the
variables DosErrNo, CErrCode, CErrType, CErrDrive and
CErrDevice are set to the appro pr

iate values. Refer to the global variable section at
the beginning of this chapter for a description of each
variable name.

The following are the I/O error values that are set in
the CErrCode global variable. These codes
match the same codes DOS function 59h (Get Extended
Error Code) return. Note that all values are
hexadecimal.

Error
Code Description
13 Write-protect error
14 Unknown unit
15 Disk drive not ready
16 Unknown command
17 Data error (bad CRC)
18 A bad request structure length
19 Data seek error
1A Unknown media type
1B Disk sector not found
1C Printer is out of paper
1D Write fault
1E Read fault
1F General failure

See Also ResetErrCodes, RestInt24

Example See program example

Source setint24.asm

----------------------------------------------------------------------
WriteFile
----------------------------------------------------------------------

Description Write to a file or device for a specified number of
bytes.

Summary VOID WriteFile( Handle, NBytes, Buffer, WBytes );
INT2 Handle file handle associated with
a file or device for read
operation to act on.
INT2 NBytes number of bytes to write to
file or device.
CHAR *Buffer data area that contains the
data that is to be written
to the file or device.
UINT2 *WBytes returns actual number of
bytes written out to the
file or device.

Remarks DosErrNo will contain one of the following error codes
when an error occurs.

DosErrNo Description
5 Access denied
6 Invalid handle
20 insufficient disk space

Example See program example

Source writefile.asm



Chapter 9
Printer

+--------------------------------+
| |
| The functions in this section |
| use the BIOS and DOS to |
| support the printer. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

----------------------------------------------------------------------
BiosPrtChar
----------------------------------------------------------------------

Description Send a character to the printer.

Summary VOID BiosPrtChar( Ch, PrtNo );
CHAR Ch character to print.
INT2 PrtNo printer number of printer to
print to.

Remarks PrtNo 1 = LPT1:
PrtNo 2 = LPT2:
PrtNo 3 = LPT3:

Example See program example

Source bprtchar.asm

----------------------------------------------------------------------
BiosPrtInit
----------------------------------------------------------------------

Description Initialize the printer

Summary INT2 BiosPrtInit( PrtNo );
INT2 PrtNo number of printer to
initialize.

Returns This functions returns the status of the printer after
the initialization process is completed.

Example See program example

Source bprtinit.asm

----------------------------------------------------------------------
BiosPrtStatus
----------------------------------------------------------------------

Description Returns the current status of the printer.

Summary INT2 BiosPrtStat( PrtNo );
INT2 PrtNo an integer representing the
printer number to check
status on.

Returns PrtStatus will return an integer giving the status of
the printer using the following bit values.


Bit Value Description
0 1 Time-out
1 2 Not used
2 4 Not used
3 8 I/O error
4 16 Printer selected
5 32 Out-of-paper signal
6 64 Acknowledgment from printer
7 128 Printer not busy

Example See program example

Source bprtstat.asm

----------------------------------------------------------------------
DosPrtChar
----------------------------------------------------------------------

Description Send a character to the printer.

Summary VOID DosPrtChar( Ch );
CHAR Ch character to print.

See Also BiosPrtChar, BiosPrtStat

Example See program example

Source prtchar.asm



Appendix A
Keyboard Return Codes

+--------------------------------+
| |
| This appendix lists the key |
| board codes for all the key |
| combinations on the key board |
| as they are interpreted by |
| the function ReadKbd. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

The ReadKbd function will return all key information into either a
one or two character code.

To understand the table below assume St is a two character string.
St[0] is the length of the character code returned. If the length of
St is one then a normal ASCII character was pressed, otherwise an
extended code is generated. Notice that some

of the keyboard codes do produce a two character code with the first
character being null.

If the length of St is one then a normal ASCII character code was
read from the keyboard. This covers the ASCII values 32-127.

If the length of St is two then one of the keys that are usually used
for cursor control was read from the keyboard. If this is the case
then St[1] will be either a 0 or 27 depending on the key combination
read from the keyboard.

Use of the switch statement works well with this type of setup to
determine which keyboard keys were read.

switch Ch[1] {
case 0 : printf( "Control code used." ); break;
case 27 : printf( "Control code used." ); break;
default : if ( Ch[1] >= 32 && Ch[1] <= 127 )
printf( "Printable code used." );
};

Key
Pressed CH[0] CH[1] CH[2]
------- ----- ----- -----
(space) 1 32 0
! 1 33 0
" 1 34 0
# 1 35 0
$ 1 36 0
% 1 37 0
& 1 38 0
' 1 39 0
( 1 40 0
) 1 41 0
* 1 42 0
+ 1 43 0
, 1 44 0
- 1 45 0
/ 1 47 0
0 1 48 0
1 1 49 0
2 1 50 0
3 1 51 0
4 1 52 0
5 1 53 0
6 1 54 0
7 1 55 0
8 1 56 0
9 1 57 0
: 1 58 0
; 1 59 0
< 1 60 0
= 1 61 0
? 1 63 0
@ 1 64 0
A 1 65 0
B 1 66 0
C 1 67 0
D 1 68 0
E 1 69 0
F 1 70 0
G 1 71 0
H 1 72 0
I 1 73 0
J 1 74 0
K 1 75 0
L 1 76 0
M 1 77 0
N 1 78 0
O 1 79 0
P 1 80 0
Q 1 81 0
R 1 82 0
S 1 83 0
T 1 84 0
U 1 85 0
V 1 86 0
W 1 87 0
X 1 88 0
Y 1 89 0
Z 1 90 0
[ 1 91 0
\ 1 92 0
] 1 93 0
^ 1 94 0
_ 1 95 0
` 1 96 0
a 1 97 0
b 1 98 0
c 1 99 0
d 1 100 0
e 1 101 0
f 1 102 0
g 1 103 0
h 1 104 0
i 1 105 0
j 1 106 0
k 1 107 0
l 1 108 0
m 1 109 0
n 1 110 0
o 1 111 0
p 1 112 0
q 1 113 0
r 1 114 0
s 1 115 0
t 1 116 0
u 1 117 0
v 1 118 0
w 1 119 0
x 1 120 0
y 1 121 0
z 1 122 0
{ 1 123 0
| 1 124 0
} 1 125 0
~ 1 126 0
Ctrl-Break 2 27 0
Esc 2 27 1
Ctrl-2 2 27 3
BackSp 2 27 8
Tab 2 27 9
Ctrl-Enter 2 27 10
Enter 2 27 13
Ctrl-BS 2 27 14
Shft-Tab 2 27 15
Alt-Q 2 27 16
Alt-W 2 27 17
Alt-E 2 27 18
Alt-R 2 27 19
Alt-T 2 27 20
Alt-Y 2 27 21
Alt-U 2 27 22
Alt-I 2 27 23
Alt-O 2 27 24
Alt-P 2 27 25
Alt-A 2 27 30
Alt-S 2 27 31
Alt-D 2 27 32
Alt-F 2 27 33
Alt-G 2 27 34
Alt-H 2 27 35
Alt-J 2 27 36
Alt-K 2 27 37
Alt-L 2 27 38
Alt-Z 2 27 44
Alt-X 2 27 45
Alt-C 2 27 46
Alt-V 2 27 47
Alt-B 2 27 48
Alt-N 2 27 49
Alt-M 2 27 50
F1 2 27 59
F2 2 27 60
F3 2 27 61
F4 2 27 62
F5 2 27 63
F6 2 27 64
F7 2 27 65
F8 2 27 66
F9 2 27 67
F10 2 27 68
Home 2 27 71
UArr 2 27 72
PgUp 2 27 73
LArr 2 27 75
RArr 2 27 77
End 2 27 79
DArr 2 27 80
PgDn 2 27 81
Ins 2 27 82
Del 2 27 83
Shft-F1 2 27 84
Shft-F2 2 27 85
Shft-F3 2 27 86
Shft-F4 2 27 87
Shft-F5 2 27 88
Shft-F6 2 27 89
Shft-F7 2 27 90
Shft-F8 2 27 91
Shft-F9 2 27 92
Shft-F10 2 27 93
Ctrl-F1 2 27 94
Ctrl-F2 2 27 95
Ctrl-F3 2 27 96
Ctrl-F4 2 27 97
Ctrl-F5 2 27 98
Ctrl-F6 2 27 99
Ctrl-F7 2 27 100
Ctrl-F8 2 27 101
Ctrl-F9 2 27 102
Ctrl-F10 2 27 103
Alt-F1 2 27 104
Alt-F2 2 27 105
Alt-F3 2 27 106
Alt-F4 2 27 107
Alt-F5 2 27 108
Alt-F6 2 27 109
Alt-F7 2 27 110
Alt-F8 2 27 111
Alt-F9 2 27 112
Alt-F10 2 27 113
Ctrl-LArr 2 27 115
Ctrl-RArr 2 27 116
Ctrl-End 2 27 117
Ctrl-PgDn 2 27 118
Ctrl-Home 2 27 119
Alt-1 2 27 120
Alt-2 2 27 121
Alt-3 2 27 122
Alt-4 2 27 123
Alt-5 2 27 124
Alt-6 2 27 125
Alt-7 2 27 126
Alt-8 2 27 127
Alt-9 2 27 128
Alt-0 2 27 129
Alt-- 2 27 130
Alt-= 2 27 131
Ctrl-PgUp 2 27 132
Ctrl-A 2 0 1
Ctrl-B 2 0 2
Ctrl-C 2 0 3
Ctrl-D 2 0 4
Ctrl-E 2 0 5
Ctrl-F 2 0 6
Ctrl-G 2 0 7
Ctrl-H 2 0 8
Ctrl-I 2 0 9
Ctrl-J 2 0 10
Ctrl-K 2 0 11
Ctrl-L 2 0 12
Ctrl-M 2 0 13
Ctrl-N 2 0 14
Ctrl-O 2 0 15
Ctrl-P 2 0 16
Ctrl-Q 2 0 17
Ctrl-R 2 0 18
Ctrl-S 2 0 19
Ctrl-T 2 0 20
Ctrl-U 2 0 21
Ctrl-V 2 0 22
Ctrl-W 2 0 23
Ctrl-X 2 0 24
Ctrl-Y 2 0 25
Ctrl-Z 2 0 26
Ctrl-[ 2 0 27
Ctrl-\ 2 0 28
Ctrl-] 2 0 29
Ctrl-6 2 0 30
Ctrl-- 2 0 31

Appendix B
Keyboard Element Codes

+--------------------------------+
| |
| This appendix lists the ele |
| ment codes for all the key |
| combinations on the key board |
| as they are interpreted by |
| the function EditSt. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+


The EditSt function will return all key information as an integer
representing an element code.

An array of 32 bytes is required for this table.

char TSet[32];

The unit or element number in the set defines which key or key
combination was pressed. This table was created for use as the
Terminating Character Set with the procedures EditSt.

Use the value in the column ELEMENT NUMBER to determine the element
number or bit number for a terminating key.


Element
Key code AH AL Number
-------- --- --- -------
Ctrl-Break 0 0 0
Esc 1 27 1
not used 2
Ctrl-2 3 0 3
not used 4
not used 5
not used 6
not used 7
BackSp 14 8 8
Tab 15 9 9
Ctrl-Enter 28 10 10
not used 11
not used 12
Enter 28 13 13
Ctrl-BS 14 127 14
Shft-Tab 15 0 15
Alt-Q 16 0 16
Alt-W 17 0 17
Alt-E 18 0 18
Alt-R 19 0 19
Alt-T 20 0 20
Alt-Y 21 0 21
Alt-U 22 0 22
Alt-I 23 0 23
Alt-O 24 0 24
Alt-P 25 0 25
not used 26
not used 27
not used 28
not used 29
Alt-A 30 0 30
Alt-S 31 0 31
Alt-D 32 0 32
Alt-F 33 0 33
Alt-G 34 0 34
Alt-H 35 0 35
Alt-J 36 0 36
Alt-K 37 0 37
Alt-L 38 0 38
not used 39
not used 40
not used 41
not used 42
not used 43
Alt-Z 44 0 44
Alt-X 45 0 45
Alt-C 46 0 46
Alt-V 47 0 47
Alt-B 48 0 48
Alt-N 49 0 49
Alt-M 50 0 50
not used 51
not used 52
not used 53
not used 54
not used 55
not used 56
not used 57
not used 58
F1 59 0 59
F2 60 0 60
F3 61 0 61
F4 62 0 62
F5 63 0 63
F6 64 0 64
F7 65 0 65
F8 66 0 66
F9 67 0 67
F10 68 0 68
not used 69
not used 70
Home 71 0 71
UArr 72 0 72
PgUp 73 0 73
not used 74
LArr 75 0 75
not used 76
RArr 77 0 77
not used 78
End 79 0 79
DArr 80 0 80
PgDn 81 0 81
Ins 82 0 82
Del 83 0 83
Shft-F1 84 0 84
Shft-F2 85 0 85
Shft-F3 86 0 86
Shft-F4 87 0 87
Shft-F5 88 0 88
Shft-F6 89 0 89
Shft-F7 90 0 90
Shft-F8 91 0 91
Shft-F9 92 0 92
Shft-F10 93 0 93
Ctrl-F1 94 0 94
Ctrl-F2 95 0 95
Ctrl-F3 96 0 96
Ctrl-F4 97 0 97
Ctrl-F5 98 0 98
Ctrl-F6 99 0 99
Ctrl-F7 100 0 100
Ctrl-F8 101 0 101
Ctrl-F9 102 0 102
Ctrl-F10 103 0 103
Alt-F1 104 0 104
Alt-F2 105 0 105
Alt-F3 106 0 106
Alt-F4 107 0 107
Alt-F5 108 0 108
Alt-F6 109 0 109
Alt-F7 110 0 110
Alt-F8 111 0 111
Alt-F9 112 0 112
Alt-F10 113 0 113
not used 114
Ctrl-LArr 115 0 115
Ctrl-RArr 116 0 116
Ctrl-End 117 0 117
Ctrl-PgDn 118 0 118
Ctrl-Home 119 0 119
Alt-1 120 0 120
Alt-2 121 0 121
Alt-3 122 0 122
Alt-4 123 0 123
Alt-5 124 0 124
Alt-6 125 0 125
Alt-7 126 0 126
Alt-8 127 0 127
Alt-9 128 0 128
Alt-0 129 0 129
Alt-- 130 0 130
Alt-= 131 0 131
Ctrl-PgUp 132 0 132


AL+ Element
Key code 132 AL Number
-------- --- --- -------
Ctrl-A 133 1 133
Ctrl-B 134 2 134
Ctrl-C 135 3 135
Ctrl-D 136 4 136
Ctrl-E 137 5 137
Ctrl-F 138 6 138
Ctrl-G 139 7 139
Ctrl-H 140 8 140
Ctrl-I 141 9 141
Ctrl-J 142 10 142
Ctrl-K 143 11 143
Ctrl-L 144 12 144
Ctrl-M 145 13 145
Ctrl-N 146 14 146
Ctrl-O 147 15 147
Ctrl-P 148 16 148
Ctrl-Q 149 17 149
Ctrl-R 150 18 150
Ctrl-S 151 19 151
Ctrl-T 152 20 152
Ctrl-U 153 21 153
Ctrl-V 154 22 154
Ctrl-W 155 23 155
Ctrl-X 156 24 156
Ctrl-Y 157 25 157
Ctrl-Z 158 26 158
Ctrl-[ 159 27 159
Ctrl-\ 160 28 160
Ctrl-] 161 29 161
Ctrl-6 162 30 162
Ctrl-- 163 31 163
(space) 164 32 164
! 165 33 165
" 166 34 166
# 167 35 167
$ 168 36 168
% 169 37 169
& 170 38 170
' 171 39 171
( 172 40 172
) 173 41 173
* 174 42 174
+ 175 43 175
, 176 44 176
- 177 45 177
/ 179 47 179
0 180 48 180
1 181 49 181
2 182 50 182
3 183 51 183
4 184 52 184
5 185 53 185
6 186 54 186
7 187 55 187
8 188 56 188
9 189 57 189
: 190 58 190
; 191 59 191
< 192 60 192
= 193 61 193
> 194 62 194
? 195 63 195
@ 196 64 196
A 197 65 197
B 198 66 198
C 199 67 199
D 200 68 200
E 201 69 201
F 202 70 202
G 203 71 203
H 204 72 204
I 205 73 205
J 206 74 206
K 207 75 207
L 208 76 208
M 209 77 209
N 210 78 210
O 211 79 211
P 212 80 212
Q 213 81 213
R 214 82 214
S 215 83 215
T 216 84 216
U 217 85 217
V 218 86 218
' 219 87 219
X 220 88 220
Y 221 89 221
Z 222 90 222
[ 223 91 223
\ 224 92 224
] 225 93 225
_ 227 95 227
` 228 96 228
a 229 97 229
b 230 98 230
c 231 99 231
d 232 100 232
e 233 101 233
f 234 102 234
g 235 103 235
h 236 104 236
i 237 105 237
j 238 106 238
k 239 107 239
l 240 108 240
m 241 109 241
n 242 110 242
o 243 111 243
p 244 112 244
q 245 113 245
r 246 114 246
s 247 115 247
t 248 116 248
u 249 117 249
v 250 118 250
w 251 119 251
x 252 120 252
y 253 121 253
z 254 122 254
{ 255 123 255
| 256 124 256
} 257 125 257
~ 258 126 258
259 127 259

Appendix C
Keyboard Codes

+--------------------------------+
| |
| This appendix lists the key |
| board codes that are returned |
| in the AH and AL registers |
| when the BIOS is used to |
| retrieve the next keyboard |
| code stored in the system |
| keyboard buffer. |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+

This appendix lists the keyboard codes that are returned by the
computer system when a key or key combination is pressed. The column
headings AH and AL refer to the hi and lo registers within the AX
register. These are the actual values returned by
the BIOS interrupt 16H in assemlby language.

Key
Pressed AH AL
------- --- ---
(space) 57 32
! 2 33
" 40 34
# 4 35
$ 5 36
% 6 37
& 8 38
' 40 39
( 10 40
) 11 41
* 9 42
+ 13 43
, 51 44
- 12 45
/ 53 47
0 11 48
1 2 49
2 3 50
3 4 51
4 5 52
5 6 53
6 7 54
7 8 55
8 9 56
9 10 57
: 39 58
; 39 59
< 51 60
= 13 61

> 52 62
? 53 63
@ 3 64
A 30 65
B 48 66
C 46 67
D 32 68
E 18 69
F 33 70
G 34 71
H 35 72
I 23 73
J 36 74
K 37 75
L 38 76
M 50 77
N 49 78
O 24 79
P 25 80
Q 26 81
R 19 82
S 31 83
T 20 84
U 22 85
V 47 86
W 17 87
X 48 88
Y 21 89
Z 44 90
[ 26 91
\ 43 92
] 27 93
^ 7 94
_ 12 95
` 41 96
a 30 97
b 48 98
c 46 99
d 32 100
e 18 101
f 33 102
g 34 103
h 35 104
i 23 105
j 36 106
k 37 107
l 38 108
m 50 109
n 49 110
o 24 111
p 25 112
q 16 113
r 19 114
s 31 115
t 20 116
u 22 117
v 47 118
w 17 119
x 48 120
y 21 121
z 44 122
{ 26 123
| 43 124
} 27 125
~ 41 126
Ctrl-2 3 0
BackSp 14 8
Tab 15 9
Ctrl-Enter 28 10
Enter 28 13
Shft-Tab 15 0
Alt-Q 16 0
Alt-W 17 0
Alt-E 18 0
Alt-R 19 0
Alt-T 20 0
Alt-Y 21 0
Alt-U 22 0
Alt-I 23 0
Alt-O 24 0
Alt-P 25 0
Esc 1 27
Alt-A 30 0
Alt-S 31 0
Alt-D 32 0
Alt-F 33 0
Alt-G 34 0
Alt-H 35 0
Alt-J 36 0
Alt-K 37 0
Alt-L 38 0
Alt-Z 44 0
Alt-X 45 0
Alt-C 46 0
Alt-V 47 0
Alt-B 48 0
Alt-N 49 0
Alt-M 50 0
F1 59 0
F2 60 0
F3 61 0
F4 62 0
F5 63 0
F6 64 0
F7 65 0
F8 66 0
F9 67 0
F10 68 0
Home 71 0
UArr 72 0
PgUp 73 0
LArr 75 0
RArr 77 0
End 79 0
DArr 80 0
PgDn 81 0
Ins 82 0
Del 83 0
Shft-F1 84 0
Shft-F2 85 0
Shft-F3 86 0
Shft-F4 87 0
Shft-F5 88 0
Shft-F6 89 0
Shft-F7 90 0
Shft-F8 91 0
Shft-F9 92 0
Shft-F10 93 0
Ctrl-F1 94 0
Ctrl-F2 95 0
Ctrl-F3 96 0
Ctrl-F4 97 0
Ctrl-F5 98 0
Ctrl-F6 99 0
Ctrl-F7 100 0
Ctrl-F8 101 0
Ctrl-F9 102 0
Ctrl-F10 103 0
Alt-F1 104 0
Alt-F2 105 0
Alt-F3 106 0
Alt-F4 107 0
Alt-F5 108 0
Alt-F6 109 0
Alt-F7 110 0
Alt-F8 111 0
Alt-F9 112 0
Alt-F10 113 0
Ctrl-LArr 115 0
Ctrl-RArr 116 0
Ctrl-End 117 0
Ctrl-PgDn 118 0
Ctrl-Home 119 0
Alt-1 120 0
Alt-2 121 0
Alt-3 122 0
Alt-4 123 0
Alt-5 124 0
Alt-6 125 0
Alt-7 126 0
Alt-8 127 0
Alt-9 128 0
Alt-0 129 0
Alt-- 130 0
Alt-= 131 0
Ctrl-PgUp 132 0
Ctrl-A 30 1
Ctrl-B 48 2
Ctrl-C 46 3
Ctrl-D 32 4
Ctrl-E 18 5
Ctrl-F 33 6
Ctrl-G 34 7
Ctrl-H 35 8
Ctrl-I 23 9
Ctrl-J 36 10
Ctrl-K 37 11
Ctrl-L 38 12
Ctrl-M 50 13
Ctrl-N 49 14
Ctrl-O 24 15
Ctrl-P 25 16
Ctrl-Q 16 17
Ctrl-R 19 18
Ctrl-S 31 19
Ctrl-T 20 20
Ctrl-U 22 21
Ctrl-V 47 22
Ctrl-W 17 23
Ctrl-X 45 24
Ctrl-Y 21 25
Ctrl-Z 44 26
Ctrl-[ 26 27
Ctrl-\ 43 28
Ctrl-] 27 29
Ctrl-6 7 30
Ctrl-- 12 31
Ctrl-BS 14 127
Ctrl-Break 0 0

Appendix D
Keyboard Scan Codes

+--------------------------------+
| |
| |
| Thank-you for supporting the |
| FlashPac Library |
| |
+--------------------------------+



FUNCTION KEYS NUMERIC KEYPAD

Key Scan Code Key Scan Code
---- --------- ---- ---------
F1 59 7 71
F2 60 8 72
F3 61 9 73
F4 62 - 74
F5 63 4 75
F6 64 5 76
F7 65 6 77
F8 66 + 78
F9 67 1 79
F10 68 2 80
3 81
0 82
. 83


CONTROL KEYS

Key Scan Code
------ ---------
Esc 1
Ctrl 29
Backspace 14
Left Shft 42
Num Lock 69
Right Shft 54
Scroll Lock 70
Alt 56
Tab 15
Caps Lock 58
Enter 28


LETTER, NUMBER, AND PUNCTUATION KEYS

Key Scan Code
---- ---------
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
0 11
- 12
= 13
Q 16
W 17
E 18
R 19
T 20
Y 21
U 22
I 23
O 24
P 25
[ 26
] 27
A 30
S 31
D 32
F 33
G 34
H 35
J 36
K 37
L 38
; 39
' 40
` 41
\ 43
Z 44
X 45
C 46
V 47
B 48
N 49
M 50
, 51
. 52
/ 53
(PrtSc) 55
There is a manual on the disk. To print it out, go to the directory
where you installed the FlashPac Library, and type:

copy manual.doc prn


-----------------------------------------------------------------------
INSTALLATION
-----------------------------------------------------------------------

pkunzip -d -o fpclib36 [d:][\path]

Path is the destination subdirectory to place the FlashPac Library
files in.


Copy the fpclib.h and fpclib.lib files to the compilers include and
lib subdirectories.

Example:

copy fpclib.h [d:]\msc\include
copy fpclib.lib [d:]\msc\lib

or

copy fpclib.h [d:]\borlandc\include
copy fpclib.lib [d:]\borlandc\lib

-----------------------------------------------------------------------
NAME, ADDRESS AND TELEPHONE NUMBER
-----------------------------------------------------------------------

Kevin Dahl
SimpleSoft
1209 Poplar St
La Crescent, MN 55947
(507) 895-8237

-----------------------------------------------------------------------
HOW TO REGISTER
-----------------------------------------------------------------------

1. Fill out the registration form found in the file REGISTER.DOC.

2. Check off the desired registration level.

Option Cost Registration Benefit
------ ------ ----------------------------------------------------
1 $0.00 - Free technical support.
- Placed on mailing list for upgrade notices.

2 $2.50 - Free technical support.
- Placed on mailing list for upgrade notices.
- Latest distribution diskette.

3 $30.00 - Free technical support.
- Placed on mailing list for upgrade notices.
- Latest distribution diskette.
- Source code.

4 $50.00 - Free technical support.
- Placed on mailing list for upgrade notices.
- Latest distribution diskette.
- Source code.
- Printed manual.


3. Mail in the registration form (with your check or money order if
you have chosen option 2, 3 or 4).


4. To contact SimpleSoft for information about dealer pricing volume
discounts, site licensing, the status of shipment of the product,
or the latest version number, call:

SimpleSoft
(507) 895-8237
Between 5:30pm and 9:00pm CST, weekdays.


-----------------------------------------------------------------------
TECHNICAL SUPPORT
-----------------------------------------------------------------------

Call:
SimpleSoft
(507) 895-8237
Between 5:30pm and 9:00pm CST, weekdays.

You may call for technical support between the hours of
7:30am to 9:30pm CST. During the hours 8:00am to 5:30pm you
will either get my wife or an answering machine. If you call
and leave a message I will return your call as soon as I can.
Generally, the best hours to call are from 5:30pm to 9:30pm
weekdays. Weekends are a tossup.

P.S. If you call during the day you may get my wife, please
be patient with her. She doesn't know anything about computers
or programming and will not be able to answer your technical
questions. (But she is a nice person and can talk about most
other things).

or write:
Kevin Dahl
SimpleSoft
1209 Poplar St
La Crescent, MN 55947


or CIS Mail:
CompuServe ID number: 70253,1270


Hopefully, the library is easy to use and tech support will rarely
be needed, but you can still call to express your needs and desires.


 December 7, 2017  Add comments

Leave a Reply