A new calling convention for gbz80 has been implemented in the
breaktheworld branch:
https://sourceforge.net/p/sdcc/code/HEAD/tree/branches/breaktheworld/

Anyone wanting to test it or experiment with it is welcome to use the
branch. C code should continue to just work without any changes, as all
regression tests pass for the branch.

Assembler code will have to be adapted to the new convention (which is
documented in the manual in the branch). Alternatively, using the
keyword __sdccoldcall in function declarations, individual functions can
be marked as using the old convention.

If no major regressions are found, this new calling convention could
become the default for a future SDCC release.

Philipp

P.S.:

The differences:

* Return values
 - Old: passed in e (8 bit), de (16 bit) or hlde (32 bit)
 - New: passed in a (8 bit), bc (16 bit) or debc (32 bit)

* Parameters
 - Old: All passed on stack
 - New: All on stack for functions with variable arguments, otherwise:
        First passed in a (8 bit), de (16 bit), debc (32 bit)
        If first in a, and second has 8 bits, passed in e.
        If first in a or de, and second has 16 bits, passed in bc
        If first in de or debc, and second has 8 bits, passed in a

* Stack cleanup
 - Old: Done by caller for all functions
 - New: Done by callee for all functions,
        except those with variable arguments


_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to