so why live with C's overhead?
This is the problem I have with HuC. I haven't messed with CC65, so m not sure about that, but it's not really the output code as it is the structure overlaying on top of it. The code can be optimized with replacement assembly stuff, but the structure is a pain in the ass (some stuff is impossible to do with HuC; no amount of assembly will fix it).
By "structure", do you mean all that messing about with putting expressions/temporary results on the C stack?
CC65 isn't really much different to HuC, it's just been optimized a lot more ... but then goes and throws away a bunch of that optimization by calling subroutines for some stuff instead of expanding the code in macros.
Either way ... both of them use "[sp],y" and "inc/dec sp" all the time which kills whatever is left of your performance.
They both do all the stack-based temporary math as 16-bit, but CC65 implments a
lot of peephole optimizations that can sometimes make it somewhat less expensive than HuC.
But, it's just (IMHO) dumb to keep doings things as 16-bit when you don't actually need to.
*************
SDCC's code generator is completely different, which is why it stands a
chance of delivering better code.
It internally figures out
all the local variables, calculations and math in terms of temporary results (8-bit/16-bit/32-bit signed/unsigned), and then does lots of trial passes through the code-generator to decide which of these temporary results should actually be in registers or real locations in memory (either as static locations, or on the stack).
Since a small-stack access can be "abs,x", that's just as fast as a static "abs" reference on the PCE.
That's not
too conceptually different to how an assembly-language programmer thinks.
I just don't know, yet, how well it's all going to work out in practice because I'm entirely dependent upon the SDCC "guru" to get the code-generator written.
The SDCC codebase itself is barely documented, and seems to rely on a lot of insider knowledge of state information that I just don't understand.
So something like NESHLA is for assembly programs, not beginners or strictly C enthusiasts.
Yes, definitely.
There's not much that can be done for people that will
only use C, but back in my day, assembly language
was for beginners, or at-least almost-beginners.
For me personally, the only real nuisance of Assembly, is the wading through the listing. Everything's really long and so it's more difficult to quickly parse through stuffs.
Yes, that's where NESHLA's approach really appeals to me (right now).
Assembly language isn't really that hard, but traditional assembly code can be a bit of a PITA to follow because of the verbosity and with the actual structure being hidden inside lines of code that
look identical to the eye.
It's like running C code through an obfuscator that removes all the spacing and line breaks and just puts everything on the same line.
Perfectly legal C code ... just a huge PITA to read and understand.
Writing code, designing logic and structure - none of that is a problem for me in assembly.
Yep, assembly coding itself usually isn't that difficult.