diff 3rdparty/packages/cc/sources/intercept.a @ 867:0198655f2552

Added sources
author boisy
date Thu, 16 Jan 2003 19:54:21 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/intercept.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,41 @@
+* 'Signal' and 'intercept' are definitely incompatible and
+* use of both in a program will have undefined results.
+* In order to protect the programmer from this a dummy global
+* label is declared in both relocatable modules which will produce
+* an 'entry name clash' error in the loader if an attempt is made
+* to use both.
+
+ use ..../defs/os9defs.a
+ psect intercept_a,0,0,1,0,0
+
+ vsect
+intsave rmb 2 place for C routine address
+ endsect
+
+_sigint:
+* intercept(func)
+intercep:
+intercept:
+ pshs u save register variable
+
+ tfr y,u set data are pointer
+ ldx 4,s get C function address
+ stx intsave,y save it for the receiver
+ leax receiver,pcr get the address for OS-9
+
+ os9 F$ICPT call os9
+ puls u restore register variable
+
+ lbra _sysret
+
+* This is where OS-9 will pass control when the process has been
+* sent a signal. All that is needed is to run the intercept routine
+* and execute 'rti'.
+receiver
+ tfr u,y set the data pointer
+ clra clear the MSB
+ pshs d stack the signal number
+ jsr [intsave,y] go run the routine
+ leas 2,s reset the stack
+ rti and return
+ endsect