Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

working Assembler memin workareound!!!

Post any examples or modules that you want to share here

working Assembler memin workareound!!!

Postby KG_is_back » Wed May 21, 2014 3:57 pm

This module is able to extract the pointer (address of first value) of a memory input. Now you can write your own custom wavetable and wave readers in assembler.

It is just a prototype to show the basic idea - I can't guarantee stability.

How I came up with it? Well I connected wave read primitive to analyzer and noticed that the analyzer shows the inner assembly code of the primitive. I noticed which value is the pointer of the memory connected to it. Extracting it automatically was then relatively easy.
Attachments
alternative memin.fsm
(1.13 KiB) Downloaded 1206 times
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: working Assembler memin workareound!!!

Postby TheAudiophileDutchman » Wed May 21, 2014 10:04 pm

Congrats, as a first impression it seems to work fine here! :D
T A D - since 2005
User avatar
TheAudiophileDutchman
 
Posts: 46
Joined: Tue Jul 13, 2010 1:36 pm
Location: Apeldoorn, The Netherlands

Re: working Assembler memin workareound!!!

Postby martinvicanek » Wed May 21, 2014 10:20 pm

A real millennium hack! :mrgreen: :ugeek:
I wonder if something similar is possible for a mem[] array declared within code/ASM to pass it to another code/ASM block (as opposed to a wavetable). That would come in handy for stream FFT, no need to serialize the input/output, less delay. ;)
User avatar
martinvicanek
 
Posts: 1322
Joined: Sat Jun 22, 2013 8:28 pm

Re: working Assembler memin workareound!!!

Postby KG_is_back » Wed May 21, 2014 10:44 pm

martinvicanek wrote:A real millennium hack! I wonder if something similar is possible for a mem[] array declared within code/ASM to pass it to another code/ASM block (as opposed to a wavetable). That would come in handy for stream FFT, no need to serialize the input/output, less delay.


Yes, it should... If you connect anything to analyser primitive, you can see that variables are actually stored as doubleword at [ebp+N] (where N is a number). Maybe you can use multiplexer to switch one code to analyzer (opposed to mono stream) and readout the address.
However in this case it might be more wise to create a memory that is used by both assembly blocks. Trog proposed similar approach some time ago. He created a frame in Ruby code and passed the pointer to assembler which effectively created float array to mem (It works basically the same way as this one). I successfully used his module in many applications to pass arrays between assembler blocks.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: working Assembler memin workareound!!!

Postby nix » Thu May 22, 2014 3:24 am

It's a little bit OT,
but is there any way to create left and right float array,
to stereo mem?
You can do it by rendering, but this takes too much time.
User avatar
nix
 
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: working Assembler memin workareound!!!

Postby KG_is_back » Thu May 22, 2014 10:12 am

nix wrote:It's a little bit OT,but is there any way to create left and right float array,to stereo mem?You can do it by rendering, but this takes too much time.

Stereo mem is a mem that has odd samples left channel and even samples right channel. Rendering is the only way.
you can render using Analyzer, which is quite fast though.

This ASM code should do it in single sample:

Code: Select all
streamin pointerL;
streamin pointerR;
streamin pointerSTEREO;
streamin Length;

int c=-1;

stage0;
push ebx;
cvtps2dq xmm0,Length;
paddd xmm0,c;
movaps c,xmm0;

loop1:
mov ebx,c[0];
shl ebx,2;
mov eax,pointerR;
add eax,ebx;
fld [eax];
mov eax,pointerL[0];
add eax,ebx;
fld [eax];
shl ebx,1;
mov eax,pointerSTEREO[0];
fstp [eax];
add eax,4;
fstp [eax];

mov eax,c[0];
add eax,-1;
mov c[0],eax;
cmp eax,0;
jnl loop1;

pop ebx;
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: working Assembler memin workareound!!!

Postby KG_is_back » Thu May 22, 2014 2:22 pm

This should work with wave-array too (the code looks very similar) but I don't understand how the waves are written in the array (and how the wave-array read primitive works) can someone look into it please?
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: working Assembler memin workareound!!!

Postby tester » Thu May 22, 2014 6:16 pm

KG_is_back wrote:This module is able to extract the pointer (address of first value) of a memory input. Now you can write your own custom wavetable and wave readers in assembler.

It is just a prototype to show the basic idea - I can't guarantee stability.

How I came up with it? Well I connected wave read primitive to analyzer and noticed that the analyzer shows the inner assembly code of the primitive. I noticed which value is the pointer of the memory connected to it. Extracting it automatically was then relatively easy.


Can't open. Immediately crashes my FS on initalization phase (no matter whether I dbclick on schematic or drag'n'drop onto open FS).
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: working Assembler memin workareound!!!

Postby KG_is_back » Thu May 22, 2014 9:04 pm

tester wrote:Can't open. Immediately crashes my FS on initalization phase (no matter whether I dbclick on schematic or drag'n'drop onto open FS).


this one should open. You need to connect the assembler blocks to analyzers. The problem might be, that analyzers are initialized too early and zero address is passed to them. I will take a little tweaking green stuff to prevent that
Attachments
alternative memin.fsm
(1.13 KiB) Downloaded 1167 times
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: working Assembler memin workareound!!!

Postby tester » Thu May 22, 2014 11:06 pm

Hmm... Right at the moment when connecting to the analyzer - FS crashes. Maybe it has to do with system (XP here) or hardware architecture (C2D)?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Next

Return to User Examples

Who is online

Users browsing this forum: No registered users and 21 guests