SLAU131Y October 2004 – June 2021
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:
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 0000 .space 100h
2 0100 000A STRX .byte 10, -1, "abc", 'a'
0101 00FF
0102 0061
0103 0062
0104 0063
0105 0061
3 0106 0008 .char 8, -3, "def", 'b'
0107 00FD
0108 0064
0109 0065
010a 0066
010b 0062