I wrote a C routine to handle the IRQ7 printer interrupt (ACK going low) and it works correctly running on a 286 DOS only PC. The program will not run in DOS mode on a PC running Windows 95 even when I reboot the PC in DOS mode only. The following code sets the interrupt. Any help will be greatly appreciated.
void install_lpt1_ack_interrupt(void)
{
int code, temp;
// use DOS to set the interrupt vector for interrupt 0x0F
//which is IRQ7 (LPT1) if a transition of the ACK#
// signal from a high to low occurs
_disable();
old_lpt1_ack_vector = _dos_getvect(0x0F);
_dos_setvect(0x0F,lpt1_ack_int);
// set IRQ bit high in control register to enable printer iRQ
code = inportb(0x37A);
code = code | IRQ_HIGH_MASK;
outportb(0x37A,code); //set IRQ bit high
temp = inp(0x21); // unmask IRQ7 LPT1 interrupt
// IRQ7 located thru port 21
temp &= ~0x80; // bit 7=0 -> enable
outportb(0x21,temp); // 0 = enable
_enable();
}
/////////////////////////////////
The interrupt handler is as follows:
void interrupt lpt1_ack_int(void)
{
++ack_count; // global variable
outportb(0x20,0x20);
}