What they are
The processor has no instruction named RET or CLR: the assembler accepts such names and encodes a core instruction with a constant from the
constant generators or a fixed register. The result is the same bytes as writing the core instruction, so a disassembler can show either. The explorer shows the emulated name by default
(as TI’s tools do) and the core instruction as encoded when Emulated instructions is off.
A name is used only when the encoding is the one the assembler produces: the constant must come from R2 or R3 (inc r5 is add #1, r5 encoded with the constant generator and is two bytes; the same instruction written with an immediate word, four bytes, is shown
as add #0x1, r5). Of the byte forms, .B follows the name (clr.b, inc.b). When two names fit one encoding the more specific is used.
The 24 emulated instructions
| Emulated | Core instruction | Operation |
|---|---|---|
ADC dst | ADDC #0,dst | Adds the carry. |
BR dst | MOV dst,PC | Branches to the address in dst (word form only). |
CLR dst | MOV #0,dst | Clears dst. |
CLRC | BIC #1,SR | Clears the carry. |
CLRN | BIC #4,SR | Clears the negative flag. |
CLRZ | BIC #2,SR | Clears the zero flag. |
DADC dst | DADD #0,dst | Adds the carry, decimally. |
DEC dst | SUB #1,dst | Subtracts 1. |
DECD dst | SUB #2,dst | Subtracts 2. |
DINT | BIC #8,SR | Disables interrupts (clears GIE). |
EINT | BIS #8,SR | Enables interrupts (sets GIE). |
INC dst | ADD #1,dst | Adds 1. |
INCD dst | ADD #2,dst | Adds 2. |
INV dst | XOR #−1,dst | Complements dst. |
NOP | MOV #0,R3 | Does nothing (writing R3 has no effect). |
POP dst | MOV @SP+,dst | Pops a word from the stack. |
RET | MOV @SP+,PC | Returns from a subroutine. |
RLA dst | ADD dst,dst | Shifts dst left one bit (arithmetic). |
RLC dst | ADDC dst,dst | Rotates dst left through the carry. |
SBC dst | SUBC #0,dst | Subtracts the borrow. |
SETC | BIS #1,SR | Sets the carry. |
SETN | BIS #4,SR | Sets the negative flag. |
SETZ | BIS #2,SR | Sets the zero flag. |
TST dst | CMP #0,dst | Compares dst with 0 (sets N, Z). |
llvm (the comparison tool) writes ret, nop, pop, br, clr, inc, incd, dec, decd, adc, dadc, sbc, tst, inv, clrc, clrn, clrz, setc, setn, setz, dint and eint
but not rla and rlc, and br and pop only for some operand forms; the explorer writes all 24. Where the names differ, the check treats the unaliased forms as the same instruction.
The conditional jumps have two names each as well (JNE/JNZ, JEQ/JZ, JLO/JNC, JHS/JC); they are one encoding, written with the first.
Not described
- The extended emulated instructions of the MSP430X (
RPTand theXforms are on the MSP430X page); the emulated forms are applied to the core instructions of the 16-bit encoding only, not to the extended ones.