Goldfield ·
how can i integrate the command abs() in the code-Editor?
Swing / SickTheramin
does not work
thx
From the original SynthMaker forum (2004–2014), with its members’ names and dates.
Goldfield ·
how can i integrate the command abs() in the code-Editor?
Swing / SickTheramin
does not work
thx
cyto ·
Goldfield wrote: how can i integrate the command abs() in the code-Editor?
It should work in the Code primitive. If you want to get an absolute value in the assembly primitive, you can "mask" your variable by using an andps operation with the integer 2147483647, which is all bits on except the sign bit. Below shows an example of the two methods...
-cyto
Goldfield ·
different Editor.. ?! ok 🙂
thx
how can i insert asm code and jmp-commands ( in the blue editor )
cyto ·
Goldfield wrote: how can i insert asm code and jmp-commands ( in the blue editor )
The short answer is "you can't."
However, the code primitive (blue) does have a "string" output that shows SM's compiled version of the contents of the code box. You can use this as a transition to full-on assembly programming. What you need to do: write out your code in the blue code box. Then connect the "S" output to a text primitive. Click in the text primitive and hit CTRL-A to select all of the contents. Hit CTRL-C to copy the contents. Open up a green assembler primitive. Click inside and hit CTRL-V to paste the text. See below...
From there you can edit the assembly code to do whatever you want. Be warned, SM only has a limited set of opcodes available. The list is on the WIKI (search "opcodes"). You'll see that you can achieve some jumping within the assembler. To see examples of how this is done, use the above method to view the compiled versions of code with "hop" and "loop" routines. That should give you some clues about how to approach this.
-cyto
trogluddite ·
Goldfield wrote: how can i integrate the command abs() in the code-Editor?
The abs() command (and a few others) were only added to SM quite recently - could be that your version of SM is older (Fruity Loops or Free version maybe?) and does not have those functions. In the mean-time, you can use abs() in code (blue) by substituting the following equation...
abs = x * (1 - 2 & ( x < 0 )); //multiplies by -1 if x < 0
Wrote something here? To have a post removed or your name hidden, write to [email protected].