Bill,

I sent E-mail earlier this morning but maybe it didn't get through. Here is a second try at communicating the information I presented earlier. Hopefully this is also
clearer than my earlier rushed E-mail.

You can find links to the user's guides for the MSP430 processors here:

http://focus.ti.com/docs/analog/catalog/announcements/brc.jhtml?path=templatedata/cm/brc/data/20011218msp430userguides&templateId=1

And here is a link to one of those User's Guides which I will reference below,
the "MSP430x1xx Family User's Guide":

http://www-s.ti.com/sc/techlit/slau049.pdf

The op-code to disassemble is 0x433f (the MSP430 is a little-endian processor so the bytes are reversed.) On page 5-24 is "Figure 5-10. Core Instruction Map".
It indicates that 4xxx instructions are MOV instructions and are of type
format I (a.k.a. double operand instructions.) Taking apart the fields
of the format I instruction  according to Figure 5-7 on page 5-18
we get:

   0100    op-code
   0011    S-Reg
   0       Ad
   0       B/W
   11      As
   1111    D-Reg
op-code '0100' means MOV. B/W '0' indicates a word instruction.
S-Reg '0011', indicating R3, and As '11', together represent the
immediate source value of 0FFFFh (see page 5-5 Table 5-3.) Ad '0'
and D-Reg '1111' indicates a destination R15. So, 0x433f is the
instruction:

   MOV    #0FFFFh,r15

The POP instruction is actually emulated using a MOV instruction and
its encoding is very similar to the MOV immediate instruction above.
The difference is the source register being R1 (the stack pointer)
instead of R3 (a constant generator register). When S-Reg is '0001'
and As '11', the source is indirect autoincrement R1 (the pop function).
So, the encoding 0x413f is:

   MOV    @R1+,R15

Which is the same as:

   POP    R15

---
Mitch Burghart
Serveron Corporation
Portland OR USA


Bill Knight wrote:

I was looking through the code generated by the compiler
and believe I came across an error in the assembler.
The function being compiled returns a -1 as an error
condition.  The assembly code generated by the compiler
produces the following:
   mov    #llo(-1),r15

However, msp430-objectdump disassembles the elf file as:
   12ae:  3f 43    pop r15

I believe 0x3f43 isin fact 'pop r15' and that 'mov #-1,r15'
is 0x3f41.  Unfortunately I do not have a good op-code map.
(If someone could e-mail one to me, it would be much
appreciated.)

The sections of the dump file and generated assembly file
are attached.

-Bill Knight
R O SoftWare




Reply via email to