;***************************************************************************
;
; WINDOW.M68
;
;
; Written By: James A. Jarboe IV
; 1401 19th Street
; Huntsville, TX 77340
; 409-295-5767
; GR/AM
;
; 02/23/86
; Copyright (C) James A. Jarboe IV
;****************************************************************************
; Description: Draws an alternate set graphics window border as per user's
; Specs.
;
;
; Usage: XCALL WINDOW, START'ROW, START'COL, COL'LONG, ROW'DEEP
;
; Where:
; START'ROW = Row to start window border on
; START'COL = Column to start window border on
; COL'LONG = Number of columns horizontal line is to be
; ROW'DEEP = Number of rows vertical line is to be
;
;
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
; Be sure to LNKLIT WINDOW after assembly to get extern arguments
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
OFINI
OFDEF STRROW,2 ; starting row #
OFDEF STRCOL,2 ; starting column #
OFDEF COLLNG,2 ; number of columns
OFDEF ROWLNG,2 ; number of rows
OFSIZ MEMSIZ
ROW=D2
COL=D3
PHDR -1,0,PH$REE!PH$REU
;
; Check for variable & set up variables
;
CMMW XP.TOP(A3),#4 ; at least 4 variables
JNE BADPARM ; no ... then quit
MOV #XA.TYP,D1 ; get start row
CALL $GTARG ; get floating point #
MOVW D1,STRROW(A4) ; start row
MOV #XB.TYP,D1 ; start col
CALL $GTARG ; get floating point #
MOVW D1,STRCOL(A4) ; start col
MOV #XC.TYP,D1 ; # of col
CALL $GTARG ; get floating point #
MOVW D1,COLLNG(A4) ; # of col
MOV #XD.TYP,D1 ; # of row
CALL $GTARG ; get floating point #
MOVW D1,ROWLNG(A4) ; # of row
;Alternate character set - here we set to graphics mode and send it
;to the terminal via it's TCRT call -1,23
SETALT:
MOV #-1_8.+23.,D1 ; set alternate char set on
TCRT
;Position the cursor - here we make the high order of D1 = the row
;and the low order of D1 = the column and then send it to the terminal
;to set the first position of the window
POSCUR:
MOVW STRROW(A4),D1 ; move row to d1
LSL D1,#8. ; make row high order
ADDW STRCOL(A4),D1 ; add col to d1
TCRT
MOV #-1_8.+38.,D1 ; top left corner -1,38
TCRT
MOV #1,COL ; make COL = 1
;Horizontal line - here we draw the top horizontal line
HORI:
INC COL ; add 1 to column
CMMW COLLNG(A4),COL ; are we at end of column length ?
BEQ TRC ; yes .. goto top right corner
MOV #-1_8.+46.,D1 ; horizontal line -1,46
TCRT
BR HORI ; do it again
TRC:
MOV #-1_8.+39.,D1 ; top right corner -1,39
TCRT
MOVW STRROW(A4),ROW ; move starting row to ROW
MOVW STRCOL(A4),COL ; move starting column to COL
SUB #1,COL
MOV #1,D4
;Vertical line - here draw the vertical sides by using the starting column
;position and adding the column length to print the right side
VERT:
INC ROW ; add 1 to Row
INC D4
CMMW ROWLNG(A4),D4 ; are we at at last row
JEQ BOTTOM ; yes ... goto bottom line
MOVW ROW,D1 ; get row position
LSL D1,#8. ; move it to high order
ADDW STRCOL(A4),D1 ; add column position
TCRT ; place cursor
MOV #-1_8.+47.,D1 ; vertical line -1,47
TCRT ; print it
MOVW ROW,D1 ; get row again
LSL D1,#8. ; move it to high order
ADDW COL,D1 ; get starting column
ADDW COLLNG(A4),D1 ; add column length
TCRT ; place cursor there
MOV #-1_8.+47.,D1 ; vertical line -1,47
TCRT ; print it on right side
JMP VERT ; do it again
;bottom line - here we draw the bottom of the window just like we drew the
;top line
BOTTOM:
MOVW STRROW(A4),D1 ; get starting row
SUB #1,D1
ADDW ROWLNG(A4),D1 ; add number of rows
LSL D1,#8. ; move it to high order
ADDW STRCOL(A4),D1 ; get starting column
TCRT ; place cursor there
MOV #-1_8.+40.,D1 ; bottom left corner -1,40
TCRT ; print it
MOV #1,D4
BOTLOP:
INC D4
CMMW COLLNG(A4),D4 ; are we at column length yet
BEQ BORC ; yes .. goto bottom right corner
MOV #-1_8.+46.,D1 ; print horizontal line -1,46
TCRT
BR BOTLOP ; do it again
BORC:
MOV #-1_8.+41.,D1 ; print bottom right corner -1,41
TCRT ; print it
;Alternate graphic set off - here we get out of the graphic mode
;and return home to basic
GO:
MOV #-1_8.+24.,D1 ; set alternate character set off
; -1,24
TCRT ; do it
RTN ; back to basic
BADPARM:
TYPECR Not enough Variables passed to subroutine
RTN