📄 window.doc
字号:
+------------------------------------+
| |
| ******************************** |
| * The IBM-PC WINDOWING library * |
| ******************************** |
| |
+------------------------------------+
A PC Character Based Windowing Library
for Stand-Alone 8086 applicatons
using MICRO-C.
Copyright 1989-2000 Dave Dunfield
All rights reserved.
DK86 WINDOWING LIBRARY Page: 1
1. IBM-PC WINDOWING Library
The MICRO-C WINDOWING LIBRARY is a set of powerful, very fast,
compact, text based windowing functions for use with the MICRO-C
compiler, on the IBM Personal Computer. Features of the library
include multiple open windows, overlaid windows with automatic
save/restore of screen underneath, scrolling within windows, optional
window borders, menu and form entry functions, and more.
The library is organized into two parts, the first is a set of
assembly language routines which provides the basic "low level"
functions to open/close windows, and to output data in them. The
second part of the library provides a set of 'C' functions which
provide "high level" functions such as menu and form entry, formatted
printing, etc.
To add these functions to the 8086 Developers Kit library (TINY
and SMALL) models, CD to the LIB86 directory, and use the following
commands:
cc86 winrtns -afop
slib i=tiny a=winrtns a=wprintf a=window
slib i=small a=winrtns a=wprintf a=window
I have compiled the window demonstration program from the standard
DOS compiler using the 8086 Developers Kit with these functions added
to its library. Run WINDEMO.COM to see the windowing functions in
action.
DK86 WINDOWING LIBRARY Page: 2
1.1 Window Control Block
Whenever a new window is opened, the windowing library sets up
a WINDOW CONTROL BLOCK (WCB) which contains information needed to
access and control the window. The format of the WCB is:
Offset: 0 - Current video attribute *
1 - Window flags (High 8 bits of w_open attrs) **
2 - Absolute 'X' position of top left corner of
active region. ***
3 - Absolute 'Y' position of top left corner of
active region. ***
4 - Width in characters of active region ***
5 - Height in characters of active region ***
6 - Current 'X' cursor coordinate
7 - Current 'Y' cursor coordinate
8,9 - Pointer to previous window buffer
10 - Previous cursor ENDING line
11 - Previous cursor STARTING line
12 - Previous cursor absolute 'X' position ****
13 - Previous cursor absolute 'Y' position ****
14..- Save area for SAVE/RESTORE function
* You may dynamically alter the video attribute of data
written to the window by writing to this byte.
** You may dynamically alter the properties of the window by
setting or clearing the flag bits with these exceptions:
-DO NOT enable SAVE/RESTORE unless opened with it
(It is Ok to disable SAVE/RESTORE).
-DO NOT change the state of the BORDER bits.
*** For windows opened with a BORDER, this reflects the size
of the active region (not including the border). Otherwise,
this is the size of the entire window.
**** For full screen window which does not SAVE/RESTORE, you can
set these values to zero to home cursor on exit.
DK86 WINDOWING LIBRARY Page: 3
1.2 External Variables
In addition to the functions decribed on the following pages,
the windowing library provides the following external variables
which may be accessed from within your 'C' program:
1.2.1 W_BASE
extern int W_BASE;
This variable contains the base address of the video screen,
which may be used to determine the type of display present:
B000 = Monochrome
B800 = Color
1.2.2 W_OPEN
extern char *W_OPEN;
This variable contains a pointer to the WCB for the "active"
window, and controls which window is manipulated by certain
library functions. This automatically set up by "wopen" to
point to the last window opened, but may be changed at any time
with:
W_OPEN = window;
NOTE, when the active window is closed, W_OPEN is reset to
point to the window which was active at the time that it (the
active window) was opened. If windows are closed in other than
the reverse order of which they were opened, W_OPEN may be left
pointing to a window which has already been closed. If this
happens, YOU MUST NOT USE THE "ACTIVE" WINDOW FUNCTIONS WITHOUT
RESETTING W_OPEN TO POINT TO AN OPEN WINDOW. It is your (the
programmer's) responsibility to insure that you know what
window will be accessed through W_OPEN at all times throughout
your program.
1.3 Window Library Functions
The following pages contain a description of each function
available in the IBM-PC windowing library.
WCLEOL WCLEOL
W_CLEOL W_CLEOL
PROTOTYPE:
wcleol()
w_cleol(char *window)
ARGUMENTS:
window - Pointer to WCB for an open window
RETURN VALUE:
None
DESCRIPTION:
The "wcleol" function clears the active window from the current
cursor position to the end of a line.
The "w_cleol" function clears the specified window fromt the
current position to the end of the line.
EXAMPLES:
wputs("Input> "); /* Display a prompt */
wcleol(); /* Clear remainder of input line */
WCLEOW WCLEOW
W_CLEOW W_CLEOW
PROTOTYPE:
wcleow()
w_cleow(char *window)
ARGUMENTS:
window - Pointer to WCB for an open window
RETURN VALUE:
None
DESCRIPTION:
The "wcleow" function clears the active window from the current
position to the end of the window.
The "w_cleow" function clears the specified window from the
current position to the end of the window.
EXAMPLES:
wgotoxy(0, 10); /* position at line 11 */
wcleos(); /* Clear lower part of screen */
WCLOSE WCLOSE
W_CLOSE W_CLOSE
PROTOTYPE:
wclose()
w_close(char *window)
ARGUMENTS:
window - Pointer to WCB for an open window
RETURN VALUE:
None
DESCRIPTION:
The "wclose" function closes the "active" window, and de-activates
it.
The "w_close" function closes the specified window, and
de-activates it.
If the window being closed is the "active" window, the "active"
window will revert to the window which was "active" at the time that
the window being closed was opened.
EXAMPLES:
wclose(); /* Close active window */
w_close(title); /* Close the title window */
WCLWIN WCLWIN
W_CLWIN W_CLWIN
PROTOTYPE:
wclwin()
w_clwin(char *window)
ARGUMENTS:
window - Pointer to WCB for an open window
RETURN VALUE:
None
DESCRIPTION:
The "wclwin" function clears the entire active window and resets
the cursor position to the top left hand corner.
The "w_clwin" function clears the entire specified window, and
resets the cursor position to the top left hand corner.
EXAMPLES:
if(c = 0x1b) { /* Escape command */
wclwin(); /* Clear the screen */
wputs("Exiting back to main menu");
return; }
WCURSOR_BLOCK WCURSOR_BLOCK
PROTOTYPE:
wcursor_block()
ARGUMENTS:
None
RETURN VALUE:
None
DESCRIPTION:
This function enables (turns on) display of the cursor on the IBM
PC video display. The cursor is shown as flashing block, occupying
the entire character window.
EXAMPLES:
if(insert) /* Test insert mode flag */
wcursor_block(); /* Indicate inserting with block cursor */
else
wcursor_line(); /* Indicate overwrite with line cursor */
WCURSOR_LINE WCURSOR_LINE
PROTOTYPE:
wcursor_line()
ARGUMENTS:
None
RETURN VALUE:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -