POPUP Subroutines - Copyright 1993 by Microdex Corporation
----------------------------------------------------------
Designed by Chris Fara. For use with Mod-III or Mod-4 BASIC,
these self-installing, self-protecting machine routines
enable instant display and hiding of pop-up windows anywhere
on the screen: menus, help windows, alerts, boxes and such.

Files: POPUP3/CMD     for Model III TRSDOS 1.3 and LDOS 5.x
------ POPUP4/CMD     for Model 4   TRS/LS-DOS 6.2 or higher

Usage: From DOS READY enter, depending on machine
------ Model III      POPUP3
       Model 4        POPUP4

The routine installs itself in high memory and protects
itself from DOS and BASIC by lowering the HIGH$ address.
After installation a message appears similar to this:

       Call address = 64000 decimal = FA00 hex

The actual numbers will vary from system to system. Make a
note of these numbers and enter BASIC (no need to protect
memory). In BASIC use these numbers to define the address of
the routine like this:

Model III:  DEF USR = 64000-65536   or   DEF USR = &HFA00
Model 4:         Z% = 64000-65536   or        Z% = &HFA00

The parameters and contents of a window to be displayed,
must be put together into a string, like this:

VY = screen row for the upper-left corner of the window
VX = column for the upper-left corner
WY = number of rows in the popup window
WX = number of columns in the window

W1$ = text of first row of the window, exactly WX characters
W2$ = text of next row, exactly WX characters
..... and so on, at least WY sub-strings for the rows

W$ = CHR$(VY)+CHR$(VX)+CHR$(WY)+CHR$(WX)+W1$+W2$+.....

To display a window, call the routine like this:

Model III:  Z$ = USR ( W$ )
Model 4:    CALL Z% ( W$ )

To hide the window and restore the screen repeat the same
call. The window can be popped on/off as often as desired.

NOTA BENE.....

The row VY and column VX of the "anchor point" for the
upper-left corner of the window must be co-ordinated with
the size of the window WY and WX in such a way that the
window will not be allowed to overlap beyond the edges of
the screen. Otherwise system crash is virtually guaranteed.

Since BASIC strings are limited to 255 characters (4 of
which will be used by row and column parameters), the window
sizes are limited to WY*WX<=251 (15 rows by 16 columns, 10
rows by 25 columns, etc).

The text in the window rows may include graphic and
"special" characters ASCII 0-31 and 128-255 (via CHR$
function). Each sub-string of the window text must have
exactly as many characters as specified in variable WX.
There must be at least as many sub-strings W1$, W2$, etc, as
there are rows specified in the variable WY. If the value of
variable WY is made smaller than the number of sub-strings
then only the initial WY rows will pop up on the screen.

If anything is printed within a displayed window, and then
the window is hidden, then the new contents will show up
next time the same window is popped up.

Any number of different windows can be stored in several
strings and displayed when desired, and may even overlap
each other on the screen in a "nested" sequence, like this:
     Pop up Window #1
     Pop up Window #2, maybe partly covering Window #1
     ......
     Hide Window #2
     Hide Window #1

By rapidly showing and hiding a window, then changing VY or
VX or both a bit, showing and hiding again, a window may be
"animated" to move across the screen, for example like this:

    100 CALL Z% (V$,W$): REM Show window
    110 K$=INKEY$: IF K$="" THEN 110 ELSE IF K$=" " THEN 200
    120 CALL Z% (V$,W$): REM Hide window
    130 VY=VY+(VY>0): VX=VX+(VX>0)
    140 MID$(W$,1)=CHR$(VY)+CHR$(VX): GOTO 100
    200 .... program continues

In this Mod-4 fragment pressing any key other than SPACE
causes motion of the window until it stops in the upper-left
corner of the screen. SPACE exits the loop.

Questions?

Write Chris, c/o Microdex, 1212 N. Sawtelle, Tucson AZ 85716

