procedure printer_stat; type str4 = string[4]; const PaperEnd_Bit= 5; {port_addr } SLCT_Bit = 4; {port_addr } ACK_Bit = 6; {port_addr } Busy_Bit = 7; {port_addr } Strobe_Bit = 0; {port_addr +1 } AutoFeed_Bit= 1; {port_addr +1 } INIT_Bit = 2; {port_addr +1 } SLCTIN_Bit = 3; {port_addr +1 } var ch : char; port_addr : integer; function hex_str(w: integer): str4; const hex: array[0..15] of char =('0','1','2','3','4','5','6','7','8', '9','A','B','C','D','E','F'); var hex_str_temp: str4; begin hex_str_temp := '0000'; hex_str_temp[4] := hex[(w and 15)]; w := w shr 4; hex_str_temp[3] := hex[(w and 15)]; w := w shr 4; hex_str_temp[2] := hex[(w and 15)]; w := w shr 4; hex_str_temp[1] := hex[(w and 15)]; hex_str := hex_str_temp end; begin {printer_stat} clrscr; writeln('Press any key to stop display.'); window(1,3,80,25); repeat gotoxy(1,1); port_addr := memw[$40:08]; if port_addr > 270 then begin write('LPT @ ',hex_str(port_addr),' '); port[port_addr] := $FF; port[port_addr+2]:= 0; writeln('Busy Line : ' , not odd(port[port_addr +1] shr 7):5); writeln(' ACK Line : ', not odd(port[port_addr +1] shr 6):5); writeln(' Paper End Line: ', odd(port[port_addr +1] shr 5):5); writeln(' SLCT Line : ', odd(port[port_addr +1] shr 4):5); writeln(' ERROR Line : ', not odd(port[port_addr +1] shr 3):5); writeln(' SLCTIN Line : ', not odd(port[port_addr +2] shr 3):5); writeln(' INIT Line : ', odd(port[port_addr +2] shr 2):5); writeln(' Auto Feed Line: ', odd(port[port_addr +2] shr 1):5); writeln(' Strobe Line : ', odd(port[port_addr +2 ]):5); end; port_addr := memw[$40:$A]; if port_addr > 270 then begin writeln; writeln('LPT @ ',hex_str(port_addr),' status of the status lines: '); port[port_addr] := $FF; writeln('Busy Line : ', odd(port[port_addr +1] div 128):5); writeln('ACK Line : ', odd(port[port_addr +1] div 64):5); writeln('Paper End Line: ', odd(port[port_addr +1] div 32):5); writeln('SLCT Line : ', odd(port[port_addr +1] div 16):5); writeln('SLCTIN Line : ', odd(port[port_addr +2] div 8):5); writeln('INIT Line : ', odd(port[port_addr +2] div 4):5); writeln('Auto Feed Line: ', odd(port[port_addr +2] div 2):5); writeln('Strobe Line : ', odd(port[port_addr +2 ]):5); end; port_addr := memw[$40:$C]; if port_addr > 270 then begin writeln; writeln('LPT @ ',hex_str(port_addr),' status of the status lines: '); port[port_addr] := $FF; writeln('Busy Line : ', odd(port[port_addr +1] div 128):5); writeln('ACK Line : ', odd(port[port_addr +1] div 64):5); writeln('Paper End Line: ', odd(port[port_addr +1] div 32):5); writeln('SLCT Line : ', odd(port[port_addr +1] div 16):5); writeln('SLCTIN Line : ', odd(port[port_addr +2] div 8):5); writeln('INIT Line : ', odd(port[port_addr +2] div 4):5); writeln('Auto Feed Line: ', odd(port[port_addr +2] div 2):5); writeln('Strobe Line : ', odd(port[port_addr +2 ]):5); end; delay(300); until keypressed; read(kbd,ch); end;{ printer stat} var target: file; begin printer_stat; assign(target,'run.chn'); chain(target) end.