Table of Contents Previous topic Next topic
ASSEMBLER DIRECTIVES->Other Assembler Directives->DC Define Constant Data
The DC data directive is used to create constant data. Tables, text and numerical data for instance can be created using DC.
Constants can be aligned on a byte, word or long word boundary.
The size of the constant is specified by appending .B, .W, .L, to the DC directive. If no size is specified then .W is assumed. If necessary, numeric data is truncated to fit into the size specified.
Multiple constants can be created with a single DC directive by including more than one expression or string in the operand. Adjacent expressions or strings are separated from each other by commas. Up to 256 bytes of data can be generated with a single directive.
Formats:
DC.B | <exprn or string>,<exprn or string> .... |
DC.W | <exprn or string>,<exprn or string> .... |
DC.L | <exprn or string>,<exprn or string> .... |
DC | <exprn or string>,<exprn or string> .... |
1 00000000 00220045004E DC 34,$45,78
2 00000006 22454E DC.B 34,$45,78
3 00000009 00220045004E DC.W 34,$45,78
4 0000000F 00000022000000450000004E DC.L 34,$45,78
5
6 00001234 number1 EQU $1234
7 00005678 number2 EQU $5678
8 0000001B 12345678 DC number1,number2
9 0000001F 0073007400720069006E0067 DC 'string1','string2'
0000002B 00310073007400720069006E
00000037 00670032
10 0000003B 737472696E6731737472696E DC.B 'string1', 'string2'
00000047 6732
11 00000049 0073007400720069006E0067 DC.W 'string1', 'string2'
00000055 00310073007400720069006E
00000061 00670032
12 00000065 000000730000007400000072 DC.L 'string1', 'string2'
00000071 000000690000006E00000067
0000007D 000000310000007300000074
00000089 00000072000000690000006E
00000095 0000006700000032