If you decide on CC65, you might want to look into a 6502 plugin for Eclipse. Would be nice to modify it for 6280.
Hahaha ... not Eclipse ...
never Eclipse!
A 177MB download and fracking Java just for an editor ... not on my computer.
I'll stick with Zeus (
http://www.zeusedit.com/index.html), and sometimes the free PSPad (
http://www.pspad.com/en/).
Also, about this stack optimization stuff: instead of using ZP, why not have a three or four stack system. As in, each stack is only 256 bytes (because if indexing directly), but the compiler could assign at compiler time which stack each function uses. And in the case of nesting of the same function, there could be 2 or 3 versions which the compiler could decide to use to keep the stack(s) usages from going out of bounds.
ABS,y is only +1 cycle more than ZP,y. And you'd get away from the [stack],y mode or worse manually building the offset to the stack each time (not sure if HuC does this or not).
Yes, I'd come to the same conclusion.
The nice thing about this, is that stack pointer can spend most of its time loaded into the Y register, and only gets kicked out when the Y register is needed to access something through a pointer. That's easy to manage in the peephole optimizer.
I'm part-way through implementing that in CC65, but it may just break things.
However, once you make the design choice to go that route, then it becomes sensible to think about removing all the C-stack pushes and pops within a function, and just calculate the stack space that a function needs and then allocate it all-at-once at the start of the function.
Again, that's something that could
potentially be done during/after HuC or CC65's peephole optimizers.
Changing the frame layout would be better handled at the code-generation stage ... but that might be difficult to accomplish in either HuC or CC65.
If you can get a frame pointer that doesn't change during a function, and you use the "abs,y" addressing mode to access the stack, then stack-based variables are often as fast as using statically allocated variables.
IMHO, that could be a bit of a game-changer.
Anyway ... even more interesting than attempting to improve HuC or CC65, is the possiblity of actually getting SDCC to support the 6502.
That's just a much superior foundation to build upon than the Small-C roots of both HuC and CC65.
I've got one of the SDCC developers showing some signs of interest in working on a 65C02 code generator for SDCC, and I'll see what I can do to help that process and to try to keep his interest alive.