Date: Wed, 5 Apr 1995 09:56:39 +0500 From: hvb AT netrix DOT com To: sarda_jea AT lsi DOT supelec DOT fr Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: Re : Interrupt programming (keyboard) References: <95040420202402 AT lsi DOT supelec DOT fr> If this is the real mode interrupt code, then you do not save any registers here. I guess it crashed because from time to time, the interrupt occurs in real mode. Hope this helps. ============================================================== Hung Bui Internet: h DOT bui AT ieee DOT org Netrix Corporation Phone: +1 703 793 1016 13595 Dulles Technology Drive Fax: +1 703 713 3805 Herndon Va 22071 ============================================================== sarda jea writes: > Hello everybody, > > Carsten Benecke wrote : > > >I programmed an interrupt service function for a hardware interrupt (IRQ 9). I > >used the source code from David Baggett`s Sound Blaster Sample (9-Nov-93) and > >did some small changes for the IRQ 9: > >+ use slave PIC at base 0xa0 to enable and acknowledge the IRQ > >+ install a new real mode interrupt vector for interrupt 0x71 (IRQ 9) > >+ chain a new protected mode interrupt vector for interrupt 0x71 > > >The service function is called only for the first two hardware interrupts! > >No more hardware interrupts can be served by my function! > > I had EXACTLY the same problem as you and I think I have nearly solved it but > there is still some problems(by the way thanks to Tim Hesketh, Long Doan, Carl > Burke for their helpful answers). > > I have included my keyboard handler code in this article. It works (at least for > more than the first two hardware interrupts) but the problem is that at random > times (4,5 or 20 minutes after the execution begining) ,it makes a segmentation > fault, or a unknow instruction code or even a SYSTEM RESET !! > I need your comments and help. > > this the code : > > /* > * Interrupt handler > * > * This is called in both protected mode and in real mode -- this means > * we don't have to switch modes when we service the interrupt. > */ > static unsigned char scan1,scan2; > > void intr(_go32_dpmi_registers *reg) > { > > > > scan1=inportb(0x60); > scan2=scan1; > /*********************** scan2 contain the useful scan code **************/ > > /********************** this is what i added to the soundblaster exemple > *********************** but in fact ,I dont know why it works with it > *********************** since I have taken this from another keyboard handler > ******************************************************************************/ > scan1=inportb(0x61); > scan1=scan1 | 0x82; > outportb(0x61,scan1); > outportb(outportb(0x61,scan1 & 0x7f); > > /******************* _pressed is just a flag to know if a key was pressed or > ******************* realesed **********************************************/ > > _pressed=1; > > > outportb (0x20, 0x20); > outportb (0xa0, 0x20); > > > > } > > > (I install this handler like it is done in the soundblaster demonstration > programm.) > > > > Jean-Philippe. > >