Category : Recently Uploaded Files
Archive   : ASILIB12.ZIP
Filename : GRAPHICS.DOC

 
Output of file : GRAPHICS.DOC contained in archive : ASILIB12.ZIP

************************ ASILIB GRAPHICS ***********************************

ASILIB's graphics subroutines may be used with nearly every widely-
available graphics screen mode (see mode chart on next page). ASILIB
automatically configures itself for the graphics mode in use.

Locations on Graphics screens are defined by coordinate pairs such as (x,y).
X-coordinates are the horizontal dimensions of the screen, and Y-coordinates
are the vertical coordinates. X = 0 is the at the left edge of the screen,
and X = 719 is the right edge of a Hercules screen, while Y = 0 is the top
edge of the screen and Y = 347 is the bottom (Hercules). Thus, the
coordinate (719,0) is the upper right corner of a Hercules screen.

Note that for a graphics mode that allows 800 X-pixels and 600 Y-pixels,
the permissible values for X are 0 through 799 and for Y the permissible
values are 0 through 599. See mode chart on next page.

ASILIB also allows multiple screen pages to be used. This is handy for
storing one image while another is displayed, for drawing an image off-
screen while another is viewed, and for animation techniques. As with
pixel dimensions, with a graphics mode that permits 4 screen pages (for
example) the allowable page numbers are 0, 1, 2 and 3. See UseGPage,
ShowGPage, GPage and GCopy.

You may also use your own coordinate system with ASILIB graphics, similar
to using WINDOW with GWBASIC's graphics functions. See QWindow at the
end of this file.


Graphics modes supported by ASILIB are listed below, along with the
equivalent ASIC SCREEN command (if any) and the ASILIB subroutine to
switch to each mode:

ASILIB Screen size Colors Equipment ASIC
subroutine (X by Y by Pages) SCREEN command


HGraph 720 x 348 x 2 2 Hercules
HGraph0 720 x 348 x 1 2 Hercules
ScreenMode(&hex8) 720 x 348 (1) 2 Hercules

HGraph 720 x 348 x 2 16 Hercules InColor
HGraph0 720 x 348 x 1 16 Hercules InColor
ScreenMode(&hex8) 720 x 348 (1) 16 Hercules InColor

ScreenMode(&hex4) 320 x 200 x 1 4 CGA, EGA, MCGA, VGA SCREEN 1
ScreenMode(&hex6) 640 x 200 x 1 2 CGA, EGA, MCGA, VGA SCREEN 2
ScreenMode(&hex40) 640 x 400 x 1 2 ATT 6300
ScreenMode(&hexD) 320 x 200 x 8 16 EGA, VGA SCREEN 7
ScreenMode(&hexE) 640 x 200 x 4 16 EGA, VGA
ScreenMode(&hexF) 640 x 350 x 2 4 EGA, VGA (2)
ScreenMode(&hex10) 640 x 350 x 2 16 EGA, VGA (3) SCREEN 9
ScreenMode(&hex11) 640 x 480 x 1 2 MCGA, VGA
ScreenMode(&hex12) 640 x 480 x 1 16 VGA
ScreenMode(&hex13) 320 x 200 x 1 256 MCGA, VGA SCREEN 13
ScreenMode(&hex6A) 800 x 600 x 1 16 VESA SVGA
VGA13X(0) 320 x 200 x 4 256 VGA
VGA13X(1) 320 x 240 x 3 256 VGA
VGA13X(2) 320 x 400 x 2 256 VGA
VGA13X(3) 360 x 480 x 1 256 VGA
SVGA16(0) 800 x 600 x 1 16 SVGA
SVGA16(1) 1024 x 768 x 1 16 SVGA
SVGA256(0) 640 x 400 x 1 256 SVGA
SVGA256(1) 640 x 480 x 1 256 SVGA
SVGA256(2) 800 x 600 x 1 256 SVGA
SVGA256(3) 1024 x 768 x 1 256 SVGA

(1) ScreenMode(&hex8) permits 2 pages if no color monitor is present,
otherwise only 1 page is allowed.
(2) monochrome monitor only; EGA requires 256k for 2 pages.
(3) EGA with 128k or more memory; 256k required for 2 pages.

Many ASILIB Graphics subroutines can be configured to draw in a number of
ways: dots, lines or images can simply replace whatever had been on the
screen, or may be combined with the pre-existing screen:

draw mode = 0 XORs the text/pixel/line/whatever with the pre-existing
screen: if a pixel (x,y) is XORed to the screen, the pixel
will be turned on if previously off, or will be turned off
if previously on;

draw mode = 1 is normal; lines are drawn, pixels are turned on, text is
foreground-on-background, and the previous screen content
is ignored or obliterated;

draw mode = 2 similar to draw mode 1, but foreground color only is updated

draw mode = 3 ORs the line or block with the existing screen; this means
that the new stuff is added to the old.

draw mode = 4 ANDs a block (or fillbox) with the existing screen; within
the block's limits, only those pixels where both the
previous screen and the pattern in the block have ON pixels
will there be a resulting ON pixel;

draw mode = -3 similar to draw mode 3, but reverses the foreground and
background before combining it with the screen

draw mode = -2 similar to draw mode 2, but reverses the foreground and
background before combining it with the screen

draw mode = -1 like draw mode 1, but uses background color. In monochrome
modes, pixels are erased, text is black with a bright
background.

Use ASILIB's SetDrawMode subroutine to change drawing mode.


°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

BUFFERDIM: Change logical dimensions of graphics memory buffer
does not change number of pixels displayed on screen;
used with ScreenOrigin.
Modes supported: EGA and VGA 16-color modes to 800x600
VGA13x

Parameters: Xpixels, Ypixels, Pages

Note that the logical buffer dimensions should be greater
than the dimensions displayed on the screen. The logical
buffer dimensions must not create a plane size greater than
64k; in 16-color modes, a logical pixel width of 800 + logical
height of 600 works out to 60,000 bytes per plane. In VGA13x
modes the same dimensions result in a plane size of 120,000
bytes so this would not work.

If anything is displayed on the screen before changing
logical dimensions, it will be unreadable after calling
BufferDim if your logical x-dimension is not the same as
the screen's physical x-width.

BufferDim does no error checking; you must determine if
the computer has an EGA or VGA (see GetCRT in SYSTEM.DOC)
and you must verify that the logical dimensions are greater
than the screen dimensions.

