Mail Archives: djgpp/2003/02/26/15:00:22
This is probably a stupid question ...
I'm trying to get a better understanding of protected mode
and real mode interrupts.
I've written my own interrupt routine to replace the
protected mode timer ISR. I don't want to chain into
the original ISR because I want to double the timer
rate and then call the original ISR every other time
my ISR is run. I installed the old ISR as protected
mode interrupt 0x81. How do invoke this interrupt?
Do I use int86()? The reference manual seems to imply
that this would invoke the real mode ISR. _dpmi_int()
also seems to run the real mode ISR.
I've included relevant code below. I would appreciate
constructive criticism.
Thanks,
Tony Richardson
richardson AT evansville DOT edu
================= main() code ======================
//load the address of the old timer ISR into the OldISR structure
_go32_dpmi_get_protected_mode_interrupt_vector(0x08, &OldISR);
_go32_dpmi_set_protected_mode_interrupt_vector(0X81, &OldISR);
//point NewISR to the proper selector:offset for handler function
NewISR.pm_offset = (int)TickHandler;
NewISR.pm_selector = _go32_my_cs();
// Double the tick rate
count = 32768;
disable();
outportb(TICK_T0_8254_CWR, TICK_T0_8254_CTR0_MODE3);
outportb(TICK_T0_8254_CTR0, count & 0xFF);
outportb(TICK_T0_8254_CTR0, (count >> 8) & 0xFF);
_go32_dpmi_set_protected_mode_interrupt_vector(0x08, &NewISR);
enable();
================= TickHandler() code ======================
TickCtr++;
// every other tick we want to call the old ISR
if(TickCtr >= 2) {
TickCtr = 0;
int86(0x81, ®s, ®s); /* What do I use here? */
}
- Raw text -