Important: The information in this document is obsolete and should not be used for new development.
Function Value Return
In the CFM-68K runtime environment, the placement of the return value depends on its size:
- Functions returning
UInt8,SInt8, orBooleandata types place the return value in the least significant byte of D0. The three most significant bytes in D0 are undefined.- Functions returning
UInt16orSInt16data types place the return value in the two least significant bytes of D0. The two most significant bytes in D0 are undefined.- Functions returning pointers (including array pointers),
UInt32,SInt32, orfloatdata types place the return value in D0.- Functions returning small data structures or
uniondata types place them in the least significant bytes of D0. For example, a 4-byte structure takes up D0, while a 2-byte structure occupies the two least significant bytes of D0, with the extra bytes being undefined.- If the function return value is larger than 4 bytes (this applies to
doubleandextendeddata types, as well as to largestructoruniondata types), a pointer must be pushed onto the stack at call time after all the user-visible arguments have been pushed. The address of the pointer must be a memory location large enough to hold the function return value. When the function exits, it returns this address in the D0 register.