Bufferdim re-calculate the number of pages available with
the new logical dimensions and returns the maximum page number
as Pages.

Example on next page
(BufferDim example)

REM The computer has a 256k EGA card & EGA-only monitor
REM and I want to display an image that is 800 pixels wide
REM and 600 pixels high.
REM I'll use EGA mode 10h, switch to logical dimensions of 800x600,
REM put the image in the video buffer & use ScreenOrigin to view
REM various parts of the image

fname$="800x600.pcx" REM a .PCX file with an 800 x 600 image

REM set up 640x350 16-color mode and re-dimension
REM the buffer
REM BufferDim should return pages = 0, because only page number 0
REM is available with there dimensions

SCREEN 9
call sub "bufferdim", 800,600,pages

REM program loads image to video buffer
call sub "loadpcx", fname$, errcode

REM default screen origin: (0,0) of buffer is at (0,0) of screen
REM change portion of buffer displayed to logical (100,100)
REM at (0,0) of screen
call sub "screenorigin", 100,100


°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

GETBITBLOCK: Copy a portion of the screen to system memory

Parameters: ramseg, ramptr, x0, y0, x1, y1


PUTBITBLOCK: Copy saved screen data from system ram

Parameters: ramseg, ramptr, x, y


BITBLOCKBYTES:calculate byte requirements to save bit block

Parameters: x0, y0, x1, y1, bytes&

Modes supported: All

GetBitBlock copies a section of the graphics screen to system
memory in order to copy the block back to the screen later
with PutBitBlock.

BitBlockBytes returns the number of bytes of memory required
store the entire pixel block. Note that bytes& is a long
integer, requiring ASIC's extended math option. After
calculating the bytes required, you may use ASILIB's AllocDOS
to allocate the memory space required. See AllocDOS in
SYSTEM.DOC. Note that bit block memory requirements can
be large. In 256-color modes, PutBitBlock clips bitblocks at
ASILIB's View boundaries.

drawing modes supported by PutBitBlock are:

All 256-color modes:
1 = replace existing screen area with bit block
2 = replace existing screen with non-zero pixels in bit block

HGraph (InColor):
4 = AND the bit block with the existing screen
3 = OR the bit block with the existing screen
1,2 = replace existing screen area with bit block
0 = XOR the bit block with the existing image
-1,-2 = replace existing screen area with inverse bit block

16-color EGA/VGA-type modes including SVGA16, and SCREEN 10:
same as InColor, plus:
-3 = OR the inverse bit block with the existing screen
-4 = AND the inverse bit block with the existing screen

SCREEN 1 and monochrome modes:
2 = combine non-zero pixels in the bit block with the
pre-existing image
1 = replace the existing screen image with un-altered
bit block
0 = XOR the bit block with the existing image
-1 = replace existing screen image with inverse bit block
-2 = combine non-zero pixel in the inverse bit block with
the previous screen image

See example on next page.

BIT BLOCK Example:


REM This example calculates the array size required,
REM dimensions the array, saves a portion of the screen and
REM restores it later.

REM start in the desired graphics mode
SCREEN 9
.
.
.
x0 = 100
y0 = 0
x1 = 400
y1 = 347

REM calculate bytes required to save bit block and allocate from
REM DOS memory space
call sub "bitblockbytes",x0, y0, x1, y1, bytes&
call sub "allocdos", bytes&, bbseg
if bbseg < 1 then nogood:
bbptr = 0

REM save the bit block
call sub "getbitblock",bbseg, bbptr, x0, y0, x1, y1
.
.
.
REM now we'll copy the block back to the screen
REM x2 and y2 may be any coordinates on the screen
call sub "putbitblock", bbseg, x2, y2

REM also release the memory block
call sub "freedos", bbseg, errcode



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

GETBITPLANE: Copy one plane of grapics screen to system RAM

Parameters: plane, ramseg, ramptr, x0, y0, x1, y1


PUTBITPLANE: Copy saved bit plane from system RAM to screen

Parameters: plane, ramseg, ramptr, x0, y0


BITPLANEBYTES:Calculate bytes required to save bit plane

Parameters: x0, y0, x1, y1, bytes&

Modes supported: All 16-color graphics modes
plus ScreenMode(&hexF)

GetBitPlane subroutines copy a section of the graphics screen
to a memory buffer in order to copy that block back to the
screen at a later time with PutBitPlane. This is similar to
the GetBitBlock/PutBitBlock subroutines, except that BitPlane
subroutines copy to or from only one of the four "planes" of
memory in 16-color modes. This is handy when you want to move
or modify only one plane at a time. The exact color
represented by each plane is determined by PALETTE or COLOR
statements.

BitPlaneBytes calculates the number of bytes of memory required
to save the desired portion of the plane. All PutBitBlock draw
modes work with PutBitPlane. You may use AllocDOS to allocate
memory space for the bit plane. Note that BitPlaneBytes, as
with BitBlockBytes, requires ASIC's extended math option.

Example on next page


Example:
REM calculate the array size required, allocate the memory,
REM save a portion of one plane of the screen and restores it later.
REM note that valid plane numbers are 0 - 3

REM First I need to establish graphics mode
call sub "screenmode", &hex10
.
.
x0 = 100: y0 = 0: x1 = 400: y1 = 347
call sub "bitplanebytes", x0, y0, x1, y1, bytes&
call sub "allocdos", bytes&, bpseg, errcode
plane = 0
ptr = 0
call sub "getbitplane", plane, bpseg, ptr, x0, y0, x1, y1
.
.
REM now we'll copy the plane back to the screen
call sub "putbitplane", plane, bpseg, ptr, x2, y2

°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

GCLEAR: Clear graphics screen.

Modes supported: All

Parameters: None.

GClear erases everything within the active viewport. In
color modes, the background color set by GColor is used. Use
SetView to establish the active viewport.

Example:

call sub "gclear"



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

COLOR16: Calculates a color value for 16-color palette

Supports EGA and VGA 16-color modes

Parameters: Red, green, blue, colorvalue

Color16 calculates a color value from individual red, green
and blue intensities, for changing the color palette in high-
resolution 16-color modes and 16-color text modes.
Used with Palette16. Red, green and blue range from 0 (off)
to 3 (highest intensity).

Example: see Palette16



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

COLOR256: returns a color value given red, green & blue intensities

Supports all VGA and SVGA 256-color modes

Parameters: red, green, blue, colorvalue&

Color256 returns a LONG INTEGER color value from individual
red, green and blue components for changing palette colors
in 256-color modes. Color256 changes the actual color
associated with a particular color attribute. With Color256,
red, green and blue color intensitites may range from 0 (off)
to 63 (highest intensity). Note that ASIC's Extended Math
option is required and that colorvalue& is a LONG integer.

Example: see Palette256

°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

DRAWBOX: Draw a box on the screen

Modes supported: All

Parameters: x0, y0, x1, y1

DrawBox draws a box with corners at (x0, y0), (x0, y1),
(x1, y0), (x1, y1). Legal draw modes are -1, 0, and 1.
If any part of the box lies outside the active graphics
viewport, that part of the box will not be drawn. See also
LinePattern.

Example:
call sub "hgraph"
x0 = 10
y0 = 10
x1 = 79
y1 = 38
call sub "drawbox", x0, y0, x1, y1



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

DRAWCIRCLE: Draw a circle on the screen

Parameters: xc, yc, Xradius

CIRCLEASPECT: Change circle's aspect ratio

Parameters: numerator, denominator

Modes supported: All

DrawCircle draws a circle on a graphics screen centered at
(xc, yc), with x-radius Xradius%. The circle's aspect ratio
may be changed with CircleAspect. Legal draw modes are -1,
0 and 1 with monochrome modes. In color modes, draw modes 2,
-2, 3 and -3 are also supported. Only the part of the circle
which lies within the viewport defined by SetView will be drawn.

CircleAspect changes the aspect ratio of the circle; using
CircleAspect, you can make the circle look like a flattened
ellipse or a tall ellipse. CircleAspect changes the Y-dimension
of the circle; the X-dimension is controlled with Xradius.
ASILIB's default is an aspect ratio of 1:1. CAUTION: extreme
aspect ratios are not supported by DrawCircle. With
numerator = 1, a maximum usable denominator% is 5, or else a
"divide by zero" error will occur. With denominator = 1, a
high numerator will cause unpredictable results.

Example:

call sub "drawcircle" xc, yc, Xradius




°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

DRAWLINE: Draw a line on the screen

Modes supported: All

Parameters: x0, y0, x1, y1

DrawLine draws a line from (x0, y0) to (x1, y1). Legal draw
modes are -4 through 4. See also LinePattern.

Example:

REM this draws a diagonal line across a Hercules screen
REM using ASILIB's current background color
x0 = 0
y0 = 0
x1 = 719
y1 = 348
call sub "setdrawmode", -1
call sub "drawline", x0, y0, x1, y1



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

FILLAREA: Fill contiguous irregular region on graphics screen

Modes supported: All

Parameters: x, y

FillArea fills irregularly-shaped areas enclosed by solid
lines. FillArea works best with SIMPLE areas; holes in the
area or areas with "inside" corners dividing horizontal lines
may not be filled properly. FillArea works by starting at the
seed pixel (x, y) and looking left and right for non-black
region boundaries, then filling horizontal lines between the
boundaries. FillArea works upward until the top of the area
has been reached, then returns to the seed pixel and works
downward. FillArea presently assumes draw mode = 1. If you
want to fill rectangular areas, FillBox is much faster than
FillArea.

Example:
call sub "hgraph"
.
.
.
REM for color modes
call sub "gcolor", attr

rem optional fill pattern
call sub "fillpattern" pattern$
call sub "fillarea", x, y



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

FILLBOX: Draw a filled box on the screen.

Modes supported: All

Parameters: x0, y0, x1, y1

Similar to DrawBox, FillBox uses the same coordinates, but
fills the box instead of drawing the sides. If draw mode = 1
or 2, an optional pattern may be used to fill the box (except
SCREEN 1). See FillPattern.

Example:
call sub "hgraph"
x0 = 10
y0 = 10
x1 = 79
y1 = 38

call sub "fillbox", x0, y0, x1, y1




°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

FILLPATTERN: Define non-solid fill pattern

Parameters: pattern$

Modes supported: 2-color and 16-color modes
ScreenMode (&hexF)

FillPattern defines an optional pattern used by FillBox if
draw mode >= 1, or by FillArea (which assumes draw mode = 1).
The bit patterns in the first 8 characters of pattern$ are
used to modify the fill in the box or area. If you want to
use a fill pattern, FillPattern must be called before each
call to FillBox or FillArea. See Examples.
FillBox will replace box borders. If you want the box to have
a solid outline, call DrawBox with draw mode = 1 after calling
FillBox. Using draw mode = 1, the pattern will completely
replace whatever was in the box. 16-color modes use draw
mode = 2.

Sample patterns, and what they produce:

REM squares
pattern$ = CHR$(255) + STRING$(5,32)

REM vertical lines
pattern$ = STRING$(8,32)

REM horizontal lines
pattern$ = CHR$(255) + STRING$(5,0)

Example on next page.

Example:
x0 = 10
y0 = 10
x1 = 79
y1 = 38

REM pattern for squares
REM fill box with pattern
pattern$ = CHR$(255) + STRING$(5,32)
call sub "fillpattern", pattern$
call sub "fillbox", x0, y0, x1, y1
.
.
.
REM no fill pattern because FillPattern was not called before FillArea
call sub "drawbox", x0, y0, x1, y1
call sub "fillarea", x, y

°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

GBASESEG: Re-direct ASILIB graphics subroutines to alternate buffer.

Modes supported: HGraph (monochrome only)
SCREEN 1,2,13
ScreenMode (&hex40)
ScreenMode (&hex11)

Parameters: Baseseg

Re-directs ASILIB's Graphics subroutines to an alternate
buffer at baseseg:0. This may be used to duplicate the
effect of multiple screen pages. GBaseSeg works only with
non-planar, non-bank switched modes. Baseseg is the segment
base address of the alternate buffer. ASILIB assumes that the
buffer begins at the start of the segment. If you call
GBaseSeg with baseseg = 0, the default video buffer becomes
active again.

Note that GBaseSeg will not work if you change graphics modes
after calling GBaseSeg.

Example on next page.


REM GBaseSeg example

REM load existing screen image to RAM buffer
call sub "fload"("screen13.gph", gpd, bytes&, errcode)

REM switch to graphics mode
SCREEN 13

REM after switching to graphics mode, tell ASILIB
REM where the off-screen buffer is
call sub "gbaseseg", gpd

