Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cc65:parameter_and_return_stacks [2010-10-30 02:53]
polluks better number
cc65:parameter_and_return_stacks [2012-03-13 08:41] (current)
polluks [Accessing data on the parameter stack] Greg King
Line 42: Line 42:
  
  
 +==== Moving the stack ====
  
 +The stack isn't put in a segment; it's put into a separate memory area.
 +That area isn't named; it's implied by two expressions.  The first one
 +is in the ld65 configuration file.  For example, "c64.cfg" has
 +"size = $C7F3 - __STACKSIZE__".  The second one is in the start-up code.
 +For example, "c64/crt0.s" has "(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)".
 +
 +If it were named explicitly (it //should// be!),
 +then they would look like this:
 +
 +<code>
 +HEADER: file=%O, define=yes, start=$0801, size=$000C;
 +STACK: file="", define=yes, start=$d000-__STACKSIZE__, size=__STACKSIZE__;
 +RAM: file=%O, define=yes, start=__HEADER_LAST__, size=__STACK_START__-__RAM_START__;
 +</code>
 +
 +And, sp would be set to "(__STACK_START__ + __STACK_SIZE__)".
 +
 +If you do want to put your stack into a segment, then you simply
 +assemble a big buffer, put a label at the end of it, and store that
 +label in sp.
  
cc65/parameter_and_return_stacks.txt ยท Last modified: 2012-03-13 08:41 by polluks
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki