[comp.sys.amiga.programmer] Printer online checking - how ?

cmp8163@sys.uea.ac.uk (P.N.J. Vlietstra) (06/27/91)

I know this may sound like a pathetic question, but I never had to do this
before:
how do you check whether a printer (on the parallel port) is actually
switched on (or on-line) ? If you open PRT:, you get a timeout after so many
seconds (including the requestor "printer trouble..."), but I can't
use that in my time-critical application. I need to know within a second
whether the printer is on/off. Is there a way of LEGALLY checking
bits in ciaa, ciab ? If so, how exactly do you go about doing that ?
What happens if you open the parallel.device directly, will that reveal
any info (in some peculiar structure perhaps) on printer status ?
The libs&devs manual is a bit unclear on this point.

Peter Vlietstra
University of East Anglia
Norwich
United Kingdom.

valentin@public.BTR.COM (Valentin Pepelea) (06/28/91)

In article <1290@sys.uea.ac.uk> cmp8163@sys.uea.ac.uk (P.N.J. Vlietstra)
writes:
>
>I know this may sound like a pathetic question, but I never had to do this
>before:

There is no such thing as a pathetic or stupid question. We all need to ask
questions some times, whether it is to learn new things, reassure us of
uncertainties, or to merely find out where to find the information.

>how do you check whether a printer (on the parallel port) is actually
>switched on (or on-line) ?

>The libs&devs manual is a bit unclear on this point.

You may check the hardware directly if you wish, by reading the ciab.ciapra
register located at address $bfd000. Bit 0 will tell you whether the printer
is busy, bit 1 will tell you whether the printer is out of paper and bit 2
will tell you whether the printer is on-line. This register is documented on
page 318 of the Hardware Manual, in appendix F.

But I suggest you use the PDCMD_QUERY command of the parallel device instead.
Should the hardware change in the future, or should your computer have a mutli-
parallel board installed, this command will remain upwardly compatible. It is
documented on page B-45 of the ROM Kernel Manual, Includes & Autodocs.

Valentin
-- 
"An operating system without virtual memory      Name:      Valentin Pepelea
 is an operating system without virtue."         Phone:     (408) 985-1700
                                                 Usenet:    mips!btr!valentin
                     - Ancient Inca Proverb      Internet:  valentin@btr.com