home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Assembly 1994 - The 3rd Phase
/
ASMROM94.mdf
/
sources
/
xlib06.txt
< prev
next >
Wrap
Text File
|
1994-11-12
|
60KB
|
1,656 lines
PART 1 of 2
-----------------------------------------------------------------------------
********* XLIB - Mode X graphics library ****************
********* ****************
********* Written By Themie Gouthas ****************
********* ****************
********* egg@dstos3.dsto.gov.au ****************
********* teg@bart.dsto.gov.au ****************
Some of the code in this library has been contributed by :
Matthew MacKenzie - matm@eng.umd.edu
and others. See individual modules.
I informally reserve all rights to the code in XLIB
Rights to contributed code is also assumed to be reserved by
the original authors.
-----------------------------------------------------------------------------
DISCLAIMER
This library is distributed AS IS. The author/s specifically disclaim
any responsibility for any loss of profit or any incidental, consequen-
tial or other damages.
---------------------------------------------------------------------------
INTRODUCTION
---------------------------------------------------------------------------
XLIB is a "user supported freeware" graphics library specifically designed
with game programming in mind.
It has been placed in the public domain for the benefit of all, and
represents *MANY* hours of work so it is requested that all users comply
with the the wishes of the author/s as specified in the individual modules
and:
a) To leave the code in the public domain
b) Not distribute any modified or incomplete versions of this library
New contribution and comments are welcome and hopefully there will be
more releases as the code evolves.
Finally, do not trust this excuse for a manual if in doubt, as this code has
undergone several revisions. The place to get the answers is in the code
itself.
REQUIREMENTS
Minimum requirements
286 processor,
Turbo C 2.0 or higher, or BORLANDC
MAKE 2.0 or higher
TLIB 2.0 or higher
Turbo Assembler 1.01 or higher
GENERAL FEATURES
Support for a number of 256 colour tweaked graphics mode resolutions
320x200 320x240 360x200 360x240 376x282 320x400 320x480 360x400 360x480
360x360 376x308 376x564
Please note that some of the new resolutions best suit monitors with
adjustable vertical height.
Virtual screens larger than the physical screen (memory
permitting) that can be panned at pixel resolution in all directions
A split screen capability for status displays etc.
Text functions supporting 8x8 and 8x14 ROM fonts and user defined fonts
Support for page flipping
Graphics primitives such as line and rectangle drawing functions and
of course bit block manipulation functions
MODULES COMPRISING XLIB
XMAIN - Main module containig mode setting code and basic functions
XPOINT - Pixel functions
XRECT - Filled Rectangle and VRAM to VRAM block move functions
XPAL - Palette functions
XLINE - Line Functions
XTEXT - Text and Font Functions
XPRINTF - Printf style string output
XPBITMAP - Planar Bitmap functions
XCBITMAP - Compiled Bitmap functions
XVBITMAP - Video Bitmap functions
XPBMCLIP - Clipped Planar Bitmap functions
XMAKEVBM - Support module for video bitmaps
XBMTOOLS - Bitmap format conversion tools
XDETECT - Hardware detection module
XFILEIO - File I/O functions
XRLETOOL - RLE encoding/decoding functions
XMOUSE - Mouse functions
XBEZIER - Bezier curve drawing
-------------------------------------------------------------------------
BUILDING THE LIBRARIES
-------------------------------------------------------------------------
Building the library had been made simple through the use of make.
To build and examples for one of the two models:
a) edit the makefile for the apropriate model (see note in the makefile)
b) edit the makefile for the apropriate compiler (again see note in the
makefile)
c) type "make" at the dos prompt.
It should be as simple as that. If problems are encountered then check
to see if tasm, make, tlib, link and bcc (or tcc) are withinin your path.
If not either change your path or specify the full path for these programs
in the makefile. It is preferrable to have your path set correctly.
Individual Compilation
----------------------
each ASM module can be compiled with the following commandline:
tasm /ml /d<model> <asm module name>
where <model> is s c or l. Where s = small model, c = compact model and
l = large model.
The resulting libraries are:
xlib<version>s.lib - small model library
xlib<version>c.lib - large model library
xlib<version>l.lib - large model library
To link the library with your programs just include the apropriate .lib
file in your project file or on the BCC or TCC command line.
Using the library with your programs
------------------------------------
Using the XLIB library in your programs is simple. Knowing the particular
modules you require, just include the associated header files in your program
and link your program modules with the library. If you don't want to wory
about selecting the apropriate header file then just include "XLIB_ALL.H"
which automatically includes all XLIB header files in your program.
For example compilations see the supplied makefile.
--------------------------------------------------------------------------
GLOBAL DEFINES (xlib.inc)
--------------------------------------------------------------------------
Types
BYTE unsigned char
WORD unsigned int
Available X mode resolutions
X_MODE_320x200 0
X_MODE_320x240 1
X_MODE_360x200 2
X_MODE_360x240 3
X_MODE_360x282 4
X_MODE_320x400 5
X_MODE_320x480 6
X_MODE_360x400 7
X_MODE_360x480 8
X_MODE_360x360 9
X_MODE_376x308 10
X_MODE_376x564 11
Palette rotation direction directiion
BACKWARD 0
FORWARD 1
X_MODE_INVALID -1
ERROR 1
OK 0
--------------------------------------------------------------------------
MODULE XMAIN
--------------------------------------------------------------------------
The Xmain module is the base module of the XLIB library. It contains the
essential functions that initialize and customize the graphic environment.
ASM SOURCES
xmain.asm xmain.inc xlib.inc model.inc
C HEADER FILE
xlib.h
EXPORTED VARIABLES
NOTE: All variables are read only unless otherwise specified. If you modify
them manually, the results may be unpredictable.
InGraphics - BYTE - Flag indicating that the xlib graphics system is
active. Set by function "x_set_mode".
CurrXMode - WORD - If the xlib graphics system is active, contains the id
of the x mode. Set by function "x_set_mode".
See also defines (ie X_MODE_320x200 ... )
ScrnPhysicalByteWidth - WORD - Physical screen width in bytes. Set by
function "x_set_mode"
ScrnPhysicalPixelWidth - WORD - Physical screen width in pixels. Set by
function "x_set_mode"
ScrnPhysicalHeight - WORD - Physical screen height in pixels. Set by
function "x_set_mode".
ErrorValue - WORD - Contains error value. General use variable to
communicate the error status from several functions. The value
in this variable usually is only valid for the the last
function called that sets it.
SplitScrnOffs - WORD - Offset in video ram of split screen. Set by
function "x_set_splitscrn". The value is only valid if a split
screen is active. See also global variable "SplitScrnActive".
SplitScrnScanLine - WORD - Screen Scan Line the Split Screen starts at
initially when set by function "x_set_splitscrn". The value is only
valid if a split screen is active. See also global variable
"SplitScrnActive".This