📄 tchk.doc
字号:
DATEHK.H - header file for date routines
DOSHK.H - header file for DOS routines
FILEHK.H - header file for file routines
FINANCE.H - header file for financial routines
HOWARD.H - header file for miscellanoues definitions
IBM.H - header file for misc. IBM routines
KEYBOARD.H - header file for keyboard routines
KEYCODE.H - keyboard key codes
MATHHK.H - header file of math routines
MENUHK.H - header file for menu routines
MOUSEHK.H - header file for mouse routines
MULTIHK.H - header file for multi-tasking routines
NETWORK.H - header file for network routines
PRINTHK.H - header file for print routines
REAL.H - header file for simulated FP functions
SOUND.H - header file for sound routines
STATEHK.H - header file for state/zip code functions
STRINGHK.H - header file for string routines
TIMEHK.H - header file for time routines
VIDEO.H - header file for video routines
ZIP.H - header file for .ZIP file format support
TCHK 2.1 Page 8
DEMO.ZIP - archive of TCHK demo programs:
DEMOADV.C - date conversion functions
DEMOADV.EXE
DEMOADV.PRJ
DEMODATE.C - date functions
DEMODATE.EXE
DEMODATE.PRJ
DEMODISK.C - disktype function
DEMODISK.EXE
DEMODISK.PRJ
DEMOLITE.C - litebar menu functions
DEMOLITE.EXE
DEMOLITE.PRJ
DEMONUM.C - number functions (math/financial)
DEMONUM.EXE
DEMONUM.PRJ
DEMOPARS.C - DOS parsing functions
DEMOPARS.EXE
DEMOPARS.PRJ
DEMOPOP.C - popup menu functions
DEMOPOP.EXE
DEMOPOP.PRJ
DEMOTIME.C - time conversion functions
DEMOTIME.EXE
DEMOTIME.PRJ
To compile the demo programs, use the configuration file TCHK.TC
and the appropriate project file. Make sure you check the Turbo C
directories before compiling. See Tips and Caveats for more
information.
IN THE BEGINNING...
Except where explicitly stated, all of these functions have been
compiled and tested on my system:
- IBM PC
- 640K memory
- (CGA) Color Graphics Adapter
- DOS 3.2
- AST SixPakPremium w/1 MB EEMS (REMM.SYS 3.1 and 4.3)
- Microsoft Mouse (MOUSE.COM 6.24)
- IBM Proprinter XL
- NEC V20 cpu
- PC Sprint (dandy little speed up plug in. No slot,
hardware switch for normal (4.77) and fast (~7) MHz speeds
and reboot. Between the board and the NEC my machine plods
TCHK 2.1 Page 9
along almost 2x as fast as a normal PC. At only $95, I
highly recommend it. Call these guys for more info:
Product: PC Sprint and/or NEC V20
Exec-PC, Inc.
PO BOX 11268
Shorewood, WI 53211
VOICE: (414) 963-2880
MODEM: (414) 964-5160
TCHK was compiled from the interactive environment of Turbo C,
with the following options changed from the default:
Memory model: SMALL
Optimize on: SPEED
Full optimization (Register/Jump)
No debug information
Standard stack frame Off
For more info, check out the configuration file TCHK.TC.
This library was written in 100% Turbo C, except for a couple of
TASM modules which were originally inline Assembly. All C code was
compiled with Turbo C 2.0, all Assembly was compiled with Turbo
Assembler 1.0 and TCHK created with TLIB 2.0.
FEATURES
TCHK sports many useful features not found in other shareware
packages. Aside from many input and output routines, TCHK provides
many functions dealing with dates, time, strings, popup and
litebar menus, DESQview support, and much more.
Many of the functions requiring output as a side effect (most
noticeably the keyboard and menu functions) make use of some of
the output routines prototyped in VIDEO.H or some of the console
i/o functions by Borland (i.e. cputs(), putch(), etc.). If you use
almost any of the keyboard routines, also expect some video
routines to be linked into your program. This is true of some
other functions as well (the popup menus use Borland's gettext()
and cputs() routines.) If you really want to change the library,
you can always purchase the source code...
For a quick synopsis of TCHK, check out the file TCHK.MSG.
TCHK 2.1 Page 10
CREDIT
The following people deserve credit for their help:
James Arnold for helping with optimizing the direct video access
functions.
Darius Thabit for his help with the reboot function.
Mark Seyden, Sysop of The BOSS (201-568-7293), for allowing me
to use his bbs as a base for TCHK.
Robert Blacher, Sysop of Computer Connections (202-547-2008),
for his comments regarding my license information and for
running an excellent BBS
Robert Mason, my college roomate, for his uncanny knack at finding
bugs within the first 30 seconds of use, no matter how clean
the code.
FUNCTIONS
Most of the functions are documented well enough below, although I
feel a few more explanations are necessary:
In the interactive environment you can #define one item in
terms of another, including spaces. If anyone knows how to do
this with the command line version, please let me know. The
variable type byte is just an unsigned char. If you use the
command line version of TC you will have to change some of
the header files of TCHK.
Beginning with TCHK 2.0, unless otherwise noted, all
functions asking for screen coordinates comply with Borland's
format (x,y). The top left corner of the screen is (1,1).
This is highly different from previous versions of TCHK.
Many functions rely on interrupts and low memory addresses
(400:xxxx) to comply with the IBM standard. Certain values
(for instance, the current video page) can be found by an
interrupt or by peeking at the value stored in low memory.
Many of the video functions especially require these values
to be found at the proper places. If your clone is radically
different from the IBM standard some of these functions may
not work properly. I didn't want to have to write a million
small functions that are just background support for the
functions found here (like current page number, etc.) so I
used the #defines found in the headers (see video.h for more
details.)
TCHK considers "key codes", "scan codes" and "ascii codes" as
different animals. Via the BIOS, any key pressed returns a
word (2-byte) value. If a 'normal' key is pressed (i.e. a
letter, space, etc.) the low order byte contains the letter.
When the low order byte is zero, an unusual key has been
pressed (i.e. Alt combinations, arrows, grey +, etc.) This 2
TCHK 2.1 Page 11
byte word as returned by the BIOS is called a scan code. For
ease of use, several functions convert this "scan code" to a
value from 0-511, called a "key code", where 0-255 are
'normal' ascii codes, as per the IBM ASCII character set, and
256-511 are the unusual keys. Many of the popular key codes
are listed in KEYCODE.H. To determine a key code, if the low
order byte is zero, take the high order byte as a number
0-255 and add 256. If the low order byte is non-zero, take
the low order byte as a number from 0-255. Note that although
the regular plus key and the grey plus key (on the numeric
keypad) return different scan codes, their key code is the
same. So, briefly, an "ascii code" is a char (value of
0-255), a "scan code" is a 2-byte word returned from the
BIOS, and a "key code" is a value 0-511. "Scan codes" and
"key codes" are both 2 bytes long (unsigned int and int,
respectively).
There are several functions that refer to a DOS file name. A
'file name' is a generic term for any possible name for a
file (drive, path and even filename.ext are optional). A
'filename' refers to a DOS filename.ext, no drive or path
(sometimes referred to with 'filename.ext'). A 'filepathname'
refers to a full file name, including drive, path and
filename.ext (some parts may be optional.) A 'filespec' is
similiar to a 'filename', but does not necessarily refer to a
specific file (i.e. D:\TURBOC is actually D:\TURBOC\*.*. See
how DIR parses filespecs for more details.)
TCHK has not been tested on a Hercules or MDA video card
since I do not have access to either piece of hardware,
although the methods I used are well documented and should
cause no problems.
All functions that use my direct screen access routines have
built-in snow control. On CGA monitors, the snow was
horrendous without it. Unless I code these routines in
assembler, I won't be able to squeeze any more optimization
out of these routines. Since Borland now provides acceptable
console i/o functions, I doubt I shall bother to recode these
in Assembler.
One type of command you will NOT find in TCHK are windowing
commands. There are plenty of windowing libraries available. You
should not try to make your poor IBM into a Mac, it won't cut it.
Splurge for the Mac, you'll be happier. If you really want windows
on your IBM-type machine, use DESQview. Yes, I know, a 'windowing'
interface is nicer. I use 'windows' too, although mine are just
boxes. Given the overhead needed for windows (in memory and
performance) I find my method more than acceptable for my current
needs.
The functions are listed in the same manner as the Turbo C manual,
in alphabetical order. Due to the size of the documentation, the
functions appear in a separate file TCHK.FNC.
TCHK 2.1 Page 12
TIPS AND CAVEATS
You really should check the settings in TCHK.TC before trying to
use TCHK. Here are a few things you might want to be aware of:
Nested Comments: I use them. Some of the header files have
nested comments in them. If you do not tell the compiler that
nested comments are ok, you may get strange and usually
untraceable error messages when compiling TCHK demos or
source code.
Command Line Compiler: byte, word and bboolean can only be
#defined in the interactive environment. If you use the
command line compiler you may have to change some header
files.
DESQview/EMS: I plan on expanding the support for DESQview
and EMS in the near future. Several functions may seem
useless or nearly so right now. Due to time constraints,
there is only so much I can do at a time, but rest assured
there is more in the works. If you really can't wait, you
could always purchase the source code and putter around
yourself...
#DEFINES
Most of these #defines are self-explanatory. All can be found in
the appropriate header files:
Ansihk.h
--------
Ansi color definitions. See ansihk.h for more details
Color.h
-------
DOS color definitions. See color.h for more details.
Chiphk.h
--------
Cpu types recognized by cpu_id(). See chiphk.h for more details.
Math coprocessor types recognized by ndp_id(). See chiphk.h for
more details.
TCHK 2.1 Page 13
Datehk.h
--------
Date types:
typedef enum { Sun, Mon, Tues, Wed, Thrus, Fri, Sat } days;
typedef enum { Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep,
Oct, Nov, Dec } months;
My date structure:
typedef struct ddate {
int dyear; /* Year - 1900 */
int dday; /* Day of month (1-31) */
months dmon; /* Month (Jan = 0) */
};
Note: the year is stored as Year - 1900. For example, if you
wanted to store 1987 in the variable d (of type struct
ddate), you would: d.dyear = 87;
Note: the months start with January as zero.
Date constants:
#define DATENULL " - - " /* empty date string */
#define DATECHAR '-' /* date delimiter char */
#define DATECHARSTR "-" /* date delim. string */
#define DATECHARTEST "/- " /* all date delimiters */
#define BASE_LEAP_YEAR 1980 /* base year for leap
year calculations */
#define BASE_JUL_YEAR 1720982.0 /* base day for Julian
Type E calcs */
Date macros:
#define isleap(yr) isleapyear(yr)
Doshk.h
-------
DOS types:
typedef struct BIOSParmBlock {
unsigned int BytesPerSector;
byte SectorsPerAllocUnit;
unsigned int ReservedSectors;
byte numberFATs;
unsigned int numberRootDirEntries;
unsigned int TotalSectors;
byte MediaDescriptor;
unsigned int SectorsPerFAT;
};
TCHK 2.1 Page 14
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -