please dont rip this site

TI MSP430 Instructions

There are thee general groups of instuctions:
 

Double Operand
12 Op-codes, a Source (S-Reg) with 4 addressing modes specified by As and a Destination (D-Reg) with only 2 modes selected by Ad, (3 if you fake one) as well as a bit called Bw or B/W to select between byte operation and word operations. Those modes start out simple, but some interesting tricks really make them flexable.
Single Operand
7 Op-codes and a destination (D-Reg) with 4 addressing modes specified by Ad which is now 2 bits. And byte or word with Bw
Jumps
7 sorts of PC relative jumps with a 10 bit offset.

Instruction Formats

15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0  Description

Op-code

S-Reg

Ad Bw

As

D-Reg

 Double Operand Note As is 2 bits, Ad is 1
 0  0  0  1  0  0  Op-code Bw

Ad

D-Reg

 Single Operand Note Ad is now 2 bits
 0  0  1 Condition

10 bit PC Offset

 Jumps

S-Reg / D-Reg
Source or Destination Register
Can be any of the 16 available registers.
R0 is the Program Counter (PC),
R1 is the Stack Pointer (SP),
R2 is the Status Register but will return special constant values  (see Constant Registers below) as will
R3 which is called the Zero Register but can return 0, 1 or 2 depending on the Source Addressing Mode.
As / Ad
Addressing Modes

In Single Operand instructions, Ad is the two bit value indicating the Destination Addressing Mode and is decoded as per this table, in Double Operand instructions As is the 2 bit Source Addressing Mode value and Ad is a single bit. This single bit selects between Direct or Indexed addressing (again using an immediate number stored after the instruction). Of course, Indirect is easy to fake with a 0 offset in the Indexed address. In the case that both source and destination addresses are Indexed, the immediate value for the source is stored directly after the instruction, followed by the one for the destination address.

Ax Name Source Syntax Description
00 Direct Register Rn The actual value stored in the register indicated by S-Reg
01 Indexed Memory pointed to by Register
+ Immediate Number
n(Rn) An immediate 16 bit value (stored in the next program word after the instruction) is added to the value in the register.
 
If the register is R0 (the PC) then we have PC relative addressing. This is how labels are referenced. The assembler will translate &lable into lable(R0)
10 Indirect Memory pointed to by Register @Rn The value in the register is used to index memory and return the value at that addres in memory.
In a Double Operand instruction, since there is no Indirect mode for the destination (Ad is only 1 bit, remember), the assembler will translate a destination of @Rn into an Indexed mode reference to 0(Rn)
11 Increment Memory pointed to by Register
(Increment Register)
@Rn+ Just like Indirect but then the register is incremented by 1 for byte or 2 for word depending on Bw. Note: the exception is when the register is the Stack Pointer: Then it is always incremented by 2.
 
When the register is PC, the source is an immediate value stored after the instruction which will be skipped by the increment! Clever huh? The syntax for that is just #n and the assembler will translate it into @R0+ and put the value of n in the word after the instruction.
 
The source register is incremented before the destination is computed so if the same register is used as the destination, the source with be based on the original value and the destination on the incremented value.
 
In a Double Operand instruction, the destination can not be post incremented (Ad is only 1 bit!), only the source. In a Single Operand instuction, Ad is 2 bits, and the destination can be incremented just fine.
D-Reg
Destination Register
Bw
Byte(=1) or Word(=0) operation

Constant Registers

When r2 (the status register) or r3 (the zero register) are specified, the addressing mode bits are decoded specially:

As S-Reg Value Description
00 Direct 0010 R2 R2 Normal access. The actual value of the Status Register is read.
01 Indexed 0010  " &<location> Absolute addressing. The extension word is used as the address directly.
10 Indirect 0010  " #4
11 Increment 0010  " #8
00 Direct 0011 R3 #0 See why R3 is called the Zero Register? Its direct value is el-zippo. Isn't really a register is it?
01 Indexed 0011  " #1 But when you use it as a source in an Indexed operation, it becomes a 1
10 Indirect 0011  " #2 And as an Inderect source, it looks like a 2
11 Increment 0011  " # -1 And if you try to Increment it, all its bits are set!

Memory aid: R3 returns a sign extended version of the As mode.

Double Operand group

Instructions

Mnemonic S-Reg,
D-Reg
Operation

Status Bits

V N Z C
MOV(.B) src,dst src » dst - - - -
ADD(.B) src,dst src + dst » dst * * * *
ADDC(.B) src,dst src + dst + C » dst * * * *
SUB(.B) src,dst dst + .not.src + 1 » dst * * * *
SUBC(.B) src,dst dst + .not.src + C » dst * * * *
CMP(.B) src,dst dst - src * * * *
DADD(.B) src,dst src + dst + C » dst (decimally) * * * *
BIT(.B) src,dst src .and. dst 0 * * *
BIC(.B) src,dst .not.src .and. dst » dst - - - -
BIS(.B) src,dst src .or. dst » dst - - - -
XOR(.B) src,dst src .xor. dst » dst * * * *
AND(.B) src,dst src .and. dst » dst 0 * * *

Emulated Group

See:

15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0

file: /Techref/ti/msp430/inst.htm, 11KB, , updated: 2009/9/14 14:32, local time: 2024/12/23 10:48,
TOP NEW HELP FIND: 
18.191.238.6:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/Techref/ti/msp430/inst.htm"> TI MSP430 Instructions</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .