🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.amiga
Article #4965

Re: Capturing ^C

#4965
From: James M Synge
Date: Fri, 07 Nov 1986 13:10
34 lines
2297 bytes
In article <2210@mtuxo.UUCP>, tas@mtuxo.UUCP (t.skrobala) writes:
> Is there a way to capture ^C signals on Amiga in a manner analagous to
> UNIX signal()?  I'd like to be able to abort recalcitrant programs with
> ^C, but do some cleanup before exiting.  Thus I'd like a function to be
> called when ^C is typed.  My reading of the ROM Kernel Manual suggests
> that SigExcept() is the key, but, in the example below, my onintr()
> function only gets called once (with d0 set to 0), when SetExcept() is
> called, and never thereafter; ^C's are ignored.

I've tried writing an exception handler and had some problems.  One thing
I notice you're not dealing with in your assembly section is the fact that
you don't know what state your registers are in, except D0 and A0, which
contain the signal mask and address of your ExceptData.  SO, when your
code is adding 1 to hadIntr, you don't know where that 1 is being
added.  It is some offset from (A4), but, since A4 is in an unknown state,
we don't know where that is.

> If I don't
> call SetExcept(), ^C produces an immediate exit (after I hit RETURN to
> satisfy the read()).

This is because the Manx io routines check for ^C every time (unless you
set an external variable whose name I cann't remember).

> Thanks,
> Tom Skrobala AT&T Information Systems  ihnp4!ariel!tas

My pleasure,
-- 
---------------------------------------------------------------------------
James M Synge, Department of Atmospheric Sciences, University of Washington
VOX: 1 206 543 0308 (Work)   1 206 455 2025 (Home)
UUCP: uw-beaver!geops!uw-atm!james
ARPA: geops!uw-atm!james@beaver.cs.washington.edu
Technical Details
Message-ID: <46@uw-atm.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!sri-spam!sri-unix!hplabs!tektronix!uw-beaver!uw-june!geops!uw-atm!james
References: <2210@mtuxo.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!sri-spam!sri-unix!hplabs!tektronix!uw-beaver!uw-june!geops!uw-atm!james
From: james@uw-atm.UUCP (James M Synge)
Newsgroups: net.micro.amiga,comp.sys.amiga
Subject: Re: Capturing ^C
Message-ID: <46@uw-atm.UUCP>
Date: Fri, 7-Nov-86 08:10:16 EST
Article-I.D.: uw-atm.46
Posted: Fri Nov  7 08:10:16 1986
Date-Received: Sun, 9-Nov-86 04:27:53 EST
References: <2210@mtuxo.UUCP>
Distribution: net
Organization: Dept. of Atmospheric Sciences, U. of Washington
Lines: 34
Summary: Using SetExcept is difficult, based on bad experiences.