Message-ID: <31983628.7AF2@nuernberg.netsurf.de> Date: Tue, 14 May 1996 09:28:40 +0200 From: Ralf Suessbrich Organization: The Internet MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Interrupt Handler Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi ;) I am learning to program on low level. As a first excercise i decided to program a short interrupt-handler for IRQ2. I wrote a function wich has an output of an one second durating sound. I first get the old ivector, then "allocate iret wrapper", then i have a test period of 20 seconds, then i restore the old ivector. My proggi compiles fine, but when i am running it, i get only one sound (when i press serveral keys on the keyboard). After 20 seconds it comes back to a dos prompt, but something went wrong with restoring the old vector: the keyboard is still out of function. What is my mistake? Ralf Suessbrich Here's the code: #include #include #include keyb_handler () { nosound(); sound (500); sleep (1); nosound (); } main () { _go32_dpmi_seginfo old_handler, my_handler; printf ("Getting old I-Vector !\n"); _go32_dpmi_get_protected_mode_interrupt_vector (9, &old_handler); my_handler.pm_offset = (int) keyb_handler; _go32_dpmi_allocate_iret_wrapper (&my_handler); printf("\nSeting new I-Vector !"); _go32_dpmi_set_protected_mode_interrupt_vector (9, &my_handler); printf("\nDONE !!\n\nWaiting now 20 seconds for testing.\n"); sleep (20); _go32_dpmi_set_protected_mode_interrupt_vector (9, &old_handler); printf("\n\nOld I-Vector restored ;)\nEnd"); return 0; }