News for hackers. Stuff that matters.
Re:C64 Power C Tutorial by klodolph on Tuesday June 11, 2019 @02:52PM (#20158372)
Having written 6502 assembly but not targeted 6502 with C, I tentatively agree, but if you can fit your program in a 256 byte stack, things should be... mostly fine? Except for the fact that you want to do pointer indirections through the zero page. Clunky!

Personally if I'm going to have fun writing assembly for a project like this, I'm not too picky about the particular architecture.

Re:C64 Power C Tutorial by sehugg on Tuesday June 11, 2019 @07:00PM (#20160289)
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... :)

Re:C64 Power C Tutorial by ddingus on Tuesday June 11, 2019 @03:07PM (#20158509)
It is clunky, but the instructions are fast. Always thought that was an interesting trade off.
Re:C64 Power C Tutorial by klodolph on Tuesday June 11, 2019 @03:19PM (#20158631)
They’re fast, but you’re not using them well if you’re writing C, because the compiler is not good at putting things like local variables, function arguments, or globals in the zero page. It’s only 256 bytes and you can’t easily share.

So for 6502 I would rather not be writing C.

Re:C64 Power C Tutorial by ddingus on Wednesday June 12, 2019 @01:19PM (#20166993)
Nor would I.

Check out PLASMA. That is being used to develop the game lawless legends. It's pretty damn impressive.