Back    Contents   Next

As10k1 Directives

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.

Directivesymbol required(yes/no)ArgumentsSummary
NAMENo"string"Gives A name to the dsp patch
CONTROLYesvalue,min,maxDefines a patch manager controllable register with initial value
DYNAMICYesnumber_of_gprsdefines 1 or more temporary gprs (may be reused by other patches)
STATICYesinit_value1,init_value2,...Defines one or more Static gprs with initial values
CONSTANTyesvalue1,value2,...Defines one or more constants
EQUYesValue_EquatedCreates an assembly time Equate
DELAYYesDelay_lengthDeclares a delay line of given length
TABLEYesTable_lengthDeclares a lookup table of given length
TREADYestram_id,offsetcreates a tram read associated with tram element "tram_id", with a given offset
TWRITEYestram_id,offsetcreates a tram write associated with tram element "tram_id", with a given offset
INCLUDE No"file_name"Include a file
MACROYesarg1,arg2,arg3,...Defines a macro with given arguments
ENDMNo Ends a Macro
FOR No symbol=start:finishAssembly Time 'for' statement
ENDFORNo  Ends a for loop
ENDNo 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:

<symbol> EQU <Value equated>

The value is a 16-bit integer value.

GPR Related Directives

Tips on selection of GPR types:


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.

<symbol> CONTROL <initialValue>,<MAX>,<MIN>

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.

<symbol> DYN <numberOfStorageSpaces>
<symbol> DYNAMIC <numberOfStorageSpaces>

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.

<symbol> STA <numberOfStorageSpaces>
<symbol> STATIC <numberOfStorageSpaces>

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).

<symbol> CONSTANT <value>
<symbol> CON <value>

Tram Memory Directives

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.

foo DELAY &100e-3     ;a 100msec delay line
bar DELAY 1000     ;a 1000 sample delay line


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.


fooreadtread 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.


INCLUDE <"file name">

The file name Must be enclosed in "".



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.


[symbol] END      include "foobar.asm"


Used for defining a macro

Defining Macro:

<symbol> macro arg1,arg2,arg3....
<opcode> arg4,arg1,arg2... ;;for example

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.

Assembly-time For loop


    For <symbol>=<start>:<stop>
macs <symbol>,....

<start> and <stop> must be integers

Handling Skips

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).

Back    Contents   Next