[comp.sys.amiga] More help with messages/handlers

aw0i+@andrew.cmu.edu (Andrew Jordan Werth) (04/25/88)

Thanks for those who gave me some information about where to look for code on
setting up an input handler.  However, after studying the ROM Kernal manual,
many crashes of my machine trying to implement that code in my program, and
finally crashing my machine running the exact code from the RKM (which I found
on an old source disk), I still can't get a handler to work correctly.  I
believe the machine is locking up when I perform the DoIO to actually add the
handler.  I think the problem is in specifying the address of the code for the
handler.  Using the type cast   (VOID)   on the function name annoyed the
compiler, so I tried compiling without any cast, as well as with the FPTR that
Matt Dillon used in his sample program, but still to no avail.  Does anyone
know how to make the ROM Kernal Manual's source work?  Thanks for the help.

Andrew Werth
aw0i@andrew.cmu.edu

phil@eos.UUCP (Phil Stone) (04/26/88)

In article <YWQoZyy00Xo3zPg0-h@andrew.cmu.edu> aw0i+@andrew.cmu.edu (Andrew Jordan Werth) writes:
.Thanks for those who gave me some information about where to look for code on
.setting up an input handler.  However, after studying the ROM Kernal manual,
.many crashes of my machine trying to implement that code in my program, and
.finally crashing my machine running the exact code from the RKM (which I found
.on an old source disk), I still can't get a handler to work correctly.  I
.believe the machine is locking up when I perform the DoIO to actually add the
.handler.  I think the problem is in specifying the address of the code for the
                   .........
.Does anyone
.know how to make the ROM Kernal Manual's source work?  Thanks for the help.

I spent about a week trying to get that example to work all because of one
stupid problem.  If you're using Lattice, make sure that stack checking is
disabled (can't remember the compile option, look it up in the manual). 
Otherwise, the assembly bridge to the input handler won't work.
Sorry if this is totally unrelated to your problem, but I didn't want to see
you go through the same hair-pulling.

Phil Stone

dillon@CORY.BERKELEY.EDU (Matt Dillon) (04/26/88)

>on an old source disk), I still can't get a handler to work correctly.  I

	Watch out for the following:

	(1) The handler MUST save any registers it uses (except A0,A1,D0,D1,
	    which are scratch).  The handler is called with the event in
	    A0 and your data segment in A1.  The handler must return the
	    new event list in D0.

	(2) If using the small data model, you MUST load the proper address
	    register with the proper value pointing to the programs data
	    space to be able to use any external variables, including making
	    any library call.

	(3) A pointer to an interrupt structure containing the function
	    and data segment (I usually don't use the data segment part)
	    is passed when adding the handler.

	Try this:	Have your handler simply RTS... see if the system
			crashes