Arguments can be a bit confusing, so I'm going to give a summary here. Firstly, the programmer should be aware of the two different types of arguments: addresses and values.
addresses:
Address are the location of GPRs, hw registers, tram registers, etc. Address are the only type of arguments to the instructions. The assembler can do basic assembly time arithmetic (add, sub, mult divide) to the addresses. Symbols used by the assembler are always addresses too. Thus in foo sta $4, foo is the address of the static register containing 0x4.
values:
Values are always 32 bit signed integers, because this is only thing the emu10k1 can handle. The assembler can do fancy assembly time conversions, but one should always realize that the end result is a 32-bit signed integer.
The possible assembly time conversions are:
Fractional
The 32-bit values can represent fractional value between 1 and -1. To accomplish this, the value given to the assembler by the programmer (which is between 1 and -1) is multiplied by 2^31-1.
example:
foo STA 0.5
--> Results in the 32 bit value: 0x3fffffff
Time
Since the sample rate is a fixed 48kHz, values of time can be converted. Times specified by the programmer (using &), is multiplied by 48k to give the number of samples required for the given amount of time. furthermore, when the the value is intended to be stored in a GPR, a mult by 0x800 is performed to account for the 11 bit shift in delay values when accessing tram.
thus:
STATIC, CONTROL, CONSTANT -->mult by 0x800
DELAY, TREAD, TWRITE -->no mult
examples:
foo con &0.02
--> Results in the 32 bit value: 0x001E0000
foo delay &0.02
--> Results in a delay-line being 0x3C1 samples long.
Summary of argument type modifiers
Modifier Symbol | Type/Conversion |
---|---|
None/Integer | Integer |
None/fractional(1,-1) | Fractional |
$ | Hexadecimal |
@ | Octal |
% | Binary |
& | Time |