Re: [cc65] Interrupts and break

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2001-09-30 20:13:15


On Sun, Sep 30, 2001 at 08:01:23PM +0200, Adam Dunkels wrote:
> >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).

You don't need to save the contents of the stack, but switching the stack
itself is needed. This is because the routines that manipulate the stack
pointer are not reentrant (they work on 8 bits per insn while the stack
pointer is a 16 bit value). It would be possible to make these manipulations
interrupt safe by disabling/enabling interrupts, but this would impose a
penalty on all programs, not just those that have an interrupt handler written
in C, so I've decided against it.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
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