home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
beehive
/
utilitys
/
swdemo15.arc
/
SWIND1.ME
< prev
next >
Wrap
Text File
|
1991-08-11
|
9KB
|
229 lines
SWIND Windowing Library
Eugene Nolan
Copyright 1989, All rights reserved
***************
* What is it? *
***************
For changes from version 1.0, search for %%%
SWIND (Small WINDows) was developed to fill the need for a fast,
compact, PORTABLE mechanism offering basic 'windowing' capabilities
across a wide range of computer systems.
The basic design goals were speed, portability, device independence,
and device simplicity.
SWIND can be ported to any type of computer system that has a
good "C" compiler available. Included in this demo release are versions
for CPM and the IBM PC/XT/AT family. Besides the system 'dependence'
and 'critical' routines ( both described below ), the main source code
is identical for both of these systems.
SWIND makes very few demands upon the host system. All window
functions are contained within the library. There is no special
runtime environment, and the requirements of the display device are
merely clearing the screen and positioning the cursor. SWIND
provides the capability of using attributes on a displayed element,
but if the output device is not capable of attributes, that is ok
also.
SWIND interfaces to the host system thru a dependence routine that
is unique to each class of system it is run on. It is here that the
device specific functions are handled. This routine must provide an
entry point for:
1: Clearing the display
2: Position the cursor w/ display of element/attribute
3: Position the cursor
4: Display of element/attribute
Associated with the 'display of element' is the actual info to be
written to the display, along with it's attribute. It is the
responsibility of the dependence routine to manage the presentation
of the attribute to the display device. As an example, it would be
very expensive in I/O overhead on a serial/parallel device to 'set'
the attribute for each character, but rather to manage it on a 'has
it changed' basis, and if it has, to only then send the change to
the output device.
*********************
* How does it work? *
*********************
SWIND is written in the "C" language, with select routines coded
in assembler to provided enhanced operation, based upon the system
it is to be run on.
SWIND is NOT a terminal emulator written in "C", but rather a data
base manager whose resultant output is a visual image of the current
state of the data base.
The paragraph above on the interface to the host system talks
about display of element, but makes no restrictions on what an
'element' is. A definition of an element in SWIND is a single screen
position that can be uniquely addressed. In the Demo, that happens
to be configured as a character on a display device, but SWIND
itself does not set that restriction. The SWIND system itself has
the limitation of 32k elements, which should not pose itself as much
of a limitation (except on available memory!).
SWIND REQUIRES a fixed amount of storage for each window that will
be used. The minimum number of windows is two, and the maximum is
based upon the type of system it is to be used on.
For each window, three pieces of information are needed for each
display element: it's current value, attribute, and order of
precedence in display. See the information below on individual
systems to see how this information is stored.
SWIND reserves window 0 as a background. This window cannot be
re-sized or hidden, but all other operations are applicable.
*********************************
* Virtual Terminal Capabilities *
*********************************
Besides the basic window functions of position in display and
display of element, there is included in the SWIND library a set of
routines that provide a fairly sophisticated emulation of a terminal
type device that can be applied to a window.
This routine provides the following 'escape' codes:
1: Insert line
2: Delete line
3: Erase to beginning of line
4: erase to end of line
5: erase window
6: Set attribute value
7: Position cursor
8: Cursor up
9: Cursor down
10: Cursor left
12: Cursor right
13: Reverse line feed
And the following low level codes:
1: Carriage return
2: Line feed
3: Tab
4: Backspace
5: Delete character left
The 'escape' codes to implement these functions are the same
across all systems. This provides a generic virtual terminal whose
capabilities are identical no matter what machine the library is run
on.
***************************************
* Implementation on different systems *
***************************************
The basic implementation on different types of systems was based
upon such things as available memory, basic processor and and
operating system resources.
1: CPM 2.2 and it's compatibles.
--------------------------------
A Z80 compatible processor is required.
Compared with the mainstream machines of today, these systems
posed the most challenging aspect of the design. A usual non-banked
system has limited resources, the biggest being available memory. A
usual system with vanilla components ( CCP/BDOS/BIOS ) or one that
has been manually installed comes in with about 55k of TPA. With the
advent of the NZCOM system installation , this may drop in the range
of 52k ( may be higher, depending upon the level of sophistication
of the systems owner/installer).
The SWIND library routines are available in both Microsoft .REL
and SLR systems .REL format. There are no extra libraries required,
and the assembler to "C" interface is very straight foreword ( please
see examples in SWFTNS.ME ).
SWIND for CPM is auto-configuring as to terminal capabilities. If
it is run in a Z3 environment, the system TCAP is used, if not, a
user supplied imbedded TCAP is accessed.
%%% SWIND has been expanded to allow applications program to choose
between using the proposed TCAP with full business graphics support, or
defining the characters to use for border vertical/horizontal lines,
and corners. The selection is made by linking with a different
supplied library.
The basic modules for this type system are configured for a
terminal type device, IE: character oriented, with limited attribute
capabilities. This system requires two byte wide arrays for each
window, one holds the character data, and the other holds 5 bits of
info for attributes and 3 bits of info used for order of precedence
of display information.
This provides for up to 8 windows, with each window requiring 3840
bytes ( 80 col X 24 rows X 2 arrays).
There are seven critical internal routines coded in assembler. This
provides, in most operations, an I/O bounded system. SWIND can run
as fast as your terminal can accept the data, no matter how fast
your processor speed is.
SWIND uses 'smart' algorithms to keep the amount of I/O actually
performed to a minimum. This also provides for enhanced through-put.
2. IBM PC and compatibles
-------------------------
%%% SWIND has been expanded to allow applications program to
define the characters to use for border vertical/horizontal lines,
and corners.
SWIND is currently available in Microsoft C 5.1 .OBJ format. This
requires the application's developer to have access to this compilers
libraries to perform the link function.
The basic modules for this type system are configured to run on
any of MONO/CGA/EGA display adapters. This system can be configured for
either the two array ( as in CPM above ) or three internal byte wide
arrays, one holds the character data, one holds 8 bits of info for
attributes, and the third holds the order of precedence of display
information.
This provides for up to 256 windows, with each window requiring
6000 bytes ( 80 col X 25 rows X 3 arrays).
There are two critical internal routines coded in assembler. This
provides even more performance than that as available in max
optimized mode of the compiler.
There is also a dependence routine provided that supports an ANSI
type device thru one of the PC's serial ports.
3. Use on mini and/or systems
providing queued device drivers
-------------------------------
SWIND is also available in "C" source code form with a dependence
routine that provides internal and user routines with a method of
buffering output. This scheme substantially reduces the number of
operating system output requests required, with a substantial
increase in through-put.
%%% SWIND has been expanded to allow applications program to
define the characters to use for border vertical/horizontal lines,
and corners.
All internal routines that require more than a single output
function will automatically make the required dependence routine
calls to turn on buffering and the subsequent calls to display the
buffers built.