You are on page 1of 2

MSP430 Addressing Modes

As

Ad

d/s

Register

Syntax

00
01
10
11

0
1
-

ds
ds
s
s

n3
n 0, 2, 3
n 0, 2, 3
n 0, 2, 3

Rn
x(Rn)
@Rn
@Rn+

01
11

1
-

ds
s

01
10
11
00
01
10
11

1
-

ds
s
s
s
s
s
s

Description

Register direct. The operand is the contents of Rn.


Ad=0
Indexed. The operand is in memory at address Rn+x.
Register indirect. The operand is in memory at the address held in Rn.
Indirect auto-increment. As above, then the register is incremented by 1 or 2.
Addressing modes using R0 (PC)
0 (PC)
LABEL Symbolic. x(PC) The operand is in memory at address PC+x.
0 (PC)
#x
Immediate. @PC+ The operand is the next word in the instruction stream.
Addressing modes using R2 (SR) and R3 (CG), special-case decoding
2 (SR)
&LABEL Absolute. The operand is in memory at address x.
2 (SR)
#4
Constant. The operand is the constant 4.
2 (SR)
#8
Constant. The operand is the constant 8.
3 (CG)
#0
Constant. The operand is the constant 0.
3 (CG)
#1
Constant. The operand is the constant 1. There is no index word.
3 (CG)
#2
Constant. The operand is the constant 2.
3 (CG)
#1
Constant. The operand is the constant 1.

MSP430 Instruction Set


15 14 13 12 11 10

opcode

B/W

As

register

B/W

As

register

RRC Rotate right through carry

As

register

SWPB Swap bytes

B/W

As

register

RRA Rotate right arithmetic

As

register

SXT Sign extend byte to word

B/W

As

register

PUSH Push value onto stack

As

register

0 0 0

0
0

0
0

1
1

condition
0 0 0

10-bit signed offset

JEQ/JZ Jump if equal/zero

10-bit signed offset

JNC/JLO Jump if no carry/lower

10-bit signed offset

JC/JHS Jump if carry/higher or same

10-bit signed offset

JN Jump if negative

10-bit signed offset

JGE Jump if greater or equal

10-bit signed offset

JL Jump if less

10-bit signed offset

JMP Jump (unconditionally)

opcode

5 4 3

Instruction
Single-operand arithmetic

CALL Subroutine call; push PC and move source to PC


0 RETI Return from interrupt; pop SR then pop PC

10-bit signed offset


10-bit signed offset

source

Ad B/W

As

destination

Conditional jump; PC = PC + 2offset


JNE/JNZ Jump if not equal/zero

Two-operand arithmetic

source

Ad B/W

As

destination

MOV Move source to destination

source

Ad B/W

As

destination

ADD Add source to destination

source

Ad B/W

As

destination

ADDC Add source and carry to destination

source

Ad B/W

As

destination

SUBC Subtract source from destination (with carry)

source

Ad B/W

As

destination

SUB Subtract source from destination

source

Ad B/W

As

destination

CMP Compare (pretend to subtract) source from destination

source

Ad B/W

As

destination

DADD Decimal add source to destination (with carry)

source

Ad B/W

As

destination

BIT Test bits of source AND destination

source

Ad B/W

As

destination

BIC Bit clear (dest &= ~src)

source

Ad B/W

As

destination

BIS Bit set (logical OR)

source

Ad B/W

As

destination

XOR Exclusive or source with destination

source

Ad B/W

As

destination

AND Logical AND source with destination (dest &= src)

MSP430 Emulated Instructions


Mnemonic
ArithmeticInstructions

Operation

Emulation

Description

ADC(.Bor.W)dst

dst+Cdst

ADDC(.Bor.W)#0,dst

Addcarrytodestination

DADC(.Bor.W)dst

dst+Cdst(decimally)

DADD(.Bor.W)#0,dst

Decimaladdcarrytodestination

DEC(.Bor.W)dst
DECD(.Bor.W)dst
INC(.Bor.W)dst
INCD(.Bor.W)dst
SBC(.Bor.W)dst

dst1dst
dst2dst
dst+1dst
dst+2dst
dst+0FFFFh+Cdst
dst+0FFhdst

SUB(.Bor.W)#1,dst
SUB(.Bor.W)#2,dst
ADD(.Bor.W)#1,dst
ADD(.Bor.W)#2,dst
SUBC(.Bor.W)#0,dst

Decrementdestination
Decrementdestinationtwice
Incrementdestination
Incrementdestinationtwice
Subtractsourceandborrow/.NOT.carry
fromdest.

Mnemonic
Operation
LogicalandRegisterControlInstructions

Emulation

Description

INV(.Bor.W)dst

.NOT.dstdst

XOR(.Bor.W)#0(FF)FFh,dst

Invertbitsindestination

RLA(.Bor.W)dst

CMSBMSB1
LSB+1LSB0
CMSBMSB1
LSB+1LSBC

ADD(.Bor.W)dst,dst

Rotateleftarithmetically

ADDC(.Bor.W)dst,dst

Rotateleftthroughcarry

dstPC
0GIE
1GIE
None
@SPPCSP+2SP

MOVdst,PC
BIC#8,SR
BIS#8,SR
MOV#0,R3
MOV@SP+,PC

Branchtodestination
Disable(general)interrupts
Enable(general)interrupts
Nooperation
Returnfromsubroutine

RLC(.Bor.W)dst

ProgramFlowControl
BRdst
DINT
EINT
NOP
RET

Mnemonic
DataInstructions
CLR(.Bor.W)dst
CLRC
CLRN
CLRZ
POP(.Bor.W)dst

SETC
SETN
SETZ
TST(.Bor.W)dst

Operation
0dst
0C
0N
0Z
@SPtemp
SP+2SP
tempdst
1C
1N
1Z
dst+0FFFFh+1
dst+0FFh+1

Emulation

Description

MOV(.Bor.W)#0,dst
BIC#1,SR
BIC#4,SR
BIC#2,SR
MOV(.Bor.W)@SP+,dst

Cleardestination
Clearcarryflag
Clearnegativeflag
Clearzeroflag
Popbyte/wordfromstacktodestination

BIS#1,SR
BIS#4,SR
BIS#2,SR
CMP(.Bor.W)#0,dst

Setcarryflag
Setnegativeflag
Setzeroflag
Testdestination

You might also like