PRINT SCREEN (Hardware Interrupt 5) Fails If Printer Is Busy
This article was previously published under Q38068 On This PageSUMMARY
If the printer is busy (still working on a print job) when a hardware
interrupt 5 (PRINT SCREEN) interrupt is issued (such as by pressing
the SHIFT+PRINT SCREEN or PRINT SCREEN key), the interrupt will not
dump the screen to the printer. The hardware interrupt 5 checks the
printer status before continuing, and if the printer is busy, it
aborts the screen dump.
This information applies to Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50, to Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS, and to Microsoft Basic PDS 7.00 for MS-DOS. It also applies to any language that supports hardware interrupt 5. MORE INFORMATION
If a program sends some information to the printer and then issues an
interrupt 5 (through CALL INTERRUPT, or an assembly-language program),
the screen dump may be skipped. If the printer has not finished
printing the information sent prior to the interrupt 5 call, the
printer will return "busy" when the print screen interrupt checks the
printer status.
This may not be a problem running on machines with slower clock speeds (4.77, 6 MHz, etc.), but the same code running on a faster machine (clock speed 10, 12, 16, 20 MHz, etc.) may fail because the processor of the computer may work faster than the printer does. To guarantee that the printer is not busy before doing a screen dump, you can check the printer status yourself. The printer status can be obtained by invoking interrupt 17 hex, function 2. The value returned in the AH register by this interrupt contains the following information corresponding to each bit: Bit Status --- ------ 7 Printer NOT busy 6 Acknowledge 5 Out of paper 4 Printer selected 3 I/O error 2 Unused 1 Unused 0 Timed-outBelow are two sample program listings, one for assembly language, and one for Basic using the CALL INTERRUPT method, that return the printer status byte. If the status byte ANDed with 128 is 128, the printer is not busy; if it is 0, the printer is busy, and a screen dump at that point would fail. Program logic should loop, constantly checking the printer status, until the status (AND 128) is 128, and then perform the interrupt 5. For another sample Basic program using this interrupt, query on the following:
time-out and printer and interrupt and 17 and function and 2
Code ExampleThe assembly listing is as follows:
The Basic listing is as follows:
APPLIES TO
| Article Translations
|

Back to the top
