867
|
1 * 'Signal' and 'intercept' are definitely incompatible and
|
|
2 * use of both in a program will have undefined results.
|
|
3 * In order to protect the programmer from this a dummy global
|
|
4 * label is declared in both relocatable modules which will produce
|
|
5 * an 'entry name clash' error in the loader if an attempt is made
|
|
6 * to use both.
|
|
7
|
|
8 use ..../defs/os9defs.a
|
|
9 psect intercept_a,0,0,1,0,0
|
|
10
|
|
11 vsect
|
|
12 intsave rmb 2 place for C routine address
|
|
13 endsect
|
|
14
|
|
15 _sigint:
|
|
16 * intercept(func)
|
|
17 intercep:
|
|
18 intercept:
|
|
19 pshs u save register variable
|
|
20
|
|
21 tfr y,u set data are pointer
|
|
22 ldx 4,s get C function address
|
|
23 stx intsave,y save it for the receiver
|
|
24 leax receiver,pcr get the address for OS-9
|
|
25
|
|
26 os9 F$ICPT call os9
|
|
27 puls u restore register variable
|
|
28
|
|
29 lbra _sysret
|
|
30
|
|
31 * This is where OS-9 will pass control when the process has been
|
|
32 * sent a signal. All that is needed is to run the intercept routine
|
|
33 * and execute 'rti'.
|
|
34 receiver
|
|
35 tfr u,y set the data pointer
|
|
36 clra clear the MSB
|
|
37 pshs d stack the signal number
|
|
38 jsr [intsave,y] go run the routine
|
|
39 leas 2,s reset the stack
|
|
40 rti and return
|
|
41 endsect
|