SPRUI03E June 2015 – January 2023
Initialize Byte
.bytevalue1[, ... , valuen ]
.ubytevalue1[, ... , valuen ]
.charvalue1[, ... , valuen ]
.ucharvalue1[, ... , valuen ]
The .byte, .ubyte, .char, and .uchar directives place one or more values into consecutive bytes of the current section. A value can be one of the following:
With little-endian ordering, the first byte occupies the eight least significant bits of a full 32-bit word. The second byte occupies bits eight through 15 while the third byte occupies bits 16 through 23. The assembler truncates values greater than eight bits.
If you use a label, it points to the location of the first byte that is initialized.
When you use these directives in a .struct/.endstruct sequence, they define a member's size; they do not initialize memory. For more information, see the .struct/.endstruct/.tag topic.
In this example, 8-bit values (10, -1, abc, and a) are placed into consecutive bytes in memory with .byte. Also, 8-bit values (8, -3, def, and b) are placed into consecutive bytes in memory with .char. The label STRX has the value 0h, which is the location of the first initialized byte. The label STRY has the value 6h, which is the first byte initialized by the .char directive.
1 00000000 0000000A STRX .byte 10,-1,"abc",'a'
00000001 000000FF
00000002 00000061
00000003 00000062
00000004 00000063
00000005 00000061
2 00000006 00000008 STRY .char 8,-3,"def",'b'