REM modify the off-screen image as desired
call sub "gcolor", 10
call sub "drawline" 0, 199, 319, 0
call sub "gprint","This was printed to an off-screen buffer", 0, 60

REM switch back to video buffer and print a message
call sub "gbaseseg", 0
call sub "gprint", "press any key...", 0, 0
call sub "getkey",keycode

REM copy the modified alternate buffer to the video buffer
REM NOTE: Video buffer address and size vary depending on graphics mode:
REM
REM mode address size (bytes)
REM
REM SCREEN 1 &hexB800 16384
REM SCREEN 2 &hexB800 16384
REM HGraph &hexB000 32768
REM ScreenMode(&hex40) &hexB800 32768
REM ScreenMode(&hex11) &hexA000 38400
REM SCREEN 13 &hexA000 64000

bytes& = 64000
call sub "copymem", gpd, 0, &hexA000, 0, bytes&

REM release the alternate buffer 'cuz I'm all done with it
REM then wait for a keypress and exit
call sub "freedos", gpd, errcode
call sub "getkey",keycode
SCREEN 0
END


°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

GCOPY: Copy from one page of graphics video memory to another

Modes supported: HGraph (mono and InColor)
VGA13X (0 - 2)
SCREEN 7,9
ScreenMode (&hexD)
ScreenMode (&hexE)
ScreenMode (&hex10)

Parameters: frompage, topage, errcode

Several graphics modes support more than one screen page.
GCopy copies one page of graphics memory to another and returns
an error flag. Errcode = 0 if no error, or -1 if GCopy is not
supported or if either frompage or topage is out of range.
See also UseGPage, ShowGPage and GPage.

Example:

REM copy from page 0 to page 1

frompage = 0: topage = 1
call sub "gcopy", frompage, topage, errcode



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

GETDOT: Determine pixel color at specified screen location

Modes supported: All

Parameters: x, y, pixelcolor

Determines the color of the pixel located at (x, y). Returns
pixelcolor = -1 if (x,y) falls outside the active graphics
viewport.

Example:

x = 0: y = 0
call sub "getdot", x, y, pixelcolor
REM This will determine the color of the pixel at the upper left
REM corner of the screen.




°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

GCOLOR: Change color attribute used by ASILIB graphics subroutines

Modes supported: all modes with more than 2 colors

Parameters: attribute

Sets the color attribute to be used when ASILIB graphics
subroutines are used in color modes. Color attributes for
16-color modes may be calculated with ColorAttr (See TEXT.DOC).

In 4-color modes, valid color attributes are 0 through 3. In
16-color modes, valid attributes are 0 through 15. In
256-color modes, you may use color attributes 0 through 255.

The color actualy displayed for each color attribute is reset
to the hardware's defaults each time the screen mode is
changed, but may be altered by changing the color palette
associated with each attribute. See Palette16 and Palette256.



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

GCURSOR: Put a simulated text cursor on graphics screen
GUCURSOR: Put a simulated underscore text cursor on graphics screen

Modes supported: All

Parameters: Xpixel, Ypixel

GCursor subroutines put a text cursor on graphics screens
at the character box with upper left coordinates at (x, y).
GCursor and GUCursor subroutines are similar to ASILIB's
text-mode CursorON and UCursorON subroutines, except that
GCursor waits until a key has been pressed before returning
to the calling program. The key pressed may be determined
with ASILIB's input subroutines.

Example:

REM program fragment assumes the screen is in graphics mode

a$ = "I want a cursor at the 'I' at the start of this line"
x = 5: y = 3
call sub "gprint", a$, x, y
call sub "gcursor", x, y


°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

HGRAPH: Switch to Hercules graphics mode, 2 pages
HGRAPH0: Switch to Hercules graphics mode, 1 page

HTEXT: Switch to Hercules text mode

Parameters: None.

Requires Hercules (mono or InColor)

These subroutines change modes on the Hercules graphics card.
HText resets the active page to 0. HGraph clears the entire
video buffer; HGraph0 clears only page 0. You must first
determine if a Hercules or compatible is installed. (see
GetCRT in SYSTEM.DOC). With HGraph0, anything in graph
page 1 is undisturbed. A graph may be stored in page 1, the
system can be switched back to text mode for a while, and if
text pages 8 - 15 are not used, the graph may be restored
by calling "HGraph0" and "GCopy", (1, 0, errcode).

HGraph0 can also be used if text screens are stored in pages
8 - 15. As long as graph page 1 is not used, the text screens
will not be disturbed and can be restored with HText and TCopy.

If you are using Hercules graphics in a 2-monitor system, use
HGraph0. HGraph0 and HText will make the Monochrome monitor
the default; to use the color monitor, use the subroutine
ModeColor (See TEXT.DOC).

Example:
REM establishes Hercules Graphics mode
call sub "hgraph"
REM ASILIB graphics subroutines will work now
.
.
.
.
.
.

REM return Hercules system to text mode
call sub "htext"
.
.
.



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

GLOAD: Load a screen image from disk
GSAVE: Save a screen image to disk

Modes supported: All

Parameters: filename$, errcode

GLoad loads a Graphics screen from a file to the screen.
The file must have been previously saved by GSave. GLoad
and GSave load to or save from the active graphics page.
If no error occurred, errcode = 0. Errcode will be a DOS
error code if a file handling error occurs. See the
introductory remarks in DISK.DOC for DOS error codes.

NOTE: files created by GSave eat lots of disk space:

HGraph (mono) 32,768 bytes
HGraph (InColor) 131,072 bytes
VGA13X(0) 64,000 bytes
VGA13X(1) 76,800 bytes
VGA13X(2) 128,000 bytes
VGA13X(3) 172,800 bytes
XMode16 up to 240,000 bytes
VESA6A, SVGA16(0) 240,000 bytes
SVGA16(1) 393,216 bytes
SVGA256(0) 256,000 bytes
SVGA256(1) 307,200 bytes
SVGA256(2) 480,000 bytes
SVGA256(3) 786,432 bytes
SCREEN 1, 2 16,384 bytes
ScreenMode(&hex40) 32,768 bytes
SCREEN 7 32,000 bytes
ScreenMode(&hexE) 64,000 bytes
SCREEN 9 112,000 bytes
ScreenMode(&hexF) 56,000 bytes
ScreenMode(&hex11) 38,400 bytes
ScreenMode(&hex12) 153,600 bytes
SCREEN 13 64,000 bytes

Example:
filename$ = "bargraph.hgc"
call sub "gsave", filename$, errcode



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

GLOADEMS: Load a graphics screen from EMS memory to the video buffer.
Modes supported: All

GSAVEEMS: Save a graphics screen to EMS memory from the video buffer.
Modes supported: All

Parameters: emshandle, emserror

GSaveEMS calculates the screen's memory requirements and
allocates sufficient EMS memory to save the screen. The
handle required to re-load the screen and to release the
EMS memory is my GSaveEMS as emshandle. If any EMS errors
were detected, the error code is returned as emserror.

GLoadEMS copies the memory block associated with emshandle
to the video buffer. The screen must have been previously
saved by GSaveEMS. GLoadEMS and GSaveEMS load to or save
from the active graphics page. If no error occurred,
emserror = 0. See the introductory remarks in EMSXMS.DOC
for EMS error codes.

NOTE: uncompressed graphics screens eat lots of memory:

HGraph (mono) 32,768 bytes
HGraph (InColor) 131,072 bytes
VGA13X(0) 64,000 bytes
VGA13X(1) 76,800 bytes
VGA13X(2) 128,000 bytes
VGA13X(3) 172,800 bytes
SVGA16(0) 240,000 bytes
SVGA16(1) 393,216 bytes
SVGA256(0) 256,000 bytes
SVGA256(1) 307,200 bytes
SVGA256(2) 480,000 bytes
SVGA256(3) 786,432 bytes
SCREEN 1, 2 16,384 bytes
ScreenMode(&hex40) 32,768 bytes
SCREEN 7 32,000 bytes
ScreenMode(&hexE) 64,000 bytes
SCREEN 9 112,000 bytes
ScreenMode(&hexF) 56,000 bytes
ScreenMode(&hex11) 38,400 bytes
ScreenMode(&hex12) 153,600 bytes
SCREEN 13 64,000 bytes

Restrictions: You must call IsEMS before using these or any other EMS
subroutines.

Example on next page


Example:
call sub "IsEMS",emsflag
if emsflag = -1 then
call sub "gsaveems", emshandle, emserror
endif

REM later in the program...

call sub "gloadems", emshandle, emserror




°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

GLOADXMS: Load a graphics screen from XMS memory to the video buffer.
Modes supported: All

GSAVEXMS: Save a graphics screen to XMS memory from the video buffer.
Modes supported: All

Parameters: xmshandle, xmserror

GSaveXMS calculates the screen's mXMory requirements and
allocates sufficient XMS memory to save the screen. The
handle required to re-load the screen and to release the
XMS memory is my GSaveXMS as xmshandle. If any XMS errors
were detected, the error code is returned as xmserror.

GLoadXMS copies the memory block associated with xmshandle
to the video buffer. The screen must have been previously
saved by GSaveXMS. GLoadXMS and GSaveXMS load to or save
from the active graphics page. If no error occurred,
xmserror = 0. See the introductory remarks in EMSXMS.DOC
for XMS error codes.

See also GLoadEMS, GSaveEMS.

Restrictions: You must call IsXMS before using these or any other XMS
subroutines.

Example:
See GLoadEMS and GSaveEMS.


°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

GPAGE: Change active and visible graphics page

Modes supported: HGraph (mono and InColor)
VGA13X(0 - 2)
SCREEN 7
ScreenMode(&hexE)
ScreenMode(&hexF)
SCREEN 9 (256k EGA memory)

Parameters: page, errcode

GPage combines the function of UseGPage and ShowGPage; see
UseGPage and ShowGPage for further information.

Example:
call sub "gpage", page, errcode
REM this is equivalent to
REM call sub "usegpage", page, errcode
REM call sub "showgpage", page, errcode




°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

GPRINT: Print text on a graphics screen

Modes supported: All

Parameters: text$, x, y

GPrint offers much more flexibility than ASIC's PRINT command
when printing text on a graphics screen, and it's the only way
to print text with many ASILIB graphics modes. GPrint prints
a string of text anywhere on the screen in normal, reverse
video, XOR or "foreground only" modes.

The size of each character and the number of characters across
the screen depends on the graphics mode:

mode standard character size columns

HGraph 8 x 14 90
SCREEN 1, 7, 13 8 x 8 40
SCREEN 2 8 x 8 80
ScreenMode(&hexE) 8 x 8 80
SCREEN 4, 9,10,11,12 8 x 14 80
VGA13X(0-2) 8 x 14 40
VGA13X(3) 8 x 14 45
SVGA16(0) 8 x 14 100
SVGA16(1), SVGA256(3) 8 x 14 128
SVGA256(0 or 1) 8 x 14 80
SVGA256(2) 8 x 14 100

All ASCII characters may be used. x and y are the PIXEL
locations of the upper left corner of the first character.
SmallText, below, allows GPrint to use the smaller 8 x 8
character in Hercules, VESA6A, XMode16, SCREEN 9-12 and SVGA
modes. Legal drawmodes are -2, -1, 0, 1 and 2.

In modes with 8 x 8 characters, you must call SmallText
sometime before calling GPrint if you use characters greater
than CHR$(127).

To calculate how many rows of text a graphics screen can
display, divide maximum Y by pixel rows (i.e., a Hercules
screen can display 347/8 = 43 rows of text in SmallText mode).

Example:
st$ = "This is an example of text in graphics mode"
x = 10
y = 20
call sub "gprint", text$, x, y

°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

GPrintDOWN: Print text on a graphics screen, from top to bottom
GPrintUP: Print text on a graphics screen, from bottom to top

Modes supported: same as GPrint

Parameters: text$, x, y

GPrintUP rotates the string so that text reads from the bottom
of the screen to the top. This is useful for labeling the
vertical axis of a graph, among other things. GPrintDOWN reads
from the top of the screen to the bottom. These subroutines
use an 8 x 8 character box, allowing up to 43 characters from
the bottom of the screen to the top in Hercules mode. If you
are going to use characters greater than CHR$(127), you must
call SmallText some time in your program before calling
GPrintDOWN/UP. However, ASILIB does not need to be in SmallText
mode when you call GPrintDOWN or GPrintUP. All GPrint draw
modes are valid.

Example:
call sub "hgraph"

REM let GPrintUP know where to find character definitions > CHR$(127)

call sub "smalltext"
.
.
.
call sub "gprintup", text$, x, y



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

CALL SUB "GPrintX",st$, x, y
CALL SUB "GPrint2X",st$, x, y
CALL SUB "GPrintDOWNX",st$, x, y
CALL SUB "GPrintDOWN2X",st$, x, y
CALL SUB "GPrintUPX",st$, x, y
CALL SUB "GPrintUP2X",st$, x, y

GPrintX subroutines are similar to GPrint, GPrintUP and GPrintDOWN,
except each character in the string st$ is expanded to twice its normal
horizontal size before printing it on the screen; this is handy for graph
headings. GPrint2X subroutines expand each character horizontally and
vertically; all graphics modes and draw modes supported by GPrint work
fine with these expanded character subroutines. See GPrint for example.



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

LinePattern: Define an optional pattern for lines drawn by DrawLine
Modes supported: All

Parameters: pattern$

LinePattern passes a string of characters of up to 8 bytes to
ASILIB's DrawLine and DrawBox subroutines. The pattern of
bits in pattern$ modify lines so that they are drawn as a
series of dots and/or dashes instead of as a solid line.
Lines drawn with a pattern will be slower than those drawn
without a pattern. In order to use pattern$, the draw mode
must be greater than zero. On monochrome screens, only draw
modes 1 and 2 are useful. LinePattern must be called before
each call to DrawLine or DrawBox if it is to work.

Draw modes have the following effects:

1 = both foreground and background colors are
drawn, obliterating underlying pixels
2 = foreground only replaces pre-existing pixels.
3 = foreground is ORed with pre-existing pixels
4 = foreground is ANDed with pre-existing pixels.

Example:
pattern$ = SPACE$(8)
call sub "linepattern", pattern$
call sub "drawbox", x0, y0, x1, y1


°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

LOADPCX: Reads and displays a .PCX-format file

Parameters: filename$, errcode

LOADPCX reads the file filename$ and displays the decoded
image on the screen. LOADPCX does not attempt to determine
the appropriate screen mode for the image; your program
can do that using ASILIB's PCXINFO subroutine. Returns with
opps <> 0 if a file error occurred.

Example:

REM horiz is the horizontal resolution of the screen
REM this is 640 for many EGA/VGA 16-color modes

REM vert is the vertical resolution of the screen
REM this is 350 for SCREEN 10 and 480 for SCREEN 12

REM colors is the number of colors encoded in the .PCX file
REM planes = 1 for SCREEN 1, 2 & 13, 4 for all 16-color modes
REM xpix is the number of horizontal pixels in the image
REM ypix is the number of vertical pixels in the image

name$ = "\pcx\demo.pcx"
CALL sub "pcxinfo", name$, horiz, vert, colors, planes, xpix, ypix, oops)

b = &hex12 ; assume VGA 640 x 480
if ypix <= 350 then b = &hex10 ; use 640 x 350 if smaller image
if colors = 256 then b = &hex13 ; SCREEN 13 if 256 colors
call sub "screenmode",b
call sub "loadpcx", name$, pcxerror

REM etc.



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

SCREENMODE: Change screen mode

Parameters: modenumber

ScreenMode allows graphics or text mode to be set, bypassing
ASIC's SCREEN command. ScreenMode also allows you to use VESA
mode &hex6A, which is supported by ASILIB's graphics (or use
SVGA16 for other high-resolution 16-color modes).

The modenumber parameter is the BIOS mode number for the
screen mode (except Hercules - ASILIB uses the Microsoft
convention of &hex8 for Hercules since no BIOS mode number
exists for Hercules).

BIOS mode numbers and the equivalent ASIC SCREEN numbers are:

BIOS number equipment SCREEN number

&hex3 CGA, MCGA, EGA, VGA SCREEN 0 (text mode)
&hex4 CGA, MCGA, EGA, VGA SCREEN 1
&hex5 CGA, MCGA, EGA, VGA SCREEN 1
&hex6 CGA, MCGA, EGA, VGA SCREEN 2
&hex7 Monochrome, Hercules SCREEN 0 (text mode)
EGA Monochrome
&hex8 Hercules, InColor
&hex40 ATT 6300
&hexD EGA, VGA SCREEN 7
&hexE EGA, VGA
&hexF EGA, VGA (monochrome)
&hex10 EGA, VGA SCREEN 9 128k+ memory
&hex11 MCGA, VGA
&hex12 VGA
&hex13 MCGA, VGA SCREEN 13
&hex6A VESA SVGA

NOTE: ScreenMode is NOT intended for switching between a
color monitor and a monochrome monitor. Use ModeColor and
ModeMono for monitor switching.

°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

SCREENORIGIN: control position of re-sized video buffer on screen
see also BufferDim
Supports: EGA/VGA 16-color modes re-sized with BufferDim
VGA13x modes re-sized with BufferDim

Parameters: xorigin, yorigin

Xorigin and yorigin are the coordinates of the logical
video buffer to be displayed at upper-left corner of screen.

Example: see BufferDim


°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

PALETTE16: Change color associated with color attribute

Supports: EGA and VGA 16-color modes

Parameters: attribute, colorvalue

PALETTE16 changes the actual color associated with a particular
color attribute. If you call PALETTE16 with attribute and
colorvalue both equal to -1, the default colors will be
restored. PALETTE16 works in EGA and VGA 16-color modes,
except modes &hex0D and &hex0E. See also COLOR16.

Example:

REM I want to use a color with low-intensity red
REM and high-intensity blue
red = 1
blue = 3
green = 0
call sub "color16", red, green, blue, colorvalue

REM I'll use color attribute 8 for this color
call sub "palette16", 8, colorvalue



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

PALETTE256: Change color associated with color attribute

Supports: 256-color modes

Parameters: attribute, colorvalue&

Similar to PALETTE16, PALETTE256 changes the actual color
displayed by a specified color attribute. Colorvalue& may
be calculated from individual red, green and blue intensities
using COLOR256. Note that colorvalue& is a long integer and
that ASIC's extended math option is required.

Restrictions: Requires ASIC's extended math option; 256-color modes only

Example:

red = 63 REM brightest red
green = 10 REM not much green
blue = 32 REM medium blue intensity

call sub "color256", red, green, blue, colorvalue&

REM I'll use color attribute 48 for this color
call sub "palette256", 48, colorvalue&



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

PCXINFO: determine vital data about a .PCX-format file

