home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 9
/
CD_ASCQ_09_1193.iso
/
news
/
558
/
tspa60
/
tsuntg.int
< prev
next >
Wrap
Text File
|
1993-07-26
|
8KB
|
223 lines
{$B-,D-,F-,I+,N-,R-,S+,V+}
(*
Timo Salmi UNiT G
A Turbo Pascal unit of informative routines, Crt replacements,
keyboad routines and redirection.
All rights reserved 26-Nov-89
Updated 6-Dec-89, 20-Mar-90, 22-Jul-90, 1-Aug-90, 8-Aug-90, 27-Oct-91,
13-Jun-92, 19-Oct-92, 8-Nov-92, 26-Jul-93
This unit may be used and distributed freely for PRIVATE,
NON-COMMERCIAL, NON-INSTITUTIONAL purposes, provided it is not
changed in any way, and that a proper attribution is made. For ANY
other usage, such as use in a business enterprise or a university,
contact the author for the terms of registration.
The units are under development. Comments and contacts are solicited. If
you have any questions, please do not hesitate to use electronic mail for
communication.
InterNet address: ts@uwasa.fi (preferred)
Bitnet address: SALMI@FINFUN
The author shall not be liable to the user for any direct, indirect or
consequential loss arising from the use of, or inability to use, any unit,
program or file howsoever caused. No warranty is given that the units and
programs will work under all circumstances.
Timo Salmi
Professor of Accounting and Business Finance
Faculty of Accounting & Industrial Management; University of Vaasa
P.O. BOX 297, FI-65101 Vaasa, Finland
Added 27-Oct-91:
ISANSIFN
Added 13-Jun-92
GETSCAN
GETESCAN
Added 19-Oct-92:
FLOPSTFN
ISUBSTFN
Added 8-Nov-92:
ACTDRVFN
MEDIAFN
Added 30-Jun-93
ISRAMFN
Moved to TSUNTBOT 26-Jul-93
WARMBOOT
COLDBOOT
*)
unit TSUNTG;
(* ======================================================================= *)
interface
(* ======================================================================= *)
uses Dos
{$IFDEF VER40}
,TSUNT45
{$ENDIF}
;
(* =======================================================================
Informative routines
======================================================================= *)
(* Number of diskette drives on the system *)
function DRIVESFN : byte;
(* The name of the first diskette drive on the system *)
function FDRIVEFN : char;
(* Number of disk devices. Only for MsDos 3.+, else returns 0, harcoded *)
function DSKCNTFN : byte;
(* Is a media present in the given drive. Argument '0' can be used to
denote the default drive *)
function INDRIVFN (drive : char) : boolean;
(* Is a media a fixed disk. Takes the drive letter (case independent) as
the argument. Argument '0' can be used for the default drive *)
function FIXEDFN (drive : char) : boolean;
(* Get the floppy disk status. Is the floppy present and formatted.
For the status values see TSUNTG.TST procedure TEST16, or
interrupt $13 function $01 in Ralf Brown's inter32a.zip *)
function FLOPSTFN (drive : char) : integer;
(* Test whether a drive is a substituted drive, that is has been subjected
to the MsDos subst command. Requires a minumum of MsDos 3.1 *)
function ISUBSTFN (drive : char) : boolean;
(* What kind of a disk media is in a disk drive.
Takes the drive letter (case independent) as the argument.
Argument '0' can be used for the default drive.
For the returned values see TEST18 in TSUNTG.TST
*)
function MEDIAFN (drive : char) : byte;
(* Get the currently active floppy drive on one drive systems.
Returns the drive letter 'A' or 'B'.
For an error returns '0', for two drive systems returns '2'. *)
function ACTDRVFN : char;
(* Is a drive a ram probable disk
Network drivers and other special circumstances may interfere *)
function ISRAMFN (drive : char) : boolean;
(* =======================================================================
Crt replacements and their derivates
======================================================================= *)
(* Set a 25*80 text mode and clear screen, no Crt unit required *)
procedure CLS;
(* Set a 25*40 text mode and clear screen, no Crt unit required *)
procedure CLS40;
(* As Turbo Pascal GoToYX but does not require the Crt unit *)
procedure GOATXY (x, y : integer);
(* As Turbo Pascal WhereX but does not require the Crt unit *)
function WHEREXFN : byte;
(* As Turbo Pascal WhereY but does not require the Crt unit *)
function WHEREYFN : byte;
(* Reverse the colors of an area.
This is slow. For fast screen routines see TSUNTA. *)
procedure REVAREA (x1, y1, x2, y2 : integer);
(* Returns whether ANSI.SYS or a similar screen driver has been loaded or not.
Use while in the text mode. Do not call not in the graphics modes.
Don't use the TP Crt unit in your program if you want ISANSIFN to work. *)
function ISANSIFN : boolean;
(* =======================================================================
Key routines with no Ctr needed
======================================================================= *)
(* As Turbo Pascal KeyPressed but does not require the Crt unit *)
function KEYPREFN : boolean;
(* As Turbo Pascal ReadKey but does not require the Crt unit *)
function READKEFN : char;
(* Enhanced keyboard ReadKey, no Ctr unit needed. Detects also F11 and F12,
and distinguishes between the numeric keypad and the gray keys.
Lower part of the word returns the first scan code, the higher part
the second, if applicable. *)
function RDENKEFN : word;
(* This function resembles the traditional Basic inkey function.
It returns the pressed character with no echo. Special chacarters
are returned in the usual paired manner (chr(0) + code).
If timelimit seconds is exceeded timeout becomes true (and a
chr(0) is returned by inkeyfn). *)
function INKEYFN (timelimit : real; var timeout : boolean) : char;
(* =======================================================================
More key routines with no Ctr needed, no key repeat
======================================================================= *)
(* Is the left shift key depressed *)
function LFSHFTFN : boolean;
(* Is the right shift key depressed *)
function RTSHFTFN : boolean;
(* Is the ctrl key depressed *)
function CTRLFN : boolean;
(* Is the left ctrl key depressed *)
function LFCTRLFN : boolean;
(* Is the right ctrl key depressed *)
function RTCTRLFN : boolean;
(* Is the alt key depressed *)
function ALTFN : boolean;
(* Is the left alt key depressed *)
function LFALTFN : boolean;
(* Is the right alt key depressed *)
function RTALTFN : boolean;
(* Is the SysRq key depressed *)
function SYSRQFN : boolean;
(* =======================================================================
Getting keyscan codes
======================================================================= *)
(* Every now and then a programmer need to find out the scan codes
of the keyboard keys. GETSCAN returns the scancode (and the ascii
value) of the key pressed. For an enhanced AT keyboard use
GETESCAN. Goes to TSUNTG *)
procedure GETSCAN (var scancode, character : byte);
(* Get scancode and ascii value of a key pressed for an enhanced
keyboard. To test the presence of an enhanced keyboard use
ISENHAFN from the TSUNTH unit *)
procedure GETESCAN (var scancode, character : byte);
(* =======================================================================
Redirection
======================================================================= *)
(* Direct write and writeln to printer *)
procedure USEPRN;
(* Direct write and writeln to the screen *)
procedure USECON;