Thanks for looking into it and sharing back! ?Your experience mirrors mine; I find the SDCC code generation to be a bit fluffy. SDCC is a labor of love of its authors, so I suspect that advancements in optimisations are catch-as-catch-come.
?
My reflection on this mini-project is that SDCC can be a project accelerator if you want to use modern C authoring on a desktop dev env and are not picky about code size. If you've got the flash/ram, might as well use it. My acid test was compiling an HP15C emulator within this toolchain. This resulted in a program that fit in the 32 KiB banked region and there was plenty of RAM for variables in the non-banked region. Could it be smaller? Doubles. Could it be faster? Surely. Did it take months to implement? No, because I already had the code on-hand, so I just had to concoct build scripts and implement main() to start the emulator.
?
(Incidentally I did not complete this PoC implementation because I realized much to my chagrin that calculators presume the presence of a button matrix, so... whoops! I did implement the screen rendering of the keyboard and LCD using VT100 codes. This was slow even at 115kbps. The stdio fprintf() layer was about half as fast as CP/M BIOS calls, but really still too slow even then to be pretty to look at. Since this was just a PoC for code size and execution speed, I didn't bother investing in completing key mapping, or thinking laterally, making a parser for a CLI version.)
?
I chasing other wild geese just now, though I still might come back to this as even just now a buddy is wanting to re-purpose some vintage z80-based spectroscope with alternative firmware. (Indeed, the genesis of this activity is because of some folks wanting to reverse-engineer an esoteric language CAI machine called the 'Cefucom'. I could glean a lot from disassembling the rom dump but eventually one has to buzz out the wires to know what PIO-A-bit-7 is electrically connected to, and whether port 20h selects U24 or U25. My suggestion was a custom firmware that tweaks the lines in a predictable way such that you can observe the chip select logic with a multimeter rather than reverse engineering all the intermediary SSI decode. So it was handy to be able to crank that out quickly irrespective of generated code quality.)
?
Thanks so much, Allison, for your insights and also your tales from the trenches of how things were. And are they materially different now? Or just more and faster? Well, I guess quantum computing seems different, or is that just the re-imagining of analog computers?