beautypg.com

Texas Instruments MSP50C6xx User Manual

Page 307

background image

Assembler

5-11

Code Development Tools

5.4

Assembler

5.4.1

Assembler Directives

Assembler directives are texts which have special meaning to the assembler.
Some of these directives are extremely helpful during conditional compiling,
debugging, adding additional features to existing codes, multiple hardware
development, code release etc. Other directives are an essential part of the
assembler to initialize variables with values, assigning symbols to memory
locations, assigning origin of a program, etc. The assembler directives that
start with a # (hash) sign cannot have spaces before the directive. The
following assembler directives are recognized by the assembler. Some of
these assembler directives use expressions and symbols. These are
explained below:

expression can be any numeric value. Addition, subtraction, and multiplication are

allowed.

Examples:

(128 / 2 ) * 2 + (220 / 5) + 2 + *0x200

equates to 0xAE +

*0x200, where *0x200 indicates data memory location.

(2 * 2 / 2 + ((5 * 2) * 3) / 2) | (0x0F & 0x04)

equates to

0x15. Note that bitwise AND (& operator) and OR (| operator) operations are
allowed.

(10 * 2) + 5 * *0x120

expression points to data memory content at

0x120, multiplies decimal 5 to it, and finally adds decimal 20. Note that a space
is required between successive asterisks (*). Also note that *0x120 indicates
content of memory location at 0x120 hex.

The grammar for expressions and symbols are as follows:

number:

number | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

expression:

number

| expression + expression

| expression expression

| expression * expression

| expression / expression

| expression | expression

| expression & expression

| ~expression

| expression

| +expression

| *expression