Parameters: (input) filename$
(output) horiz, vert, colors, planes, xpix, ypix, errcode

Reads vital data from the header of a .PCX-format file.
From this data you may determine whether you can use the
image or what screen mode will work best.

Example: see LOADPCX



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

PUTDOT: Write one pixel on graphics screen

Modes supported: All

Parameters: x, y

Sets the pixel at (x, y) according to the specified draw mode
and current GColor. In monochrome modes, legal draw modes are
-1, 0, and 1. Color modes may use draw mode -4 through 4.
Coordinates outside the active graphics viewport are ignored.

Example:
x = 10
y = 10
call sub "putdot", x, y



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

CALL SUB "ScreenDump", (errcode)

Modes supported: HGraph (mono)

Prints the active graphics screen on a graphics printer (Epson MX,
FX, RX; IBM Graphics Printer, IBM ProPrinter, and compatibles).
ScreenDump can be stopped with the ESC key. If this occurs, errcode = 27
is returned (27 is the ASCII character code for the ESC key). If the
computer is not in Hercules graphics mode, errcode = -1. If all went
well, errcode = 0. Use PrinterReady (EQUIP.DOC) to see if the printer is
ready.

Example:
CALL SUB "ScreenDump", (errcode)
errormsg$ = ""
IF errcode = -1 THEN errmsg$ = "Not Hercules mode"
IF errcode = 27 THEN errmsg$ = "Printing stopped"
IF errorcode <> 0 THEN
PRINT errmsg$
ENDIF



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

SHOWGPAGE: Select displayed page of graphics memory

Modes supported: HGraph (mono and InColor) pages 0 and 1
SCREEN 7 pages 0 through 7 (256k EGA memory)
SCREEN 9 pages 0 and 1 (256k EGA memory)
ScreenMode(&hexE) pages 0 through 3 (256k EGA memory)
ScreenMode(&hexF) pages 0 and 1 (256k EGA memory)
VGA13X(0) pages 0 through 3
VGA13X(1) pages 0 through 2
VGA13X(2) pages 0 and 1

Parameters: gpagenumber, errcode

ShowGPage changes the graph page visible on the screen.
This can be handy for animation or for storing one graph
while another is displayed. If gpagenumber is too large
for the default mode, errcode = -1. See also GPage.

Example:
REM establish Hercules graphics mode
REM allow 2 pages in graphics mode
call sub "hgraph"
call sub "use64k"

.
.
.
REM now put a graph in the second page
gpagenumber = 1
call sub "usegpage", gpagenumber, errcode

.
.
.
REM let's look at graph 1 now that it's complete
gpagenumber = 1
call sub "showgpage", gpagenumber, errcode

.
.
REM restore default output page
REM and look at graph 0
gpagenumber = 0
call sub "gpage", gpagenumber, errcode




°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

CALL SUB "ShowGPlane",(plane, errcode)

Modes supported: all 16-color modes
ScreenMode(&hexF), planes 0 and 2

EGA and VGA memory in 16-color modes is arranged in 4 parallel
"planes". The 16 colors available when all planes are visible result
from a combination of the data bits in each plane at each data address.
The planes, numbered 0, 1, 2 and 3, each control a single color. With
the default palette, plane 0 is blue, plane 1 is green, plane 2 is red
and plane 3 is "intensity". A pixel that appears bright blue in the
screen represents pixels at identical locations in the Blue and Intensity
planes. (Note that the actual colors each plane represents may change
depending on the use of COLOR and PALETTE statements). If ShowGPlane
doesn't work in the active mode, errcode is returned = -1.

The plane parameters are:

plane 0 plane = 1
plane 1 plane = 2
plane 2 plane = 4
plane 3 plane = 8

Use ASIC's OR operator to show more than one plane; i.e., to
show only planes 0 and 3, plane = 1 OR 8. To restore normal output,
plane = 1 OR 2 OR 4 OR 8.

Example:
CALL SUB "ShowGraphPlane",(plane, errcode)




°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

SETVIEW: Change active portion of screen
GETVIEW: Determine active portion of screen

Modes supported: All

Parameters: (x0, y0) = upper left corner
(x1, y1) = lower right corner

SetView establishes the active viewport on the active graphics
page. Most ASILIB graphics subroutines limit their output to
the active viewport. GetView returns the viewport coordinates
presently active. ASILIB's default viewport is the entire
graphics screen. If SetView is called with coordinates outside
legal bounds (for example, if x1 = 1000), SetView limits the
coordinates to the bounds for the active graphics mode (or to
Hercules bounds if the system is either not in graphics mode
or in an unsupported mode). This SetView feature is handy for
clearing out old view data or for establishing the entire
screen as the viewport when the exact limits are variable
(such as when using BufferDIM).

Example:
call sub "setview", x0, y0, x1, y1



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

SMALLTEXT: force GPRINT to use 8x8 character font
STDTEXT: force GPRINT to yse 8x14 character font

Modes supported: HGraph (mono and InColor)
VESA6A, XMode16, SVGA16, SVGA256
SCREEN 3,9,10,12

GPrint may be set to use a smaller 8 x 8 character,
which allows up to 43 rows of text in Hercules graphics
mode, where StdText (ASILIB's default) results in a maximum
25 rows of text. Once SmallText is called, GPrint will print
8 x 8 text until the 8 x 14 character is restored with StdText.
8x8 and 8x14 text may be mixed on one screen.

Example:
call sub "hgraph" REM establish Hercules graphics mode
call sub "smalltext" REM sets GPrint to use small text
call sub "gprint" a$, x0, y0


°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

VGA13X: Extended 256-color VGA modes

Requires VGA or better

Parameters: modenumber

Provides extended VGA 256-color modes. I have used these
modes on PS/2 computers and with a variety of other VGA cards;
it should be compatible with most VGA systems. VGA13X modes
provide up to twice the resolution of SCREEN 13, or up to 4
pages with resolution identical to SCREEN 13.

VGA13X modes are:

horizontal pixels vertical pixels pages

VGA13X(0) 320 200 0, 1, 2, 3
VGA13X(1) 320 240 0, 1, 2
VGA13X(2) 320 400 0, 1
VGA13X(3) 360 480 0

Example:
REM make sure we're running on a VGA system
call sub "getcrt", crt
if crt = 3 then
REM 2-page mode
call sub "vga13x", 2
else
print "Vga modes not available"
end if
.
.
.
REM all done with graphics, go back to text mode

REM 80 x 25 text mode
call sub "screenmode", 3

REM clear ASILIB's internal flags
call sub "xmodeclear"




°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

SetDrawmode: changes default ASILIB graphics operations

Parameters: drawmode

See introductory remarks in this GRAPHICS.DOC

°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

SVGA16: 16-color SVGA modes

Parameters: modenumber, errcode

SVGA16 sets most super VGA boards in either a 1024x768 16-color
mode (modenumber = 1) or an 800x600 16-color mode (modenumber
= 0). Boards supported are:

Ahead Technologies
ATI
Chips & Technologies
Everex
Genoa GVGA
NCR
Oak Technologies
Paradise (Western Digital)
Trident
Trident 8900
Tseng (Genoa, Orchid, Willow)
Tseng 4000
VESA standard
Video 7

SVGA16 returns errcode = -1 if the requested mode is not
available on your equipment, errcode = 0 if successful.

Most ASILIB subroutines may be used with SVGA16 modes.
See documentation for each subroutine.

ASILIB's SVGA subroutines are derived from John Bridges'
public domain VGAKIT board identification and bank switching
code.

Example:

REM Use SVGA mode if available, mode &hex12 otherwise
call sub "svga16", 1, errcode
if errcode = -1 then
call sub "screenmode", &hex12
end if



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

SVGA256: 256-color SVGA modes

Parameters: modenumber, errcode

SVGA256 is similar to SVGA16, but sets one of several 256-color
modes. Modes available are:

modenumber = 3: 1024x768
modenumber = 2: 800x600
modenumber = 1: 640x480
modenumber = 0: 640x400

Equipment supported is listed under SVGA16, plus:

Compaq (640x480 only)

!! DO NOT USE ANY I% VALUES OTHER THAN 0, 1, 2 & 3 !!

SVGA256() returns errcode = -1 if the requested mode is not
available on your equipment; errcode = 0 if successful.

Most ASILIB graphics subroutines may be used with SVGA16 modes.
See documentation for each subroutine.

ASILIB's SVGA subroutines are derived from John Bridges' public
domain VGAKIT board identification and bank switching code.

Example:

REM Use SVGA mode if available, VGA13X mode otherwise
call sub "svga256", 3, errcode
if errcode = -1 then
call sub "vga13x", 3
endif



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

USE32K: Hercules memory management; restrict to 1 page
USE64K: Hercules memory management; allow 2 pages

Requires Hercules (mono or InColor)

Parameters: None

USE32K masks the second 32k block of Hercules memory out of the
memory map. If the second 32k is included in the memory map,
ASILIB's video routines can use all Hercules screen pages.
The second 32k of Hercules video memory conflicts with most
color monitors' address space, so USE32K should be used to
mask the second 32k out of the memory map for two-monitor
systems. USE64K allows the second block. ASILIB's default is
USE32K. You MUST call USE64K if you want to use graphics
page 1 with Hercules systems.

Example:
call sub "getcrt", crt
if crt >= 128 then call sub "use64k"



°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

CALL SUB "UseFont", (fseg, fptr, points, bytes)

Supports: all graphics modes with maximum Y > 200

UseFont permits use of non-standard fonts with GPrint, GPrintX, GCenter
and GCenterX. The font you wish to use must be somewhere in memory,
either "hardwired" into your program or loaded from a disk file.

Parameters used when calling UseFont are:

fseg = segment address of character definition data
fptr = offset address of character definition data
points = height of each character on screen (in pixel rows)
bytes = byte interval from the start of one character definition
to the next

ASILIB's GPrint subroutines assume that each character in the font is
8 pixels wide.
To use character widths other than 8 pixels, use FontWidth.
This can be used not only to print properly spaced characters in a
font less than 8 bits wide, but may also be used to add extra space
between characters in a string. Note that the character definition
data still needs to be 8 bits wide; FontWith's pixel width parameter
tells GPRINT how much space to leave between characters.

Example:
REM I want to use the italic font supplied by Hercules with the
REM InColor Card and Graphics Card Plus. All Hercules font files
REM have a byte interval of 16, even for those fonts which are
REM less than 16 points high.

REM load font file into far memory
filename$ = "C:\RAMFONT\ITALICS.FNT"
CALL SUB "FLoad" (filename$, fseg, bytes&, errcode)
fptr = 0 ' Hercules font definitions begin
' at the start of the file
points = 14 ' 14-point font
bytes = 16
CALL SUB "UseFont", (fseg, fptr, points, bytes)
CALL FontWidth(10) REM add extra space

REM GPrint will now use italics font until SmallText or StdText is
REM is called, or until UseFont is called with another font definition
REM Once you are done with the font, release the far memory with
REM CALL FreeMem (fseg)


°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

CALL SUB "ForceGMode",(modenumber)
CALL SUB "DefGMode"

ForceGMode forces ASILIB's graphics subroutines to use a particular
graphics mode whether the system is in that mode or not. This is handy
when you want to create an image in an off-screen buffer or on the
computer's 2nd monitor while the primary monitor is in text mode.
DefGMode causes ASILIB to use the algorithms for the system's active
graphics mode. Mode numbers used with ForceGMode are the same as those
used by ScreenMode.

Example:

REM use Hercules graphics
CALL SUB "ForceGMode",(&hex8)
.
.
.
CALL SUB "DefGMode"


°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

CALL SUB "UseGPage", (gpage, errcode)

Modes supported: HGraph (mono and InColor) pages 0 and 1
SCREEN 7 pages 0 through 7 (256k EGA memory)
SCREEN 9 pages 0 and 1 (256k EGA memory)
ScreenMode(&hexE) pages 0 through 3 (256k EGA memory)
ScreenMode(&hexF) pages 0 and 1 (256k EGA memory)
VGA13X(0) pages 0 through 3
VGA13X(1) pages 0 through 2
VGA13X(2) pages 0 and 1

UseGPage changes the screen page used by ASILIB's graphics
subroutines. ASILIB's default gpage is 0. If multiple pages are not
available for the current mode, or gpage is too big, errcode = -1.

Example:
CALL SUB "HGraph" REM establish Hercules graphics mode
REM HGraph calls Use64k
gpage = 1
CALL SUB "UseGPage", (gpage, errcode)
REM ASILIB's graphics subroutines use page 1 now