From WiiBrew
Jump to navigation Jump to search

Assembler programming for the WII

It is possible to write assembler programs for the Wii and this describes how to do it.

Writing games and applications in C or C++ is of course more efficient. However, it is not forbidden to use Assembler for the WII. If you are interested in assembler programming then give it a try and do it!

The devkitpro toolchain uses the GCC C/C++ compiler. This compiler uses the AS (or GAS) assembler to assemble the code. The AS assembler has a different syntax to most other assemblers since it does not use the Intel syntax but the AT&T syntax which is very different from the Intel syntax. The advantage of the AS assembler among other features is that it can generate code not only for Intel processors but for a lot of different processors as well such as the PowerPC processor. So it supports instructions like stmw, stwu, mflr, mtlr, blr etc.

The assembler code usually has to call the C functions of the devkitpro package which provide support for the WII such as querying the Wiimote. So you have to link these with your assembler code.


Application Note to compile and run assembler programs on the WII
GCC inline assembler tutorial for the PowerPC processor
Tutorial for the PowerPC processor instructions and the AS assembler


AIX assembler AIX assembler manual (not AS!) with detailed descriptions of the PowerPC instructions

MPCFPE32B.pdf The special PowerPC instructions are documented in chapter 8 of this manual

SVR4ABI.pdf or [1] The PowerPC Processor ABI Supplement

AS assembler manual

PPC CL datasheet

PPC CL special features

Introduction to assembly on the PowerPC