Network Card User Manual

Loading and Unloading an Interrupt Service Routine (ISR)
4-3
Interrupt Handling
This routine converts either the eight low hardware interrupts, or the eight high
interrupts, or a software interrupt higher than 0xF to the vector table, then
makes an O/S call to get the old vector and slips in the new. It returns the pre-
vious contents of that table entry so that it can be restored later. The timer inter-
rupt is not connected to one of the 15 hardware interrupts, so its vector is high-
er than 0xF and is entered explicitly.
The code called is:
void interrupt far TimerIsr()
{
if (timercount)
if (––timercount == 0)
IndicateEvent(EV_TIMEOUT);
if (nic.OldTimer)
(*nic.OldTimer)();
}
If a time-out value has been set, nic.OldTimer is decremented. If it reaches 0,
it sets an internal program flag that is checked in the main program loop. If the
OldTimer value is not 0 (there was a vector saved in this NIC’s instance of the
structure NICEVN), the routine branches to that code so that whatever else
needs to be done on the PC on a timer tick is done.
The next interrupt service routine to be intercepted is the abort routine. If the
user tries to kill this program with a control break, the sample program makes
an attempt to put back all of the interrupt vectors as they were found before
exiting the program. The call to insert code from the sample program is similar
to the timer intercept above:
nic.OldAbort = HwSetIntVector((BYTE)0x23, AbortIsr);
The code that gets executed is:
void interrupt far AbortIsr()
{
cleanup();
abort();
}