Initialize Text
.string/.pstring
4-83
Assembler Directives
Syntax
.string ”
string
1
” [,
... , ”string
n
”]
.pstring ”
string
1
” [,
... , ”string
n
”]
Description
The .string and .pstring directives place 8-bit characters from a character
string into the current section. With the .string directive, each 8-bit character
has its own 16-bit word, but with the .pstring directive, the data is packed so
that each word contains two 8-bit bytes. Each
string is either:
-
An expression that the assembler evaluates and treats as a 16-bit signed
number, or
-
A character string enclosed in double quotes. Each character in a string
represents a separate byte.
With .pstring, values are packed into words starting with the most significant
byte of the word. Any unused space is padded with null bytes.
The assembler truncates any values that are greater than 8 bits. You may have
up to 100 operands, but they must fit on a single source statement line.
If you use a label, it points to the location of the first word that is initialized.
Note that when you use .string in a .struct/.endstruct sequence, .string defines
a member’s size; it does not initialize memory. For more information about
.struct/.endstruct, see Section 4.9,
Assembly-Time Symbol Directives, on
page 4-21.
Example
This example shows 8-bit values placed into words in the current section.
1 000000 0041 Str_Ptr: .string ”ABCD”
000001 0042
000002 0043
000003 0044
2 000004 0041 .string 41h, 42h, 43h, 44h
000005 0042
000006 0043
000007 0044
3 000008 4175 .pstring ”Austin”, ”Houston”
000009 7374
00000a 696E
00000b 486F
00000c 7573
00000d 746F
00000e 6E00
4 00000f 0030 .string 36 + 12
Summary of Contents for TMS320C54x
Page 38: ......
Page 39: ......
Page 40: ......
Page 41: ......
Page 42: ......
Page 43: ......
Page 44: ......
Page 45: ......
Page 46: ......
Page 47: ......
Page 48: ......
Page 49: ......
Page 50: ......
Page 51: ......
Page 52: ......
Page 53: ......
Page 54: ......
Page 55: ......
Page 56: ......
Page 57: ......
Page 58: ......
Page 59: ......
Page 60: ......
Page 61: ......
Page 62: ......
Page 276: ......
Page 277: ......
Page 278: ......
Page 279: ......
Page 280: ......
Page 281: ......
Page 282: ......
Page 283: ......
Page 284: ......
Page 285: ......
Page 286: ......
Page 287: ......
Page 288: ......
Page 289: ......
Page 290: ......
Page 291: ......
Page 292: ......
Page 293: ......
Page 294: ......
Page 295: ......
Page 296: ......
Page 297: ......
Page 298: ......
Page 299: ......
Page 300: ......
Page 301: ......
Page 302: ......