obtain pointer to variable in assembler

DSP related issues, mathematics, processing and techniques
Post Reply
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

obtain pointer to variable in assembler

Post by KG_is_back »

I have found a way to obtain pointer to a variable in assembler code. Under normal circumstances, access to a local variable is restricted to the same ASM/code component and you can't pass it around. I have discovered a workaround that extracts the memory address (or a pointer) to any variable or array you choose.

This may come handy, expecially when you need to pass arrays between ASM components. It may also allow you to pass pointers to an array to a function from the ASM component - coupled with the machine code injection discovered by MyCo this could allow some pretty useful things. For example, one may execute FFT on various arrays, simply by having the FFT machine code in a string in ruby and calling it from ASM component.
Attachments
pointerToVariable.fsm
(1.2 KiB) Downloaded 1379 times
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: obtain pointer to variable in assembler

Post by martinvicanek »

Hey that's interesting. I wonder: is there an advantage over the MemAddress prim? If your new method proves more stable, then I can see some applications like a fast wave reader, fast lookup tables etc. Wonder if this would also work in poly?
adamszabo
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: obtain pointer to variable in assembler

Post by adamszabo »

In the new version this will be very easy to do and it works in poly so you can make fast wave readers. ;)
Attachments
mem.jpg
mem.jpg (62.35 KiB) Viewed 18435 times
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: obtain pointer to variable in assembler

Post by KG_is_back »

x64 assembler!!!!! :drolling:
francoisreme
Posts: 29
Joined: Wed Feb 15, 2017 4:01 pm

Re: obtain pointer to variable in assembler

Post by francoisreme »

I'll buy it ten times.
Post Reply