I know exactly what you’re saying, which is why I’ve been experimenting with cross developing for 8 bit.
I would have said the exact same thing.
However, it’s not quite as bad as that. Firstly, i would say the compiled code is about 75% performance and probably 25-50% fatter.
It’s totally vital that the source code be careful. So for example, i couldn’t just try building frotz
in its current form. It’s definitely too fat. Firstly, the things you mention would definitely have to go, and probably a few more.
Writing C code for 8 bit needs work, you have to approach the project differently. It’s absolutely essential that you use char
variables everywhere - especially loops.
The usual C convention of passing parameters everywhere also needs to change. For small projects, make everything global, for more complex ones, pass in a single “context” structure which holds everything. Passing lots of parameters all the time, kills code size.
On the upside, there are things you can do which can give an advantage over hand assembly;
For example, you can mess with your data structures and recompile everything. The order of data in your structures makes a difference to the code.
Typically with hand designed code, you don’t have the option to re-arrange data deep into the project. For compiled code, you can.
Other obvious things are to not pull in libs you don’t need, have a really bare-bones c-lib etc.
If anyone knows of a really really cut down C, Z3 emulator. I’d definitely look into it.
but really cut down