Page 1 of 1

Coffecients and pot values

Posted: Fri Dec 05, 2014 5:02 pm
by the_boris
I'm a bit confused by what values of POT0-2 are supposed to be. According to docs and forum posts, the values are 0-1. But when I use a coefficient that represents the same range of values, the behaviors are not at all the same. Below is an example of a basic script where POT2 is a volume pot. If instead of POT2 I use the VOLUME coefficient, it doesn't work.

Code: Select all

equ VOLUME .75

rdax adcl, .5
rdax adcr, .5
mulx pot2 ;works
;mulx VOLUME ; doesn't work.
wrax dacl, 1
wrax dacr, 0


Posted: Fri Dec 05, 2014 5:11 pm
by frank
MULX requires the parameter to be a register and not a constant so you would need to save 0.75 in to a register called VOLUME then use it like:

Code: Select all

equ VOLUME .15

equ	volreg	reg0

sof	0,VOLUME
wrax	volreg, 0 ; load VOLUME value into  register

rdax adcl, .5 
rdax adcr, .5 
;mulx pot2 ;works 
mulx volreg ; works with register
wrax dacl, 1 
wrax dacr, 0 
If you want to use VOLUME as a coefficient directly then use sof or other instruction that takes a coefficient directly

Posted: Mon Dec 08, 2014 1:59 pm
by the_boris
perfect! thank you!

my background in higher level programming made me assume that a constant and a variable are interchangeable.