6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri May 10, 2024 11:18 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Wed Nov 11, 2020 9:46 am 
Offline

Joined: Sat Sep 05, 2020 3:12 pm
Posts: 22
Hi all,

I would like to share an old university years project of mine,
a Small C compiler written in Forth, running on C64 or Plus4 and
targeting the 6502. It had hibernated for ~25 years in almost
working form. Recently I have picked it up again and open-sourced it.
It lives here: https://github.com/pzembrod/cc64

I won't advertise this yet as a full tool for C programming, since
a real library is still on the todo list, as well as ANSI style
function definitions (so far it's K&R only).
But apart from that, for coding
locally on the Commodore machines, as an alternative to
cross-development, cc64 should already be a practical option.

I would love to hear some feedback if anyone wants to try it out.

Cheers
/Philip


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 11, 2020 10:52 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
Welcome! Can I suggest we use this thread, in Programming, to discuss the usage of this compiler? We can use the other thread, in Forth, to discuss the implementation.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 25, 2021 11:01 pm 
Offline

Joined: Sat Sep 05, 2020 3:12 pm
Posts: 22
An update on this: I've recently gotten cc64 to run on the Commander X16:
https://www.commanderx16.com/forum/inde ... -cc64-x16/


Top
 Profile  
Reply with quote  
PostPosted: Wed May 12, 2021 10:55 pm 
Offline

Joined: Fri May 06, 2005 1:02 pm
Posts: 17
Location: Limerick, PA
Now I’m much more incentivized to get my Plus4 working properly again!


Top
 Profile  
Reply with quote  
PostPosted: Fri May 14, 2021 10:10 pm 
Offline

Joined: Sat Sep 05, 2020 3:12 pm
Posts: 22
Gurft wrote:
Now I’m much more incentivized to get my Plus4 working properly again!


Glad to hear that! :-)

The latest release brought a decent compile speed increase (https://github.com/pzembrod/cc64/releases/tag/v0.9), and I'm currently working on enabling ANSI-style function definitions.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 05, 2022 7:12 pm 
Offline

Joined: Sat Sep 05, 2020 3:12 pm
Posts: 22
Just before Christmas I released v0.10 (https://github.com/pzembrod/cc64/releases/tag/v0.10) which brings the mentioned ANSI syntax for function definitions (no type check between formal and actual params, though), better support for fastcall functions, and a basic libc, partially written in C, ported from https://pdclib.rootdirectory.de/, and partially rewritten in 6502 assembly. Of course, only a subset of functions was feasible and made sense due to limitations of both the compiler and the target platforms (C64, C16, X16).
A piece of code that I was initially most scared off was printf(). I thought it would need to turn into a monster in size and complexity. But surprisingly it was rather enjoyable, both to decide on a limit for features, and to squeeze those features into as compact and efficient code as I could. I even had fun sacrificing readability for efficiency in a few places, something I usually avoid, and instead tried to mollify my future self with extensive code comments where it seemed useful.
The code lives at https://github.com/pzembrod/cc64/blob/m ... e/printf.a if anyone wants to take a look.


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 07, 2022 3:35 am 
Offline

Joined: Wed Oct 18, 2017 1:26 am
Posts: 28
This is great. Thank you!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: