beautypg.com

Texas Instruments MSP50C6xx User Manual

Page 131

background image

Bit, Byte, Word and String Addressing

4-45

Assembly Language Instructions

is a string of bytes. The length of the byte string is stored in the string register
(STR). To define the length of a string, the STR register should hold the length
of the string minus 2. For example, if the length of a byte string is 10, then STR
should be 8. A byte string address can be even or odd. Byte string data is
fetched from the lower address (starting address) one byte at a time to consec-
utive addresses.

NOTE:

Data Memory Access

Data memory access (RAM) is always accessed with byte addresses. Pro-
gram memory (ROM) is accessed with 17-bit words. Rx registers autoincre-
ment (or autodecrement) by 1 for byte addressing, by 2 for word addressing,
or by the length of the string in bytes if Rx++ (or Rx– –) is used.

Word and Word String Addresses: One data memory word is composed of
two consecutive bytes. A word address is always an even byte address and
the least significant bit of the byte address is assumed to be zero. Instructions
that operate on words have internal hardware which increments the byte ad-
dress appropriately to load the two consecutive bytes in one clock cycle. To
use an absolute word address, the address should be multiplied by 2. A word-
string is a string of consecutive words. Like a byte-string, word-strings use the
STR register to define the string length. Word-strings always start at an even
byte address. When string instructions are used, words are fetched from the
first word-string memory location to consecutive addresses. The word address
is the data memory address in bytes. This is obtained by multiplying the byte
address by two.

Figure 4–3. Data Memory Organization and Addressing

17th Bit

17th Bit

17th Bit

17th Bit

17th Bit

17th Bit

0000h

0001h

0002h

0040h

0041h

nnnn

Global

flags

Relative

flags

Flag

addresses

MS Byte

MS Byte

MS Byte

MS Byte

0000h

0002h

0004h

nnnn

LS Byte

LS Byte

LS Byte

LS Byte

Data memory

address (even)

0001h

0003h

0005h

nnnn+1

Data memory

address (odd)

1 Word

Note:

Word address is data memory address (or byte
address) divided by 2.

† Flag address always accesses the 17th bit of 17 bit wide data word in data memory.