[Coco] Calling convention used by older 6809 C compilers

William Astle lost at l-w.ca
Mon Jun 24 11:44:10 EDT 2024


I believe it is passed on the stack but I didn't test that particular 
permutation.

On 2024-06-23 20:46, Pierre Sarrazin via Coco wrote:
> 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.
>      [...]
> 



More information about the Coco mailing list