home *** CD-ROM | disk | FTP | other *** search
- {$B-,D-,F-,I+,N-,R-,S+,V+}
-
- (*
- Timo Salmi UNiT G
- A Turbo Pascal unit of informative routines, Crt replacements,
- redirection, and reboot.
- 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
-
- This unit may be used and distributed freely for PRIVATE, NON-COMMERCIAL,
- NON-INSTITUTIONAL purposes, provided it is not changed in any way. 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@chyde.uwasa.fi (preferred)
- Funet address: GADO::SALMI
- 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
- School of Business Studies, University of Vaasa
- P.O. BOX 297, SF-65101 Vaasa, Finland
-
- Added 27-Oct-91:
- ISANSIFN
- *)
-
- 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;
-
- (* =======================================================================
- 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 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;
-
- (* =======================================================================
- Redirection
- ======================================================================= *)
-
- (* Direct write and writeln to printer *)
- procedure USEPRN;
-
- (* Direct write and writeln to the screen *)
- procedure USECON;
-
- (* =======================================================================
- Reboot
- ======================================================================= *)
-
- (* Reboot the computer without memory tests. Resembles alt-ctrl-del.
- Inline coded. Use judiciously *)
- procedure WARMBOOT;
-
- (* Reboot the computer with memory tests. Inline coded. Use judiciously *)
- procedure COLDBOOT;
-