Path: utzoo!attcan!uunet!aplcen!samsung!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!ucsd!helios.ee.lbl.gov!nosc!logicon.arpa!trantor.harris-atd.com!trantor!dleroy From: dleroy@x102a.harris-atd.com (leroy david 01354) Newsgroups: comp.sys.m68k Subject: Interrupt Handling Message-ID: Date: 17 Nov 89 14:39:30 GMT Sender: news@trantor.harris-atd.com Distribution: comp.sys.m68k Organization: GASD Harris Corp. Lines: 41 I'm new to writing exception handling routines for the 68000 and have run into severel problems. Basically I would like to know how to handle the stack within my exception handling routine as I think this is where my problems are arising. The scenario: I have a main routine and a counter interrupt handler both which were written in C. I went into the assembly source for the interrupt handler and changed RTS to RTE and placed an instruction to save all the registers at the beginning of the routine and restore them at the end. I'm also a beginner at 68000 assembly coding so I'm not sure these are the correct commands. movem.l d0-d7/a0-a6,-(a7) /* save registers */ disable_counter_interrupts /* do any processing here enable_counter_interrupts movem.l (a7)+,d0-d7/a0-a6 /* restore registers */ RTE When I have a very simple main routine with just a printf statement in it, this works fine. I have a counter interrupt occuring every 200ms and toggling a status light. When I add processing in the main loop however, the interrupts seem to occur about 3 or 4 times and then the processor seems to be off in the weeds somewhere. Whats going on here? How do I ensure that nothing I do in the interrupt service routine messes up registers used in the interrrupted routine. I know this opens a whole can of worms. Some further info, this is all being run in the supervisor mode and the interrupt service routine is not calling any routines used by the main routine. -- ______________________________________________________________________ Dave LeRoy | Harris Corporation - GASD | ARPANET: dleroy@x102a.harris-atd.com P.O. Box 94000 | UUCP : uunet!x102a!dleroy Melbourne, FL 32902 | (407) 727-4000 | ----------------------------------------------------------------------