From: anarch AT ai DOT mit DOT edu (Anne R Wright) Date: Mon, 8 Aug 94 16:35:10 EDT To: djgpp AT sun DOT soe DOT clarkson DOT edu Cc: anarch AT ai DOT mit DOT edu Subject: djgpp and interrupts I work at the MIT AI Lab and am using an IBM pc to control a robot. I recently started using djgpp and am having problems with installing an interrupt handler on a hardware interrupt. I have two questions: 1) What compiler should be used to compile go32? I've got the source, but it doesn't look compatible with microsoft c. Is it turbo c?? 2) Can anybody help with the following interrupt question: -------------------------------------------------------------------- I am generating periodic interrupts on IRQ5 (interrupt 0xd). I have called the functions _go32_dpmi_set_real_mode_interrupt_vector and _go32_dpmi_set_protected_mode_interrupt_vector to install a handler function into both interrupt tables. The code will work for a while, then the pc will crash saying "Unsupported INT 0x0d". I have discovered that while it is working it is calling the protected mode interrupt. I assume that when it crashes when an interrupt is requested while it is in real mode. I based my initialization code on the sound blaster example code I found with djgpp. The real-mode initialization part looks like this: _go32_dpmi_seginfo oldirq_rm; /* original real_mode handler */ _go32_dpmi_seginfo rm_si; /* real_mode segment info */ _go32_dpmi_seginfo rm_gi; /* real_mode segment info */ _go32_dpmi_registers rm_regs; /* real mode registers segment info */ void timer_install_rm_interrupt(void_func *f, int vec) { int ret; rm_si.pm_offset = (int)f; ret = _go32_dpmi_allocate_real_mode_callback_iret(&rm_si, &rm_regs); if (ret != 0) { printf("cannot allocate real mode callback, error=%04x\n",ret); exit(1); } disable(); _go32_dpmi_get_real_mode_interrupt_vector(vec, &oldirq_rm); _go32_dpmi_set_real_mode_interrupt_vector(vec, &rm_si); _go32_dpmi_get_real_mode_interrupt_vector(vec, &rm_gi); enable(); } I have confirmed that rm_si, which I use to set as the real mode vector is the same as rm_gi, the entry in the real mode vector table after initialization, so the dpmi code does seem to confirm that the interrupt vector is installed properly. However, the behavior of the system seems to indicate otherwise. Has anyone seen this behavior before? Is there some step I'm missing? Has anyone successfully used djgpp to install interrupts like this on a pentium (I'm using a pentium and a little worried that it's not completely compatible)? Any insight would be appreciated. Anarch