DSP Processor User Guide
DSP Processor User Guide
Program listings, program examples, interactive displays, filenames, and symbol names are shown in a special typeface similar to a typewriters.
In syntax descriptions, the instruction, command, or directive is in a bold face font and parameters are in an italics. Portions of a syntax that are in bold should be entered as shown; portions of a syntax that are in italics describe the type of information that should be entered. Syntax that is entered on a command is centered in a bounded box. Syntax that is used in a text file is left-justified in an unbounded box. Here is an example of a directive syntax: .include filename .include is the directive. This directive has one parameter, indicated by filename. When you use .include, the parameter must be an actual filename, enclosed in double quotes.
Square brackets ( [ and ] ) identify an optional parameter. If you use an optional parameter, you specify the information within the brackets; you dont enter the brackets themselves. Heres an example of an instruction that has an optional parameter: LACC 16-bit constant [, shift] The LACC instruction has two parameters. The first parameter, 16-bit constant, is required. The second parameter, shift, is optional. If you use the optional second parameter, you must precede it with a comma.
Braces ( { and } ) indicate a list. The symbol | (read as or ) separates items within the list. Heres an example of a list: { * | *+ | * } This provides three choices: *, *+, or *. Unless the list is enclosed in square brackets, you must choose one item from the list.
In assembler syntax statements, column 1 is usually reserved for the first character of an optional label or symbol. If a label or symbol is a required parameter, the symbol or label will be shown starting against the left margin of the shaded box as in the example below. No instruction, command, directive, or parameter, other than a symbol or label, should begin in column one.
symbol .set symbol value
In the above example, the symbol is required for the .set directive and must begin in column 1.
Some directives can have a varying number of parameters. For example, the .word directive can have several parameters. The syntax for this directive is:
.word 0abcdh,56 This syntax shows that .word must have at least one value parameter, but you have the option of supplying a label or additional value parameters, separated by commas.
Indirect Addressing
Constants
The assembler supports four types of constants:
Decimal integer constants Hexadecimal integer constants Binary integer constants Character constants
The assembler maintains each constant internally as a 32-bit quantity. Constants are not sign extended. For example, the constant 0FFh is equal to 00FF (base 16) or 255 (base 10); it does not equal 1.
Decimal integers
Hexadecimal integers
Binary integers
Character constants
A character constant is a single character enclosed in double quotes. The characters are represented as 8-bit ASCII characters.
Symbols
Symbols are used as labels, constants, and substitution symbols. A symbol name is a string of up to 16 alphanumeric characters (AZ, az, 09, $, , and +); symbols cannot contain embedded blanks. The first character in a symbol cannot be a number or special character. The symbols you define are case sensitive; for example, the assembler recognizes ABC, Abc, and abc as threeunique symbols.
Labels
A label must be unique. Do not use register names as labels.
.................the label Begins has the value of a00h. 00001 *assume other code was assembled 00002 00003 0a00 .ps 0a00h 00004 0a00 000a Begins: .word 0Ah,3,7 0a01 0003 0a02 0007
Constants
Symbols can be set to constant values. By using constants, you can equate meaningful names with constant values. The .set directive enables you to set constants to symbolic names. Symbolic constants cannot be redefined. The following example shows how these directives can be used:
;======================================================= ; Example showing valid symbols, labels and references ;======================================================= .ps 0a00h ; Initialize PC K .set 12 ; constant definition K = 12 K*2 .set 24 ; constant definition K*2 = 24 BIN .set 01010101b ; BIN = 055h max_buf .set K*2 ; constant definition max_buf = K*2 = 24 +A .set 10 ; constant definition << Incorrect lacl #K ; loads 12 lacl #K ; loads 12 lacl #K*2 ; loads 24 lacl max_buf ; loads 24 lacl !BIN ; loads 0AAh
For example:
dsk5a test.asm asmFFT .set 256 asm .entry 0a00h
This statement specifies a program entry point (or load address) of 0a00h and generates the file test.inc, in the following format: FFT .SET 256 .entry 0a00h
All asm statements are written to an include file named file.inc, overwriting the previous file. The asm statement is also useful for controlling parameter values such as .set, or controlling conditional assemble execution by using such directives as the .if/.else/.endif. dsk5a test.asm asmfft .set 256 In this example, the asm statement is assigning a value of 256 to the symbol fft.
Assembler Directives
Assembler directives supply program data and control the assembly process. They allow you to do the following:
Assemble code and data into specified sections Reserve space in memory for uninitialized variables Control the appearance of listings Initialize memory Assemble conditional blocks Define global variables