C compiler for the C64 and other 65xx machines.

C, Cobol, Durex, Fortran, Pascal, etc, etc
User avatar
Shaun_B
Member
Member
Posts: 179
Joined: Tue May 06, 2014 12:12 pm
Location: UK
Contact:

C compiler for the C64 and other 65xx machines.

Post by Shaun_B » Fri May 16, 2014 7:54 pm

I gave cc65 a quick blast a couple of year ago (I think), but didn't get very far with it mostly due to a lack of time, but it did what it was supposed to. It's available here:

http://cc65.github.io/cc65/

There are some samples to look through as well. Enjoy!

Regards,

Shaun.


BASIC Programming - making the mistakes so that you don't have to.
Circles and Squares.
Nothing I post here will stand up in a court of law.

User avatar
onlineprof2010
Member
Member
Posts: 10
Joined: Fri Oct 03, 2014 12:20 am
Location: Virginia

Re: C compiler for the C64 and other 65xx machines.

Post by onlineprof2010 » Fri Oct 03, 2014 1:49 am

I started looking at cc65. Definitely slower than assembly but a bit faster than BASIC which is good for games. But programming timewise I think I was able to whip up something faster than basic or assembly.

UFO attack .prg file (v1.1)
https://drive.google.com/file/d/0BxrxBh ... sp=sharing
youtube preview
[video]https://www.youtube.com/watch?v=VrvEdKqHkKo[/video]

Looter .prg file (v2.2)
https://drive.google.com/file/d/0BxrxBh ... sp=sharing
youtube preview
[video]https://www.youtube.com/watch?v=uTVfDOk3xxc[/video]

I know, the games are simplistic but considering I never actually completed making a game as a kid I am happy so far.
Last edited by onlineprof2010 on Fri Nov 28, 2014 7:37 pm, edited 3 times in total.

User avatar
Shaun_B
Member
Member
Posts: 179
Joined: Tue May 06, 2014 12:12 pm
Location: UK
Contact:

Re: C compiler for the C64 and other 65xx machines.

Post by Shaun_B » Fri Oct 03, 2014 9:57 am

Now I have slightly improved my BASIC programming skills, I'll have a look again into C for the C64. I think the Mine Sweeper program that I wrote should be easy enough to convert to C and I'd be happy enough if I could manage it as I'm not 1337.

Regards,

Shaun.
BASIC Programming - making the mistakes so that you don't have to.
Circles and Squares.
Nothing I post here will stand up in a court of law.

dudz
Member
Member
Posts: 140
Joined: Tue Jun 17, 2014 5:40 am

Re: C compiler for the C64 and other 65xx machines.

Post by dudz » Fri Oct 03, 2014 11:41 am

Definitely slower than assembly but a bit faster than BASIC
you should carefully look at the generated code, then you'll quickly notice what the compiler is good at and what doesnt work so great - its surely not quite as good as plain assembly, but you can certainly use it to write *much* faster code than in basic :)

User avatar
onlineprof2010
Member
Member
Posts: 10
Joined: Fri Oct 03, 2014 12:20 am
Location: Virginia

Re: C compiler for the C64 and other 65xx machines.

Post by onlineprof2010 » Sat Oct 04, 2014 12:10 am

Thanks for the thoughts guys. I think exploring c with c64 is worthwhile. It is a language that follows a standard and it just may be possible to write portable code for the c64 (simple tile based windows games or ones with less than 9 sprites). Like in my game loop, I call a check_collision or update_sprites c function which goes to a c64 layer peeking/poking the sprite locations. But adding these function calls slows things down so I might try making some "inline". I still want to keep them though as I can conceivably replace the c64 layer with another system.

User avatar
onlineprof2010
Member
Member
Posts: 10
Joined: Fri Oct 03, 2014 12:20 am
Location: Virginia

Re: C compiler for the C64 and other 65xx machines.

Post by onlineprof2010 » Sat Oct 04, 2014 8:50 pm

I spent this Saturday morning tweaking the UFO game into an air sea battle game.
[video]https://www.youtube.com/watch?v=G8YHrVt7By4[/video]

Air Sea Battle PRG download
https://drive.google.com/file/d/0BxrxBh ... sp=sharing

Prime

Re: C compiler for the C64 and other 65xx machines.

Post by Prime » Sun Oct 05, 2014 8:04 pm

Thanks for sharing onlineprof2010 it's always great to see what others are up too.

User avatar
onlineprof2010
Member
Member
Posts: 10
Joined: Fri Oct 03, 2014 12:20 am
Location: Virginia

Re: C compiler for the C64 and other 65xx machines.

Post by onlineprof2010 » Sat Oct 11, 2014 8:56 pm

I decided to do another quick game before I take on something much bigger like my super mario game. I did a PETSCII centipede clone. Some have asked to see 'C' code for learning purposes so I am posting here:

[video]http://www.youtube.com/watch?v=yMx-HyvEKxI[/video]

C Code
https://drive.google.com/file/d/0BxrxBh ... sp=sharing

PRG File to play v2.1
https://drive.google.com/file/d/0BxrxBh ... sp=sharing

User avatar
onlineprof2010
Member
Member
Posts: 10
Joined: Fri Oct 03, 2014 12:20 am
Location: Virginia

Re: C compiler for the C64 and other 65xx machines.

Post by onlineprof2010 » Wed Dec 03, 2014 4:43 am

I know there are probably plenty of tools out there for sprites, but I decided to make my own in excel. After creating the sprite in an excel grid, it spits out data which you can paste into your c code.

Image

Here is the excel spreadsheet:
https://drive.google.com/file/d/0BxrxBh ... sp=sharing
clicking the link will display the spreadsheet through google but there is a download button which makes it easier to view and edit in excel itself.

I used it to do a basic update of my UFO game:
https://drive.google.com/file/d/0BxrxBh ... sp=sharing

On a side note also made some quick updates to my looter and centipede game:
https://drive.google.com/file/d/0BxrxBh ... sp=sharing
https://drive.google.com/file/d/0BxrxBh ... sp=sharing

Wish I had more time to do this fun stuff!

User avatar
Heart
Member
Member
Posts: 16
Joined: Fri Aug 22, 2014 3:52 pm
Location: Minnesota

Re: C compiler for the C64 and other 65xx machines.

Post by Heart » Thu Dec 04, 2014 2:53 pm

I always find it faster and easier to bload sprite data in rather than repoke/recompile/ressemble data statements.

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 1 guest