
C64 Power C Tutorial - harel
http://64k.blot.im/power-c-tutorial-part-i-introduction
======
phendrenad2
There's something magical about writing code in C for these old 8-bit and
16-bit CPUs. You really feel like you're in control. You can inspect the
assembly output and actually understand it. You can do inline assembler to
optimize critical sections. 32-bit CPUs lose some of that magic, because the
instructions sets are usually much more complex. However, RISC ISAs like
RISC-V are still plenty of fun...

~~~
pjmlp
As someone that started coding back when those systems were modern, if you
want to be in control learn Assembly.

~~~
bane
IIR, C wasn't even available for most of these systems as they probably didn't
have the local resources to compile their own code.

~~~
pjmlp
On what concerns the Spectrum range, there were some pseudo C compilers that
you could type in, but there were basically toys given the 48KB space.

With the 128KB +3A model you could use CP/M, which had a better compiler
available, still a pseudo C toy compiler versus the real thing on UNIX.

We only used such compilers for homework assignments.

------
NikkiA
What OP is attempting to do is actually not really something that was done 'in
the day'. By the time games developers were shifting from writing in ASM the
idea of development 'on the hardware' was largely disappearing, and most dev
studios had low-end minicomputers or (16-bit, mostly) workstations running
cross-compilers or cross-assemblers. Most indie devs, of that era, were
sticking with ASM - it didn't help that the native compilers were often
outrageously expensive for an individual to purchase.

That said, I understand the allure of trying to work 'native', and it's a
mistake/trap I often fall into myself.

------
TazeTSchnitzel
The 6502 only has 66 extremely simple instructions, and it's slow enough C is
a disadvantage and you would need to learn 6502 assembly to know how to write
good C code anyway, so I don't see the point in avoiding it. I started writing
a Famicom game for the fun of it, and the ISA is very easy to pick up because
of it's so tiny and uncomplicated.

~~~
jmull
Yes. But OP will learn (hopefully) and that's the fun of it.

Anyway, for the C64 many of your "APIs" \-- especially for games -- are
accessed by peeking and poking memory-mapped locations, careful usage of the
zero-page, etc. C doesn't help you with that stuff but assembly loves it.

If you aren't in there counting cycles you are leaving so much on the table,
and there just isn't that much table!

------
wyld_one
Interesting, when you mentioned Power C I thought you meant this:
[http://www.mixsoftware.com/product/powerc.htm](http://www.mixsoftware.com/product/powerc.htm)

The book for it was very nice as well. Best bang for the buck at the time.
Could only compile code up to x286, not 386 CPUs

------
djmips
Another thing to look at and try for the C64 is KickC. It's modern and being
worked on. It's not true C and that's not it's intent. The intent is to
produce efficient code for the 6502 and C64.

[https://gitlab.com/camelot/kickc](https://gitlab.com/camelot/kickc)

------
aidenn0
Is this related to Mix Software's "Power C" for DOS? That was the first C
compiler I ever used.

~~~
NikkiA
Nope, this is ProLine's Power C, as seen here:

[https://www.c64-wiki.com/wiki/Power_C](https://www.c64-wiki.com/wiki/Power_C)

(the ALL CAPS code example with some really horrific variable and function
names is a nice touch of the 80s)

