Adding new software - z88dk/z88dk GitHub Wiki
Adding new software to the Z88DK library
Here are some general guidelines to take into account if you want to add or integrate some new software into Z88DK. Some of them are generic (but worthy!) ones, and others are Z88DK specific.
Always have code examples available: they will be the ones to use for checking that everything works, and also that everything continues working after a change. Try to have enough examples to exercise all of the new code.
Ensure everything compiles and works with both supported compilers (SCCZ80 and SDCC), and with all C library combinations (Classic, Newlib IX, Newlib IY). The previously mentioned examples will help you to do this quickly.
Try to have a single source tree and use it for both C library flavors. You can do the necessary tricks with paths in LST files to ensure this.
Be careful with the calling conventions used by different compilers when using function arguments. The same source with no function decorators generates different code depending on the compiler: SCCZ80 pushes arguments on the stack from left to right, and SDCC does it right to left.
Ensure the C stubs in assembler match the calling conventions and decorators used for the functions declared in the
#includefiles. Remember to pop function arguments in the ASM stub in the reverse order as they appear in the C declaration for the sccz80 implementation.
Specific instructions for each of the C Library flavors (Classic and Newlib):