1. printer test - Reply
- Posted by "BABOR, JIRI" <J.Babor at GNS.CRI.NZ> Aug 22, 1997
- 614 views
Michael J Doscher asked: > How do you determine if the printer is on line or not ? I think Wally was absolutely right, why don't you listen to your printer? But just in case, I also translated Irv's proposition. Jiri -- snip ------------------------------------------------------------------------ -- printer.ex -- j.babor at gns.cri.nz include machine.e function printer_status(integer printer_number) -- return printer status -- printer_number is 1 for lpt1, 2 for lpt2, etc -- status byte bits (1 & 2 are not used): -- -- 7 --- ---- 6 ---- -- 5 --- -- 4 --- -- 3 -- --- 0 --- -- not busy acknowledge no paper selected i/o err. timed-out sequence rl -- list of register values rl = repeat(0,10) rl[REG_AX] = #0200 rl[REG_DX] = printer_number-1 -- 0..2 -> lpt1..lpt3 rl = dos_interrupt(#17,rl) return floor(rl[REG_AX]/256) end function function printer_ok(integer printer_number) -- return 1 (true) if printer is selected, has paper, -- and no I/O or time out error has occurred integer status status=printer_status(printer_number) return and_bits(status,#10) and not and_bits(status,#29) end function -- example --------------------------------------------------------------------- ? printer_status(1) ? printer_ok(1)