📄 suplmnt.doc
字号:
---------------------------------------------------------------
getvmode -- Get Video Mode
---------------------------------------------------------------
int getvmode(void);
Returns the current video mode.
---------------------------------------------------------------
setvpage -- Set Video Page
---------------------------------------------------------------
void setvpage(int page);
Sets the video page to 'page'. Pages are only supported on
color systems. This function also modifies v_seg so that it
reflects the new page value set.
---------------------------------------------------------------
getvpage -- Get Video Page
---------------------------------------------------------------
int getvpage(void);
Returns the current video page.
---------------------------------------------------------------
setvbordr -- Set Video Border
---------------------------------------------------------------
void setvbordr(int attrib);
Sets the border color of the screen.
MISCELLANEOUS FUNCTIONS:
---------------------------------------------------------------
str*just -- right, left, or center justify a string.
---------------------------------------------------------------
These functions 1st trim all spaces (ASCII 32's) and then just-
ify the string in the specified field width using the specified
pad character. The memory area where the string is located
must be at least field size + 1 in size. If the string is
longer than the field width, strljust and strcentr truncate the
right portion of the string; strrjust will cut off the right
side. Only ASCII 32's are trimmed.
Returns a pointer to the justified string.
char *strrjust(char *, int, char);
char *strljust(char *, int, char);
char *strcentr(char *, int, char);
str_out = strrjust(str_in, fieldsz, padchar);
---------------------------------------------------------------
str*trim -- trims spaces (ASCII 32's only) from a string.
---------------------------------------------------------------
Trims spaces from left, right, or both ends of a string.
Returns pointer to the passed string.
char *strrtrim(char *);
char *strltrim(char *);
char *strtrim(char *);
str_out = strrtrim(str_in);
---------------------------------------------------------------
strsum -- strcat for multiple strings.
---------------------------------------------------------------
Makes one string from multiple strings. Unlike strcat, the
first string in the list is not one of the strings to add but
instead is a buffer for the result of adding the rest of the
strings in the list. The args to the function are:
the dest, a variable number of char *'s, a NULL ptr
Returns a pointer to the result string.
char *strsum(char *, ...);
str_out = strsum(str_out, str_in1, str_in2, ..., NULL);
---------------------------------------------------------------
strpbrkf -- finds 1st char in str1 not in str2.
---------------------------------------------------------------
This function looks for the first character in 'str1' that does
not belong to the character set contained in 'str2' and returns
a pointer to that character. If 'str1' consists entirely of
characters in 'str2', NULL is returned. Opposite of strpbrk.
char *strpbrkf(char *, char *);
rtnstr = strpbrkf(str1, str2);
---------------------------------------------------------------
strrstr -- find last occurrence of str2 in str1.
---------------------------------------------------------------
This function returns a pointer to the last occurrence of
'str2' within 'str1'. If 'str2' is not in 'str1', NULL is
returned. This is identical to the standard 'strstr' function
except it works from the end of 'str1' towards the beginning
instead of the other way.
char *strrstr(char *, char *);
rtnstr = strrstr(str1, str2);
---------------------------------------------------------------
strcntch -- returns number occurrences of char in string.
---------------------------------------------------------------
int strcntchr(char *, char);
count = strcntchr(string, srchchar);
---------------------------------------------------------------
calc_crc -- 16 bit CRC routine for block data.
---------------------------------------------------------------
Calculates the CRC for a block of data 'count' bytes long.
Returns CRC.
int calc_crc(char *, int);
crc = calc_crc(data, nbr_bytes_of_data);
---------------------------------------------------------------
update_crc -- 16 bit CRC for character at a time data.
---------------------------------------------------------------
Returns updated CRC.
int update_crc(int, char);
crc = update_crc(crc, char);
---------------------------------------------------------------
watchdogset -- Enables/Disables watchdog function (C function)
watchdoghook -- ASM function used by WATCHDOG.C
---------------------------------------------------------------
int watchdogset(int flag, int combase)
To enable: call with flag = 1
combase = base adrs of comm chip (ex: 3F8)
To disable: call with flag = 0
combase = don't care
This function monitors Carrier Detect on the selected serial
port and does a cold reboot if the carrier is lost. If you use
both this function and the TIMEOUT functions make sure you
uninstall the hooks in the reverse order that you installed
them and make sure that you uninstall them before you exit your
program. Failing to do this will cause your system to crash
(the redirected interrupt vectors are now pointing to freed
memory instead of a program).
---------------------------------------------------------------
ctshookset -- Patch to BIOS INT14 to prevent timeouts when
using CTS handshaking (C function)
int14ctshook -- ASM function used with CTSHOOKSET
---------------------------------------------------------------
int ctshookset(int flag, int portval, int combase)
void interrupt far int14ctshook(void);
To enable: call with flag = 1
portval = COM1 (0) or COM2 (1)
combase = base adrs of comm chip (ex: 3F8)
To disable: call with flag = 0
portval = don't care
combase = don't care
This function sets a hook into the BIOS serial interrupt vector
that waits indefinitely for CTS to go high on the specified
port when sending data. All INT14 calls that are not for the
specified port and all service requests except for 'send byte'
are passed on to the old INT14 vector unaltered. In other
words for the hook to have any effect when INT14 is called:
1) DX has to equal the 'portval' you set here
2) AH has to equal '1' -- the send char service ID
The effect it has then is to wait for CTS to be true then exe-
cute the old INT14 interrupt. The purpose of the function is
keep high speed modems that CTS handshake from creating timeout
errors when redirecting stdout and stderr to the comm port. Be
SURE to uninstall the hook before exiting your program or the
redirected interrupt vector will be pointing to free memory
instead of an interrupt handler.
---------------------------------------------------------------
tickhookset -- Enables/Disables 'ticker' for timer functions
---------------------------------------------------------------
int tickhookset(int flag)
To enable: call with flag = 1
To disable: call with flag = 0
This function enables the 'tick counter' used by the timeout
and tdelay functions by pointing the TIMER interrupt vector,
1Ch, to a new interrupt handler that increments the counter
approximately 18.2 times per second. The advantage of using
this method over the BIOS function is no coding is needed to
account for the possibility of calling your timer functions
near midnight. The 'tick counter' is a long and may be read by
calling 'get_ticker'.
YOU MUST DISABLE 'TICKER' BEFORE EXITING YOUR PROGRAM.
---------------------------------------------------------------
set_timeout -- initializes a timer
set_longtimeout -- initialize a long timer
timed_out -- checks if a timeout has occurred
---------------------------------------------------------------
void set_timeout(long *t_out, unsigned ticks);
int timed_out(long *t_out);
These functions work in conjunction with each other and require
the 'tick counter' to be activated by TICKHOOKSET. The fol-
lowing macros are defined in EXTRA.H:
SET_TO_TENTHS(to, tenths) set_timeout((&to), (tenths)*9/5)
SET_TO_SECS(to, secs) set_timeout((&to), (secs)*18)
SET_TO_MINS(to, mins) set_timeout((&to), (mins)*1080)
After setting the timeout value with one of the above macros
you then call timed_out() see if a timeout has occurred. Here
is an example:
long to;
int toolong = 0;
tickhookset(1); /* enable hook */
SET_TO_SECS(to, 2); /* set timeout for 2 secs */
while (!(toolong = timed_out(&to)))
{
if (condition_met()) /* wait for cond 2 secs max */
break;
}
if (toolong) /* timed out if toolong NZ */
return TIMEOUT_ERR;
Notice that the macro does not require the '&' operator but the
call to timed_out() does. Using these functions, you may have
as many timeouts going as you have timeout variables.
---------------------------------------------------------------
get_ticker -- get the current value of internal tick counter
---------------------------------------------------------------
long get_ticker(void);
Returns the value of the internal tick counter. This counter
is incremented 18.2 times a second from the time tickhookset(1)
is called until tickhookset(0) is called.
---------------------------------------------------------------
tdelay -- kill time function
---------------------------------------------------------------
int tdelay(unsigned ticks);
This functions delays the specified number of ticks and then
returns. Before using this function you must enable the
internal tick counter by calling 'tickhookset'.
The following macros are defined in EXTRA.H:
DELAY_TENTHS(tenths) tdelay(((tenths)*9/5)+1)
DELAY_SECS(secs) tdelay((secs)*18)
DELAY_MINS(mins) tdelay((mins)*1080)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -