C Programming :
Function :_bios_printer
Syntax
#include <bios.h>
unsigned _bios_printer(int cmd, int port, int abyte);
Description
_bios_printer performs various printer functions on the printer identified by the parameter port using BIOS interrupt 0x17.
A port value of 0 corresponds to LPT1; a port value of 1 corresponds to LPT2; and so on.
The value of cmd can be one of the following values (defined in bios.h):
_PRINTER_WRITE Prints the character in abyte. The value of abyte can be 0 to 255.
_PRINTER_INIT Initializes the printer port. The abyte argument is ignored.
_PRINTER_STATUS Reads the printer status. The abyte argument is ignored.
Return Value
The value returned from any of these operations is the current printer status, which is obtained by ORing these bit values together:
Bit 0 0x01 Device time out
Bit 3 0x08 I/O error
Bit 4 0x10 Selected
Bit 5 0x20 Out of paper
Bit 6 0x40 Acknowledge
Bit 7 0x80 Not busy
Example :
/* _bios_printer example */
#include <stdio.h>
#include <conio.h>
#include <bios.h>
int main(void)
{
unsigned PortNum = 0x1; /* LPT1 -> 0, LPT2 -> 1 */
unsigned status, abyte = 0;
printf("Please turn off your printer.\n\
Press any key to continue\n");
getch();
status = _bios_printer(_PRINTER_STATUS, PortNum, abyte);
if (status & 0x01)
printf("Device time out.\n");
if (status & 0x08)
printf("I/O error.\n");
if (status & 0x10)
printf("Selected.\n");
if (status & 0x20)
printf("Out of paper.\n");
if (status & 0x40)
printf("Acknowledge.\n");
if (status & 0x80)
printf("Not busy.\n");
return 0;
}
Function :_bios_printer
Syntax
#include <bios.h>
unsigned _bios_printer(int cmd, int port, int abyte);
Description
_bios_printer performs various printer functions on the printer identified by the parameter port using BIOS interrupt 0x17.
A port value of 0 corresponds to LPT1; a port value of 1 corresponds to LPT2; and so on.
The value of cmd can be one of the following values (defined in bios.h):
_PRINTER_WRITE Prints the character in abyte. The value of abyte can be 0 to 255.
_PRINTER_INIT Initializes the printer port. The abyte argument is ignored.
_PRINTER_STATUS Reads the printer status. The abyte argument is ignored.
Return Value
The value returned from any of these operations is the current printer status, which is obtained by ORing these bit values together:
Bit 0 0x01 Device time out
Bit 3 0x08 I/O error
Bit 4 0x10 Selected
Bit 5 0x20 Out of paper
Bit 6 0x40 Acknowledge
Bit 7 0x80 Not busy
Example :
/* _bios_printer example */
#include <stdio.h>
#include <conio.h>
#include <bios.h>
int main(void)
{
unsigned PortNum = 0x1; /* LPT1 -> 0, LPT2 -> 1 */
unsigned status, abyte = 0;
printf("Please turn off your printer.\n\
Press any key to continue\n");
getch();
status = _bios_printer(_PRINTER_STATUS, PortNum, abyte);
if (status & 0x01)
printf("Device time out.\n");
if (status & 0x08)
printf("I/O error.\n");
if (status & 0x10)
printf("Selected.\n");
if (status & 0x20)
printf("Out of paper.\n");
if (status & 0x40)
printf("Acknowledge.\n");
if (status & 0x80)
printf("Not busy.\n");
return 0;
}
No comments:
Post a Comment