SDCC calling convention

From Fox Labs Wiki
Revision as of 20:34, 1 January 2024 by Inari (talk | contribs) (Created page with "By default, SDCC uses the stack to provide parameters to function calls, and uses the L. HL or DE - HL registers for return values depending on the size of the return value. {{Table alignment}}SDCC starting in version 4.2.0 introduced changes to the calling conventions used. {| class="wikitable" |+ ! !__sdcccall(0) !__sdcccall(1) !__z88dk_fastcall |- | colspan="4" style="text-align: center; background-color: #eee;" |Return |- |{{Rh}}|8 bits |L |A |L |- |{{Rh}}|16 bits |H...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

By default, SDCC uses the stack to provide parameters to function calls, and uses the L. HL or DE - HL registers for return values depending on the size of the return value. SDCC starting in version 4.2.0 introduced changes to the calling conventions used.

__sdcccall(0) __sdcccall(1) __z88dk_fastcall
Return
8 bits L A L
16 bits HL HL HL
32 bits DE - HL HL - DE DE - HL
Parameters
8 bits Stack A L
16 bits Stack HL HL
32 bits Stack HL - DE HL - DE
8 + 8 bits Stack A + L Invalid
8 + 16 bits Stack A + DE Invalid
16 + 16 bits Stack HL + DE Invalid
16 + 8 bits Stack HL + Stack Invalid