|
|
|
|
|
by Someone
1733 days ago
|
|
Not only C, any language that thinks there’s other things than global state. If all your functions are void foo(void) and you don’t use local variables (or your language doesn’t support recursion, in which case all locals can be given a fixed address), targeting 6502 is fine (it also helps if you avoid floating point, use 8-bit variables where possible, etc) Not supporting recursion also means you can statically compute maximum stack depth. That way, you can avoid linking code that would overflow the stack. |
|
I recall a tutorial for 'cc65 optimizations'[0] which basically destroys a well-structured C program in order to do all of these optimizations (like making everything global) and it was absolutely terrible, code-wise. Well, the end result was probably fine, but it's just a shame these 'optimizations' were needed.
[0] I think it was this one: https://github.com/ilmenit/CC65-Advanced-Optimizations