This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F2618: Confusion about source addressing mode for CLRX emulated instruction (MOVX).

Part Number: MSP430F2618


I'm attempting to understand the behavior of the compiler when executing the CLRX(.B,.A) dst command on the MSP430F2618 microcontroller (uC).
Specifically, I'm trying to grasp the addressing mode for extended instructions.

I'm confused about the source addressing mode. I expected it to be in immediate addressing mode, but the compiler seems to treat it as if it were in register addressing mode. This is perplexing, especially if I'm interpreting the manual correctly.

According to the MSP430F2618 design manual, CLRX(.B,.A) dst is an emulated instruction and is transformed into MOVX(.B,.A) #0,dst. Hence, it should be compiled as MOVX.

I consulted an ASM file generated by dis430, and indeed, I found the expected extended MOV instruction:

01182c: 0018 CLRX.A 0x00000(SP)
01182e: C143
011830: 0000

This instruction uses three words. Accounting for endianness, 0018 translates to 1800, and C143 to 43C1.

Here, 43C1 indicates asflag = 0 and adFlag=1. An asflag value of 0 implies register addressing mode for both non-extended and extended instructions. This is where my confusion lies. According to the dis430-generated file, it should be in immediate addressing mode.

The MSP430F2618 family user guide (with Chapter 4 dedicated to extended instruction CPUX) provides the following schematic:



Based on this schematic, for extended instructions, the immediate source addressing mode has asFlag = 0b11. Meanwhile, asFlag=0 denotes register source addressing mode.

thank you.


 

**Attention** This is a public forum