Frank
What I find utterly fascinating is how well HI-TECH 3.09 holds up! Sure, it can be improved on -- but it takes an order of magnitude more resources to get a couple of percent improvement. Now... were I to use Z80 for a project, I would probably use HI-TECH 3.09 (in cross compile mode using zxc). With a bit of (either) in-line assembler or zas, we can do most of what is needed.
HI-TECH C code generation is pretty good -- for 8080 use, you *may* want to consider Whitesmiths C 2.1 *That* compiler gives
good results for 8080.
What I did notice is that your C code does *not* have any "register" directives. As compiler hints, this is vital for the best code
generation for boh HI-TECH and Whitesmiths. HI-TECH has only a single "register" Whitesmiths has 1.5 (uses BC and DE very effectively).
I don't have time to play with this yet -- but my gut reaction is : starting with pi-olz88.c , break main into init, process, print (avoid giving compiler too much to deal with). declare register variable (either a or b). Note that globals are NOT in registers, and this
is a problem with the piz88.c source. When I get a chance, I will dive into this. I should be retired, but am not...
Also, do NOT assume that "optimize" will be very effective -- just plain peephole. Those changes should get the "native"
compilers to VERY competitive with z88
Just some food for thought.
FredW
(and, PS. I got to this thread from my "ALTAIR C is slow" comment. I, strangely, don't want to speed it up! Having it
"nice and slow" makes me think more slowly and deeply. -Or- I am just an old fossil...).