Path: utzoo!utgpu!water!watmath!clyde!att!alberta!ubc-cs!uw-beaver!mit-eddie!bloom-beacon!tut.cis.ohio-state.edu!mailrus!uwmcsd1!marque!uunet!mcvax!hp4nl!philmds!leo
From: leo@philmds.UUCP (Leo de Wit)
Newsgroups: comp.sys.atari.st
Subject: Re: Ctrl-C
Summary: Any moment now!
Message-ID: <608@philmds.UUCP>
Date: 21 Aug 88 17:09:58 GMT
References: <7620@boring.cwi.nl> <2239@alliant.Alliant.COM>
Reply-To: leo@philmds.UUCP (Leo de Wit)
Organization: Philips I&E DTS Eindhoven
Lines: 34

In article <2239@alliant.Alliant.COM> rosenkra@alliant.UUCP (Bill Rosenkranz) writes:
  [Steven Pemberton's question omitted]...

>you could modify the entry into any of the gemdos/bios/xbios traps (see
>osbind.o) to check for ^C. in this way, when any system call was made, a check
>is first performed. this is not really equivalent to signal(3) under unix, but
>is better than what's there now. MWC has a signal(3) function but i don't
>know how/if it works. alcyon's does not seem to work.

Although it is better than the current situation, this woun't stop a
non-I/O process. Try to break into this program:

main() { for (;;); } /* now, isn't this small 8-) */

Since no system call is made within the for loop it will go on forever,
even if ^C is hit.

Before the weekend I promised to look into an old break version I had
laying somewhere, that used a VBL interrupt routine to check for ^C. A
problem with this scheme was that it could not always get the ^C before
a bios call did.  After some puzzling I got the solution: the keyboard
interrupt vector (#$46) is changed to my own routine (in a memory
resident program). After this one has executed first the old code, a
check for the break character is done.  This is an airtight way to
intercept a special character and do with it whatever you like.

The original was a C program I wrote a year ago; it has been changed to
an assembler program (this must be an improvement 8-) and mailed to
Steven Grimm today in both an uuencoded binary and a source form.

B.T.W. If you don't mind bill, signal is (2) in unix, being a system
call ((3) is the library functions department).

                       Leo.