Re: [cc65] Interrupt <-> C runtime environment

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2011-07-11 21:50:10
On Mon, Jul 11, 2011 at 07:11:54PM +0200, marcas wrote:
> Why does cc65 need an own argument stack? Are 256 bytes not enough?

No. Think about local string variables:

        void func (void)
        {
            char buf[128];
            ...
        }

They fill up the stack rather quickly.

> What is the base address of the software stack?

It doesn't have a base address. It grows down from top memory, while the heap
grows from bottom up.

> What is the address of the stack pointer (or index counter) for the
> software stack?

It is contained in the zero page variable named "sp".

> What is the maximum size of the software stack?

This is configurable but there are no checks if you don't enable them-

> Only if the stack parameters are flexible: is there a instrinsic C
> header file  with definitions to access this software stack?

Not sure what you mean with this.

> If interrupting the software stack methods is not save (as mentioned
> by Greg), why are the access methods for the stack not "interrupt
> save" (sei,cli)?

Because it is overhead that adds up. The stack pointer sp is a 16 byte
variable that is incremented and decrement with every push and pop. Every
access to this variable would have to be protected.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Jul 11 21:50:19 2011

This archive was generated by hypermail 2.1.8 : 2011-07-11 21:50:21 CEST