Re: [cc65] Stack problems with several segments.

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2004-11-18 14:34:00
On Wed, Nov 17, 2004 at 08:21:20AM -0800, Shawn Jefferson wrote:
> Where is the y register used even?  Is this compiled
> with optimization?  I've seen where unoptimized code
> has things like this, but the optimizer takes them out
> (registers given values that they don't really need.)

The Y register is used to pass the size of the arguments in case of a variadic
function, or a function without a prototype. The generated code shows exactly
that there was a problem with prototyping in Karris code. The first sequence
calls a function were no prototype is available, so the size of the arguments
is passed in Y. The second sequence calls a function with a prototype, the
called function is known, so there is no need to pass the argument size. If
the called function in the first sequence ignores the value in Y and drops a
different number of bytes from the stack on return, you will get exactly the
problem, Karri describes.

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 Thu Nov 18 14:34:03 2004

This archive was generated by hypermail 2.1.8 : 2004-11-18 14:34:12 CET