should I use assembly

support for the ARM toolchain
Post Reply
codycox.c
Posts: 49
Joined: Thu Mar 08, 2012 2:26 am

should I use assembly

Post by codycox.c » Fri Jun 15, 2012 2:09 am

I was wondering if many people are using assembly with C to make their games. Should I learn assembly or should I just use C? I do not know if people still use assembly to make games using devkitARM.

elhobbs
Posts: 354
Joined: Thu Jul 02, 2009 1:19 pm

Re: should I use assembly

Post by elhobbs » Fri Jun 15, 2012 1:24 pm

If you are asking this question then no you should not use assembly. Generally, assembly is used to optimize slow yet high usage areas. So, at this point you would most likely not be able to do better then the c compiler. Should you learn arm assembly? If you have the time and the inclination then I would say yes. arm processors seem likely to stay around for awhile.

Dwedit
Posts: 40
Joined: Sun Jan 06, 2008 4:06 am

Re: should I use assembly

Post by Dwedit » Sun Jun 17, 2012 6:34 pm

There are other things you can do to optimize code.
First, if you are using any significant amount of multiplication or division, build as ARM code instead of THUMB code. GCC generates really bad THUMB code for math heavy code, but it's better for ARM mode.
Second, there's a trick to write a function that efficiently returns two 32-bit ints. It involves unions and structs, but generates the best possible code for returning two ints.
Third, don't use the standard library's memset and memcpy, use replacement ASM versions that properly use ldmia/stmia loops.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest