📄 tcxl.doc
字号:
Inputs: none
Return: none
Also see: lprintc
Example:
lprints("Hello, world");
lcrlf();
lprintc(FF);
Name: lprintc
Purpose: prints a character on the printer
Prototype: void lprintc(int ch);
Header: tcxlprn.h
Inputs: ch - the character to print
Return: none
Also see: lcrlf lprintf
Example:
26
lprints("Hello, world\n");
lprintc(FF);
Name: lprintf
Purpose: sends formatted output to the printer, works like printf()
Prototype: int lprintf(const char *format,...);
Header: tcxlprn.h
Inputs: format - format string, refer to Turbo C manual under printf()
... - any additional arguments
Return: a zero if no error, otherwise a memory allocation error
Also see: lprintc lprintns lprints
Example:
char ch='X';
int i=327;
char *str="Hello";
lprintf("%s %c %d\n",str,ch,i);
Name: lprintns
Purpose: prints a string on the printer, formatting width
Prototype: void lprintns(char *str,int width);
Header: tcxlprn.h
Inputs: str - the address of the string to print
width - width to print string, uses padding or truncating
Return: none
Also see: lprintf lprints lprintsu
Example:
lprintns("Hello, world",5);
lcrlf();
lprintc(FF);
Name: lprints
Purpose: prints a string on the printer
Prototype: void lprints(char *str);
Header: tcxlprn.h
Inputs: str - the address of the string to print
Return: none
Also see: lprintf lprintns lprintsu
Example:
lprints("Hello, world\n");
lprintc(FF);
Name: lprintsb
Purpose: prints a bold-faced string on the printer
Prototype: void lprintsb(char *str);
Header: tcxlprn.h
Inputs: str - the address of the string to print
Return: none
Also see: lprints lprintsu
Example:
lprintsb("Hello, world\n");
lprintc(FF);
27
Name: lprintsu
Purpose: prints an underlined string on the printer
Prototype: void lprintsu(char *str);
Header: tcxlprn.h
Inputs: str - the address of the string to print
Return: none
Also see: lprints lprintsb
Example:
lprintsu("Hello, world\n");
lprintc(FF);
Name: machid
Purpose: returns the value of the machine ROM ID byte
Prototype: int machid(void);
Header: tcxldef.h
Inputs: none
Return: the value of the machine ROM ID byte
Also see: biosver
Example:
if(machid()==IBMPCAT) printf("You have an IBM PC/AT\n");
Name: mathchip
Purpose: determines if a math coprocessor is installed
Prototype: int mathchip(int equip);
Header: tcxldef.h
Inputs: equip - the result from the biosequip() function
Return: a 1 if a math coprocessor is installed
Also see: gameport numflop numpar numser
Example:
int i;
i=biosequip();
printf("Math coprocessor is %sinstalled\n",mathchip(i)?"":"not ");
Name: mode
Purpose: sets the video mode
Prototype: void mode(int mode_code);
Header: tcxlvid.h
Inputs: mode_code - mode code number
Return: none
Also see: setlines vidtype
Example:
mode(4);
printf("We are now in CGA graphics mode\n");
Name: msbpress
Purpose: gets info about specific button presses of mouse
Prototype: void msbpress(int button,int *bstat,int *bcount,int *x,int *y);
Header: tcxlmou.h
Inputs: button - button to check, 0 = left button, 1 = right button
bstat - address to receive button status (0 = not being pressed,
1 = currently being pressed)
bcount - address to receive number of times pressed since last
call
28
x - address to receive X pixel coordinate at time of press
y - address to receive Y pixel coordinate at time of press
Return: none
Also see: msbreles msstatus
Example:
int bstat,int bcount,int x,int y;
msbpres(0,&bstat,&bcount,&x,&y);
printf("bstat = %d, bcount = %d, x = %d, y = %d\n",bstat,bcount,
x,y);
Name: msbreles
Purpose: gets info about specific button releases of mouse
Prototype: void msbreles(int button,int *bstat,int *bcount,int *x,int *y);
Header: tcxlmou.h
Inputs: button - button to check, 0 = left button, 1 = right button
bstat - address to receive button status (0 = not being pressed,
1 = currently being pressed)
bcount - address to receive number of times released since last
call
x - address to receive X pixel coordinate at time of release
y - address to receive Y pixel coordinate at time of release
Return: none
Also see: msbpress msstatus
Example:
int bstat,int bcount,int x,int y;
msbreles(0,&bstat,&bcount,&x,&y);
printf("bstat = %d, bcount = %d, x = %d, y = %d\n",bstat,bcount,
x,y);
Name: mscursor
Purpose: sets the mouse cursor mode
Prototype: void mscursor(int curtype,int smask,int cmask);
Header: tcxlmou.h
Inputs: curtype - cursor type, 0 = software, 1 = hardware
smask - screen mask (SW) or start scan line (HW), see section
on using mouse functions for a description of mask
cmask - cursor mask (SW) or stop scan line (HW), see section
on using mouse functions for a description of mask
Return: none
Also see: msshowcur
Name: msgotoxy
Purpose: sets the mouse coordinates
Prototype: void msgotoxy(int x,int y);
Header: tcxlmou.h
Inputs: x - X pixel coordinate
y - Y pixel coordinate
Return: none
Also see: msstatus
Example:
msgotoxy(20*8,10*8); /* sets mouse cursor at row 10, column 20 */
Name: mshbounds
29
Purpose: sets the mouse horizontal bounds
Prototype: void mshbounds(int left,int right);
Header: tcxlmou.h
Inputs: left - left pixel boundry
right - right pixel boundry
Return: none
Also see: msvbounds
Example:
/* limits mouse movement between columns 40 and 60 */
mshbounds(40*8,60*8);
Name: mshidecur
Purpose: hides the mouse cursor
Prototype: void mshidecur(void);
Header: tcxlmou.h
Inputs: none
Return: none
Also see: msshowcur
Example:
msshowcur(); /* now you see mouse cursor */
mshidecur(); /* now you don't */
Name: msinit
Purpose: determines if mouse is present. If so, initializes mouse. See
section on how to use TCXL's mouse functions for details.
Prototype: int msinit(void);
Header: tcxlmou.h
Inputs: none
Return: a 0 if mouse is not present
Example:
if(msinit()) {
printf("Mouse initialized!\n");
}
else {
printf("Mouse does not exist\n");
}
Name: msmotion
Purpose: gets information about the movement of mouse
Prototype: void msmotion(int *xcount,int *ycount);
Header: tcxlmou.h
Inputs: xcount - address to receive amount of X movement in pixels -/+
ycount - address to receive amount of Y movement in pixels -/+
Return: none
Example:
int xcount,ycount;
msinit();
msmotion(&xcount,&ycount);
printf("Move mouse, then press a key\n");
waitkey();
msmotion(&xcount,&ycount);
if(xcount<0) printf("mouse moved left\n");
if(xcount>0) printf("mouse moved right\n");
if(ycount<0) printf("mouse moved up\n");
30
if(ycount>0) printf("mouse moved down\n");
Name: msshowcur
Purpose: reveals the mouse cursor
Prototype: void msshowcur(void);
Header: tcxlmou.h
Inputs: none
Return: none
Also see: mshidecur
Example:
msshowcur(); /* now you see mouse cursor */
mshidecur(); /* now you don't */
Name: msspeed
Purpose: adjusts mouse speed by changing its sensitivity
Prototype: void msspeed(int xratio,int yratio);
Header: tcxlmou.h
Inputs: xratio - horizontal speed (higher numbers are slower)
yratio - vertical speed (higher numbers are slower)
Return: none
Example:
msinit();
msshowcur();
printf("move mouse around, then press a key\n");
waitkey();
msspeed(15,15);
printf("now see how mouse moves\n");
waitkey();
Name: msstatus
Purpose: returns the mouse status
Prototype: void msstatus(int *bstat,int *x,int *y);
Header: tcxlmou.h
Inputs: bstat - address to receive button status (0 = not pressed, 1 =
pressed)
x - address to receive current X pixel coordinate
y - address to receive current Y pixel coordinate
Return: none
Example:
int bstat,x,y;
msstatus(&bstat,&x,&y);
printf("bstat = %d, x = %d, y = %d\n",bstat,x,y);
Name: msvbounds
Purpose: sets the mouse vertical bounds
Header: tcxlmou.h
Prototype: void msvbounds(int top,int bottom);
Inputs: top - top pixel boundry
bottom - bottom pixel boundry
Return: none
Also see: mshbounds
Example:
/* limits mouse movement between rows 10 and 20 */
31
msvbounds(10*8,20*8);
Name: numflop
Purpose: returns the number of floppy disk drives installed
Prototype: int numflop(int equip);
Header: tcxlmou.h
Header: tcxldef.h
Inputs: equip - the result from the biosequip() function
Return: the number of floppy disk drives installed
Also see: gameport mathchip numpar numser
Example:
int i;
i=biosequip();
printf("Number of floppy disk drives = %d\n",numflop(i));
Name: numoff
Purpose: toggles the NumLock key off
Prototype: void numoff(void);
Header: tcxlkey.h
Inputs: none
Return: none
Also see: capsoff kbstat numon
Example:
numoff();
Name: numon
Purpose: toggles the NumLock key on
Prototype: void numon(void);
Header: tcxlkey.h
Inputs: none
Return: none
Also see: capson kbstat numoff
Example:
numon();
Name: numpar
Purpose: determines the number of parallel ports
Prototype: int numpar(int equip);
Header: tcxldef.h
Inputs: equip - the result from the biosequip() function
Return: the number of parallel ports installed
Also see: gameport mathchip numflop numser
Example:
int i;
i=biosequip();
printf("Number of parallel ports = %d\n",numpar(i));
Name: numser
Purpose: determines the number of serial ports installed
Prototype: int numser(int equip);
Header: tcxldef.h
Inputs: equip - the result from the biosequip() function
32
Return: the number of serial ports installed
Also see: gameport mathchip numflop numpar
Example:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -