home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 19
/
CD_ASCQ_19_010295.iso
/
dos
/
prg
/
bas
/
asilib11
/
text.doc
< prev
Wrap
Text File
|
1994-10-22
|
28KB
|
836 lines
****************************** TEXT MODE *******************************
ASILIB Text mode video subroutines (C) Copyright 1994 Douglas Herr
All rights reserved
Screen writing in TEXT mode
ASILIB subroutines write directly to the video memory buffer, except
where noted. ASILIB detects the default display type and screen
dimensions. ASILIB assumes that CGA equipment requires "snow" control
and behaves accordingly. In text modes, ASILIB does not distinguish
between CGA and MCGA equipment.
Multiple pages of video memory are available except with MDA video adapters.
Pages supported by ASILIB are shown below:
video system screen size ASILIB support
------------- ----------- --------------
MDA 80 x 25 page 0
CGA, MCGA 80 x 25 pages 0 - 3
CGA, EGA, VGA 40 x 25 pages 0 - 7
EGA, VGA 80 x 25 pages 0 - 7
EGA 80 x 43 pages 0 - 3
VGA 80 x 50 pages 0 - 3
SVGA 132 x 25 pages 0 - 3
SVGA 132 x 44 pages 0 & 1
SVGA 132 x 50 pages 0 & 1
HGC, HGC+, InC 80 x 25 pages 0 - 15
HGC+, InC 90 x 25 pages 0 - 13
HGC+, InC 80 x 43 page 0
HGC+, InC 90 x 43 page 0
ASILIB subroutines assume that rows are the vertical dimension and
columns are the horizontal dimension of a text-mode screen. The upper
left corner of the screen is at row=1 and col=1
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
ANSICOLOR: determines color attribute used by ANSI device driver.
See also IsANSI.
Parameters: No input parameters; returns color attribute
Example:
call sub "ansicolor", colorattribute
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
BLINKOFF: disable blinking attributes; enable bright background attributes
BLINKON: enable blinking attributes; disable bright background attributes
Parameters: None.
Color attributes which specify a background color greater
than 7 will cause either blinking foreground characters or
a bright-color background, depending on whether "Blink" is
ON or OFF. BlinkON enables the blinking characters and
disables the bright background; BlinkOFF disables blinking
characters and enables bright-color backgrounds. This is
unlike ASIC, which does not permit bright backgrounds.
Restrictions: Cannot be used on selected portions of the screen. Works
with all monitors in Text mode; may also affect 16-color
graphics modes. Affects entire screen, all pages.
Example:
REM turn blinking attributes into bright background attributes
call sub "blinkoff"
REM turn bright background attributes into blinking attributes
call sub "blinkon"
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
BORDER: Change border color on CGA, EGA and VGA systems.
Parameters: colorattribute
EGA borders are quite thin. Valid color attributes are 0 - 15.
See COLORATTR for default colors.
Example:
REM blue border
REM assumes color palette was not changed
attr = 1
call sub "border", attr
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
CLEAREOL: clear from cursor position to end of line
Parameters: colorattribute
CLEAREOL clears from the cursor's current position to the
right edge of the screen using colorattribute.
Restrictions: On Hercules equipment, works only in text mode on page 0;
will not work with VGA13X graphics modes.
Example:
REM I want to clear from (5,10) to the right edge of the screen
REM with a BLACK color
cursorrow=5
cursorcolumn=10
colorattribute=0
call sub "cursoron", cursorrow, cursorcolumn
call sub "cleareol", colorattribute
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
CURSORCOLOR: set cursor color and enable color palette (InColor only)
Parameters: colorattribute
Colorattribute may range from 0 to 15; requires Hercules
InColor equipment. If colorattribute = 0, the cursor color
defaults to 7 (white). If Hercules InColor is not installed,
CURSORCOLOR does nothing.
Restrictions: works on Hercules InColor equipment only
Example:
REM Change cursor color to bright red
call sub "cursorcolor",12
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
CURSOROFF: make hardware cursor invisible at present location
Parameters: None.
Restrictions: Text mode only; supports CGA, MCGA, MDA, HGC, HGC+, InC,
EGA, VGA, SVGA
Example:
call sub "cursoroff"
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
CURSORON: move cursor to (row, col) and update cursor shape
Parameters: Row, Column
Row is the vertical dimension of the screen, starting at
the top of the screen = 1, and column is the horizontal
dimension of the screen, starting at the left edge = 1.
Cursor shape is underscore if INSERT is off, larger block
if INSERT is on.
Restrictions: Text mode only. Supports CGA, MCGA, MDA, HGC, HGC+, InC, EGA
VGA, SVGA
Example:
REM move cursor to left bottom of 80-column, 50-row screen
CursorRow=50
CursorColumn=1
call sub "cursoron", CursorRow, CursorColumn
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
COLORATTR: Calculate color attribute from foreground & background colors
Parameters: Fore, Back, Colorattribute
Calculates color attribute used by many ASILIB subroutines
from foreground and background attributes. Default
foreground colors are shown below:
foreground color Value
black 0 Note: Background colors 0-7 are
blue 1 identical to foreground colors 0-7.
green 2 Background colors 8-15 are identical
cyan 3 foreground color 8-15 if Blink has
red 4 been turned off. If blink is on,
magenta 5 background colors 8-15 will look like
brown 6 colors 0-7, and will make the foreground
"white" 7 blink.
gray 8
bright blue 9
bright green 10
bright cyan 11
bright red 12
bright magenta 13
yellow 14
bright white 15
Example:
REM determine color attribute for bright red foreground with
REM white background, no blinking
fore=12
back=7
call sub "colorattr", fore, back, colorattribute
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
FILLEOL: fill row from cursor position to edge of screen
Parameters: fill character, colorattribute
FILLEOL fills from the cursor's current position to the
right edge of the screen using colorattribute and specified
fill character
Restrictions: On Hercules equipment, works only in text mode on page 0;
will not work with VGA13X graphics modes.
Example:
REM I want to fill from (5,10) to the right edge of the screen
REM with a blue "*".
cursorrow=5
cursorcolumn=10
colorattribute=1
fillcharacter=ASC("*")
call sub "cursoron", cursorrow, cursorcolumn
call sub "filleol", fillcharacter, colorattribute
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
GETBORDER: determine border color on CGA, EGA and VGA systens
Parameters: no input parameters; returns color of screen border.
Color attributes returned by GETBORDER range from 0 to 15.
Example:
call sub "getborder", bordercolor
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
GETPOS: Get cursor position
Parameters: No input parameters; returns cursorrow, cursorcolumn
Uses BIOS functions to determine the current cursor position.
Similar to ASIC's col% = POS(x) and row% = CSRLIN commands,
but works with all text-mode screens sizes.
Example:
call sub "getpos", cursorrow, cursorcolumn
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
GETSCREEN: save a screen page to a memory buffer
PUTSCREEN: copy a saved screen page to the video buffer
Parameters: buffersegment, bufferoffset
Buffersegment is the segment part of the memory buffer's
address; bufferoffset is the offset part of the buffer's
address. You may use either an ASIC array or an ASILIB
memory block allocated by AllocDOS.
Restrictions: Text mode only.
Example:
REM allocate 4000 bytes for 80-column, 25-row screen
dim screenbuffer(2000)
REM save the screen
bufferoffset = VARPTR(screenbuffer(1))
call sub "asicds", buffersegment
call sub "getscreen", buffersegment, bufferoffset
.
.
.
REM some time later...
call sub "putscreen", buffersegment, bufferoffset
REM see also ScreenMem example
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
GETSCREENSIZE:determine screen dimensions
Parameters: No input parameters; returns screenrows, screencolumns
GETSCREENSIZE allows you to determine the screen's dimensions.
Rows are the vertical dimension and columns are the horizontal
dimension.
Example:
call sub "getscreensize", screenrows, screencolumns
REM with a standard 80 x 25 screen, getscreenrows returns screenrows = 25
REM and screencolumns = 80
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
HSCROLL: scroll a portion of the screen left or right.
Parameters: row0, col0, row1, col1, color, columns
(Row0, col0) are the coordinates of the upper left part of
the screen you want to scroll; (row1, col1) is the lower
right corner. Color = color attribute for cleared columns.
Columns is the number of columns scrolled left or right.
Scrolls left if columns > 0, scrolls right if columns < 0,
clears area if columns = 0.
Restrictions: Text mode only; any screen dimensions supported by ASILIB.
Example:
REM I want to scroll the entire screen area left 3 columns
REM assume 80-column, 25-row screen
REM use white-on-blue color attribute
colorattribute = &hex0107
call sub "hscroll", 1, 1, 25, 80, colorattribute, 3
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MODE43: switch EGA to 80x43 text mode or VGA to 80x50 text mode
Mode43 switches an EGA to the 80-column, 43-row text mode from
any color mode or any EGA monochrome mode, or switches a color
VGA to 80x50 text mode from any other color mode.
Parameters: None
Example:
call sub "mode43"
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MODECOLOR: switches system to color text mode; may be used to switch
monitors on a 2-monitor system, or to switch to the standard
80-column, 25-rows color mode from other color modes
Parameters: None
Example:
call sub "modecolor"
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MODEMONO: switches system to monochrome text mode; may be used either
to switch active monitors on a 2-monitor sysem or to switch
to monchrome text mode (80x25) from graphics mode (EGA or
Hercules).
Parameters: None
Example:
call sub "modemono"
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MOVEPOS: Move cursor position
Parameters: rowoffset, columnoffset
Moves the cursor from its present position by rowoffset rows
and columnoffset columns. Rowoffset and columnoffset may be
positive or negative.
Example:
rowoffset = -2 REM move the cursor up two rows
columnoffset = 0 REM same column
call sub "movepos", rowoffset, columnoffset
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
SETPOS: Set cursor location to row, column
Parameters: row, column
Positions the cursor at row, column. Similar to ASIC's
LOCATE row, column
command, but works with non-standard text screens. ASIC's
PRINT command will not work well beyond 25 rows.
Example:
call sub "hram9043" REM Hercules RAMFont 90-column mode, 43 rows
row = 40
column = 85
call sub "setpos", row, column
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
SCREENMEM: calculate bytes required to save screen page
Used with GetScreen and PutScreen.
Parameters: No input parameters; returns bytes& required to save screen.
Note that SCREENMEM returns a LONG integer (bytes&) so that
you can allocate the required space with AllocDOS. Requires
ASIC's extended math option.
Example:
call sub "screenmem", screenbytes&
call sub "allocdos", screenbytes&, blockseg
call sub "getscreen", blockseg, 0
.
.
.
REM some time later...
call sub "putscreen", blockseg, 0
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TCENTER: Print string directly to video buffer, centered horizontally
Parameters: TextToPrint$, screenrow, colorattribute
TextToPrint$ is a normal ASIC text string; Screenrow is
the row on the screen where you want the text to appear,
and Colorattribute is the color you want the text to be.
TCENTER calculates the correct column to center te string
on the screen.
Restrictions: Text mode only; any screen dimensions supported by ASILIB.
Example:
REM Center a warning message at the bottom of the screen. I already
REM know that the screen has been set in a 43-row Hercules RAMFont mode.
call sub "tcenter", warning$, 43,12
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TCLEAR: Clear entire screen
Parameters: colorattribute
Clears the entire screen using " " character and color as
specified by colorattribute.
Restrictions: Text mode only. Supports all ASILIB screen dimensions.
Example:
colorattribute = &hex0107
call sub "tclear", colorattribute
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TCOPY: copies one page of text-mode video memory to another page
Supports: all ASILIB text modes, pages 0 - 15; includes CGA snow control
Parameters: frompage, topage, errcode
Copies from frompage to topage.
returns errcode=0 if no problem
errcode=&hexFF00 if frompage out-of-bounds
errcode=&hex00FF if topage out-of-bounds
Example:
REM copy from page 0 to page 1
frompage=0
topage=1
call sub "tcopy", frompage, topage, errcode
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TFILL: Fill entire screen with specified character
Parameters: ASCIIcode, colorattribute
Fills the entire screen using the character specified by the
ASCII code and color as specified by colorattribute.
Restrictions: Text mode only. Supports all ASILIB screen dimensions.
Example:
colorattribute = &hex0107
ASCIIchar=ASC("$")
call sub "tfill", ASCIIchar, colorattribute
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TGETCHR: Get character and color attribute at specified screen
position.
Parameters: row, column, character, color attribute.
Determines what character and color attribute are at
(row, column). The character returned is the ASCII
character code, not a string.
Restrictions: Text mode only.
Example:
row = 14
column = 28
call sub "tputchr", row, column, character, colorattribute
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TPRINT: Print string directly to video buffer.
Parameters: TextToPrint$, screenrow, screencolumn, colorattribute
TextToPrint$ is a normal ASIC text string; Screenrow is
the row on the screen where you want the text to appear;
Screencolumn is the column on the screen where you want
the text, and Colorattribute is the color you want the
text to be. TPrint may be used to print on any part of
any text-mode screen; it is not limited to ASIC's 25-row,
80-column screen area.
Restrictions: Text mode only; any screen dimensions supported by ASILIB.
Example:
REM Print a warning message at the bottom of the screen. I already
REM know that the screen has been set in a 43-row Hercules RAMFont mode.
call sub "tprint", warning$, 43,1, 12
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TPRINTCE: Print string directly to video buffer, clearing to right edge.
Parameters: TextToPrint$, screenrow, screencolumn, colorattribute
TextToPrint$ is a normal ASIC text string; Screenrow is
the row on the screen where you want the text to appear;
Screencolumn is the column on the screen where you want
the text, and Colorattribute is the color you want the
text to be. TPRINTCE works just like TPRINT except that
the remainder of the row after the end of the string is
cleared to the right edge of the screen.
Restrictions: Text mode only; any screen dimensions supported by ASILIB.
Example:
See TPRINT.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TPUTCHR: Print a single character on the screen.
Parameters: row, column, character, color attribute.
Prints ASCII character on the screen at (row, column) using
specified color attribute. Note that character is the
ASCII character code, not a string.
Restrictions: Text mode only; any screen dimensions supported by ASILIB.
Example:
row = 14
column = 28
colorattribute = 12
character = ASC("!")
call sub "tputchr", row, column, character, colorattribute
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
VSCROLL: scroll a portion of the screen up or down.
Parameters: row0, col0, row1, col1, color, rows
(Row0, col0) are the coordinates of the upper left part of
the screen you want to scroll; (row1, col1) is the lower
right corner. Color = color attribute for cleared columns.
Rows is the number of rows scrolled up or down. Scrolls up
if rows > 0, scrolls down if columns < 0, clears area if
columns = 0.
Restrictions: Text mode only; any screen dimensions supported by ASILIB.
Example:
REM I want to scroll the entire screen area up 3 columns
REM assume 80-column, 25-row screen
REM use white-on-blue color attribute
colorattribute = &hex0107
call sub "vscroll", 1, 1, 25, 80, colorattribute, 3
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
WCLEAR: clear a rectangular portion of a text-mode screen
Parameters: row0, col0, row1, col1, colorattribute
(Row0, col0) are the coordinates of the upper left part of
the screen you want to clear; (row1, col1) is the lower
right corner. Color = color attribute for the cleared area.
Restrictions: Text mode only; any screen dimensions supported by ASILIB.
Example:
REM I want to clear from row 3, column 3 to row 20, column 62
REM using white-on-blue color attribute
colorattribute = &hex0107
call sub "wclear", 3, 3, 20, 62, colorattribute
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
WFILL: fill a rectangular protion of a text-mode screen with
specified character and attribute; variation of WClear
Parameters: row0, col0, row1, col1, colorattribute, asciicode
(Row0, col0) are the coordinates of the upper left part of
the screen you want to clear; (row1, col1) is the lower
right corner. Color = color attribute for the cleared area.
Asciicode is the ASCII character code for the character
you want to fill the area with.
Restrictions: Text mode only; any screen dimensions supported by ASILIB.
Example:
REM I want to fill from row 3, column 3 to row 20, column 62
REM using white-on-blue color attribute and character "*"
colorattribute = &hex0107
i = ASC("*")
call sub "wfill", 3, 3, 20, 62, colorattribute, i
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
WFRAME: draw a border around a part of a text-mode screen
Parameters: row0, col0, row1, col1, colorattribute, asciicode
(Row0, col0) are the coordinates of the upper left part of
the screen you want to draw a border around; (row1, col1) is
the lower right corner. Color = color attribute for the
border. Colorattribute is the color you want the border
to be. Asciicode is the ASCII character code for the character
you want to use for the border. There are 2 special border
types: if asciicode = 0, a single line is used, and if
asciicode = -1, a double line is drawn.
Restrictions: Text mode only; any screen dimensions supported by ASILIB.
Example:
REM I want to frame from row 4, column 4 to row 19, column 61
REM using white-on-blue color attribute and a single-lined border.
REM I need to draw the border OUTSIDE the area I want framed.
colorattribute = &hex0107
i = 0
call sub "wframe", 3, 3, 20, 62, colorattribute, i
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
WPAINT: replace all color attributes in a window of the screen
Any text or other information in the window will not be
changed; only the color is changed.
Parameters: row0, col0, row1, col1, colorattribute
(row0, col0) are the coordinates of the upper left corner of
the area you want to change, (row1, col1) are the coordinates
of the lower right corner of the are you want to change.
Colorattribute is the color you want the area changed to.
Restrictions: Text mode only; any screen dimensions supported by ASILIB.
Example:
REM I want to change the color from row 3, column 5 to row 20, column 60
REM to bright red on a blue background.
colorattribute = &hex010C
call sub "wpaint", 3, 5, 20, 60, colorattribute
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
WRECOLOR: change selected color attributes in a window of the screen
Parameters: row0, col0, row1, col1, oldcolor, newcolor
(row0, col0) are the coordinates of the upper left corner of
the area you want to change, (row1, col1) are the coordinates
of the lower right corner of the are you want to change.
Oldcolor is the color you want to be changed; newcolor is the
you want oldcolor in that window changed to.
Restrictions: Text mode only; any screen dimensions supported by ASILIB.
Example:
REM I want to change yellow-on-black color attributes from row 3, column 5
REM to row 20, column 60 to bright red on a blue background.
oldcolor = &hex000E
newcolor = &hex010C
call sub "wrecolor", 3, 5, 20, 60, oldcolor, newcolor
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
WRESTORE: restore a portion of a text-mode screen from a buffer
WSAVE: save a portion of a text-mode screen to a buffer
(handy when using pop-up windows on the screen)
Parameters: bufferseg, bufferoffset, row0, col0, row1, col1
Bufferseg is the segment address of the buffer you want to
use to save the screen portion. Bufferoffset os the offset
portion of the buffer's address. (row0, col0) are the
coordinates of the upper left corner of the screen window
and ((row1, col1) are the coordinates of the lower right
corner of the screen window. WSave and WRestore use the
same parameters; WSave copies from the screen to the buffer
while WRestore copies from the buffer to the screen.
Restrictions: Text mode only; any screen dimensions supported by ASILIB.
Example:
REM I'm going to pop up a message window on the screen so I want
REM to save the area of the screen where the message box is going
REM to be 'cuz I want to make the message box disappear as quickly
REM as it appeared.
call sub "wsize", row0, col0, row1, col1, bytes
longbytes& = bytes
call sub "allocdos", longbytes&, bufferseg
REM According to ASILIB documentation, memory blocks allocated with
REM AllocDOS start at bufferseg:0
REM thus bufferoffset = 0
bufferoffset = 0
call sub "wsave", bufferseg, bufferoffset, row0, col0, row1, col1
REM now the program does its thing to the screen and waits for the humanoid
REM staring at the screen to push either the "Y" or "N" key.
call sub "yesno", keycode
REM Having received an answer, the program may now clean up the screen.
call sub "wrestore", bufferseg, bufferoffset, row0, col0, row1, col1
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
WSIZE: calculate the memory required to save a screen window
Parameters: row0, col0, row1, col1, bytes
As with all other ASILIB text-mode Window subroutines, the
row and column coordinates define the corners of the window.
Bytes = the size of the buffer required to store this portion
of the screen.
Restrictions: Text mode only; any screen dimensions supported by ASILIB.
Example:
See example for WSave, WRestore.