view 3rdparty/packages/cc/sources/intercept.a @ 1942:b41df77588b0

printer is now scbbp sio is now scbbt All references changed in various files
author boisy
date Sat, 26 Nov 2005 22:51:50 +0000
parents 0198655f2552
children
line wrap: on
line source

* '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