working Assembler memin workareound!!!

Post any examples or modules that you want to share here
User avatar
nix
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: working Assembler memin workareound!!!

Post by nix »

Yo KG,
I'm not sure how to implement the ASM.
If you can be bothered(ie. want this too)-
could you wire it?
I'll look at the window again,
but I think I can't suss how to implement.
Cheers man,
-so you are saying it can be rendered in a single sample's time?
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: working Assembler memin workareound!!!

Post by KG_is_back »

tester wrote: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)?


Check if the first Analyzer generates the same code as mine:

Code: Select all

***** Init ***** 
push ebp;
mov ebp,edi;
pop ebp
ret;
***** Sample Rate *****
push ebp;
mov ebp,edi;
push eax;
push ebx;
mov eax,56920200; //This is the address of the pointer that is being extracted. Starts at position 140 in this string
mov eax,[eax];
cmp eax,0;
jz 213
mov eax,56909904;
movaps xmm0,dword ptr[ebp+0]
minps xmm0,dword ptr[eax]
maxps xmm0,dword ptr [ebp+4256]
movaps dword ptr[ebp+4240],xmm0
fld dword ptr[ebp+4240]
fistp dword ptr[ebp+4224]
fld dword ptr[ebp+4244]
fistp dword ptr[ebp+4228]
fld dword ptr[ebp+4248]
fistp dword ptr[ebp+4232]
fld dword ptr[ebp+4252]
fistp dword ptr[ebp+4236]
mov eax,dword ptr[ebp+4224]
shl eax,2;
mov ebx,eax;
mov eax,56920200;
mov eax,[eax];
add eax,ebx;
fld dword ptr[eax]
fst dword ptr[ebp+4192]
fstp dword ptr[ebp+4208]
mov eax,dword ptr[ebp+4228]
shl eax,2;
mov ebx,eax;
mov eax,56920200;
mov eax,[eax];
add eax,ebx;
fld dword ptr[eax]
fst dword ptr[ebp+4196]
fstp dword ptr[ebp+4212]
mov eax,dword ptr[ebp+4232]
shl eax,2;
mov ebx,eax;
mov eax,56920200;
mov eax,[eax];
add eax,ebx;
fld dword ptr[eax]
fst dword ptr[ebp+4200]
fstp dword ptr[ebp+4216]
mov eax,dword ptr[ebp+4236]
shl eax,2;
mov ebx,eax;
mov eax,56920200;
mov eax,[eax];
add eax,ebx;
fld dword ptr[eax]
fst dword ptr[ebp+4204]
fstp dword ptr[ebp+4220]
pop ebx
pop eax
pop ebp
ret;


Note, that the numbers may have different values and change every time you change the schematic.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: working Assembler memin workareound!!!

Post by tester »

After start, in "mem to pointer" module (directly from analyzer):

Code: Select all

***** Init ***** 
push ebp;
mov ebp,edi;
pop ebp
ret;
***** Sample Rate *****
push ebp;
mov ebp,edi;
push eax;
push ebx;
mov eax,24821440;
mov eax,[eax];
cmp eax,0;
jz 213
mov eax,25623248;
movaps xmm0,dword ptr[ebp+0]
minps xmm0,dword ptr[eax]
maxps xmm0,dword ptr [ebp+4256]
movaps dword ptr[ebp+4240],xmm0
fld dword ptr[ebp+4240]
fistp dword ptr[ebp+4224]
fld dword ptr[ebp+4244]
fistp dword ptr[ebp+4228]
fld dword ptr[ebp+4248]
fistp dword ptr[ebp+4232]
fld dword ptr[ebp+4252]
fistp dword ptr[ebp+4236]
mov eax,dword ptr[ebp+4224]
shl eax,2;
mov ebx,eax;
mov eax,24821440;
mov eax,[eax];
add eax,ebx;
fld dword ptr[eax]
fst dword ptr[ebp+4192]
fstp dword ptr[ebp+4208]
mov eax,dword ptr[ebp+4228]
shl eax,2;
mov ebx,eax;
mov eax,24821440;
mov eax,[eax];
add eax,ebx;
fld dword ptr[eax]
fst dword ptr[ebp+4196]
fstp dword ptr[ebp+4212]
mov eax,dword ptr[ebp+4232]
shl eax,2;
mov ebx,eax;
mov eax,24821440;
mov eax,[eax];
add eax,ebx;
fld dword ptr[eax]
fst dword ptr[ebp+4200]
fstp dword ptr[ebp+4216]
mov eax,dword ptr[ebp+4236]
shl eax,2;
mov ebx,eax;
mov eax,24821440;
mov eax,[eax];
add eax,ebx;
fld dword ptr[eax]
fst dword ptr[ebp+4204]
fstp dword ptr[ebp+4220]
pop ebx
pop eax
pop ebp
ret;


