Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!olivea!oliveb!amiga!jimm From: jimm@amiga.UUCP (Jim Mackraz) Newsgroups: comp.sys.amiga.programmer Subject: Re: Input Device Message-ID: <6377@amiga.UUCP> Date: 18 Feb 91 04:26:04 GMT References: <54kHX1w163w@guru.pub.uu.oz.au> Organization: I and I Computing, Palo Alto, CA Lines: 43 In article <54kHX1w163w@guru.pub.uu.oz.au> dcole@guru.pub.uu.oz.au (Dave Cole) writes: )I have been trying to get an input handler working without much success. )I can make the handler discard all mouse events, but as soon as I try to )pass a message from the handler to the mainline via PutMsg() I get a )guru (00000003 - Odd address). I have no idea where the odd address is )coming from. Input handlers are called by the input.device, so if you're using small code and small data it's common to get a crash like this. With small data and maybe sometimes small code, the compiler assumes that register A4 remains as set up by your program's initialization. The value found in A4 by your input handler will be something different, whatever the input.device happened to be using. So whenever your program is called from the outside world, you have to set up A4 if you use small data. With Lattice/SAS, you can use the __saveds function attribute for the handler's entry routine. For Manx, you used to be able to call geta4(). Assuming you refer to the target message port of PutMsg() by using a global variable, then failing to set up A4 would definitely screw you if you use small data. If you use no other globals, then commenting out the PutMsg() may well make you live. Another possibility is if your compiler doesn't believe in the same register preservation rules that are decreed in the Amiga RKM. Older versions of Manx (new ones too?) had a different scheme, and your entry point of your handler has to explicitly save and restore these registers, in assembler. If you have this small data all taken care of, then maybe the port isn't set up (if you didn't call CreatePort, perhaps you forgot the NewList() ). Maybe you can PutMsg() one from the main task as a warm up, to eliminate the input handler voodoo from the equation. jimm -- --- opinions expressed herein are my own. --- "... Because they can." - profound punchline to joke about dogs