[Coco] Calling convention used by older 6809 C compilers
Pierre Sarrazin
sarrazip at sarrazip.com
Sun Jun 23 22:46:11 EDT 2024
Thanks for this information. I've been working on this lately.
Your specification says that "all arguments go on the stack for variadic
functions", but does that still apply to the hidden parameter that
points to a struct return value?
For example:
struct Foo f(char b, int n, ...)
{
[...]
}
Here, does f() receive the address of the resulting struct in X, or on
the stack?
Dixit William Astle via Coco (2024-06-07 21:53):
[...]
> * all arguments go on the stack for variadic functions; otherwise see below
[...]
> * Functions with larger return values receive a pointer argument that
> specifies where the return value goes; which includes long and float. This
> will be the first argument so it will usually end up in X.
>
> * Based on some experimentation with structs, it looks like it passes a
> pointer for the return value for structs and unions of any size but it
> passes 8 and 16 bit structs in B, X, or the stack as it would for other
> arguments.
[...]
--
Pierre Sarrazin <sarrazip @ sarrazip . com>
More information about the Coco
mailing list