Date: Fri, 9 Apr 93 14:56:02 -0400 From: mjc AT zuvad DOT DNET DOT NASA DOT GOV (Mail from Martin Clayton) To: "djgpp%sun.soe.clarkson.edu"@EAST.DNET.NASA.GOV Subject: Interrupt handler. I need to write an interrupt service routine for data acquisition on my 486...I'm using the DJGPP version of gcc which works fine for all the non-interrupt driven instrument control, GUI etc...but crashes when I try to call my interrupt service routine. Has anyone done this before and what am I doing wrong? Here's what I'm doing: The interrupt service routine is installed by this little program; #include #include #include #define IVECT (0x0060) #define __CPPARGS extern unsigned _heaplen = 1024; extern unsigned _stklen = 512; static void interrupt (*old_vect)(__CPPARGS); static int count = 0; static int safety = 10240; void interrupt acquisition_handler( unsigned bp, unsigned di, unsigned si, unsigned ds, unsigned es, unsigned dx, unsigned cx, unsigned bx, unsigned ax, unsigned flags ) { (void)(printf("count is %d", ++count)); return; } void main( void ) { old_vect = getvect(IVECT); (void)(setvect(IVECT, acquisition_handler)); (void)(keep(0, (_SS + ((_SP + safety) / 16) - _psp))); return; } /*End-of-file */ This is compiled with Borland C++ 3.1 and then executed once to set-up everything. Then I run this program to trigger the routine: #include #include #include static union REGS s; void main( void ) { (void)(int86(0x60, &s, &s)); (void)(exit(0)); } /*End-of-file */ This works fine when compiled under C++ and the count increases etc, but just crashes out when compiled under gcc exactly on the "0xCD60" interrupt call...ho hum. Any help or advice (except to give up) is appreciated. Martin Clayton, mjc AT zuvad DOT dnet DOT nasa DOT gov.