Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!wuarchive!waikato.ac.nz!canterbury!phys169 From: phys169@csc.canterbury.ac.nz Newsgroups: comp.lang.pascal Subject: Re: Help in Printer Status! Message-ID: <1991Jun24.163223.1178@csc.canterbury.ac.nz> Date: 24 Jun 91 04:32:23 GMT References: <1991Jun22.163830.21689@cs.mcgill.ca> Organization: University of Canterbury, Christchurch, New Zealand Lines: 31 In article <1991Jun22.163830.21689@cs.mcgill.ca>, dara@cs.mcgill.ca (Dara UNG) writes: > I've tried the following code suggested by Tom Swan, "Mastering Turbo > Pascal 5.5", but the output from PrintStatus always is 255 > regardless of the ON/OFF state of printer! > Try... var PrintStatus : byte; LptPortAddr : array[1..4] of word absolute 0:$408; begin PrintStatus := Port [LprPortAddr[1]]; writeln (PrintStatus); end; The idea is to find the actual port addresses from the table BIOS creates during power-on self-testing. Otherwise teh port address for LPT1 depends on such factors as the type of vidoe display you have. An even better idea is to use interrupt $17 (with AH=2) or possibly MsDos call $44, to allow for such things as printer redirection. So you could declare... const LPT1 = 0; LPT2 = 1; LPT3 = 2; LPT4 = 3; function PrinterStatus(WhichPrinter : word) : byte; inline($B4/$02/ { mov ah,2 } $5A/ { pop dx } $CD/$17/ { int 17h } $8A/$C4); { mov al,ah } Hope this helps, Mark Aitchison, Physics, University of Canterbury, New Zealand. [insert favourite quote from BlackAdder/Goodies/Spike Milligoon/Penfold here]