function ReadPortB(wPort:Word):Byte;
asm
  mov   dx, wPort
  in    al, dx
  mov   result, al
end;//获取打印机是否出错
function CheckPrinter:boolean;
var
  temp:byte;
begin
    temp:=ReadPortB($379);
    Result:=not ( ((temp and $80)=0) //打印机忙
            or ((temp and $20)<>0)   //打印机缺纸
            or ((temp and $10)=0)    //打印机未联机
            or ((temp and $08)=0) ); //打印机出错;
end;