Static allocations on a memory constrained system is not "bad C". It is standard practice. Indeed so far as dynamic allocation is often frowned upon and malloc (etc) might be banned by coding guidelinesflibble wrote: ↑Fri Nov 22, 2019 12:56 amI've also bounced off the memory limit (appears to be a binary size of approx 23KB (and 5KB sprites)) and discovered some interested things about the C implementation with regards to memory. Creating large local variables on the stack is generally a lot worse than just having a static variable in global scope, it's nicely making me write worse C
There are things you can do to drop the code size. Are you using the heap? Bin it if not. Run your init from an init segment then reuse this memory for data after init - easy to do in C. Pointer maths on 6502 are bloaty when the compiler can't elide it (might be why stack variables suck so bad - that & the register spill code is huge). Aggresively drop to (un)signed char from ints where you definitely only need 8 bits.