Closed dgchrt closed 11 months ago
SDCC is already supported in Z88DK. So it is also supported in Cross-Lib. I even have an option to set its options in Cross-Lib's configuration file: https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/src/config.ini#L11
Z88DK comes with 3 different compilers: SCC80, ZSDCC (basically the official SDCC with more optimizations) and recently CLANG. ZSDCC in Z88DK has an improved optimizer but it strictly follows and takes all SDCC improvements. It is regularly synched to SDCC.
ZSDCC has several shortcomings when compared to SCCZ80, though:
On the other hand, ZSDCC can produce faster and shorter binaries if I enable all optimizations but not always and not always by a large margin when compared to SCCZ80. So I only use ZSDCC on some of the slowest targets because SDCC with all Z88DK new optimizations can produce faster and smaller binaries.
One thing that I plan to do is to let the user more easily choose which compiler (SCCZ80 vs ZSDCC) to use for Z88DK targets. This is somehow already possible with the configuration file by passing the right options but it is not clean.
@diogoeichert
If you want to compile a game for a Zilog 80 target and you want to use sdcc, just edit config.ini
and change the sccz80_opts
parameter as follows:
sccz80_compiler_opts = -compiler=sdcc -SO3
This line alone will tell Cross-Lib to always use sdcc instead of sccz80 with a high level of optimizations. You can use much heavier and slower optimizations with:
sccz80_compiler_opts = -compiler=sdcc -SO3 --max-allocs-per-node200000
But you may need to prepare a coffee for this because for large projects it may take minutes. As a rule, I would first develop my project only with sccz80 and only later switch to sdcc with the heavy optimizations, if I need extra speed but then, if you use sdcc, you need to retest your game.
I am closing this issue but feel free to ask more questions.
Hi again,
I have now changed the name of the configuration parameter in config.ini
to z88dk_compiler_opts
(to avoid confusion).
You can specify there any option including which compiler.
For example:
-compiler=sdcc
to use sdcc
for all Z88DK targets (a bit slow compilation)-compiler=sdcc -S03
to use sdcc
for Z88DK targets and use heavy optimization (slow compilation)-compiler=sdcc -S03 --max-allocs-per-node200000
for sdcc
for Z88DK targets with extreme optimization (take a nap)sccz80
(very fast compilation)-O3
to use sccz80
with heavy optimization (relatively quick)
SDCC is not just easier to use than Z88DK because there are readily available packages, but it also outperformed it in tests: http://www.cpcmania.com/Docs/Programming/SDCC_vs_z88dk_Comparing_size_and_speed.htm