extracted part:

Code: Select all

24821440;
mov e


It does not matter which asm to analyzer I try to connect - the one in module or that external one. FS crashes. On 2 machines.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: working Assembler memin workareound!!!

Post by KG_is_back »

The extracted string is then converted to integer. In my case that means everything after (including) semicolon is discarded and only the integer is passed forward.

The integer is then spitted into two integers (lower 16 bits and higher 16 bits) which can losslessly be converted to floats. These floats are passed to the ASM code and reconstructed into single integer.

try putting this code in the ASM inside the module:

Code: Select all

cvtps2dq xmm0,highbit;
cvtps2dq xmm1,lowbit;
pslld xmm0,16;
orps xmm0,xmm1;
movd eax,xmm0;
//mov eax,[eax];
//mov address[0],eax;


it has the read from memory bypassed (so the output will be zero). If the FS will not crash with this code, then the problem is that FS doesn't allow you to read data from that position.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: working Assembler memin workareound!!!

Post by tester »

If I put the code above into ASM that is placed in "mem to pointer" module, then I can connect the analyzer inside there without issues. (however that last one, external - still crashes FS).
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: working Assembler memin workareound!!!

Post by KG_is_back »

tester wrote:If I put the code above into ASM that is placed in "mem to pointer" module, then I can connect the analyzer inside there without issues. (however that last one, external - still crashes FS).


The one outside will not work obviously because the passed address is zero, without the inner one working.

try this one:

Code: Select all

streamout address;
mov eax,[[copy the address here]];
mov eax,[eax];
mov address[0],eax;


copy the extracted integer directly there... It should work. If it works, then the problem is that the address is passed incorrectly. If that crashes too, then I do not know how to fix it, because the whole concept is nonworking.
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: working Assembler memin workareound!!!

Post by KG_is_back »

Try this one... has different method of sending the pointer address. In converts the integer to hex and hex to float (in ruby) and sends that to the inner ASM. Has no parallel trigger lines, so trigger order should be no problem.
Attachments
alternative memin3.fsm
(1.59 KiB) Downloaded 1143 times
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: working Assembler memin workareound!!!

Post by tester »

This one seems to work fine.

Is there anything I should do except connecting the external analyzer?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: working Assembler memin workareound!!!

Post by KG_is_back »

one very important thing I've noticed today. Mem connector transmits triggers when it changes - force-connect it to the first analyzer (the one that has the wave read connected to it). This will update the pointer every time it changes, so no crashes should happen when loading wave files / creating memory buffers and stuff...

Also a very cool thing to do when using the array is to have smart bypass when the pointer is not loaded yet. It should prevent most of the crashes. It will however not prevent crashes from real pointer changing and not updating the hacked one (the float output of the module).

Code: Select all

streamin pointer;
//...

mov eax,pointer[0];
cmp eax,0;
jz NotReady;

//code that uses the pointer to read/write data i.e. via Fld [eax]; or mov eax,[eax];

NotReady:


Also I recently noticed that when I copied the module the analyzer generated some weird code with extra lines (probably a bug) so the pointer was not extracted.

On another note... I was still not able to come up with how to hack wave array in this way. Mainly because I totally don't understand how it works. If someone could hack this we could have very cool new custom modules... for example wavetable array oscillator.
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: working Assembler memin workareound!!!

Post by RJHollins »

Question? With this concept, are we looking at maybe the possibility of 2 separate apps [say a VST], being able to communicate/share memory locations with the concept that is being explored here ?

I ask this as a mere mortal :lol:

I know this 'concept' as been discussed in the past ... even having a 'server/client' routine that was posted. I was just wondering if this 'memin workaround' has that type of possibility. That would be a very useful ability.

trying to learn from youse guys ! ;)
Post Reply