fredrik@Siri.Unit.NO (Fredrik Knoph Kvamme) (04/14/91)
In his article Sid writes he couldn't get the compiler to accept my code. I
must agree with him, the error was mine.
> IF ((port[$379] and 16)==16) THEN PRN_OnLine:=TRUE
^
That line should have been :
IF ((port[$379] and 16)=16) THEN PRN_OnLine:=TRUE
It was my fault. I have been away from PASCAL too long. The == is the way
we do it in C.
Now, how do we check the other status-bits?
I got the number 16 because the Select bit is bit number four in the status port.
2 to the power of 4 is 16.
The numbers for the other is :
Error : 8
Select(Online) : 16
Paper out : 32
Acknowledge : 64
BUSY : 128
So in order to write a routine checking for out of paper do this:
FUNCTION PaperOut: BOOLEAN;
BEGIN
IF ((port[$379] and 32)=32) THEN PaperOut:=TRUE
ELSE PaperOut:=FALSE;
END;
I hope this helps.
(Next time I shall proofread my article better.)
Fredrik Kvamme
fredrik@lise.unit.no
NTH, Norwegian Institute of Technology
Trondheim, Norway