Bruce J.A. Nourish | 17 Jul 2003 19:21

PPC Assembler

Hey everyone,

I'm working on a port to the MPC8xx and I could use some help with PPC
assembler. I've figured out the basic stuff, and cross-assembled a few
small programs, but I have some questions:

 * What is the significance of a period after some mnemonics? IOW,
   what is the difference between (say) addic and addic.?

 * Why do some examples assume r0 is zero? Is this a good practice?
   I notice that prep's locore.S immediately zeroes out r0. But is
   this still a safe assumption in the presence of a C compiler?

 * I have Apple's guide to PPC assembler as my only reference. Is there
   anything better out there? I would be willing to invest a modest
   amount in a book.
--

-- 
Bruce J.A. Nourish <bjan+JUNK <at> bjan.net>
+JUNK is a bit bucket - remove it to email me.

Jochen Roth | 17 Jul 2003 20:14
Picon
Favicon

Re: PPC Assembler

>  * What is the significance of a period after some mnemonics? IOW,
>    what is the difference between (say) addic and addic.?

Arithmetic ops with period will set bits in the condition register,
while those without will not. So if you want to e.g. jump based on
the result of an addic being non-zero, use 'addic.'.

>  * Why do some examples assume r0 is zero? Is this a good practice?
>    I notice that prep's locore.S immediately zeroes out r0. But is
>    this still a safe assumption in the presence of a C compiler?

Some instructions use the actual r0, some use the value 0 if r0 was
specified. To make things less complicated (for humans I suppose),
the convention of leaving r0 with value 0 at all times was adopted
by some ABIs, I think.

>  * I have Apple's guide to PPC assembler as my only reference. Is there
>    anything better out there? I would be willing to invest a modest
>    amount in a book.

Go to e-www.motorola.com and search for 'powerpc programming
environments' as a pdf. I don't have a link at hand. I think you can
also try ordering it on paper from either IBM or Motorola.

Regards,
Jochen


Gmane