From: Eduardo TUDA Lorenzetti Pellini Newsgroups: comp.os.msdos.djgpp Subject: Basic IRQ mapping ... What am I doing wrong ? Date: Fri, 6 Apr 2001 13:42:06 -0400 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <3AE73146@MailAndNews.com> X-InterChange-Posted-By: dochell AT MailAndNews DOT com Sender: Eduardo TUDA Lorenzetti Pellini X-EXP32-SerialNo: 50000000 Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: InterChange (Hydra) News v3.61.08 X-Complaints-To: newsabuse AT supernews DOT com Lines: 87 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi friends... I'm trying to hook a &^@&^#&^ IRQ with my DJGPP program. I hate to post code on the newsgroup, but i don't have more options. The program is running over plain DOS (IO.SYS, MSDOS.SYS and COMMAND.COM ONLY). I'm trying to hook IRQ 0 - System Timer Interrupt (0x08) with no sucess. I can hook INT 0x1C, but i need the real IRQ ISR INT 0x08 8(( Please, if you have time, take a look to this (minimum) code and tell me what is wrong. It works for INTERRUPT = 0x1C, but don't for 0x08. Do i need to hook the real mode 0x08 interrupt ? Or both the protected and real mode ones ? ---8<--- cut here ---8<---- #include #include #include #include #include #define INTERRUPT 0x08 //works for INTERRUPT 0x1C unsigned int ct; _go32_dpmi_seginfo oldvect; _go32_dpmi_seginfo newvect; void hookint(void); void unhookint(void); int *newtimer(void) { ct++; } int *endtimer(void) { } int main(void) { sound(500);usleep(50000);nosound(); printf("Hooking INT %X...\n",INTERRUPT); ct=0; hookint(); while(ct<=100); //just to wait a few seconds... unhookint(); printf("The End\n"); sound(900);usleep(50000);nosound(); return(1); } void hookint(void) { _go32_dpmi_lock_code (newtimer, (long)endtimer - (long)newtimer); _go32_dpmi_lock_data (&ct,sizeof(ct)); _go32_dpmi_get_protected_mode_interrupt_vector (INTERRUPT, &oldvect); newvect.pm_offset = (long)newtimer; newvect.pm_selector= _go32_my_cs(); _go32_dpmi_allocate_iret_wrapper (&newvect); _go32_dpmi_set_protected_mode_interrupt_vector (INTERRUPT, &newvect); } void unhookint(void) { _go32_dpmi_set_protected_mode_interrupt_vector (INTERRUPT, &oldvect); _go32_dpmi_free_iret_wrapper(&newvect); } ---8<--- cut here ---8<--- Thanks in advance for your help and attention !! Eduardo TUDA DocHell Lorenzetti Pellin PEA - Electrical Energy and Automation Department USP - Politechnical School of Sao Paulo University - BRAZIL http://www.pea.usp.br/~epellini --------------------------------- And if you have a time to loose, an open mind, and right to choose, would you care to take a look, or can you read me like a book... time's is allways on my side... --------------------------------- (Up the Irons !!!)