Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!njin!princeton!udel!kerly From: kerly@udel.EDU (Philip Kerly) Newsgroups: comp.sys.atari.st Subject: Cntrl-C Exception Handling Message-ID: <5078@louie.udel.EDU> Date: 31 Oct 88 02:44:00 GMT Sender: usenet@udel.EDU Reply-To: kerly@udel.EDU (Philip Kerly) Distribution: na Organization: University of Delaware Lines: 41 Hello, I've got a problem that I've been working on for several days that has left me perplexed. Hopefully, someone on the net can help me out. I've been trying to write a Cntrl-C interrupt handler without much success. I'm using Mark Williams's C compiler for setting the exception address. This is working fine. I know that I'm getting to the function that I've referenced when setting the exception address. I'm also using an assembly routine written by Mark Williams Co. called setrte() which is the first thing that is called in the interrupt service routine. This all appears to be working correctly when I invoke the interrupt within the software using a trap #4. However, if I remove the trap #4 and try to invoke the interrupt using Cntrl-C from the keyboard the system crashes. I have several questions: 1. Does a trap #4 invoke the same response as a Cntrl-C interrupt from the keyboard? (i.e. Is the stack adjusted the same way?) 2. When an interrupt is invoked and the status register is placed on the stack, does this register reflect the status before the interrupt or does it reflect the status due to the interrput. The code I've been working with is below. It's very short so there maybe some hackers that have Mark Williams C that would be interested in taking a look at it. Thanks in advance for any time you may expend looking this code. Phil #include #include #include sig_catch() { setrte(); /*<-------- can be found in Mark Williams C */ printf ("THERE\n"); /* disks under /src directory. It's */ } /* found in setrte.s */ main () { signal (SIGINT, sig_catch); /* signal and SIGINT is delcared in */ for (;;) /* signal.h */ printf ("HERE\n"); }