home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
ASSEMBLE
/
ASMWIN13
/
WINDOWS.DOC
< prev
Wrap
Text File
|
1989-01-24
|
4KB
|
103 lines
Module : WINDOWS.ASM - Assembly level windowing routines
Author : Thomas Hill
Version : 1.0
Date : 01/20/89
This is a set of assembly routines, written for use with Borlands TASM
assembler, which provides the primitive routines neede to manage windows
in assembly code.
Thanks to Dave Bennett for the underlying direct video routines "VIDEO.ASM",
also included in this archive file.
The following routines are provided:
---------------------------
InitWindows Prepare the window arrays, check for available DOS memory.
If DOS reports no avialable memory, then the routine returns
with the CARRY flag SET.
Note that InitWindows will save the current contents of the
screen into window #0. If your program calls EraseTopWin
just before exitting, the screen which was present at the
time the windows were initialized will be restored.
If you DO NOT do this, you will leave 4K of allocated
memory in the DOS memory chain which cannot be used.
---------------------------
MakeWindow - Create a window record in the array of possible windows.
Passed to the routine are the following:
AH - Top left row
AL - left column
BH - Number of rows
BL - Number of columns
CL - various flags:
Bit 0 = 1 Save the underlying screen
Bit 1 = 1 Frame the window
Bit 2 = 1 Clear the window
DH - Frame Attribute ( See VIDEO.INC for values)
DL - Background attribute for clear
DS:SI - Null terminated title for the window(20 chars max)
On return if CARRY is SET, something went wrong.
Otherwise a 'window handle' is returned in AL.
----------------------
DispWindow - Display a specified window.
This routine will display the requested window.
If the title specified for the window fits, and a frame
has been specified, the title will appear centered at
the top.
AL - Window handle
On return if CARRY is SET, something went wrong.
Otherwise, the requested window is displayed.
------------------------
EraseTopWin - Erases the 'top' window on the screen. If the
underlying screen was saved, it is restored.
The previously defined window is made active.
No input parameters
On return if CARRY is SET, something went wrong.
------------------------
WWriteStr - Write a null terminated string to the current window.
If the string is too long it will be clipped.
If the row,column starting point of the string is
'outside' the current window, nothing is written.
DS:SI - pointer to null terminated string.
AH - Row
AL - Col
BH - Attribute to use during write
On return if the string was not written,
the CARRY will be SET.
Some notes on usage here:
If you will examine the demo program, you will find a routine called
'ReSizeMem'. THis routine computes (roughly) the size of the program
and releases to DOS all unused memory. This is needed because the
windowing routines request their memory areas for screen saves from
DOS via the Allocate Memory Block call. If the memory is not released,
there is no memory to use for screen saves, and the windowing routines
will not work.
I did it this way because I didn't want to pre-allocate worst case sized
memory (4K per window). The method of requesting memory from DOS is
very much like the heap in PASCAL. A future version will attempt to
first get the memory areas from EMS memory, then try the DOS calls.
The code may not be the world's best, I wasn't aiming for super compact
or highest speed. The last time I worked in assembly was in the 8080/Z80
days, and I am out of practice. Give me time, I'll get better!