home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
fortran
/
library
/
library
/
libry2.doc
< prev
next >
Wrap
Text File
|
1989-11-10
|
14KB
|
386 lines
.pa
GENERAL UTILITIES AND CRT CONTROL
These general utilities should work on whatever system you have (as long as it
is basically IBM compatible or an HP-1000). However, all of the CRT control
procedures will only work on PCs (80 column mode only), HP-26XXs, or Tektronix
4XXX terminals.
QUICK LIST OF GENERAL UTILITIES AND CRT CONTROL
ADATE.... fetch the date
ATIME.... fetch the time of day
BEEP..... beep
CLEAR1... clear one line on the CRT and move cursor to column 1
CPU...... fetch the time (also see SECNDS)
CRT1C.... write one character to the CRT
CRT1D.... write one dot to the CRT in graphics mode
ERASE.... clear the CRT
EXEPRG... run a program from within another program
FFPRN.... send a formfeed to the printer
FTIME.... fetch character string indicating date and time
GET1C.... read 1 character from the keyboard don't wait or display
GETPSP... get the program segment prefix (PC only - on HP use GETST)
HELPME... list help information from user-defined help file
IFBRK.... detect keyboard interrupt (if-break)
LXXX87... logical test for math coprocessor
PAUSE.... display message and wait for any keystroke
PRT1C.... send 1 character to the printer
READ1.... read 1 character from the keyboard - don't wait for RETURN
READC.... read a string from the keyboard
RRPAR.... get file name from runtime string
RS232I... RS-232 communications port I/O and control
SECNDS... fetch the time (also see CPU)
SETVM.... set video mode
SPOOL.... divert output from FFPRN and WRPRN to a file (can be NUL or CON)
TONE..... sound a tone
UP1LIN... move the cursor up 1 line on the CRT
WCGRM.... write a character in graphics mode
WRPRN.... print a character string
WRTTY.... write a character string on the CRT
.pa
NAME: ADATE
PURPOSE: fetch the date
TYPE: subroutine (far external)
SYNTAX: CALL ADATE(MONTH,IDAY,IYEAR)
OUTPUT: MONTH (INTEGER*2) month
IDAY (INTEGER*2) day of the month
IYEAR (INTEGER*2) year 1986, 1987, etc.
NAME: ATIME
PURPOSE: fetch the time of day
TYPE: subroutine (far external)
SYNTAX: CALL ATIME(IHOUR,MIN,ISEC,IHUN)
OUTPUT: IHOUR (INTEGER*2) hours in military time
MIN (INTEGER*2) minutes
ISEC (INTEGER*2) seconds
IHUN (INTEGER*2) hundredths of seconds
NAME: BEEP
PURPOSE: beep
TYPE: subroutine (far external)
SYNTAX: CALL BEEP
NAME: CLEAR1
PURPOSE: clear one line on the CRT and move cursor to column 1
TYPE: subroutine (far external)
SYNTAX: CALL CLEAR1
NAME: CPU
PURPOSE: fetch the time
TYPE: subroutine (far external)
SYNTAX: CALL CPU(SEC)
OUTPUT: SEC (REAL*4) seconds
NOTE: on the PC this returns the elapsed time since midnight
on the HP-1000F this returns cumulative session CPU
this is useful for computing runtimes
also see SECNDS
NAME: CRT1C
PURPOSE: write one character to the CRT
TYPE: subroutine (far external)
SYNTAX: CALL CRT1C(IROW,ICOL,CHAR)
INPUT: IROW (INTEGER*2) row number (0=top)
ICOL (INTEGER*2) column number (0=left)
CHAR (CHARACTER*1) character
OUTPUT: none
NAME: CRT1D
PURPOSE: write one dot to the CRT in graphics mode
TYPE: subroutine (far external)
SYNTAX: CALL CRT1D(IROW,ICOL,IDOT)
INPUT: IROW (INTEGER*2) row number (0=top)
ICOL (INTEGER*2) column number (0=left)
IDOT (INTEGER*2) color (depends on video mode)
OUTPUT: none
NAME: ERASE
PURPOSE: clear the CRT
TYPE: subroutine (far external)
SYNTAX: CALL ERASE
NAME: EXEPRG
PURPOSE: run a program from within another program
TYPE: subroutine (far external)
SYNTAX: CALL EXEPRG('d:\path\myprog.exe'//CHAR(0),
& 'string/options etc.'//CHAR(0),IER)
INPUT: program name and runtime string
OUTPUT: IER (INTEGER*2) error indicator
NAME: FFPRN
PURPOSE: send a formfeed to the printer
TYPE: subroutine (far external)
SYNTAX: CALL FFPRN
NAME: FTIME
PURPOSE: fetch character string indicating date and time
TYPE: subroutine (far external)
SYNTAX: CALL FTIME(DATE)
OUTPUT: DATE (CHARACTER*30)
NAME: GET1C
PURPOSE: read 1 character from the keyboard don't wait or display
TYPE: subroutine (far external)
SYNTAX: CALL GET1C(ANS)
OUTPUT: ANS (CHARACTER*1)
NOTE: this is very handy for creating menus - also see READ1
NAME: GETPSP
PURPOSE: get the program segment prefix (PC only - on HP use GETST)
TYPE: subroutine (far external)
SYNTAX: CALL GETPSP(PSP)
INPUT: none
OUTPUT: PSP (CHARACTER*1 PSP(128))
NOTE: This seems like a logical thing to want; but to actually find
the PSP after DOS gets through with it on the PC is no easy
task when working from inside an EXE file.
NAME: HELPME
PURPOSE: detect keyboard interrupt (if-break)
TYPE: subroutine (far external)
SYNTAX: CALL HELPME(NAME,CBUF)
INPUT: NAME (CHARACTER*12) user-defined help file name
CBUF (CHARACTER*5) key
OUTPUT: output is always to the CRT via WRTTY
NOTE: The key can be '?,xxx' or just 'xxx ' either way will do.
See example help file at the end of this section.
NAME: IFBRK
PURPOSE: detect keyboard interrupt (if-break)
TYPE: LOGICAL*2 function (far external)
SYNTAX: IF(IFBRK(0)) GO TO 100
NOTE: you must pass a dummy parameter "0" so FORTRAN will generate
the proper calling sequence
NAME: LXXX87
PURPOSE: logical test for math coprocessor
TYPE: LOGICAL*2 function (far external)
SYNTAX: IF(.NOT.LXXX87(0)) GO TO 100
NOTE: you must pass a dummy parameter "0" so FORTRAN will generate
the proper calling sequence
NAME: PAUSE
PURPOSE: display the message "hit the SPACE BAR to continue" and wait
for any keystroke
TYPE: subroutine (far external)
SYNTAX: CALL PAUSE
NOTE: you may want to follow this with CALL CLEAR1 to erase the line
NAME: PRT1C
PURPOSE: send 1 character to the printer (bypasses DOS)
TYPE: subroutine (far external)
SYNTAX: CALL PRT1C('a') or CALL PRT1C(CHAR(13))
INPUT: one CHARACTER*1 variable
NOTE: if you want to print a string use WRPRN
NAME: READ1
PURPOSE: read 1 character from the keyboard - don't wait for RETURN
TYPE: subroutine (far external)
SYNTAX: CALL READ1(ANS)
OUTPUT: ANS (CHARACTER*1)
NOTE: this is very handy for creating menus - also see GET1C
NAME: READC
PURPOSE: read a string from the keyboard
TYPE: subroutine (far external)
SYNTAX: CALL READC(CBUF,NBUF,IERR)
INPUT: NBUF (INTEGER*2) maximum number of characters to be read
OUTPUT: CBUF (CHARACTER*1 CBUF(NBUF) or CHARACTER*80 CBUF, NBUF=80)
IERR (INTEGER*2) error return indicator (IERR=0 is normal)
NOTE: This bypasses DOS (which is often advantageous). On the HP
this goes directly to the OPSYS. If you ask for 6 characters
then READC will only allow you to enter 6. The maximum number
of characters that can be requested is the 80 - the current
column (or a maximum of 79 if the cursor is at the left)
NAME: RRPAR
PURPOSE: get file name from runtime string
TYPE: subroutine (far external)
SYNTAX: CALL RRPAR(N,NAME)
INPUT: N (INTEGER*2) number of entry see example below
OUTPUT: NAME (CHARACTER*12)
NOTE: the purpose of this is to fetch and parse the string that you
type in after the name of your program as below
MYPROG this.dat that.for other.bin wednesday
fetch the names with the following
CHARACTER NAME1*12,NAME2*12,NAME3*12,COMMENT*12
CALL RRPAR(1,NAME1)
CALL RRPAR(2,NAME2)
CALL RRPAR(3,NAME3)
CALL RRPAR(4,COMMENT)
you will get the following
NAME1='this.dat'
NAME2='that.for'
NAME3='other.bin'
COMMENT='wednesday'
NAME: RS232IO (or RS232I as FORTRAN chops external names longer than 6
characters)
PURPOSE: control RS-232 port
TYPE: subroutine (far external)
SYNTAX: CALL RS232IO(IPORT,IOPT,ICHAR)
INPUT: IPORT (INTEGER*2) either 1 or 2
IOPT (INTEGER*2) see DOS Technical Reference Manual for INT14
ICHAR (INTEGER*2) see DOS Technical Reference Manual for INT
OUTPUT: ICHAR (INTEGER*2) see DOS Technical Reference Manual for INT
NOTE: All this routine does is subtract 1 from IPORT and put the result
in the DX register, put the low byte of IOPT into the AH register,
put the low byte of ICHAR into the AL register, call the BIOS
interrupt 14, put the resulting value of AX into ICHAR and return.
In order to figure out what this does you'll just have to consult
the DOS Technical Reference Manual. I have provided an example of
its use to "talk" to an HP pen plotter at the end of this section.
NAME: SETVM
PURPOSE: set video mode
TYPE: subroutine (far external)
SYNTAX: CALL SETVM(MODE)
INPUT: MODE (INTEGER*2) mode (see your hardware manual)
OUTPUT: none
NAME: SECNDS
PURPOSE: fetch the time
TYPE: REAL*4 function (far external)
SYNTAX: T=SECNDS(0.) or T=SECNDS(T0)
INPUT: T0 (REAL*4) offset time
OUTPUT: seconds since midnight (REAL*4)
NOTE: this is for compatibility with DEC machines
also see CPU
NAME: SPOOL
PURPOSE: divert output from FFPRN and WRPRN to a file
TYPE: subroutine (far external)
SYNTAX: CALL SPOOL('FILE.EXT',IER)
INPUT: FILE.EXT (CHARACTER*?) name of file (can be NUL or CON)
note: if the file name has no extension then leave a space at the
end (e.g. 'PRN ') otherwise there is no way of telling where the
name ends
OUTPUT: IER (INTEGER*2) error indicator (IER=0 is normal)
NOTE: This will only divert output sent to FFPRN or WRPRN. The file must
not already exist (to avoid unintentional overwriting). To
terminate diversion and return output to the printer, just call it
again like: CALL SPOOL('PRN ',IER).
NAME: TONE
PURPOSE: sound a tone
TYPE: subroutine (far external)
SYNTAX: CALL TONE(IFREQ,ICOUNT)
INPUT: IFREQ (INTEGER*2) frequency in HZ
ICOUNT (INTEGER*2) duration in "counts" which is about 1/18th sec
OUTPUT: none
NOTE: This can also be used for a timed wait by setting IFREQ to zero.
NAME: UP1LIN
PURPOSE: move the cursor up 1 line on the CRT
TYPE: subroutine (far external)
SYNTAX: CALL UP1LIN
NOTE: there is no way to do this in FORTRAN on the PC
(UP1LIN is in assembler)
NAME: WCGRM
PURPOSE: write a character in graphics mode
TYPE: subroutine (far external)
SYNTAX: CALL WCGRM(CHAR,IROW,ICOL,ICOLOR)
INPUT: CHAR (CHARACTER*1) character
INPUT: IROW (INTEGER*2) row number (0=top)
ICOL (INTEGER*2) column number (0=left)
ICOLOR (INTEGER*2) color (see your hardware manual)
OUTPUT: none
.de
NAME: WRPRN
PURPOSE: print a character string
TYPE: subroutine (far external)
SYNTAX: CALL WRPRN('print this string<')
INPUT: a character string (CHARACTER*? , it doesn't matter)
NOTE: this bypasses DOS (which is often advantageous)
CALL WRPRN('this is only a test_')
CALL WRPRN(' for the next 60 seconds<')
the above 2 lines will print on the same line as...
this is only a test for the next 60 seconds
The "_" tells WRPRN to not follow the string with a
carriage return (CR) and line feed (LF) while the "<"
does indicate this. Neither the "_" nor the "<" will
actually be printed.
If you want to change the symbols "_" and "<" to say
"+" and "." use the following...
CALL WRPRN('_+.this is only a test+')
CALL WRPRN('_+.for the next 60 seconds.')
Of course, in this case you can't print a "+" or a "."
so you could use CHAR(0) and CHAR(13) instead. Beginning
a string with a "_" tells WRPRN that the next 2 characters
are to replace the "_" and "<" characters.
Also see WRTTY.
In case you are wondering why I wrote this, it's because some
misguided persons at DEC and Microsoft had this bizarre idea
that one should put some stupid character like "\" or "$" at
the end of a format to suppress a carriage control, while the
whole rest of the world uses "_" at the end of a string.
If anyone out there knows, please tell me what comes over
these people who do weird things like this?
WARNING: should you forget to end the string with a proper terminator
(e.g. "_" or "<") WRPRN will just continue indefinitely until
it finds one or your system crashes...
.ee
NAME: WRTTY
PURPOSE: write a character string on the CRT
TYPE: subroutine (far external)
SYNTAX: CALL WRTTY('display this string<')
INPUT: a character string (CHARACTER*? , it doesn't matter)
NOTE: This bypasses DOS (which is often advantageous) AND the BIOS
(which is also often advantageous) and pushes your string
directly into the display memory (as a result Ctrl-PrtSc will
not even see it). This is VERY much faster than DOS (which is
often painfully slow) and the BIOS (which isn't any better).
On the HP this goes directly to the OPSYS, not the FORTRAN I/O
handler.
For notes on how to use WRTTY see WRPRN.
.ad LIBRY2A.DOC