Page 1 of 1

WLDR Instruction

Posted: Sun Nov 16, 2014 3:15 pm
by Colin
I'm trying to make sense of the WLDR instruction in rom_pitch.spn:

wldr 0, 0, 4096

The notes say:
'''
wldr rmp0,freq,amp

There are two RAMP generators in the FV-1, RMP0 and RMP1
The frequency variable is a 16 bit value
The frequency variable is a 2 bit value 00 (0)=512, 01 (1)=1024, 10 (2)=2048 and 11 (3)=4096
'''

Conflicting information about the freq variable... Should it say "The amplitude variable is a 2 bit value..." But then, in rom_pitch the amp=4096 (not a 2 bit value).

Any insights would be greatly appreciated!
-Colin

Posted: Mon Nov 17, 2014 11:49 am
by frank
Which note says "The frequency variable is a 2 bit value "? That must be a typo I need to fix. Amp is a 2-bit value.

Yes, 4096 is larger than 2-bits but the assembler is treating it as a symbol in this instruction not a literal value so it sees 4096 and uses the proper 2-bit value in the assembled instruction.

Posted: Mon Nov 17, 2014 3:35 pm
by Colin
That typo is under Knowledge Base -> SpinAsm instructions and syntax -> WLDR

Thanks for clearing this up!

-Colin 8)

Posted: Mon Nov 17, 2014 3:41 pm
by Colin
If the 4096 is interpreted as a symbol, could you use %11 to get the same result?

From Knowledge Base -> Programming the FV-1:
"Labels may be equated with equations, numbers in decimal, binary (preceded by the % symbol) or hexadecimal (preceded with the $ symbol)."

I also take it that for hex you can use 0x prefix as well?

Posted: Mon Nov 17, 2014 5:29 pm
by frank
I've never tried it and I did not write the assembler so I say give it a try. If it works then great! If not then we all learned something new about it. If the parser was written correctly it should recognize the % or 0x