HCS08 Argument Passing (used for the -Cs08 Option)

The HCS08 uses the C calling convention for all functions. The caller pushes the arguments from left to right. After the call, the caller removes the parameters from the stack.

When a function contains a fixed number of arguments and the size of the last parameter is two bytes, the HCS08 passes the last parameter in H and X.

When a function contains a fixed number of arguments and the size of the last parameter is one byte, the HCS08 passes the last parameter in A. If the size of the next to last parameter is also one byte, the HCS08 passes the next to last parameter in X. If the size of the next to last parameter is two bytes, the HCS08 passes the next to last parameter in H and X.