Is assembly really better than C in MKW modding?
#1
Why dont we use C/C++ instead of assembly? Wouldnt it be more efficient? Are there some limitations?
I tried compiling C/C++ with Metrowerks and/or powerpc-eabi-gcc into PowerPC code, but it was compiled really badly, so i imagine thats why. But i still believe you could overcome those issues with having good knowledge of compiler/linker files.
Reply
#2
It depends on what you want to mod.

For most Gecko Cheat Codes, Assembly is preferred as there are certain "tricks" you can easily implement in Assembly. Plus with these type of Codes you are "injecting" code at a specific address. In a sense, your "environment" is dictated for you. Thus, things such as Register Safety, come into play.

For something such as MKW-SP, CTGP, C/C++ is the obvious choice. Trying to write such large programs in Assembly is insane and it's a 99% probability the Compiler will do it better than you when it's all said and done. I would say that for something like this, you could write out handwritten memcpy, memset, etc routines in Assembly that would greatly improve performance.

C/C++ with a Compiler for *most* coders/devs is more efficient. It's hard to write faster than a compiler. There are some tricks, but you have to know what you are doing and how Broadway actually processes instructions from the Fetcher all the way to Retirement. You have to consider factors such as max instruction fetches per clock, zero clock branch folding, 32-byte cache block size, instruction serialization, cache hits/misses, instruction latency, etc etc).

Compilers have different optimization settings. For example some will have an -Os setting to optimize the code to be as short as possible and -O3 would optimize the code for clock latency. Compilers will default to a lower optimization setting (-O2) for safety. Any beginner can handwrite code faster than -O2.

This site is mainly an archive/database for Gecko Codes. Which is why I have tons of info about PPC Assembly all over the place.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)