void interrupt irq_service()
{
char cc; int_num++;
/* 1. Read interrupt signal status */ new_int_state=inp(wBase+0x07)&0xff;
/* | 2. | Find the active | signal | */ |
int_c=new_int_state ^ | now_int_state; | |||
/* | 3. | IF PC0 is active |
| */ |
if ((int_c&0x01) != 0)
{
cc=new_int_state&0x01;
if (cc !=0) CNT_H1++; else CNT_L1++; invert=invert ^ 1;
}
/* 4. IF PC1 is active | */ |
if ((int_c&0x02) != 0)
{
cc=new_int_state&0x02;
if (cc !=0) CNT_H2++; else CNT_L2++; invert=invert ^ 2;
}
/* 5. IF PC2 is active | */ |
if ((int_c&0x04) != 0)
{
cc=new_int_state&0x04;
if (cc !=0) CNT_H3++; else CNT_L3++; invert=invert ^ 4;
}
/* 6. IF PC3 is active | */ |
if ((int_c&0x08) != 0)
{
cc=new_int_state&0x08;
if (cc !=0) CNT_H4++; else CNT_L4++; invert=invert ^ 8;
}
now_int_state=new_int_state; outp(wBase+0x2a,invert);
if (wIrq>=8) outp(A2_8259,0x20); outp(A1_8259,0x20);
}