[Coco] Calling convention used by older 6809 C compilers
Pierre Sarrazin
sarrazip at sarrazip.com
Fri Jun 7 22:27:18 EDT 2024
Hi. I'm in the process of adding a second calling convention to CMOC,
a C-like compiler that targets the 6809.
I have seen C programs for the 6809 that had some code written in
assembly that assumed a calling convention where the first parameter
of a function is received in register B or X, depending on its size,
instead of on the stack, as in CMOC's default convention.
platotermCoCo is such a program:
https://github.com/beretta42/platotermCoCo/tree/master/src/coco2
I'm looking for a detailed description of that calling convention,
with the goal of clarifying a few questions that I have on corner cases.
1. Is the first parameter still passed in B or X when the parameter is
a 1- or 2-byte struct or union?
2. When the return value is one or two bytes, which register is it
returned in?
3. When the function must return a struct, a union, a long, a float
or a double, does it receive a hidden first parameter that points
to the location to be filled with the return value?
If so, is that hidden parameter received in X?
What if the return type is a 1- or 2-byte struct or union?
Thanks for any leads...
The CMOC home page: http://sarrazip.com/dev/cmoc.html
--
Pierre Sarrazin <sarrazip @ sarrazip . com>
More information about the Coco
mailing list