home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
beehive
/
utilitys
/
swdemo15.arc
/
SWFTNS1.ME
< prev
next >
Wrap
Text File
|
1991-08-11
|
18KB
|
691 lines
SWIND Windowing Library
Eugene Nolan
Copyright 1989, All Rights Reserved
Version 1.1 - Please see those items marked with a *** for changes
from version 1.0
This document provides a description of the different entry
points available in the SWIND windowing library and their associated
parameters.
All references to 'Returns:' are valid if the full error check version
of the library are used, otherwise all are void (none) if not.
--------------------------------------------------------------------
Function: WINIT
Purpose: Initialize the internal data base.
Parameters: None
Calling proc:
C Z80 assem 80XX(X) assem
void winit(); ld hl,2
call winit## call winit
Returns: None
--------------------------------------------------------------------
Function: WOPEN
Purpose: Create a window
Parameters: Window ID, Min X,Y Max X,Y, Border character and
attribute for border, default X,Y cursor position, Flags
to use for window (see 'Window Flags' below)
Calling proc:
C Z80 assem 80XX(X) assem
int wopen(pnt); ld hl,pnt mov ax,offset pnt
int *pnt; push hl push ax
ld hl,4 call wopen
call wopen## add sp,2
Returns: 0 = Success in HL in AX
1 = Bad ID
2 = Exists
Example: *** for MSDOS and CPM no business graphics
int *pnt,wind1[]={1, /* window ID */
10, /* Min X */
10, /* Min Y */
20, /* Max X */
20, /* Max Y */
0x7C2D, /* Border character vertical line high byte = '|'
Border character horizontal line low byte = '-'
set both bytes 0 for no border */
0x2B07, /* Border character for corners high byte = '+'
border attribute low byte */
0, /* Defualt X cursor position */
0, /* Default Y cursor position */
0x21 /* Window flags */
};
pnt=(int *)wind1;
pnt: dw 1,10,10,20,20,7c2dh,2b07h,0,0,21h
pnt dw 1,10,10,20,20,7c2dh,2b07h,7,0,0,21h
Example: *** CPM business graphics with new TCAP
int *pnt,wind1[]={1, /* window ID */
10, /* Min X */
10, /* Min Y */
20, /* Max X */
20, /* Max Y */
1, /* Non zero to display borders, 0 for no borders */
0x10, /* Bit 4 set to enable business graphics
0, /* Default X cursor position */
0, /* Default Y cursor position */
0x21 /* Window flags */
};
pnt=(int *)wind1;
pnt: dw 1,10,10,20,20,1,10h,0,0,21h
--------------------------------------------------------------------
Function: WINDEL ( *** Renamed from WDELET )
Purpose: Delete a window from the data base, freeing it up
for a subsequent new WOPEN. Will remove from
display all visible parts of the window.
Parameters: Window ID
Calling proc:
C Z80 assem 80XX(X) assem
int wdelet(id); ld hl,id mov ax,id
int id; push hl push ax
ld hl,4 call wdelet
call wdelet## add sp,2
Returns: 0 = Success in HL in AX
1 = Bad ID
2 = Not exist
--------------------------------------------------------------------
Function: WSELCT
Purpose: Make the given window the object of output that
follows. Selected window will be in exact state as
it was in before ( cursor will be positioned and
attributes set accordingly).
Parameters: Window ID
Calling proc:
C Z80 assem 80XX(X) assem
int wselct(id); ld hl,id mov ax,id
int id; push hl push ax
ld hl,4 call wselct
call wselct## add sp,2
Returns: 0 = Success in HL in AX
1 = Bad ID
2 = Not Exist
--------------------------------------------------------------------
Function: WHIDE
Purpose: Disconnect window from display preference list,
remove all displayable portions from screen.
Parameters: Window ID
Calling proc:
C Z80 assem 80XX(X) assem
int whide(id); ld hl,id mov ax,id
int id; push hl push ax
ld hl,4 call whide
call whide## add sp,2
Returns: 0 = Success in HL in AX
1 = Bad ID
2 = Not Exist
--------------------------------------------------------------------
Function: WUNHID
Purpose: Reconnect window to top of display preference
list. This window will now be on 'top' and 'selected'.
Parameters: Window ID
Calling proc:
C Z80 assem 80XX(X) assem
int wunhid(id); ld hl,id mov ax,id
int id; push hl push ax
ld hl,4 call wunhid
call wunhid## add sp,2
Returns: 0 = Success in HL in AX
1 = Bad ID
2 = Not Exist
--------------------------------------------------------------------
Function: WRESIZ
Purpose: Redefine the Min X,Y Max X,Y for window. Reconnect
window to top of display preference list. Now on
'top' and selected.
Parameters: Window ID, New Min X,Y Max X,Y.
Calling proc:
C
int wresiz(id,xmin,ymin,xmax,ymax)
int id,xmin,xmax,xmax,ymax;
Z80 assem
ld hl,ymax
push hl
ld hl,xmax
push hl
ld hl,ymin
push hl
ld hl,xmin
push hl
ld hl,id
push hl
ld hl,0ch
call wresiz##
80XX(X) assem
push ymax
push xmax
push ymin
push xmin
push id
call wresiz
add sp,0ah
Returns: 0 = Success in HL in AX
1 = Bad ID
2 = Not Exist
--------------------------------------------------------------------
Function: WSBCHR ( *** renamed from WBCHR )
Purpose: Redefine the character and attributes used for the
border. May be defined to 'none'.
Parameters: Window ID, Border character/attribute.
Calling proc:
C
int wbchr(id,chr,att) /* *** Chr and att as defined above
under WOPEN */
int id,chr,att;
Z80 assem
ld hl,att
push hl
ld hl,chr
push hl
ld hl,id
push hl
ld hl,08h
call wbchr##
80XX(X) assem
push att
push chr
push id
call wresiz
add sp,06h
Returns: 0 = Success in HL in AX
1 = Bad ID
2 = Not Exist
--------------------------------------------------------------------
Function: WSFLAG *** ( renamed from WSATTS )
Purpose: Set the 'flags' for given window.
Parameters: Window ID, flags
Calling proc:
C
int wsflag(id,flag)
int id,flag;
Z80 assem
ld hl,flag
push hl
ld hl,id
push hl
ld hl,06h
call wsflag##
80XX(X) assem
push flag
push id
call wsflag
add sp,04h
Returns: 0 = Success in HL in AX
1 = Bad ID
2 = Not Exist
--------------------------------------------------------------------
Function: WSATTS - *** New funtion
Purpose: Set the attributes used for character display in a given window.
Parameters: Window ID, attributes
Calling proc:
C
int wsatts(id,atts)
int id,atts;
Z80 assem
ld hl,atts
push hl
ld hl,id
push hl
ld hl,06h
call wsatts##
80XX(X) assem
push atts
push id
call wsatts
add sp,04h
Returns: 0 = Success in HL in AX
1 = Bad ID
2 = Not Exist
--------------------------------------------------------------------
Function: WCURPO
Purpose: Set the current window cursor position. Operation
dependent upon windows 'flags'.
Parameters: X,Y
Calling proc:
C
void wcurpo(x,y)
int x,y;
Z80 assem
ld hl,y
push hl
ld hl,x
push hl
ld hl,06h
call wcurpo##
80XX(X) assem
push y
push x
call wcurpo
add sp,04h
Returns: None
--------------------------------------------------------------------
Function: WGCURP
Purpose: Get the current window cursor position. Operation
dependent upon windows 'flags'.
Parameters: Address to place position
Calling proc:
C
void wgcurp(pnt)
int *pnt, xy[2];
pnt=xy;
wgcurp(pnt);
Z80 assem
pnt: dw 0,0
ld hl,pnt
push hl
ld hl,04h
call wgcurp##
80XX(X) assem
pnt dw 0,0
mov si,offset pnt
push si
call wgcurp
add sp,02h
Returns: None
--------------------------------------------------------------------
Function: WPUTCH
Purpose: Display the given character at current cursor
position, using current attributes. Cursor
position will be updated dependent upon windows
flags.
Parameters: Character
Calling proc:
C Z80 assem 80XX(X) assem
void wputch(chr); ld hl,chr push chr
int chr; push hl call wputch
ld hl,4 add sp,2
call wputch##
Returns: None
--------------------------------------------------------------------
Function: WVINIT ( in dependence routine )
Purpose: Initialize anything required to use the video
output.
Parameters: None
Calling proc:
C Z80 assem 80XX(X) assem
int wvinit(); ld hl,2 call wvinit
call wvinit##
Returns: 0 = Success in HL in AX
1 = Failure
--------------------------------------------------------------------
Function: WCLRSC ( in dependence routine )
Purpose: Clear the video display. This is a raw output and
is outside the windowing system control.
All data bases remain intact, physical display altered.
Parameters: None
Calling proc:
C Z80 assem 80XX(X) assem
void wclrsc(); ld hl,2 call wclrsc
call wclrsc##
Returns: None
--------------------------------------------------------------------
Function: WGOXY ( in dependence routine )
Purpose: Position the cursor to given screen position. This
is a 'raw' move, and is outside the windowing
system control.
All data bases remain intact, physical display altered.
Parameters: X,Y
Calling proc:
C
void wgoxy(x,y)
int x,y;
Z80 assem
ld hl,y
push hl
ld hl,x
push hl
ld hl,06h
call wgoxy##
80XX(X) assem
push y
push x
call wgoxy
add sp,04h
Returns: None
--------------------------------------------------------------------
Function: WCOUT ( in dependence routine )
Purpose: Display the given character with given attribute.
This is a 'raw' output and is outside the
windowing system control.
All data bases remain intact, physical display altered.
Parameters: Character in low byte, Attribute in high byte.
Calling proc:
C Z80 assem 80XX(X) assem
void wcout(chr); ld hl,chr push chr
int chr; push hl call wcout
ld hl,4 add sp,2
call wcout##
Returns: None
--------------------------------------------------------------------
Function: WGOXYC ( in dependence routine )
Purpose: Position the cursor and draw given character with
given attribute. This is a 'raw' output and is
outside the windowing system control.
All data bases remain intact, physical display altered.
Parameters: X,Y, character in low byte, attribute in high
byte.
Calling proc:
C
void wgoxyc(x,y,chr)
int x,y,chr;
Z80 assem
ld a,atts
ld h,a
ld a,chr
ld l,a
push hl
ld hl,y
push hl
ld hl,x
push hl
ld hl,08h
call wgoxyc##
80XX(X) assem
mov ah,atts
mov al,chr
push ax
push y
push x
call wgoxyc
add sp,06h
Returns: None
--------------------------------------------------------------------
Function: WCONOF *** ( in dependence routine )
Purpose: Turn cursor display on/off
Parameters: 0 = off, non-zero = on
Note: Only available under CPM proposed TCAP version
Calling proc:
C
void wconof(onoff);
int onoff;
Z80 assem
ld hl,onoff
push hl
ld hl,4
call wconof
--------------------------------------------------------------------
Function: WWAIT *** ( in dependence routine )
Purpose: Wait a specified amount of time
Parameters: Number of milli-seconds to wait
Note: Only available under CPM version with exact timings,
MS-DOS version get approximate timings
Calling proc:
C
void wwait(wtime);
int wtime;
Z80 assem
ld hl,wtime
push hl
ld hl,4
call wwait
80XX(X) assem
MOV ax,wtime
push ax
call wwait
add sp,2
--------------------------------------------------------------------
Function: WDOCHR
Purpose: Call to the 'virtual' terminal processing routine.
Parameters: Character
Calling proc:
C
p="\033G\001\001\033F\001Hello World\033F";
while(*p) wdochr(*p++);
wdochr(*p);
Z80 assem
t: db 1bh,'G',1,1 ; position the cursor to 1,1
db 1bh,'F',1 ; Turn highlighting on
db 'Hello World'
db 1bh,'F',0 ; turn highlighting off
t1 equ $-t
ld hl,t ; Point to data to output
ld b,t1 ; Number of bytes to output
next: ld e,(hl) ; get data byte
push hl
push bc
push de ; Put data on stack
; High byte don't care
ld hl,4 ; "C" required
call wdochr## ; Do it
; "C" return procedure has taken
; care of DE on the stack
pop bc
pop hl
inc hl
djnz next
80XX(X) assem
t db 1bh,'G',1,1 ; position the cursor to 1,1
db 1bh,'F',1 ; Turn highlighting on
db 'Hello World'
db 1bh,'F',0 ; turn highlighting off
t1 equ $ - offset t
mov si,offset t ; Point to data to output
mov cx,t1 ; Number of bytes to output
next: push si
push cx
push [si]
call wdochr ; Do it
add sp,2
pop cx
pop si
inc si
loop next
Returns: None
--------------------------------------------------------------------
Window 'flags':
Each window defined to the system has the
following flag bits available:
Bit Use
0 If Reset, Border area is allowed to be written upon.
Otherwise visible area is set to Min X+1,Y+1 Max X-1,Y-1
1 Reserved, set to 0.
2 Reserved, set to 0.
3 Reserved, set to 0.
4 If set, and X surpasses max X boundary, cursor will
be positioned at min X boundary and Y incremented. If
Y surpasses max Y boundary, a scroll up is performed
with Y set to max Y boundary.
5 Wrap to min X boundary if max X boundary surpassed.
Wrap to min Y boundary if max Y boundary surpassed.
Note: If bits 4 & 5 both 0, clip at max X boundary
6 If Set, window boundaries are set to the full physical
display size, with the portion visible under control of
Min X,Y Max X,Y as defined in the previous
WOPEN or WRESIZ.
If reset, window boundaries are set according to
Min X,Y Max X,Y as defined in previous WOPEN or WRESIZ.
7 Reserved, not accessible to user programs.
--------------------------------------------------------------------
Virtual terminal 'escape' codes ( all are preceded by a 1Bh code):
Note: Left, right, top, and bottom margins are as defined in the
flag bit section above.
Code Use
A Insert line. If at top, a scroll down is performed.
B Delete Line. All subsequent lines in the window
will be moved up and last line in window will be
cleared. If at bottom, only last line is cleared.
C Erase from current cursor position to max X boundary.
D Erase from min X boundary to current cursor position.
E Clear window from min X,Y to max X,Y boundaries.
It is cleared with spaces ( 20h ), and attributes are
set to 0.
F Position the cursor in the window. ( X,Y follows )
G Set attributes for subsequent output. ( follows )
H Reverse line feed. If at min Y boundary, a scroll
down will be performed in the window.
I Move cursor right, if at max X boundary, wrap to the
min X boundary.
J Move cursor left, if at min X boundary, wrap to the
max X boundary.
K Move cursor up, if min Y boundary, wrap to max Y boundary.
L Move cursor down, if at max Y boundary, wrap to min Y
boundary.
All other codes following a 1Bh code are thrown away.
The following low level codes are also supported:
08h Back space, if at min X boundary, wrap to max X boundary.
09h Tab. Fixed tab stops every eight positions from
min X boundary. Stops at max X boundary.
0Ah Line feed. Move cursor down, if at max Y boundary,
perform a scroll up. X position remains constant.
0Dh Carriage return, position cursor at min X boundary.
7Fh Delete character to the left, if at min X boundary,
wrap to the max X boundary.
All other low level codes are passed directly to the
dependence routine, with no action or storage by the
libraries.