SPNU118Z September 1995 – March 2023 66AK2E05 , 66AK2H06 , 66AK2H12 , 66AK2H14 , AM1705 , AM1707 , AM1802 , AM1806 , AM1808 , AM1810 , AM5K2E04 , OMAP-L132 , OMAP-L137 , OMAP-L138 , SM470R1B1M-HT , TMS470R1A288 , TMS470R1A384 , TMS470R1A64 , TMS470R1B1M , TMS470R1B512 , TMS470R1B768
Initialize Text
.string {expr1 | "string1"} [, ... , {exprn | "stringn"} ]
.cstring {expr1 | "string1"} [, ... , {exprn | "stringn"} ]
The .string and .cstring directives place 8-bit characters from a character string into the current section. The expr or string can be one of the following:
The .cstring directive adds a NUL character needed by C; the .string directive does not add a NUL character. In addition, .cstring interprets C escapes (\\ \a \b \f \n \r \t \v \<octal>).
The assembler truncates any values that are greater than eight bits. Operands must fit on a single source statement line.
If you use a label, it points to the location of the first byte that is initialized.
When you use .string and .cstring in a .struct/.endstruct sequence, the directive only defines a member's size; it does not initialize memory. For more information, see the .struct/.endstruct/.tag topic.
In this example, 8-bit values are placed into consecutive bytes in the current section.
1 00000000 41 Str_Ptr: .string "ABCD"
00000001 42
00000002 43
00000003 44
2 00000004 41 .string 41h, 42h, 43h, 44h
00000005 42
00000006 43
00000007 44
3 00000008 41 .string "Austin", "Houston", "Dallas"
00000009 75
0000000a 73
0000000b 74
0000000c 69
0000000d 6E
0000000e 48
0000000f 6F
00000010 75
00000011 73
00000012 74
00000013 6F
00000014 6E
00000015 44
00000016 61
00000017 6C
00000018 6C
00000019 61
0000001a 73
4 0000001b 30 .string 36 + 12