Message-ID: <319A1F93.37C6@nuernberg.netsurf.de> Date: Wed, 15 May 1996 20:16:51 +0200 From: Ralf Suessbrich Organization: The Internet MIME-Version: 1.0 To: DJGPP Mailing List Subject: Realmode interrupts Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello, first thank you all for the answers to my last question (about installing a protected mode interrupt handler) !!! ;) This time i have some questions about realtime ones. I read the section 18 of the FAQ and the part of INFO about the used functions. I wrote following code: #include #include #include #include handler () { nosound (); sound (500); sleep (1); nosound (); } int bottom () {}; main () { int (* funcptr) (); int len, return_selector, real_address; __dpmi_raddr handler_adr; /* real mode addresses */ len = (int) (bottom - handler); /* ???? does this work ?? */ /* i need the lenght for allocating DOS mem with: */ real_address = __dpmi_allocate_dos_memory (((len+15)>>4, &return_selector); funcptr = handler; /* now i have a pointer to my handler */ dosmemput (funcptr, len, real_address); /* now i moved my handler to first 1 MB memory */ handler_adr.segment = ra_adr >> 4; /* FAQ section 18.9: lower 4 bits to offset16 */ handler_adr.offset16 = ra_adr & 15; /* the rest to segment, did i do this right ? */ __dpmi_set_real_mode_interrupt_vector (9, &handler_adr); /* now all should be done */ while (true); /*now every keystroke should produce a 500 Hz tone for one second*/ } I tried this with hooking int9 (IRQ1), keyboard interrupt, i know this is a critical interrupt, compiling is ok, but when running, my system hangs, i get an exception from qemm. thank you all, who look at my code and/or have an idea, what i made wrong ;) Ralf Suessbrich