Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!overload!dillon From: dillon@overload.Berkeley.CA.US (Matthew Dillon) Newsgroups: comp.sys.amiga.programmer Subject: Re: Can you use Signal() from an input handler? Message-ID: Date: 5 May 91 21:53:52 GMT References: <2032@ria.ccs.uwo.ca> <1991May4.193801.30388@kuhub.cc.ukans.edu> Organization: Not an Organization Lines: 42 In article <1991May4.193801.30388@kuhub.cc.ukans.edu> markv@kuhub.cc.ukans.edu writes: >> I want to send a signal from the handler to the main program using >> Signal(), so that the main program can do some DOS stuff. >> - The Task pointer (pointing to the main program) and a >> pre-AllocSignal()-ed signal bitnumber are passed to the handler >> in it's data area.(The data area isn't used otherwise,in this handler.) >> >> So far so good. Using kprintf's to a serial terminal I know things >> are getting passed OK. But el GURU visits as soon as the Signal() function >> is called in the handler. > >Signal() is kosher in an interrupt. The trick is, if your handler is >in C, and if you are in a small data addressing scheme, then your >library base isn't automatically addressable by the handler. Under >SAS, either: > -compile the module with the handler with -y > -use the __saveds keyword (I've had some problems mixing > mulitple keywords on functions though) on the function. > -call geta4(); as the first line of the function. Also, look into software interrupts.. the Cause() function. This generates a software level interrupt that has a higher priority than tasks but a lower priority than interrupts, allowing an interrupt to get in, do its stuff, cause the software interrupt, and get out fast. Signal() and Cause() are both valid from an interrupt. PutMsg() and ReplyMsg() are also valid but if you can avoid them please do. Many cia resource calls relating to interrupts are valid. Most other functions are NOT valid. For example, AllocMem() and Wait() can NOT be called from an interrupt. -Matt -- Matthew Dillon dillon@Overload.Berkeley.CA.US 891 Regal Rd. uunet.uu.net!overload!dillon Berkeley, Ca. 94708 USA