• Nem Talált Eredményt

ASSEMBLY LANGUAGE CONVENTIONS

In document Assembler Tools& Simulator Manual (Pldal 50-55)

3 Assembler

3.4 ASSEMBLY LANGUAGE CONVENTIONS

3 Assembler

3.3.8 Disable Semantics Checking (-s)

Giving the -s switch prevents the assembler from checking the semantics (conventional ordering) of multifunction instructions in your code.

ADSP-21xx multifunction instructions may have multiple clauses which have a logical left-to-right ordering. The clauses may, however, be listed in a different order and still assembled correctly. If this happens the

assembler normally generates a warning message for you; the -s switch switch inhibits these warnings.

As long as the individual clauses of a multifunction instruction are legal, the proper opcode will be generated regardless of the order in which they are given. The assembler’s warning messages are only intended to point out instructions which may appear confusing or misleading.

3 Assembler

The same symbol may be declared and separately used in different source code modules. Symbols are recognized only within the scope of the local module—unless they are declared as GLOBAL or ENTRY. This type of symbol can be referenced by all modules and must originate in one module only. See the descriptions of the assembler’s .GLOBAL, .ENTRY, and .EXTERNAL directives later in this chapter.

Table 3.2 lists the reserved assembler keywords. You may not use a keyword as a symbol in your code. Because the assembler is case-insensitive by default, both the upper and lower-case versions of

keywords are reserved. Keywords are shown in UPPERCASE throughout this manual.

ABS DM INCLUDE MR0 RTS

AC DO INIT MR1 RX0

AF EMODE JUMP MR2 RX1

ALT_REG ENA L0 MSTAT SAT

AND ENDMACRO L1 MV SB

AR ENDMOD L2 MX0 SEG

AR_SAT ENTRY L3 MX1 SEGMENT

ASHIFT EQ L4 MY0 SET

ASTAT EXP L5 MY1 SHIFT

AUX EXPADJ L6 NAME SI

AV EXTERNAL L7 NE SR

AV_LATCH FOREVER LE NEG SR0

AX0 FLAG_IN LOCAL NEWPAGE SR1

AX1 FLAG_OUT LOOP NOP SS

AY0 GE LSHIFT NORM SSTAT

AY1 GLOBAL LT NOT STATIC

BIT_REV GT M0 OR STS

BM I0 M1 PASS SU

BY I1 M2 PC TEST

C I2 M3 PM TIMER

CACHE I3 M4 POP TOGGLE

CALL I4 M5 PORT TOPPCSTACK

CE I5 M6 POS TRAP

CIRC I6 M7 TRUE

CLR I7 MACRO PUSH TX1

CLEAR ICTRL MF RAM TX0

CNTR IDLE M_MODE REGBANK UNTIL

CONST IF GO_MODE RESET US

3 Assembler

3.4.2 Assembler Expressions

The ADSP-2100 Family Assembler can evaluate simple expressions in source code. An expression may be used wherever a numerical value is expected.

Two kinds of expressions are allowed:

• an arithmetic or logical operation on two or more integer constants examples: 29 + 129 (128 - 48) * 3 0x55 & 0x0F

• a symbol plus or minus an integer constant

examples: data - 8 data_buffer + 15 startup + 2 The symbols are either data variables, data buffers, or program labels. All of these symbols actually represent address values which are determined by the linker. Adding or subtracting a constant specifies an offset from the address.

(Note: Since the assembler’s .VAR directive is used for declaring both single-word data variables and multiple-word data buffers, the term “data buffer” is used to denote both variables and buffers.)

Simple arithmetic or logical expressions can be used to declare symbolic constants with the .CONST directive of the system builder and assembler.

These expressions may use the following operators, which are a subset of the operators recognized in the C language environment (listed in order of precedence):

( ) left, right parenthesis

~ - ones complement, unary minus

* / % multiply, divide, modulus + - addition, subtraction

<< >> bitwise shifts

& bitwise AND

| bitwise OR

^ bitwise XOR

3 Assembler

Expressions may also be used when entering commands in one of the ADSP-2100 Family Simulators. The simulators recognize an additional set of expression elements and operators.

The most important difference between assembler expressions and simulator expressions is that memory contents (such as data variables) and processor register contents may be used as operands in the simulator only. The assembler cannot evaluate memory and register values at assembly-time; the simulator, however, has access to the instantaneous values of simulated memory and registers.

3.4.3 Buffer Address & Length Operators

Two special operators are recognized by the assembler. The address pointer (^) and length of (%) operators are used with data buffer names:

^buffer_name is evaluated as the base (first) address of the buffer

%buffer_name is evaluated as the length (number of words) of the buffer The ^ operator can also be used with variables, which are simply single-location buffers:

^variable_name gives the address of the variable

Simple expressions may be created by adding or subtracting a constant from the operator term:

^buffer_name ± constant

%buffer_name ± constant For example:

^array + 3

%array - 10

3 Assembler

The assembler operators are used to load L (length) and I (index) registers when setting up circular buffers:

This code fragment initializes I5 and L5 to the base address and length, respectively, of the circular buffer real_data. The buffer length value contained in L5 determines when addressing wraps around to the top of the buffer. Further information on circular buffers can be found in the

“Data Variables & Buffers” section of this chapter and in the Data Transfer chapter of the ADSP-2100 Family User’s Manual.

3.4.4 Comments

You may insert comments anywhere in a source code file, enclosed by braces, { }, except on C preprocessor directive lines. Nested comments are not allowed.

Multiple-line comments enclosed by a single pair of braces may not have a pound sign (“#”) at the beginning of any line.

Assembler directives may only have one-line comments—the comment cannot be continued on the following line. If you need more space to continue a comment, begin a new comment field on the next line.

Note that the C preprocessor cannot accept assembler-style comments enclosed by braces. To place a comment on the same line as a C

preprocessor directive (beginning with the “#” character), use the C convention:

#directive /* comment */

.VAR/DM/RAM/CIRC real_data[n]; {n=number of } {input samples}

I5=^real_data; {buffer base address}

L5=%real_data; {buffer length}

M4=1; {post-modify I5 by 1}

CNTR=%real_data; {loop counter=buffer length}

DO loop UNTIL CE;

AX0=DM(I5,M4); {get next sample}

{now process sample stored in AX0}

loop: …

3

Assembler

In document Assembler Tools& Simulator Manual (Pldal 50-55)