[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ff-interface



At  1:16 AM 5/6/93 +0200, Tobias Kunze wrote:
>Hello,
>
>yesterday i sent a description of a problem that i have with mcl's foreign-
>function-interface, but it apparently didn't make it to cambridge.apple.com.
>Today i posted another message which refered to the former, so i think it 
>would be best to describe the whole thing again:

Your message of yesterday did get here. I've been thinking about it.

I don't have my MIDI Manager documentation handy, but I can guess
what's happenning. Firstly, interrupt routines can't make any assumption
about the value of A5. They must set it themselves if they wish to
use a5 offsets. It is possible that the MIDI Manager sets A5 for you
to the value that it had when the callback was installed (that would
be how I would have written the MIDI Manager code). If so, then when
you install your interrupt routine, A5 must be pointing at your
foreign function A5-world. Hence, any MIDI manager calls that provide
callback routines should be done from inside your foreign code. If the MIDI
Manager doesn't set up A5 before calling your interrupt routines, then
you'll have to remember the correct value and set it yourself. This is
easy to do in assembly language (Store A5 before or after your code and
access PC-relative), but I don't know how to do it in C.

Conclusion, don't pass the addresses of any foreign functions to
the MIDI manager from Lisp. Instead, call a foreign function to do it.
Find out if the MIDI Manager initializes A5 for you before calling your
interrupt-level callbacks.