Friday, November 19, 2010

PowerPC Assembly Tutorial on AIX: Chapter 2, Adding Clarity

You would have noticed that the load instruction in line 5 is rather confusing as to which is the register, and which is the value being read. To make things clearer, we will use the .set assembler pseudo-op. C programmers can think of .set as a #define. The program will then look like this:

  1.         #File. 1_2.s
  2.         .set r3, 3
  3.         .csect
  4.         .globl .main
  5.         .main:
  6.                 li        r3, 5
  7.                 blr

The above program has the same effect as 1_1.s

No comments: