Live data from Hacker News

C Compiler Assembler and Runtime for C64

github.com

21–30 of 34 posts

Re: C Compiler Assembler and Runtime for C64

#21

Earlier quoted context omitted.

To quote the article: “C++ support level The compiler will most likely not support a current C++ standard in the near future, but several C++ features are already implemented. The compiler can be switched into C++ mode with the command line option -pp or by providing a source file with a .cpp extension.”

Thanks, you are right, the compiler has some C++ support also.

I do expect some mangling of the boost header files would need to be done.

It’d be awesome if a patch was made and submitted :-)

Re: C Compiler Assembler and Runtime for C64

#22

Cool stuff, seems to be competing with cc65 (not very performant, includes a stdlib), sdcc (very new port), vbcc (not open-source, best performance), and kickc (not standard c)

I went looking for a performance comparison, found this. SDCC looks pretty good, but it doesn't show code size:

https://gglabs.us/node/2293

Re: C Compiler Assembler and Runtime for C64

#23

So I recently took at broad look at some of the old C compilers and wrote an article about it. One interesting thing of note is a lot of compilers in the mid 70s compilers like the Small-C compiler actually only compiled a subset of the C programming language. This was because the 8-bit systems were much more resource constrained the then PDP-11s that C was developed on, and C was difficult to compile. It's hard to b…

Also: these old compilers ran on the target system. If all features are supported, the compiler might not fit into memory, and need many passes to work.

I know, from personal experience, that a lot of C64 games were written on PCs, cross-assembled and squirted to the C64 target.

This included graphics.

Circa 1989 so it was the backend of C64 development.

Re: C Compiler Assembler and Runtime for C64

#24
Neat. When I owned 8-bit machines back in the 1980's, I never bothered to learn assembly; just BASIC. I'd love to tinker with retro computers again including things like the Commander X16, but to be honest I'm too old and impatient to code in assembly even though I'm comfy with it now. If I could use a C compiler that inflicted a non-heinous size/performance penalty, I'd be happy. Especially if I could link in asm libs for performance-critical or low-level functions.

Re: C Compiler Assembler and Runtime for C64

#25

So I recently took at broad look at some of the old C compilers and wrote an article about it. One interesting thing of note is a lot of compilers in the mid 70s compilers like the Small-C compiler actually only compiled a subset of the C programming language. This was because the 8-bit systems were much more resource constrained the then PDP-11s that C was developed on, and C was difficult to compile. It's hard to b…

Which is why I say the whole Kernigahm's rant regarding Pascal is kind of bogus.

On one side most Pascal dialects did not have the issues he had with raw ISO Pascal.

And outside UNIX server rooms, all C implementations were also dialects anyway, so it should count both ways.

By the way, besides Small-C, have you also considered RatC, another dialect of it?

Re: C Compiler Assembler and Runtime for C64

#26

Earlier quoted context omitted.

Also: these old compilers ran on the target system. If all features are supported, the compiler might not fit into memory, and need many passes to work.

I know, from personal experience, that a lot of C64 games were written on PCs, cross-assembled and squirted to the C64 target. This included graphics. Circa 1989 so it was the backend of C64 development.

Also UNIX, VAX and CP/M systems, and not only in regards to C64.

Re: C Compiler Assembler and Runtime for C64

#27

Wow this is actually more than just a C compiler... it supports numerous 6502 systems like NES, has a number of useful libraries and examples like disk i/o and many ample programs including sprite multiplexing. There are also extensive pragmas to help optimize.

Yes, this is very cool! And impressive! The only other compiler for 6502 I've ever used (and had to modify) is the old cc65. The original author stop developing it (10+ years ago): https://cc65.github.io/ But there is some development ongoing: https://cc65.github.io/ Would be interesting to see comparison with the new one.

I experimented with cc65 and wrote a simple game that ran on my actual C64 hardware. It was a lot of direct memory access, unrolling loops, and avoiding stack usage. A fun time overall, and it ultimately ran smoothly, but I see do why people who attempt anything serious on a C64 tend to focus on using ASM.

Re: C Compiler Assembler and Runtime for C64

#28
post #24

Neat. When I owned 8-bit machines back in the 1980's, I never bothered to learn assembly; just BASIC. I'd love to tinker with retro computers again including things like the Commander X16, but to be honest I'm too old and impatient to code in assembly even though I'm comfy with it now. If I could use a C compiler that inflicted a non-heinous size/performance penalty, I'd be happy. Especially if I could link in asm li…

You should see if Arduino based computers fit the bill for you: https://www.instructables.com/Arduino-Basic-PC-With-TV-Outpu...

Re: C Compiler Assembler and Runtime for C64

#29
post #24

Neat. When I owned 8-bit machines back in the 1980's, I never bothered to learn assembly; just BASIC. I'd love to tinker with retro computers again including things like the Commander X16, but to be honest I'm too old and impatient to code in assembly even though I'm comfy with it now. If I could use a C compiler that inflicted a non-heinous size/performance penalty, I'd be happy. Especially if I could link in asm li…

Idea ... If you want to stick to a (late) 1980s platform AND you want to code in C without penalty, consider the Sega Genesis.

68000 CPU. There's a mature and helpful homebrew scene. Documentation is good. The SGDK devkit/framework is nice and gives you a no fuss pipeline from C through GCC to a ROM file output that you can run on any emulator, or actual Genesis console (flash cart), or an FPGA like the MiSTer project. 68K assembly is pleasant IMO, if you want to sprinkle in some of that with your C. And, to satisfy an 8-bit itch, the Genesis also has a Z80 CPU on board, typically used for audio programming. Which, by the way, gives you authentic 1980s arcade/console FM synthesis.

IMO the Genesis' architecture of sprites, tilemaps, and palettes is very sane and easy to grok (compared to, say, the Super Nintendo of the era). Also, flat memory model. Yay.

Re: C Compiler Assembler and Runtime for C64

#30

Would this work on the Apple ][? How does it compare/differ from the LLVM 6502-MOS project?

Not much of a point since Apple ][ has the SWEET16 interpreter already as part of its BASIC ROM. But yes, it would be nice if the LLVM-MOS6502 folks put some effort towards feature parity with this toolchain. LLVM almost certainly has better auto-optimization than a new bespoke compiler.

According to Wikipedia the SWEET16 Interpreter is significantly slower than native assembly (Wiki says 1/10th the speed). A C compiler that targets 6502 would make sense if I want to code something to run on the Apple ][ that's relatively performant
Post reply on HN