Lprint and printers

 BBS: Inland Empire Archive
Date: 07-06-92 (14:59)             Number: 168
From: TOM KIEHL                    Refer#: NONE
  To: JIM TANNER                    Recvd: NO  
Subj: Lprint and printers            Conf: (2) Quik_Bas
Jim,

RE: can't get CheckPrn% function to return TRUE... Read
other messages of possible solutions for your not getting a
valid 144 Looking back thru some of my QB code, I found
that I needed to do this with the Regs.ax...

Status% = (Regs.ax \256) AND 255
                         ^^^^^^^
This takes care of the negative-number return value.

Secondly, the printer "busy" line could be triggered by the printer which
would give you a return value of 16. Since busy is not
really an error state and will clear itself in time, I make
a simple delay loop of a second or so and try again. Of
course if too much time passes (iterations of the loop)
there could be a problem and it would be a good idea to
bail out at that point.

Sorry for the missing "AND 255". I had typed it from memory
(where I deal with AH and AL individually in C and ASM adn
don't need to divide by 256).

If you want to distinguish each "error", here's a list:

Bit 7 (128 decimal)  Printer NOT busy if ON Bit 6 (64 dec)       Printer
acknowledge Bit 5 (32 dec)       Out of paper if ON Bit 4
(16 dec)       Printer Selected (On-Line) if ON Bit 3 (8
dec)       I/O error if ON Bits 1 & 2           Not used
Bit 0 (1  dec)       Printer timed out if ON

So if status% = 144 ... (128 ORed with 16) printer is ready
to roll. IF Status% = 128   all is fine but printer buffer
may be full. IF Status% AND 32  then out of paper IF
Status% AND 8   then I/O error IF Status% AND 1   then
Printer timed out I usually ignore Bit 6.

That should get you going.

Tom Kiehl

~~
 * SLMR 2.1a * Old programmers never die, they just lose their byte.


--- TosScan 1.00
 * Origin: Carrie's Living Room - Largo, Florida USA  (1:3603/150)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET