Professional Documents
Culture Documents
Chapt15 4.pps
Chapt15 4.pps
UBI
Chapter 15
Advanced Laboratories
MSP430 assembly language tutorial: MSP430X CPU
Pedro Dinis Gaspar, António Espírito Santo, Bruno Ribeiro, Humberto Santos
University of Beira Interior, Electromechanical Engineering Department
www.msp430.ubi.pt
www.msp430.ubi.pt
Contents
UBI
The constants are fixed and are selected by the (As) bits of
the instruction. (As) selects the addressing mode;
Values of constants
generated:
In a non-register
addressing mode, the
extension word of an
instruction, whether
format I (double
operands) or format II
(single operand), is
coded as:
0 0 0 1 1 0 0 ZC # A/L 0 0 n-1/Rn
0 0 0 1 1 0 0 0 0 1 0 0 0000
Op-code S-reg Ad B/W As D-reg
0100 0101 0 0 00 0100
MOVX R5 Register 16-bit Register R4
The coding specifies that the CPU must perform the 16-bit
data function MOVX, the source being the contents of
memory address pointed to by (src 19:16: X1 + PC) and
the destination being register R5;
The bits dst 19:16 are stored in the extension word and the
value X1 is stored in the word following.
The coding specifies that the CPU must perform the 16-bit
data function MOVX, the source being the contents of the
memory address pointed to by (src 19:16: X1 + PC) and
the destination being the contents of the memory address
pointed to by (dst 19:16: X2 + PC);
The bits src 19:16 and dst 19:16 are stored in the
extension word and the words X1 and X2 are stored in the
words following.
Copyright 2009 Texas Instruments
>> Contents All Rights Reserved
24
www.msp430.ubi.pt
Extended format II - single operand-
instructions (1/2)
UBI
The bits dst 19:16 are stored in the extension word and the
value X1 is stored in the word following;
Copyright 2009 Texas Instruments
>> Contents All Rights Reserved
29
www.msp430.ubi.pt
Examples: Extended single operand
instructions (4/4)
UBI
Call a routine:
CALLA R5
This type of instruction can be coded in three different
formats, as shown in the figure below:
0 0 0 1 1 0 0 ZC # A/L 0 0 n-1/Rn
0 0 0 1 1 0 0 0 0 0 0 0 0000
Op-code S-reg Ad B/W As D-reg
0100 0101 0 1 00 0100
MOVX R5 Register 20-bit Register R4
In this example, bits 19:16 are set to zero when the operand
addresses are calculated.
Data
Destination Address
0x00200 (R4)
0x00002 (X2)
0x00202 0x00202 0xXXXX X2(R4) 0x00202 0x1234 X2(R4)
Source Address
0x00200 (R5) 0x001D0 0x1234 X1(R5) 0x001D0 0x1234 X1(R5)
0xFFFD0 (X1)
0x001D0
Data
Destination Address
0x00200 (R4)
0x00002 (X2)
0x00202 0x00202 0xXXXX X2(R4) 0x00202 0x1234 X2(R4)
Source Address
0x101D0 (R5) 0x101A0 0x1234 X1(R5) 0x101A0 0x1234 X1(R5)
0xFFFD0 (X1)
0x101A0
Data
Destination Address
0x00200 (R4)
0x00002 (X2)
0x00202 0x00202 0xXXXX X2(R4) 0x00202 0x1234 X2(R4)
Source Address
0x101D0 (R5) 0x101A0 0x1234 X1(R5) 0x101A0 0x1234 X1(R5)
0xFFFD0 (X1)
0x101A0
Data
Destination Address
0x03114 (PC)
0xD0EE (X2)
0x0202 0x00202 0xXXXX TONI 0x00202 0x1234 TONI
Source Address
0x03112 (PC) 0x00200 0x1234 EDEN 0x00200 0x1234 EDEN
0xD0EE (X1)
0x0200
R5 0xXXXXX R5 0x01234
0x1001C 0x1001C PC
0x1001A 0x01E6 X1 0x1001A 0x01E6 X1
PC 0x10018 PC 0x1001C
0x10018 0x4015 PC 0x10018 0x4015
Data
Destination Address
Source Address
0x1001A (PC) 0x10200 0x1234 EDEN 0x10200 0x1234 EDEN
0x001E6 (X1)
0x10200
Data
Destination Address
Source Address
0x03114 (PC) 0x00200 0x1234 EDEN 0x00200 0x1234 EDEN
0xFD0EC (X1)
0x00200
Data
Destination Address
Source Address
0x00200 0x1234 EDEN 0x00200 0x1234 EDEN
Data
Destination Address
Source Address
0x00200 0x1234 EDEN 0x00200 0x1234 EDEN
Data
Destination Address
Source Address
0x00200 0x1234 EDEN 0x00200 0x1234 EDEN