INF: Calling ROM BIOS Routines to Check the Printer Status

ID Number: Q12110

5.00 5.10 6.00 6.00a 6.00ax 7.00

MS-DOS

Summary:

This article discusses how to check the printer status from within a C

program before trying to write to the printer.

More Information:

Although there is no portable method for checking printer status in C,

you can get printer status information via the ROM BIOS. You can

obtain status information by calling _bios_printer(), which is an

interface to INT 17H, function 2. You can also call BIOS interrupt

functions through the int86() functions. See the online help or the

run-time library reference for your version of the compiler for more

information about these functions.

You may want to handle the error by revectoring the critical error

handler interrupt (24H), which will allow you to intercept the "abort,

retry, ignore" message before the user receives it. You then can

decide whether to substitute your own message, such as "Printer off

line: set printer on line and press Y to continue."

More information on the ROM BIOS routines and interrupt handlers can

be found in the following two books from Microsoft Press:

1. "The Peter Norton Programmer's Guide to the IBM PC" by Peter Norton

2. "Advanced MS-DOS" by Ray Duncan

Additional reference words: 5.00 5.10 6.00 6.00a 6.00ax 7.00