Best practices for writing C on 68000?

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Best practices for writing C on 68000?

Post by djcouchycouch » Mon Mar 12, 2012 1:47 pm

Hi,

I'm trying to find resources on best practices for writing efficient C code on the 68000. I've found http://www.mactech.com/articles/mactech ... index.html which looks like a good article.

Are there others that would be helpful?

Thanks!
DJCC

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Mon Mar 12, 2012 3:26 pm

Many C optimization tricks are CPU-independent, so you may check these two pages, they are about CC65 compiler and 6502: 1, 2.

However, it is a good idea to test some of the tricks and check assembly output, because in your enviroment one tricks could be effective, while other aren't too effective to be worthwhile to use.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Mon Mar 12, 2012 3:40 pm

Shiru wrote:Many C optimization tricks are CPU-independent, so you may check these two pages, they are about CC65 compiler and 6502: 1, 2.

However, it is a good idea to test some of the tricks and check assembly output, because in your enviroment one tricks could be effective, while other aren't too effective to be worthwhile to use.
Just by reading the assembly output you can learn how the help the compiler to optimize its code.
I did it a lot in SGDK so usually the loop / code style in SGDK should produces efficient GCC compiled code :)

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Tue Mar 13, 2012 1:28 pm

Awesome, thanks!

Post Reply