_bios_printer

Description

Calls BIOS printer services, using INT 0x17.

#include <bios.h>

unsigned _bios_printer( unsigned service, unsigned printer, unsigned data );

service Printer function desired  
printer Target printer port  
data Output data  

Remarks

The _bios_printer routine uses INT 0x17 to perform printer output services for parallel printers. The printer argument specifies the affected printer, where 0 is LPT1, 1 is LPT2, and so forth.

Some printers do not support the full set of signals. As a result, the “Out of Paper” condition, for example, may not be returned to your program.

The service argument can be any of the following manifest constants:

Constant Meaning

_PRINTER_INIT Initializes the selected printer. The data argument is ignored.
_PRINTER_STATUS Returns the printer status. The data argument is ignored.
_PRINTER_WRITE Sends the low-order byte of data to the printer specified by printer.

Return Value

The _bios_printer function returns the value in the AX register after the BIOS interrupt. The high-order byte (AH) of the return value indicates the printer status after the operation, as defined below:

Bit Meaning if True Bit Meaning if True

0 Printer timed out 4 Printer selected
1 Not used 5 Out of paper
2 Not used 6 Acknowledge
3 I/O error 7 Printer not busy

Compatibility

Standards:None

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:None

Example

/* BPRINTER.C: This program checks the status of the printer attached to

* LPT1 when it is off line, then initializes the printer.

*/

#include <bios.h>

#include <conio.h>

#include <stdio.h>

#define LPT1 0

void main( void )

{

unsigned status;

printf ( "Place printer off line and press any key\n" );

_getch();

status = _bios_printer( _PRINTER_STATUS, LPT1, 0 );

printf( "Status with printer off line: 0x%.4x\n\n", status );

printf( "Put the printer on line and then\n" );

printf( "Press any key to initialize printer\n" );

_getch();

status = _bios_printer( _PRINTER_INIT, LPT1, 0 );

printf( "Status after printer initialized: 0x%.4x\n", status );

}

Output

Place printer off line and press any key

Status with printer off line: 0x0018

Put the printer on line and then

Press any key to initialize printer

Status after printer initialized: 0x0090