Re: [cc65] Interrupts and break

Date view Thread view Subject view

From: Adam Dunkels (adam_at_sics.se)
Date: 2001-09-30 20:01:23


Hi all!

On Sunday 30 September 2001 19:12, groepaz wrote:
> DB> I've tried to use a timer interrupt to check the joysticks and update
> DB> some structs and sprites. (on the c64, or well, vice) Unfortunately, as
> DB> soon as I try to use any not totally trivial functions in my (probably
> DB> wrongly set up) interrupt handler the program crashes or goes weird. I
> DB> haven't found any mentions of how to do interrupts in C or cc65 and no
> DB> good examples anywhere. It would be nice if someone could tell me or
> DB> point me to the correct cc65 way of doing this.
>
> calling a C-function from within an interupt won't work with the
> current implementation of the runtime library.... to support this it
> would require to enclose a whole bunch of stack-related routines in
> sei/cli i guess... UZ should know better though ;=P

This topic has been touched in a previous discussion, and if I remember 
correctly, Uz said that the functions in cc65/libsrc/dbg/dbgsupp.s could be 
used for this type of context switching (switching between "normal" and 
"interrupt" context). It could also be used for context switching for 
multiple threads.

>From the code it seems as if it is some 30 bytes that needs to be 
swapped/saved. When switching from normal to interrupt context, it should be 
possible to avoid swapping the contents of the stack (which would be needed 
for multiple threads).

/adam
-- 
Adam Dunkels <adam_at_sics.se>
http://www.sics.se/~adam
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:42 CET