Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!mordor!sri-spam!rutgers!rochester!udel!burdvax!sdcrdcf!trwrb!trwspf!knurlin From: knurlin@trwspf.TRW.COM (Scott Karlin) Newsgroups: comp.sys.amiga Subject: Cause() problem solved. Message-ID: <699@trwspf.TRW.COM> Date: 3 Feb 88 19:10:06 GMT Reply-To: knurlin@trwspf.UUCP (Scott Karlin) Distribution: na Organization: TRW - Data Systems Lab., Redondo Beach, CA Lines: 58 A few weeks ago, I posted a question about using the Cause() function to generate an interrupt. For those of you who might be interested there were two problems: (1) NT_SOFTINT should be changed to NT_INTERRUPT and (2) the compiler was too smart for my own good (the compiler saw that abort was always 0 so it didn't bother to test it each time through the loop). Here is the corrected code: #include #include #include int abort; /* Compile with Lattice 4.0 using -y -v options */ void main() { struct Interrupt interrupt; int aborttest(); /* new */ void InterruptCode(); abort = 0; interrupt.is_Node.ln_Type = NT_INTERRUPT; /* was NT_SOFTINT */ interrupt.is_Node.ln_Pri = 0; interrupt.is_Node.ln_Name = "test"; interrupt.is_Code = InterruptCode; Cause(&interrupt); while(aborttest() == 0) /* aborttest() was abort */ { printf("."); Delay(50); } printf("abort = 1\n"); return; } int aborttest() /* new subroutine */ { return(abort); } void InterruptCode() { abort = 1; return; } -- -- Scott Karlin TRW, Bldg O2-1761, One Space Park, Redondo Beach, CA 90278 USENET: knurlin@trwspf.trw.com Phone: (213) 535-3785 {sdcrdcf, scgvaxd, ucbvax}!trwrb!trwspf!knurlin