home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 8 Other
/
08-Other.zip
/
MNO100.ZIP
/
MNOCALLS.DOC
< prev
next >
Wrap
Text File
|
1991-05-27
|
99KB
|
3,307 lines
MNOCALLS, MNODRVR, MNOCONSL, MF
Version 1.00 Copyright (c) 1991,
by Stephen L. Reed, all rights reserved.
Thank you for choosing to evaluate these shareware products.
If you are an individual using them or incorporating the
MNOCALLS DLL into your own applications, you are expected to
become a registered user. Registration fee is $US 25.00.
Please make your check or Postal Money Order payable to:
Stephen Reed Software
3034 Segovia St.
Coral Gables FL
33134 USA
Registered users will be notified of all subsequent releases,
and will be free to use the next version upgrade when it
becomes available.
For use by corporations and other institutions, please contact
Steve Reed for a licensing arrangement. Source code is
available. MNOCALLS is a professional quality toolkit which
can add dual monitor abilities to any commercial product.
You are encouraged to share this evaluation version, which has
complete functions and documentation, with anyone else,
provided that it is unmodified, whole and complete, and that it
is not combined with any other software.
As is the case with most shareware, you may not charge more
than a small "disk fee" if you operate a software distribution
business.
The author will distribute this release and subsequent
versions through the growing network of OS/2 bulletin boards
worldwide.
Please leave comments for Steve Reed on Peter Norloff's
superb OS/2 Shareware BBS:
703-385-0931 (2400 Courier)
703-385-4325 (HST DS)
- 1 -
MNODRVR.SYS MNOCALLS.DLL
-------------------------
This is a device driver and dynamic link library
to assist OS/2 developers who use dual monitors on non-
Micro Channel PC's. (MDA adaptors are not yet available
for MC PS/2's.)
You can use standard VIO functions to access the EGA\VGA
monitor and use the included MNO functions to access the
MDA monitor.
Twenty of the VIO library functions have been duplicated using
a Mno prefix. They provide a convenient and consistent ability
to display character mode output on the monochrome monitor
(MDA) while at the same time, the primary VGA/EGA monitor is
used by the application and Presentation Manager.
Both writing to, and reading from the screen is supported.
All applications can access the MDA regardless of whether they
are foreground, background or detached processes.
- 2 -
CONTENTS
--------
Registration .......................... 1
MNOCALLS Description .................. 2
Features .............................. 4
Requirements .......................... 4
Test Suite ............................ 4
MNOCONSL Description .................. 5
VIO Documentation Sources ............. 5
Simple Setup .......................... 6
Organized Setup ....................... 8
How To Use DLL's In Your Programs..... 10
MnoGetCurPos ......................... 11
MnoSetCurPos ......................... 12
MnoGetCurType ........................ 14
MnoSetCurType ........................ 16
MnoGetPhysBuf ........................ 18
MnoGetAnsi ........................... 20
MnoSetAnsi ........................... 21
MnoReadCharStr ....................... 22
MnoReadCellStr ....................... 24
MnoScrollDn .......................... 26
MnoScrollUp .......................... 28
MnoScrollLf .......................... 30
MnoScrollRt .......................... 32
MnoWrtCharStr ........................ 34
MnoWrtCellStr ........................ 36
MnoWrtNAttr .......................... 38
Attribute Byte ....................... 40
MnoWrtNChar .......................... 41
MnoWrtNCell .......................... 43
MnoWrtCharStrAtt ..................... 45
MnoWrtTTY ............................ 47
ANSI Escape Sequences ................ 48
Using MNOCONSL ....................... 53
Using MF ............................. 54
Detached Compilation ................. 55
MNOEXAMP, an example with CodeView ... 56
How to Set Up Dual Monitors .......... 57
Troubleshooting ...................... 58
Index ................................ 59
- 3 -
FEATURES
--------
Two monitors simultaneously active, but controlled
independently.
Parameters and return codes are identical to familiar Vio.
MnoWrtTTY completely supports ANSI escape sequences.
Complete control over cursor position, visibility and shape.
Small binaries: 2K MNODRVR device driver, 11K MNOCALLS DLL.
REQUIREMENTS
------------
OS/2 version 1.2 or later.
Microsoft C version 5.1 or later.
Dual monitor configuration, such as VGA and MDA, or EGA and
MDA. See the appendix for more information on how to set up a
dual monitor system if you do not already have one.
TEST SUITE
----------
MNOTEST.EXE is a test suite which executes each MNO function
and compares the equivalent VIO function on your dual monitor
system. Complete source code is included.
- 4 -
SAMPLE APPLICATION
------------------
MNOCONSL.EXE is a sample application which uses Mno functions
to provide an operating system display console on the MDA.
You can see...
A list of process names that is periodically updated to
show which tasks are currently executing.
A count of total threads and those ready to execute.
Percent CPU utilization.
Amount of free memory available.
Digital clock.
Background message window. MF.EXE is a filter provided
to pipe stdout from any background process to this
window, such as compilation error messages from a
batch file.
Source code is included for MF.EXE (MNOFILT.C).
Source code is available for MNOCONSL.EXE, MNOCALLS.DLL,
and the MNODRVR.SYS device driver. See the preceding
registration section.
ADDITIONAL HELPFUL VIO DOCUMENTATION
------------------------------------
Microsoft OS/2 Programmer's Reference Volumes 3 & 4.
Or the similar IBM OS/2 Programming Tools and Information.
- 5 -
SETUP - Choose either Simple Setup or Organized Setup.
Simple Setup uses only one subdirectory while the
Organized Setup puts puts files into separate
subdirectories.
Try the Simple Setup if you are in a hurry.
See the Troubleshooting section for common errors.
SIMPLE SETUP
------------
1. Create a MNOCALLS subdirectory and copy all the files into
it.
2. Add the following line to your CONFIG.SYS:
DEVICE=C:\MNOCALLS\MNODRVR.SYS
Or use whatever path which contains the MNOCALLS files.
Ensure that the following line is in your CONFIG.SYS:
IOPL=YES
3. Add the MNOCALLS subdirectory to the LIBPATH in CONFIG.SYS.
For example:
LIBPATH=.;C:\MNOCALLS;C:\OS2\DLL;C:\
4. Add the MNOCALLS subdirectory to the PATH in CONFIG.SYS.
For example:
SET PATH=C:\BND;D:\BINP;C:\OS2;... C:\MNOCALLS
5. Reboot OS/2.
The device driver will display the message:
Monochrome Display Driver Version 1.00.
Copyright (c) 1991, by Stephen L. Reed, All rights
reserved.
6. From a command line, execute MNOTEST.EXE to verify the
correct installation of the components. All twenty of the
MNOCALLS functions will be tested together with their Vio
equivalents. The objective of the tests is to manipulate
both the MDA and VGA/EGA monitors in the exact same
fashion. After each brief step of the test sequence,
MNOTEST will compare both the video buffers and report any
errors detected.
The test will terminate with the following message.
TEST SUCCESSFUL .. everything installed OK.
- 6 -
7. Erase MNOTEST.EXE and compile the source code to recreate
it. This step will verify the correct installation of
MNOCALLS.H, SYMTYPES.H, and MNOCALLS.LIB.
cl /AL /Lp /qc /c /G2 /W4 mnotest.c
link /ST:25000 /SE:256 mnotest,mnotest,mnotest,
mnocalls.lib;
- 7 -
ORGANIZED SETUP
---------------
1. Create a DRIVERS subdirectory and copy the device driver
MNODRVR.SYS to it. Or use another directory of your
choice.
2. Add the following line to your CONFIG.SYS:
DEVICE=C:\DRIVERS\MNODRVR.SYS
Or use whatever path which contains MNODRVR.SYS.
Ensure that the following line is in your CONFIG.SYS:
IOPL=YES
This gives permission for MNOCALLS to disable interrupts
when it writes to the MDA from a background process.
3. Create a DLL subdirectory and copy the library
MNOCALLS.DLL to it. Or use another directory of your
choice.
4. Add the DLL subdirectory (or your substitute) to the
LIBPATH in CONFIG.SYS.
For example:
LIBPATH=.;C:\DLL;C:\OS2\DLL;C:\
5. Copy MNOCALLS.H and SYMTYPES.H to the subdirectory where
you keep C language header files.
6. Copy MNOCALLS.LIB to the subdirectory where you keep your
LIB files required by the linker. MNOCALLS.LIB is not a
true object code library; it is an import definition file
which defines the MNOCALLS.DLL functions.
7. Copy MNOTEST.C and MNOFILT.C to a new subdirectory or an
existing subdirectory of your choice.
8. Create the MNO subdirectory and copy MNOCONSL.EXE,
MNOTEST.EXE and MF.EXE to it. Or use another directory of
your choice.
9. Add the MNO subdirectory (or your substitute) to the PATH
in CONFIG.SYS.
10. Reboot OS/2.
The device driver will display the message:
Monochrome Display Driver Version 1.00.
Copyright (c) 1991, by Stephen L. Reed, All rights
reserved.
- 8 -
11. Execute MNOTEST.EXE to verify the correct installation of
the components. All twenty of the MNOCALLS functions will
be tested together with their Vio equivalents. The object
of the tests is to manipulate both the MDA and VGA/EGA
monitors in the exact same fashion. After each brief
step of the test sequence, MNOTEST will compare both the
video buffers and report any errors detected.
The test will terminate with the following message.
TEST SUCCESSFUL .. everything installed OK.
12. Erase MNOTEST.EXE and compile the source code to recreate
it. This step will verify the correct installation of
MNOCALLS.H, SYMTYPES.H, and MNOCALLS.LIB.
cl /AL /Lp /qc /c /G2 /W4 mnotest.c
link /ST:25000 /SE:256 mnotest,mnotest,mnotest,
mnocalls.lib;
13. Rerun the installation test (step 11) using your compiled
version of MNOTEST.EXE. This will confirm that your
compile and link procedures work properly.
- 9 -
HOW TO USE DLL'S IN YOUR PROGRAMS
---------------------------------
You incorporate DLL functions into your C language programs in
the same way as you use the built-in system functions.
1. Include the headers.
#define INCL_BASE // Or whatever else you need.
#include <os2.h>
#include "SYMTYPES.H" // Some type definitions.
#include "MNOCALLS.H" // DLL function prototypes.
2. Use the MNO functions according to your requirements.
USHORT fStatus ;
// Draw a vertical line.
fStatus = MnoWrtCharStr ("│",1,23,11,0 ) ;
3. Compile using the large programming model. The /qc option
is used for quick compiles, but is not required. Also the
option /W4 is used for the most strict warning message
level, but is not required.
cl /AL /Lp /qc /c /G2 /W4 myprog.c
4. Link using the MNOCALLS.LIB import library. The /ST option
specifies a stack of at least 25K and the /SE option allows
for up to 256 segments. You may experiment with lower
values for your applications if you desire.
link /ST:25000 /SE:256 myprog,myprog,myprog,
mnocalls.lib;
5. Ensure that a DLL subdirectory listed in your LIBPATH
contains MNOCALLS.DLL and you are ready to execute your
program.
6. Registered users may distribute only the MNOCALLS.DLL and
MNODRVR.SYS files with their applications royalty-free
worldwide. Permission is also granted to include portions
of this document in the application setup instructions, so
that end-users can configure their dual monitor systems
for MNOCALLS.
- 10 -
THE MNO FUNCTIONS
1. Cursor Control.
------------------
USHORT DLLFUN MnoGetCurPos (
PUSHORT pusRow,
PUSHORT pusColumn,
HVIO hvio )
MnoGetCurPos gets the current position of the monochrome
adaptor cursor.
pusRow:
The address of the variable which receives the cursor
row position. This is a value in the range 0 ... 24.
pusColumn:
The address of the variable which receives the cursor
column position. This is a value in the range 0 ... 79.
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
Returns:
Normally returns 0. If the hvio parameter was not 0,
then the error return is the value
ERROR_VIO_INVALID_HANDLE.
Remarks:
Even if the cursor is not visible, MnoGetCurPos will
retrieve the position of where the cursor would be, if
it were visible. There are two common techniques for
hiding the monochrome cursor. One is to set the scan
lines used by the cursor to zero. The device driver uses
a second approach, which is to move the cursor beyond the
boundaries of the screen. However, the coordinates of
the virtual cursor are kept in the driver and can be
queried with this function.
Example:
USHORT usRow ;
USHORT usColumn ;
USHORT fStatus ;
fStatus = MnoGetCurPos ( &usRow, &usColumn, 0 ) ;
- 11 - MnoGetCurPos
USHORT DLLFUN MnoSetCurPos (
USHORT usRow,
USHORT usColumn,
HVIO hvio )
MnoSetCurPos sets the current position of the monochrome
adaptor cursor.
usRow:
The variable which specifies the cursor row position.
This must be a value in the range 0 ... 24.
usColumn:
The address of the variable which receives the cursor
column position. This is a value in the range 0 ... 79.
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
Returns:
Normally returns 0. If the hvio parameter was not 0
then the error returned is the value
ERROR_VIO_INVALID_HANDLE.
If usRow is greater than 24 then the error returned is
the value
ERROR_VIO_ROW.
If usColumn is greater than 79 then the error returned is
the value
ERROR_VIO_COL.
Remarks:
Even if the cursor is not visible, MnoSetCurPos will set
the position to where the cursor would be if it were
visible.
- 12 - MnoSetCurPos
Example:
USHORT usRow ;
USHORT usColumn ;
USHORT fStatus ;
usRow = 1 ;
usColumn = 10 ;
fStatus = MnoSetCurPos ( usRow, usColumn, 0 ) ;
// This sets the cursor position to (1, 10),
// where the origin (0, 0) is defined as the upper left
// corner of the screen.
- 13 -
USHORT DLLFUN MnoGetCurType (
PVIOCURSORINFO pvioCursorInfo,
HVIO hvio )
MnoGetCurType gets the Cursor Information structure which
contains the starting and ending cursor scan lines, and that
also contains an attribute that indicates if the cursor is
hidden.
pvioCursorInfo:
This points to the structure...
typedef struct _VIOCURSORINFO
{
USHORT yStart;
USHORT cEnd;
USHORT cx;
USHORT attr;
} VIOCURSORINFO;
yStart:
This is a value from 0 to 13 which indicates which is
the top line of the displayed cursor. The monochrome
cursor has 14 scan lines. The uppermost scan line is
number zero.
cEnd:
This is a value from 0 to 13 which indicates which is
the bottom line of the displayed cursor. The
bottommost scan line is number 13.
cx:
Cursor width is always 1 since this is a text mode.
attr:
Value 0xFFFF indicates the cursor is hidden. Any
other value indicates the cursor is visible.
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
Returns:
Normally returns 0. If the hvio parameter was not 0 then
the error returned is the value
ERROR_VIO_INVALID_HANDLE.
- 14 - MnoGetCurType
Example:
VIOCURSORINFO vioCursorInfo ;
USHORT fStatus ;
fStatus = MnoGetCurType ( &vioCursorInfo, 0 ) ;
// This gets the monochrome cursor type information.
- 15 -
USHORT DLLFUN MnoSetCurType (
PVIOCURSORINFO pvioCursorInfo,
HVIO hvio )
MnoGetCurType changes the shape of the monochrome cursor
and it can also be used to hide and reveal the cursor.
pvioCursorInfo:
This points to the structure...
typedef struct _VIOCURSORINFO
{
USHORT yStart;
USHORT cEnd;
USHORT cx;
USHORT attr;
} VIOCURSORINFO;
yStart:
This is a value from 0 to 13 which specifies which is
to be the top line of the displayed cursor. The
monochrome cursor has 14 scan lines. The uppermost
scan line is number zero.
cEnd:
This is a value from 0 to 13 which specifies which is
to be the bottom line of the displayed cursor. The
bottommost scan line is number 13. The video adaptor
can accept an ending value which is less than the
starting value, in which case the cursor is displayed
as two blocks.
cx:
Cursor width is always set to 1 since this is a text
mode.
attr:
Value 0xFFFF (decimal -1) specifies that the cursor
is to be hidden. Any other value specifies that the
cursor is to be visible.
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
- 16 - MnoSetCurType
Returns:
Normally returns 0. If the hvio parameter was not 0 then
the error returned is the value
ERROR_VIO_INVALID_HANDLE.
if cx is not 1, then the error returned is the value
ERROR_VIO_INVALID_PARMS.
Example:
VIOCURSORINFO vioCursorInfo ;
USHORT fStatus ;
vioCursorInfo.yStart = 0 ;
vioCursorInfo.cEnd = 13 ;
vioCursorInfo.cx = 1 ;
vioCursorInfo.attr = 0 ;
fStatus = MnoSetCurType ( &vioCursorInfo, 0 ) ;
// This sets the monochrome cursor as a full 14 scan lines
// in height and it is made visible.
- 17 -
2. Video Buffer Direct Access.
------------------------------
USHORT DLLFUN MnoGetPhysBuf (
PVIOPHYSBUF pvioPhysBuf,
USHORT usReserved )
MnoGetPhysBuf will obtain a selector to access the MDA video
buffer.
pvioPhysBuf:
Points to the structure...
typedef struct _VIOPHYSBUF
{
PBYTE pBuf ;
ULONG cb ;
SEL asel [1] ;
} VIOPHYSBUF ;
MnoGetPhysBuf will set the variable asel [0], and the
other elements of the structure are ignored.
usReserved:
Ignored by MnoGetPhysBuf.
Returns:
Normally returns 0.
Remarks:
The selector will always have full read and write access
when the calling process remains in the foreground. Use
VioScrLock to force the process into the foreground until
the selector is no longer needed. When the process is in
the background, MnoGetPhysBuf will obtain a valid
read/write selector that will remain valid even if the
process is switched to foreground.
When a foreground process is switched to background, OS/2
protects the display buffer by changing the selector
access rights from read/write to read-only.
A detached process cannot use VioScrLock or
MnoGetPhysBuf. It must use other Mno functions to write
to the MDA video buffer.
- 18 - MnoGetPhysBuf
Example:
VIOPHYSBUF vioPhysBuf ;
USHORT fStatus ;
USHORT fDetachStatus ;
USHORT fAnsi ;
BYTE fLockStatus ;
PCH pchMonoBuffer ;
/*---------------------------------------------*/
/* Here is how to test for a detached process. */
/*---------------------------------------------*/
fDetachStatus = MnoGetAnsi ( &fAnsi, 0 ) ;
if ( fDetachStatus == ERROR_VIO_DETACHED )
{
/*---------------------------------------------*/
/* Use other Mno functions to manipulate the */
/* MDA video buffer since we cannot detect */
/* screen group switching. */
/*---------------------------------------------*/
}
else
{
/*---------------------------------------------*/
/* If this is the foreground process, */
/* then prevent screen group switching until */
/* this function completes. */
/*---------------------------------------------*/
fStatus = VioScrLock (
LOCKIO_NOWAIT,
&fLockStatus,
0 ) ;
fStatus = MnoGetPhysBuf ( &vioPhysBuf, 0 ) ;
pchMonoBuffer = MAKEP ( vioPhysBuf.asel [0], 0 ) ;
/*---------------------------------------------*/
/* At this point, pchMonoBuffer is a read/write*/
/* pointer into the MDA video buffer, which is */
/* an array of 2000 character-attribute cells. */
/*---------------------------------------------*/
*pchMonoBuffer++ = 'A' ; // Bright 'A' in the
*pchMonoBuffer = 0x0F ; // first buffer position.
if ( fLockStatus == LOCK_SUCCESS )
fStatus = VioScrUnLock ( 0 ) ;
}
- 19 -
3. ANSI Escape Sequence.
------------------------
USHORT DLLFUN MnoGetAnsi (
PUSHORT pfAnsi,
HVIO hvio )
MnoGetAnsi determines if the processing of ANSI escape
sequences by the MnoWrtTTY function is enabled.
pfAnsi:
Points to a flag to receive the setting of the ANSI
escape sequence indicator. Value ANSI_ON means enabled,
and value ANSI_OFF means that escape sequences are
disabled and MnoWrtTTY will output them as-is to the
display.
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
Returns:
Normally returns 0. If the hvio parameter was not 0 then
the error returned is the value
ERROR_VIO_INVALID_HANDLE.
If the process was initiated using the DETACH OS/2
command, then pfAnsi will contain the correct status.
And the value returned is
ERROR_VIO_DETACHED.
Remarks:
The ANSI status of the EGA/VGA display is independent of
the monochrome display ANSI status.
Example:
USHORT fStatus ;
USHORT fAnsi ;
fStatus = MnoGetAnsi ( &fAnsi, 0 ) ;
// fAnsi is either ANSI_ON or ANSI_OFF.
- 20 - MnoGetAnsi
USHORT DLLFUN MnoSetAnsi (
USHORT fAnsi,
HVIO hvio )
MnoSetAnsi specifies whether the processing of ANSI escape
sequences by the MnoWrtTTY function is enabled.
fAnsi:
A flag to specify the setting of the ANSI escape sequence
indicator. Value ANSI_ON means enabled, and value
ANSI_OFF means that escape sequences are disabled and
MnoWrtTTY will output them as-is to the display.
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
Returns:
Normally returns 0. If the hvio parameter was not 0 then
the error returned is the value
ERROR_VIO_INVALID_HANDLE.
Remarks:
The state of the monochrome display ANSI indicator is not
affected by VioSetAnsi for the VGA/EGA adaptor.
Example:
USHORT fStatus ;
USHORT fAnsi ;
fAnsi = ANSI_ON ;
fStatus = MnoSetAnsi ( fAnsi, 0 ) ;
fStatus = MnoWrtTTY ( "\n\n\n\t\bSample Text\r\n", 18, 0 ) ;
- 21 - MnoSetAnsi
4. Video Buffer Read Functions.
-------------------------------
USHORT DLLFUN MnoReadCharStr (
PCH pchString,
PUSHORT pcb,
USHORT usRow,
USHORT usColumn,
HVIO hvio )
MnoReadCharStr reads characters from the monochrome display
starting at the specified row and column, and for a
specified length.
pchString:
Points to a character array (buffer) which receives the
character string. A null character is not appended.
pcb:
Points to a variable which contains the length, in
characters, of the string to be read. MnoReadCharStr
sets this variable to the actual length read, in case an
attempt was made to read past the end of the screen.
usRow:
The variable which specifies the starting row position.
This must be a value in the range 0 ... 24.
usColumn:
The variable which specifies the starting column
position. This is a value in the range 0 ... 79.
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
Returns:
Normally returns 0. If the hvio parameter was not 0,
then the error return is the value
ERROR_VIO_INVALID_HANDLE.
If usRow is greater than 24 then the error return is the
value
ERROR_VIO_ROW.
If usColumn is greater than 79 then the error return is
the value
ERROR_VIO_COL.
- 22 - MnoReadCharStr
Remarks:
The character string may wrap from one line to the next
one below, but MnoReadCharStr does not read past the end
of the screen. The cursor position is not affected.
Example:
USHORT fStatus = 0 ;
USHORT cText = 0 ;
UCHAR achText [ 500 ] = "" ;
// Read 30 characters starting at
// the 11th line and 2nd column.
cText = 30 ;
fStatus = MnoReadCharStr ( achText, &cText, 10, 1, 0 ) ;
- 23 -
USHORT DLLFUN MnoReadCellStr (
PCH pchCellStr,
PUSHORT pcb,
USHORT usRow,
USHORT usColumn,
HVIO hvio )
MnoReadCellStr reads characters and their attributes from
the monochrome display starting at the specified row and
column, and for a specified buffer length.
pchCellStr:
Points to a character array (buffer) which receives the
character-attribute pairs (cells). A null character is
not appended.
pcb:
Points to a variable which contains the length, in
bytes, of the cell string to be read. MnoReadCellStr
sets this variable to the actual length read, in case an
attempt was made to read past the end of the screen.
usRow:
The variable which specifies the starting row position.
This must be a value in the range 0 ... 24.
usColumn:
The variable which specifies the starting column
position. This is a value in the range 0 ... 79.
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
Returns:
Normally returns 0. If the hvio parameter was not 0,
then the error return is the value
ERROR_VIO_INVALID_HANDLE.
If usRow is greater than 24 then the error return is the
value
ERROR_VIO_ROW.
If usColumn is greater than 79 then the error return is
the value
ERROR_VIO_COL.
- 24 - MnoReadCellStr
Remarks:
The character string may wrap from one line to the next
one below, but MnoReadCellStr does not read past the end
of the screen. The character-attribute pair is called a
cell and the specified buffer length should be an even
number. The cursor position is not affected.
Example:
USHORT fStatus = 0 ;
USHORT cText = 0 ;
UCHAR achText [ 500 ] = "" ;
// Read 15 characters-attribute pairs
// starting at the 1st line and 5th
// column.
cText = 30 ;
fStatus = MnoReadCellStr ( achText, &cText, 0, 4, 0 ) ;
- 25 -
5. Video Buffer Scroll Functions.
---------------------------------
USHORT DLLFUN MnoScrollDn (
USHORT usTopRow,
USHORT usLeftCol,
USHORT usBotRow,
USHORT usRightCol,
USHORT cbLines,
PBYTE pCell,
HVIO hvio )
MnoScrollDn scrolls lines down within a specified rectangle
on the screen. A specified character-attribute pair (cell)
is used to fill the new lines at the top of the rectangle.
usTopRow:
The variable which specifies the top row boundary of the
rectangle. This must be a value in the range 0 ... 24.
If a value greater than 24 is specified, then 24 is
substituted without an error.
usLeftCol:
The variable which specifies the left column boundary of
the rectangle. This is a value in the range 0 ... 79.
If a value greater than 79 is specified, then 79 is
substituted without an error.
usBotRow:
The variable which specifies the bottom row boundary of
the rectangle. This must be a value in the range
0 ... 24. If a value greater than 24 is specified, then
24 is substituted without an error.
usRightCol:
The variable which specifies the right column boundary of
the rectangle. This is a value in the range 0 ... 79.
If a value greater than 79 is specified, then 79 is
substituted without an error.
cbLines:
The number of lines to scroll down. If this number is
zero, then no scrolling is done.
pCell:
Points to a two byte array containing the character-
attribute pair (cell).
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
- 26 - MnoScrollDn
Returns:
Normally returns 0. If the hvio parameter was not 0,
then the error return is the value
ERROR_VIO_INVALID_HANDLE.
If usTopRow is greater than usBotRow then the error
value is
ERROR_VIO_ROW.
If usLeftCol is greater than usRightCol then the error
value is
ERROR_VIO_COL.
Remarks:
The cursor position is not affected.
Example:
USHORT fStatus = 0 ;
BYTE abCell [ 2 ] = { 0 } ;
/* Erase monochrome display. */
abCell [ 0 ] = ' ' ;
abCell [ 1 ] = 0x07 ;
fStatus = MnoScrollDn ( 0,
0,
0xFFFF,
0xFFFF,
0xFFFF,
abCell,
0 ) ;
- 27 -
USHORT DLLFUN MnoScrollUp (
USHORT usTopRow,
USHORT usLeftCol,
USHORT usBotRow,
USHORT usRightCol,
USHORT cbLines,
PBYTE pCell,
HVIO hvio )
MnoScrollUp scrolls lines up within a specified rectangle
on the screen. A specified character-attribute pair (cell)
is used to fill the new lines at the bottom of the
rectangle.
usTopRow:
The variable which specifies the top row boundary of the
rectangle. This must be a value in the range 0 ... 24.
If a value greater than 24 is specified, then 24 is
substituted without an error.
usLeftCol:
The variable which specifies the left column boundary of
the rectangle. This is a value in the range 0 ... 79.
If a value greater than 79 is specified, then 79 is
substituted without an error.
usBotRow:
The variable which specifies the bottom row boundary of
the rectangle. This must be a value in the range
0 ... 24. If a value greater than 24 is specified, then
24 is substituted without an error.
usRightCol:
The variable which specifies the right column boundary of
the rectangle. This is a value in the range 0 ... 79.
If a value greater than 79 is specified, then 79 is
substituted without an error.
cbLines:
The number of lines to scroll up. If this number is
zero, then no scrolling is done.
pCell:
Points to a two byte array containing the character-
attribute pair (cell).
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
- 28 - MnoScrollUp
Returns:
Normally returns 0. If the hvio parameter was not 0,
then the error return is the value
ERROR_VIO_INVALID_HANDLE.
If usTopRow is greater than usBotRow then the error
value is
ERROR_VIO_ROW.
If usLeftCol is greater than usRightCol then the error
value is
ERROR_VIO_COL.
Remarks:
The cursor position is not affected.
Example:
USHORT fStatus = 0 ;
BYTE abCell [ 2 ] = { 0 } ;
abCell [ 0 ] = '.' ;
abCell [ 1 ] = 0x0F ;
/*---------------------------------------------*/
/* Scroll the box at (row,col): */
/* */
/* (0,74)----------+ */
/* | | */
/* | | */
/* | | */
/* +----------(24,79) */
/* */
/* Up 1 row. */
/*---------------------------------------------*/
fStatus = MnoScrollUp ( 0, 74, 24, 79, 1, abCell, 0 ) ;
- 29 -
USHORT DLLFUN MnoScrollLf (
USHORT usTopRow,
USHORT usLeftCol,
USHORT usBotRow,
USHORT usRightCol,
USHORT cbCol,
PBYTE pCell,
HVIO hvio )
MnoScrollLf scrolls lines left within a specified rectangle
on the screen. A specified character-attribute pair (cell)
is used to fill the new lines at the right of the rectangle.
usTopRow:
The variable which specifies the top row boundary of the
rectangle. This must be a value in the range 0 ... 24.
If a value greater than 24 is specified, then 24 is
substituted without an error.
usLeftCol:
The variable which specifies the left column boundary of
the rectangle. This is a value in the range 0 ... 79.
If a value greater than 79 is specified, then 79 is
substituted without an error.
usBotRow:
The variable which specifies the bottom row boundary of
the rectangle. This must be a value in the range
0 ... 24. If a value greater than 24 is specified, then
24 is substituted without an error.
usRightCol:
The variable which specifies the right column boundary of
the rectangle. This is a value in the range 0 ... 79.
If a value greater than 79 is specified, then 79 is
substituted without an error.
cbLines:
The number of lines to scroll left. If this number is
zero, then no scrolling is done.
pCell:
Points to a two byte array containing the character-
attribute pair (cell).
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
- 30 - MnoScrollLf
Returns:
Normally returns 0. If the hvio parameter was not 0,
then the error return is the value
ERROR_VIO_INVALID_HANDLE.
If usTopRow is greater than usBotRow then the error
value is
ERROR_VIO_ROW.
If usLeftCol is greater than usRightCol then the error
value is
ERROR_VIO_COL.
Remarks:
The cursor position is not affected.
Example:
USHORT fStatus = 0 ;
BYTE abCell [ 2 ] = { 0 } ;
abCell [ 0 ] = '#' ; // Fill character.
abCell [ 1 ] = 0x0F ;
/*---------------------------------------------*/
/* Scroll the box at (row,col): */
/* */
/* (0,0)-----------+ */
/* | | */
/* | | */
/* | | */
/* +----------(5,79) */
/* */
/* Left 10 columns. */
/*---------------------------------------------*/
fStatus = MnoScrollLf ( 0, 0, 5, 79, 10, abCell, 0 ) ;
- 31 -
USHORT DLLFUN MnoScrollRt (
USHORT usTopRow,
USHORT usLeftCol,
USHORT usBotRow,
USHORT usRightCol,
USHORT cbCol,
PBYTE pCell,
HVIO hvio )
MnoScrollRt scrolls lines right within a specified
rectangle on the screen. A specified character-attribute
pair (cell) is used to fill the new lines at the left of
the rectangle.
usTopRow:
The variable which specifies the top row boundary of the
rectangle. This must be a value in the range 0 ... 24.
If a value greater than 24 is specified, then 24 is
substituted without an error.
usLeftCol:
The variable which specifies the left column boundary of
the rectangle. This is a value in the range 0 ... 79.
If a value greater than 79 is specified, then 79 is
substituted without an error.
usBotRow:
The variable which specifies the bottom row boundary of
the rectangle. This must be a value in the range
0 ... 24. If a value greater than 24 is specified, then
24 is substituted without an error.
usRightCol:
The variable which specifies the right column boundary of
the rectangle. This is a value in the range 0 ... 79.
If a value greater than 79 is specified, then 79 is
substituted without an error.
cbLines:
The number of lines to scroll right. If this number is
zero, then no scrolling is done.
pCell:
Points to a two byte array containing the character-
attribute pair (cell).
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
- 32 - MnoScrollRt
Returns:
Normally returns 0. If the hvio parameter was not 0,
then the error return is the value
ERROR_VIO_INVALID_HANDLE.
If usTopRow is greater than usBotRow then the error
value is
ERROR_VIO_ROW.
If usLeftCol is greater than usRightCol then the error
value is
ERROR_VIO_COL.
Remarks:
The cursor position is not affected.
Example:
USHORT fStatus = 0 ;
BYTE abCell [ 2 ] = { 0 } ;
abCell [ 0 ] = '.' ; // Fill character.
abCell [ 1 ] = 0x07 ;
/*---------------------------------------------*/
/* Scroll the box at (row,col): */
/* */
/* (0,0)-----------+ */
/* | | */
/* | | */
/* | | */
/* +----------(24,79) */
/* */
/* Right 80 columns. */
/*---------------------------------------------*/
fStatus = MnoScrollRt ( 0,
0,
0xFFFF,
0xFFFF,
0xFFFF,
abCell,
0 ) ;
- 33 -
5. Video Buffer Write Functions.
--------------------------------
USHORT DLLFUN MnoWrtCharStr (
PCH pchStr,
USHORT cb,
USHORT usRow,
USHORT usColumn,
HVIO hvio )
MnoWrtCharStr writes characters to the monochrome display
starting at the specified row and column, and for a
specified length.
pchStr:
Points to a character array (buffer) which contains the
character string to be written. A null character
terminator is not required.
cb:
Contains the length, in characters, of the string to be
written.
usRow:
The variable which specifies the starting row position.
This must be a value in the range 0 ... 24.
usColumn:
The variable which specifies the starting column
position. This is a value in the range 0 ... 79.
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
Returns:
Normally returns 0. If the hvio parameter was not 0,
then the error return is the value
ERROR_VIO_INVALID_HANDLE.
If usRow is greater than 24 then the error return is the
value
ERROR_VIO_ROW.
If usColumn is greater than 79 then the error return is
the value
ERROR_VIO_COL.
- 34 - MnoWrtCharStr
Remarks:
The character string may wrap from one line to the next
one below, but MnoWriteCharStr does not write past the
end of the screen. The cursor position is not affected.
Example:
USHORT fStatus = 0 ;
UCHAR szText [ 20 ] = "hello world" ;
// Display string at 2nd row, 1st column.
fStatus = MnoWrtCharStr ( szText,
strlen ( szText ),
1,
0,
0 );
- 35 -
USHORT DLLFUN MnoWrtCellStr (
PCH pchCellStr,
USHORT cb,
USHORT usRow,
USHORT usColumn,
HVIO hvio )
MnoWrtCellStr writes characters and their attributes to the
monochrome display starting at the specified row and column,
and for a specified buffer length.
pchCellStr:
Points to a character array (buffer) which contains the
character-attribute pairs (cells) to be written. A null
character string terminator is not required.
cb:
Contains the length, in bytes, of the cell string to be
written.
usRow:
The variable which specifies the starting row position.
This must be a value in the range 0 ... 24.
usColumn:
The variable which specifies the starting column
position. This is a value in the range 0 ... 79.
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
Returns:
Normally returns 0. If the hvio parameter was not 0,
then the error return is the value
ERROR_VIO_INVALID_HANDLE.
If usRow is greater than 24 then the error return is the
value
ERROR_VIO_ROW.
If usColumn is greater than 79 then the error return is
the value
ERROR_VIO_COL.
- 36 - MnoWrtCellStr
Remarks:
The character string may wrap from one line to the next
one below, but MnoWrtCellStr does not write past the end
of the screen. The character-attribute pair is called a
cell and the specified buffer length should be an even
number. The cursor position is not affected.
Example:
USHORT fStatus = 0 ;
UCHAR szText [ 200 ] = "" ;
// Display string at 11th row, 2nd column.
strcpy ( szText,
"T\07e\07s\07t\07 \07o\07f\07 \07"
"W\07r\07t\07C\07e\07l\07l\07S\07"
"t\07r\07" ) ;
fStatus = MnoWrtCellStr ( szText,
strlen ( szText ),
10,
1,
0 ) ;
- 37 -
USHORT DLLFUN MnoWrtNAttr (
PBYTE pAttr,
USHORT cb,
USHORT usRow,
USHORT usColumn,
HVIO hvio )
MnoWrtNAttr writes the specified attribute N times to the
monochrome display starting at the specified row and column.
pAttr:
Points to a byte which contains the display attribute.
cb:
Contains the desired repeat count.
usRow:
The variable which specifies the starting row position.
This must be a value in the range 0 ... 24.
usColumn:
The variable which specifies the starting column
position. This is a value in the range 0 ... 79.
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
Returns:
Normally returns 0. If the hvio parameter was not 0,
then the error return is the value
ERROR_VIO_INVALID_HANDLE.
If usRow is greater than 24 then the error return is the
value
ERROR_VIO_ROW.
If usColumn is greater than 79 then the error return is
the value
ERROR_VIO_COL.
Remarks:
The repeated attribute may wrap from one line to the next
one below, but MnoWrtNAttr does not set attributes past
the end of the screen. The existing characters are not
changed and the cursor position is not affected.
- 38 - MnoWrtNAttr
Example:
USHORT fStatus = 0 ;
UCHAR szText [ 50 ] = "" ;
BYTE bAttr = 0x00 ;
bAttr = 0x70 ;
strcpy ( szText, "hello world" ) ;
// Display 'hello world' on the 6th row
// and 11th column.
fStatus = MnoWrtCharStr ( szText,
strlen ( szText ),
5,
10,
0 ) ;
// Set the attributes for 'hello world'.
fStatus = MnoWrtNAttr ( &bAttr,
strlen ( szText ),
5,
10,
0 ) ;
- 39 -
Monochrome Adapter Attribute Byte.
Binary Description
0... .... No blinking
1... .... Blinking
.... 0... Normal foreground intensity
.... 1... Bright foreground intensity
.... .001 Underlining
.000 .... Black background
.111 .... White background
.... .000 Black foreground
.... .111 White foreground
Hex combinations.
0x07 White on black
0x0F Bright white on black
0x70 Reverse video (black on white)
0x01 White on black underlined
0x87 Blinking white on black
- 40 -
USHORT DLLFUN MnoWrtNChar (
PCH pchChar,
USHORT cb,
USHORT usRow,
USHORT usColumn,
HVIO hvio )
MnoWrtNChar writes the specified character N times to the
monochrome display starting at the specified row and
column.
pchChar:
Points to a character which is to be written.
cb:
Contains the desired repeat count.
usRow:
The variable which specifies the starting row position.
This must be a value in the range 0 ... 24.
usColumn:
The variable which specifies the starting column
position. This is a value in the range 0 ... 79.
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
Returns:
Normally returns 0. If the hvio parameter was not 0,
then the error return is the value
ERROR_VIO_INVALID_HANDLE.
If usRow is greater than 24 then the error return is the
value
ERROR_VIO_ROW.
If usColumn is greater than 79 then the error return is
the value
ERROR_VIO_COL.
Remarks:
The repeated character may wrap from one line to the next
one below, but MnoWrtNChar does not set attributes past
the end of the screen. The existing attributes are not
changed and the cursor position is not affected.
- 41 - MnoWrtNChar
Example:
USHORT fStatus = 0 ;
USHORT usRow = 0 ;
USHORT usColumn = 0 ;
BYTE chChar = ' ' ;
PBYTE pchChar = &chChar ;
USHORT cChars = 0 ;
// Set the last line of the display to all 'E'.
chChar = 'E' ;
usRow = 24 ;
usColumn = 0 ;
cChars = 80 ;
fStatus = MnoWrtNChar ( pchChar,
cChars,
usRow,
usColumn,
0 ) ;
- 42 -
USHORT DLLFUN MnoWrtNCell (
PBYTE pCell,
USHORT cb,
USHORT usRow,
USHORT usColumn,
HVIO hvio )
MnoWrtNCell writes the specified character-attribute pair
(cell) N times to the monochrome display starting at the
specified row and column.
pCell:
Points to a two byte array which contains the character-
attribute pair (cell) that is to be written.
cb:
Contains the desired repeat count.
usRow:
The variable which specifies the starting row position.
This must be a value in the range 0 ... 24.
usColumn:
The variable which specifies the starting column
position. This is a value in the range 0 ... 79.
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
Returns:
Normally returns 0. If the hvio parameter was not 0,
then the error return is the value
ERROR_VIO_INVALID_HANDLE.
If usRow is greater than 24 then the error return is the
value
ERROR_VIO_ROW.
If usColumn is greater than 79 then the error return is
the value
ERROR_VIO_COL.
Remarks:
The repeated cell may wrap from one line to the next one
below, but MnoWrtNCell does not write past the end of the
screen. The cursor position is not affected.
- 43 - MnoWrtNCell
Example:
USHORT fStatus = 0 ;
USHORT cCells = 0 ;
USHORT usRow = 0 ;
USHORT usColumn = 0 ;
BYTE abCell [ 2 ] = { 0 } ;
// Display ten 'A' starting at the 3rd row,
// 79th column, and wrapping onto the 4th row,
// through the eight column. The attribute
// has been set to the normal intensity.
abCell [ 0 ] = 'A' ;
abCell [ 1 ] = 0x07 ;
cCells = 10 ;
usRow = 2 ;
usColumn = 78 ;
fStatus = MnoWrtNCell ( abCell,
cCells,
usRow,
usColumn,
0 ) ;
- 44 - MnoWrtNCell
USHORT DLLFUN MnoWrtCharStrAtt (
PCH pch,
USHORT cb,
USHORT usRow,
USHORT usColumn,
PBYTE pAttr,
HVIO hvio )
MnoWrtCharStrAtt writes the specified character string to
the monochrome display starting at the specified row and
column.
pch:
Points to an array of characters (buffer) which contains
the string to be written. A null character string
terminator is not required.
cb:
Contains the count of characters to be written.
usRow:
The variable which specifies the starting row position.
This must be a value in the range 0 ... 24.
usColumn:
The variable which specifies the starting column
position. This is a value in the range 0 ... 79.
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
Returns:
Normally returns 0. If the hvio parameter was not 0,
then the error return is the value
ERROR_VIO_INVALID_HANDLE.
If usRow is greater than 24 then the error return is the
value
ERROR_VIO_ROW.
If usColumn is greater than 79 then the error return is
the value
ERROR_VIO_COL.
- 45 - MnoWrtCharStrAtt
Remarks:
The specified attribute is used for each character. The
string may wrap from one line to the next one below, but
MnoWrtCharStrAtt does not write past the end of the
screen. The cursor position is not affected.
Example:
USHORT fStatus = 0 ;
USHORT usRow = 0 ;
USHORT usColumn = 0 ;
BYTE bAttr = 0x07 ;
UCHAR szText [ 80 ] = "" ;
strcpy ( szText, "Some sample text in reverse video" ) ;
bAttr = 0x70 ;
fStatus = MnoWrtCharStrAtt ( szText,
strlen ( szText ),
0,
5,
&bAttr,
0 ) ;
- 46 -
USHORT DLLFUN MnoWrtTTY (
PCH pch,
USHORT cb,
HVIO hvio )
MnoWrtTTY writes the specified character string to the
monochrome display starting at the current cursor position.
pch:
Points to an array of characters (buffer) which contains
the string to be written. A null character terminator is
not required. ANSI escape sequences may be contained
within the string.
cb:
Contains the count of characters to be written. If the
ANSI escape mode is enabled then count each escaped
character (i.e. '\t') as one character.
hvio:
Must be 0. This is only provided for syntatic
compatibility with VIO functions.
Returns:
Normally returns 0. If the hvio parameter was not 0,
then the error return is the value
ERROR_VIO_INVALID_HANDLE.
Remarks:
The current default attribute is used for each character.
The string may wrap from one line to the next one below,
and MnoWrtTTY will scroll the screen up one line
repeatedly to accomodate line wrap on the last line of
the screen. The cursor position is set to the immediate
right of the last character written. In the case where
the last character written by MnoWrtTTY is in the
rightmost column, then the cursor will appear on the
leftmost position on the next lower line, even if the
screen has to be scrolled upwards to accomodate it.
MnoWrtTTY interprets the following special characters:
\n ... New line (cursor down one line)
Also known as line-feed
\r ... Carriage return (cursor to column 1)
\t ... Horizontal tab (every 8 columns)
\b ... Backspace
\a ... Bell (alert)
- 47 - MnoWrtTTY
MnoWrtTTY will process the following ANSI escape
sequences, using these symbols:
ESC... the escape character (decimal 27)
It can be written as "\033" in strings.
col... column 1 thru 80
(Note that Vio/Mno use 0 thru 79.)
row... row 1 thru 25
(Note that Vio/Mno use 0 thru 24.)
n..... count 0 thru 79
g..... graphic code
The suffix characters H,f,A,B,C,D,s,u,J,K and m
indicate the escape sequence (command) type and also
terminate it.
ESC[H Move cursor to upper left of the screen.
ESC[f Move cursor to upper left of the screen.
ESC[row;colH Move the cursor to the specified row and
column.
ESC[row;colf Move the cursor to the specified row and
column.
ESC[nA Move the cursor up n rows staying in the
same column. The cursor will not be
moved beyond the top of the screen.
ESC[nB Move the cursor down n rows staying in
the same column. The cursor will not be
moved beyond the bottom of the screen.
ESC[nC Move the cursor right n columns staying
in the same row. The cursor will not be
moved beyond the right boundary of the
screen.
ESC[nD Move the cursor left n columns staying in
the same row. The cursor will not be
moved beyond the left boundary of the
screen.
ESC[s Save the current cursor position which
can be restored with ESC[u. Repeated use
of the ESC[s sequence saves only the most
recent cursor position.
- 49 -
ANSI escape sequences (continued).
ESC[u Restore the cursor position to the
location saved by the previous use of
ESC[s, otherwise move the cursor to the
upper left of the screen if ESC[s has not
been used previously. ESC[u may be used
repeatedly without losing the saved
position.
ESC[2J Erase the screen and move the cursor to
the upper left position.
ESC[g;g;..gm The graphic codes are applied in the
order in which they appear and will set
the default attribute used by MnoWrtTTY.
The other Mno functions do not use this
attribute. ANSI graphic codes support
color, but the monochrome display has its
own interpretation.
graphic monochrome
code attribute effect
------- --------------------------------
0 All attributes off. White
foreground on black background.
1 Bold (high intensity) attribute
on.
2 Faint (normal intensity)
attribute on. Ignored if already
reverse video bold.
3 Italic attribute (ignored).
5 Blink attribute on.
6 Rapid Blink (ignored).
7 Reverse Video attribute on.
Black foreground on white
background.
8 Concealed attribute on. Black
foreground on black background.
30 Black foreground attribute on.
- 50 -
ANSI graphic escape sequences (continued).
graphic monochrome
code attribute effect
------- --------------------------------
31 Red foreground.
White on monochrome display.
Also turn off underlining.
32 Green foreground.
White on monochrome display.
Also turn off underlining.
33 Yellow foreground.
White on monochrome display.
Also turn off underlining.
34 Blue foreground.
Underline monochrome display.
35 Magenta foreground.
White on monochrome display.
Also turn off underlining.
36 Cyan foreground.
White on monochrome display.
Also turn off underlining.
37 White foreground.
Also turn off underlining.
40 Black background.
41 Red background.
White on monochrome display.
42 Green background.
White on monochrome display.
43 Yellow background.
White on monochrome display.
44 Blue background.
White on monochrome display.
45 Magenta background.
White on monochrome display.
46 Cyan background.
White on monochrome display.
- 51 -
ANSI graphic escape sequences (continued).
graphic monochrome
code attribute effect
------- --------------------------------
47 White background.
48 Subscript (ignored).
49 Superscript (ignored).
Examples:
USHORT fStatus = 0 ;
UCHAR szText [ 200 ] ;
VIOCURSORINFO vioCursorInfo ;
// Display "HELLO WORLD" followed by
// Carriage return - line feed.
strcpy ( szText, "HELLO WORLD\r\n" ) ;
fStatus = MnoWrtTTY ( szText, strlen ( szText ), 0 ) ;
// Erase the screen, move the cursor to the upper
// left position. Reset all attributes and use
// normal intensity white text on a dark background.
// Then display "HELLO WORLD". The cursor will be
// placed to the right of the text.
strcpy ( szText, "\033[2J\033[0mHELLO WORLD" ) ;
fStatus = MnoWrtTTY ( szText, strlen ( szText ), 0 ) ;
// Display cursor attributes.
fStatus = MnoGetCurType ( &vioCursorInfo, 0 ) ;
sprintf ( szText,
"\r\nCursor Start=%d End=%d Width=%d attr=%x\r\n",
vioCursorInfo.yStart,
vioCursorInfo.cEnd,
vioCursorInfo.cx,
vioCursorInfo.attr ) ;
fStatus = MnoWrtTTY ( szText, strlen ( szText ), 0 ) ;
- 52 -
USING MNOCONSL
--------------
MNOCONSL can be executed from an OS/2 command line as a
foreground process:
> MNOCONSL
If you Ctrl-Esc, then it gets switched to the background
and continues to update the monochrome display.
It can also be started as background process:
> START "Console" MNOCONSL.EXE
In this case, it will not get switched to the foreground
unless you select the ICON and open it. The ICON can also
be closed if you have another need for the monochrome
display. This command can be placed in your STARTUP.CMD file.
It can be executed as a detached process:
> DETACH MNOCONSL
The screen updates are more time consuming and the CPU
utilization increases since the entire video buffer must
be refreshed on each access, for a detached process.
When it begins, MNOCONSL first draws lines on the display
and some titles. Then it displays the message:
Calibrating the CPU...
It is executing a highest-priority counting thread for
ten seconds to calibrate its idle loop. Later, the
CPU cycles that the lowest-priority counting thread
accumulates gives the CPU time not used by any useful
process. The inverse of that measurement is the CPU
utilization.
The system function DosQProcStatus is used to obtain the
list of processes and threads. This is not a documented
function but was determined by examining PSTAT. The MNOCONSL
source code contains a structure which defines the
system information returned by DosQProcStatus.
- 53 -
MNOCONSL does not prevent other processes from accessing the
monochrome display, either directly (such as MODE MONO), or
by using MNOCALLS. The responsibility for coordinating
access to the monochrome display is up to the user.
For example, MNOCONSL should be closed (shut down) when running
dual monitor CODEVIEW. It can easily be restarted after the
debugging session.
Do not run more than one copy of MNOCONSL at a time. MNOCALLS
can handle multiple client processes, but MNOCONSL was not
designed to share the monochrome display.
Source code to MNOCONSL is available for those wishing to
customize or enhance it. See the registration section.
USING MF
--------
When MNOCONSL is running, try the following on an OS/2
command line:
> DIR | MF
The result of the Directory listing will be shown on both
monitors. You are then free to use the primary display
for some other purpose. MF is a simple stdin/stdout filter
so it can be incorporated wherever stdout is available.
- 54 -
Detached Compilation
--------------------
Program compilations can be executed as detached processes and
messages can be piped to the monochrome display while the
primary display is used for some other purpose.
Install a PM desktop program entry in a group of your choice
with the following parameters:
Properties...
Program title: Compile MnoExamp
Path and file name: C:\MNOCALLS\DETCMD.CMD
Parameters: MNOEXAMX
Working directory: C:\MNOCALLS
When you activate this program, either by mouse or keyboard, it
will detach the command file MNOEXAMX.CMD. The detached
command file then uses MF to pipe a separator line to the MDA,
and then executes NMAKE to build MNOEXAMP.EXE. Finally, the
return code (errorlevel) is checked to display a completion
message.
You can use MNOEXAMX.CMD and MNOEXAMP.MAK as models for your
own detached compilations.
The supplied MNOTEST.C source code is also accompanied by
the compilation files MNOTESTX.CMD and MNOTEST.MAK which are
intended for detached compilation.
Detached compilations will execute almost as fast as foreground
compilations, in the absence of other significantly active
tasks.
- 55 -
MNOEXAMP, an example with CodeView
----------------------------------
MNOEXAMP.C contains an example for each Mno function. Use the
supplied make file to compile the program:
> NMAKE /F MNOEXAMP.MAK
The compilation messages will appear on the MNOCONSL message
area. Examine the make file for examples of how to use MF in
your make and CMD files.
Close MNOCONSL from the PM desktop if it is active.
Then you can animate the examples by using CodeView:
> CVP MNOEXAMP.EXE
Use the single step command (F10) to trace each example. The
local variables are unique for each one, and are automatically
visible in the CodeView window.
The compile can also be done as a detached process:
> DETACH NMAKE /F MNOEXAMP.MAK
Similar commands can be assigned to PM desktop group menu
items, so that background compiles can be initiated with the
mouse and the progress observed on the monochrome monitor.
See the preceding section for a more complete description of
detached compilations.
- 56 -
HOW TO SET UP DUAL MONITORS
---------------------------
The cost of adding a monochrome monitor and adaptor to an
IBM AT compatible (ISA) or EISA system is low. These are
component prices taken from an issue of COMPUTER SHOPPER:
Monographic card $US 15.00 also known as MGP
Monochrome monitor $US 69.00
The original IBM PC allowed for combinations of video monitors.
The video memory address for the Monochrome Display Adaptor
does not overlap any of the following adaptor types:
EGA, VGA, CGA, MCGA, 8514
For example, to use an EGA and MDA together, put the following
into your config.sys file:
rem EGA is primary, MPA is secondary adaptor
SET VIDEO_DEVICES=VIO_IBMEGA,VIO_MONO
SET VIO_MONO=DEVICE(BVHMPA)
SET VIO_IBMEGA=DEVICE(BVHEGA)
DEVINFO=SCR,EGA,C:\OS2\VIOTBL.DCP
Or for example, to use an VGA and MDA together, put the
following into your config.sys file:
rem VGA is primary, MPA is secondary adaptor
SET VIDEO_DEVICES=VIO_IBMVGA,VIO_MONO
SET VIO_IBMVGA=DEVICE(BVHVGA)
SET VIO_MONO=DEVICE(BVHMPA)
DEVINFO=SCR,VGA,C:\OS2\VIOTBL.DCP
The monochrome adaptor cards typically also have a printer
(parallel) port attached and are also Hercules graphics
compatible. MNOCALLS does not support the graphics mode.
Configure the card for character mode if a choice is required.
You know if the monochrome monitor/card is installed correctly
if OS/2 boots on the EGA/VGA. Then you go to a full screen
OS/2 command line and enter
> MODE MONO ... the monochrome monitor will activate.
To get back to the EGA/VGA enter
> MODE CO80 ... the full screen EGA/VGA session will
activate.
- 57 -
TROUBLESHOOTING
---------------
Below are error messages from MNOCALLS or its device driver,
and your response.
The Monochrome Display Driver is NOT loaded
because the monochrome adaptor card was not found.
During its initialization sequence, MNODRVR.SYS stores a
cursor value in the monochrome display adaptor control
register and then attempts to read that value. If these
values do not agree, then the adaptor card is either not
installed or not functioning properly. Most likely the
OS/2 MODE MONO command will also fail. If problems persist,
have your computer and display adaptors serviced.
SYS1804: The system cannot find the file MNOCALLS.
Check to be sure the supplied MNOCALLS.DLL file is present
in one of the subdirectories specified on LIBPATH in
CONFIG.SYS. Have you rebooted OS/2 since modifying
LIBPATH or MNOCALLS.DLL?
SYS0197: The operating system is not presently
configured to run this application.
You need to specify IOPL=YES in your config.sys file.
For this to become effective, you need to reboot OS/2.
MNOTEST has failed because the MNODRVR.SYS device
driver did not open properly. Status: 110.
When MNOCALLS.DLL attempted to establish contact with the
supplied device driver, the DosOpen failed. Check the
OS/2 boot messages to ensure that the following message is
displayed:
Monochrome Display Driver Version 1.00.
Copyright (c) 1991, by Stephen L. Reed, All rights
reserved.
- 58 -
INDEX
-----
ANSI Escape Sequences 48
Attribute Byte 40
Author, comments and questions 1
BBS, OS/2 Shareware 1
CODEVIEW 54,56
CONFIG.SYS 6,8,57-58
DosQProcStatus 53
DLL's, how to use 10
IOPL 6,8
LIBPATH 6,8,58
Licensing arrangement 1
MF,
How to use 54,55
MF.EXE 5
MNOFILT.C 8
MNOCALLS,
Description 2
Features 4
Functions,
MnoGetAnsi 20
MnoGetCurPos 11
MnoGetCurType 14
MnoGetPhysBuf 18
MnoReadCellStr 24
MnoReadCharStr 22
MnoScrollDn 26
MnoScrollLf 30
MnoScrollRt 32
MnoScrollUp 28
MnoSetAnsi 21
MnoSetCurPos 12
MnoSetCurType 16
MnoWrtCellStr 36
MnoWrtCharStr 34
MnoWrtCharStrAtt 45
MnoWrtNAttr 38
MnoWrtNCell 43
MnoWrtNChar 41
MnoWrtTTY 47
MNOCALLS.DLL 2,8,10,58
MNOCALLS.H 7-10
MNOCALLS.LIB 7-10
Requirements 4
- 59 -
INDEX
-----
MNOCONSL,
Using 53
Description 5
MNOCONSL.EXE 8
MNODRVR.SYS 2,6,10,58
MNOEXAMP,
MNOEXAMP.C 56
MNOEXAMP.EXE 56
MNOEXAMP.MAK 55-56
MNOEXAMX.CMD 55
MNOTEST,
MNOTEST.C 8
MNOTEST.EXE 4,6,7,9
MNOTEST.MAK 55
MNOTESTX.CMD 55
NMAKE 55
PATH 6,8
Registration 1
Royalty-free 10
Setup,
Dual Monitors 57
Organized 8
Simple 6
Source Code 1,4,54
STARTUP.CMD 53
SYMTYPES.H 7-10
Test Suite 4
Troubleshooting 58
VIO Documentation Sources 5
- 60 -