Mail Archives: djgpp/2002/11/27/23:00:08
Andrew Cottrell <andnews AT ihug DOT com DOT oz DOT au> wrote in message news:<hqs8uu04qrhp5363t9ref760hhbdstnn3i AT 4ax DOT com>...
> >I have a GUI to handle mouse interrupt and H/W interrupt, I used "INT
> >33H" to handle mouse interrupt. It worked fine with COM port mouse
> >when H/W interrupt
> >has occurred, but hang with PS2 mouse. It's there an other way to
> >handle PS2 mouse interrupt or How can I avoid system hang?
> >
> >The GUI worked on pure DOS (Windows 98 [Version 4.10.2222])
> My only suggestion is to have a looks at how TV or Allegro work as
> they both work with PS/2 mouses.
Thanks for Andrew replied!
When I replaced the source code disable() and enable() by
("sti") and ("cli") in my H/W interrupt handler, then system
never been hung, they work fine both with PS/2 mouse and
COM port mouse. So I think my problem has been solved!
but I don't know why?
my previous code here.
hardware_int_handler()
{
disable();
//your handler code here.
outportb (0x20, 0x20); //EOI for IRQ0-7
outportb (0xA0, 0x20); //EOI for IRQ8-15, both 8259 chips moust get EOI
enable();
}
-----Here is the snippet code captured from comp.os.msdos.djgpp-----
#define INTERRUPT_ENTER(); asm("sti"); /* enable maskable interrupts*/
#define INTERRUPT_LEAVE(); asm("cli"); /* disable maskable interrupts*/\
outportb (0x20, 0x20); /* End of interrupt */
#define INTERRUPT_LEAVE_BOTH(); asm ("cli"); /* disable maskable interrupts */ \
outportb (0x20, 0x20); /* End ofinterrupt */ \
outportb (0xA0, 0x20); /* End ofinterrupt */
----------------------------------------------------------------------------
hardware_int_handler()
{
INTERRUPT_ENTER();
//your handler code here.
INTERRUPT_LEAVE_BOTH();
}
After use this method, my program work fine on PURE DOS.
- Raw text -