Page 1 of 1

cs609 ENJOY

PostPosted: Mon May 10, 2010 7:14 pm
by abdulsaboor
#include<stdio.h>
#include<bios.h>

union REGS regs;

void main(void)
{

regs.h.ah=2;

regs.x.dx=0;

int86(0x17,&regs,&regs);


if ((regs.h.ah & 0x01)==0x01)
{
//if bit # 0 of status byte is set, it means there is a time out error

printf("\n Printer Time out");

}

else

if ((regs.h.ah & 0x08)==0x08)
{
//if bit # 3 of status byte is set, it means there is some data transfer error

printf("\n Data transfer error");

}

else

if ((regs.h.ah & 0x10)==0)
{
//if bit # 4 of status byte is cleared, it means printer is offline

printf("\n Printer is offline");

}

else

if ((regs.h.ah & 0x20)==0x20)
{
//if bit # 5 of status byte is set, it means printer is out of paper

printf("\n Printer is out of paper");

}

else

if ((regs.h.ah & 0x80)==0)
{
//if bit # 7 of status byte is cleared, it means printer is busy

printf("\n Printer is busy");

}

else

{

printf("\n Ready to print");

}

}