
190
Fortran Programs for Chemical Process Design
GETTXT is perhaps the simplest of these. It uses ANSI control
sequences to locate the cursor on the screen, to highlight a box for text
entry, and through assembly-language-coded calls to an MS DOS func-
tion, intercepts individual keypresses and builds them into a text string
in the text entry box.
The low level functions that use the ANSI codes are coded into
GOTOXY Cursor location (FORTRAN)
REVID
Turn reversed video effect on (ASM)
NORMAL Restore normal video (no attributes) (ASM)
SHWTXT Display string (FORTRAN)
From these further calls to assembly language routines that call DOS
functions are made. These routines are:
GETCHR
SHWBYT
Get character from keyboard buffer
Display character string
Analogous routines to GETTXT are provided for inputting INTE-
GER and FLOATING POINT (REAL) variables, and they are called
GETINT and GETFLO. In principle, they are identical to GETTXT,
but they perform the additional tasks of intercepting invalid keypresses
(e.g., no alphabetic characters are permitted nor can the decimal point
be duplicated, etc.) and converting from a text string into a valid num-
ber format. A routine BEEP is provided to send ASCII 07 (BEL) to the
screen, which drives the PC's internal speaker.
The subroutine MENU displays a list of mnemonics on the screen at
predefined locations. In my code, these mnemonics are usually in a ver-
tical stack, and they are all accompanied by a line of explanatory text
per mnemonic. Use of the cursor keys causes a highlighted bar to step
through the mnemonics. Pressing the RETURN key selects the option
equivalent to the currently selected mnemonic.
In addition to the GETxxx subroutines, I sometimes need to display
text or numbers at predefined locations on the screen. The GOTOXY
and SHWTXT calls are put together in DISTXT, DISINT, and DISFLO
(DIS implying DISplay). Some other routines which are used to create
special effects are
BORDER
COLORS