The Directives are special instructions which tell the assembler to do certain things at assembly time. Directives can be used to tell the assembler to reserve Registers or Tram, to assign a name to the DSP program, to create macro, or to perform an assembly time 'For' loop. The following section describes each of the Directives used in the as10k1. A summary table is listed below.
Directive | symbol required(yes/no) | Arguments | Summary |
---|---|---|---|
NAME | No | "string" | Gives A name to the dsp patch |
CONTROL | Yes | value,min,max | Defines a patch manager controllable register with initial value |
DYNAMIC | Yes | number_of_gprs | defines 1 or more temporary gprs (may be reused by other patches) |
STATIC | Yes | init_value1,init_value2,... | Defines one or more Static gprs with initial values |
CONSTANT | yes | value1,value2,... | Defines one or more constants |
EQU | Yes | Value_Equated | Creates an assembly time Equate |
DELAY | Yes | Delay_length | Declares a delay line of given length |
TABLE | Yes | Table_length | Declares a lookup table of given length |
TREAD | Yes | tram_id,offset | creates a tram read associated with tram element "tram_id", with a given offset |
TWRITE | Yes | tram_id,offset | creates a tram write associated with tram element "tram_id", with a given offset |
INCLUDE | No | "file_name" | Include a file |
MACRO | Yes | arg1,arg2,arg3,... | Defines a macro with given arguments |
ENDM | No |   | Ends a Macro |
FOR | No | symbol=start:finish | Assembly Time 'for' statement |
ENDFOR | No |   | Ends a for loop |
END | No |   | end of asm file |
Specifies the name of the patch for identification purposes.
Equates a symbol to a be constant which is substituted at assembly time:
syntax:
<symbol> EQU <Value equated>
The value is a 16-bit integer value.
Tips on selection of GPR types:
CONTROL
Declares a static GPR. The value in the control GPR is modifiable
via the new mixer interface. The mixer is informed of the min and max values and will create a
slider with value within that range. Upon loading the patch, the GPR is also loaded with the specified
initial value.
Syntax:
The arguments are 32-bit integer values.
Declares an automatic GPR from the emu10k1. This should be used
for temporary storage only. It the GPR may be reused by other patches. No initial
value is loaded to it.
Syntax The argument can be an equated symbol, if no value is given 1 GPR is allocated.
Declares a static GPR. The GPR is loaded with the specified initial value. The GPR
is not shared with any other patch.
Syntax:
The argument is a 32-bit integer value
Declares a constant GPR. Usage of Constant GPR allows for a greater efficient use of GPRs as
patch which need access to the same constant will all share this GPR. The sharing is done by
the patch loader at load time.
The patch loader will also use a hardware constant (see the
register map) instead if the GPR constant happens to
be one of them. (i.e. if you were to declare a constant with value 1, the patch loader would
make your dsp program use the hw constant at address 0x41 instead).
Syntax:
To create a delay-line/look-up table, you'll want to first reserve some tram (using delay or table) then declare tram reads and writes (using tread and twrite respectively).
Note, lookup tables currently don't work (because we don't understand how to)
Define Delay, used for allocating an amount of TRAM for a delay line.
<symbol> DELAY <Size>
The symbol is used to identify this delay line. The Size is the amount of TRAM
allocated. The argument is a 32-bit integer value. A '&' indicates that the value
represents an amount of time, the assembler will calculate the amount of samples
required for the delay.
e.g:
Defines lookup Table
same as DELAY but for lookup tables.
Define read: used for defining a TRAM read point
<symbol> TREAD <lineName>,<Offset>
The tram read is associated with the delay or lookup line given by "lineName". This must be the same symbol used
in defining the delay/lookup line. The Offset indicates an offset from the beginning of the delay/lookup line
for which the read will occur.
"Symbol" will be given the address of the TRAM data register associated with this TRAM read
operation. The assembler will create <symbol1>.a which has the address of the TRAM
address register.
example:
<symbol> CONTROL <initialValue>,<MAX>,<MIN>
<symbol> DYN <numberOfStorageSpaces>
or
<symbol> DYNAMIC <numberOfStorageSpaces>
<symbol> STA <numberOfStorageSpaces>
or
<symbol> STATIC <numberOfStorageSpaces>
<symbol> CONSTANT <value>
or
<symbol> CON <value>
Tram Memory Directives
foo DELAY &100e-3 ;a 100msec delay line
bar DELAY 1000 ;a 1000 sample delay line
fooread | tread | 100e-3,foo | |
macs | fooread.a,one,two,three | ; writes a new tram read address | |
macs | temp,fooread,one,two | ; reads the data from the delay line |
Same as TREAD but used for writing data to a delay line.
<symbol1> TWRITE <symbol2>,<value>
The include directive is used to include external asm files into the current asm file.
Syntax:
INCLUDE <"file name">
The file name Must be enclosed in "".
examples:
The END directive should be placed at the end of the assembly source file. If the END directive is not found, a warning will be generated. All text located after the END directive is ignored.
Syntax:
[symbol] END include "foobar.asm"
Used for defining a macro
Defining Macro:
<symbol> | macro | arg1,arg2,arg3.... |
.... | ||
<opcode> | arg4,arg1,arg2... | ;;for example |
.... | ||
.... | ||
endm |
were the <symbol> used is the mnemonic representing the macro.
arg1,arg2,arg3... can be any symbols (auto-defining and local to a macro) as long as the symbol is not already in use outside the macro (i.e. as a DC, DS, etc.).
There's no limit to how many arguments can be used.
Using Macro:
<macro nmeumonic> arg1,arg2,arg3....
where arg1,arg2,arg3,... are values or symbols.
usage:
For | <symbol>=<start>:<stop> |
... | |
... | |
macs <symbol>,.... | |
... | |
endfor |
<start> and <stop> must be integers
The as10k1 assembler handles skips in a special way explained best by an example:
skip CRR,CRR,CC_test,.foo ... ... ... .foo ...
the "." tell the assembler that the symbol is for skipping purposes, it will automatically define a GPR when parsing the skip instruction, and when the second .foo is encountered it will insert the number of instructions to skip. (the skip instruction needs a GPR by design, so don't blame me for the half-assness of it).