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

Re: VBLRetrace Manager: how to access A5 ?

At  1:55 PM 9/30/93 +0100,  Eric JACOPIN wrote:
>Hello !
>I'd like to install a VBL retrace task and to access to some of my globals in
>it. I then have to manipulate A5. Reading it seems to be possible within MACL.
>But what about Placing values in A5 ?
>Here is an example of what I'd like to do:

VBL tasks run at interrupt time. You cannot run MCL code at interrupt
time. Some parts of MCL do not expect to be interrupted, and should the
interrupt happen when the garbage collector is running, the Lisp heap
will not be in a consistent state.

Note that running MCL code at interrupt time may appear to work sometimes,
but such code is guaranteed to eventually crash.

Hence, if you need to write a VBL task, you'll have to write it in
a static language (e.g. C, Pascal, or assembler) and use MCL's foreign
function interface to load it (or use LAP). The VBL must communicate to
MCL through memory allocated on the Mac heap.

Is there any reason that your code must be done with a VBL interrupt?
MCL has an undocumented periodic tasks feature that allows you to
schedule an MCL function to be called periodically at a period which
is a multiple of 1/60 second. Ask, and I'll send you some documentation.

You can also use the *eventhook* feature which is documented.