3 ms·
The dominant C compiler (CC65) has a separate stack for parameters and local variables, and keeps SP as a pointer in zero-page. This is a nice general approach
by sehugg 7y ago
The dominant C compiler (CC65) has a separate stack for parameters and local variables, and keeps SP as a pointer in zero-page. This is a nice general approach that allows for deep stacks, recursion, and lots of locals, but isn't very efficient.
Newer experimental 6502 languages either forbid recursion (cowgol) or limit parameters passed to functions (C02), but I can see a language using a hybrid of stack and zero page to keep locals and parameters.
The drawback of high-level programming on the 6502 is you are always looking for ways to make it better... :)