Page 1 of 1

obtain pointer to variable in assembler

PostPosted: Sun Mar 04, 2018 1:07 am
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.

Re: obtain pointer to variable in assembler

PostPosted: Sun Mar 04, 2018 11:49 am
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?

Re: obtain pointer to variable in assembler

PostPosted: Sun Mar 04, 2018 12:49 pm
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. ;)

Re: obtain pointer to variable in assembler

PostPosted: Sun Mar 04, 2018 1:24 pm
by KG_is_back
x64 assembler!!!!! :drolling:

Re: obtain pointer to variable in assembler

PostPosted: Mon Mar 05, 2018 9:52 pm
by francoisreme
I'll buy it ten times.