Jump to content

Extended Flat Assembler - Memory Management, Creating Standalone Machine Code Functions - Updated x64 support


Recommended Posts

  • 2 weeks later...


  • Added support for assignment operator (=) usage in _FasmAdd() . Ex: _FasmAdd('eax = 100')
  • Added Ternary operator support as well.. Ex: _FasmAdd('$var1 <> eax ? $var2 = 37 : add $var2, 50')
  • Added few more examples. Base64 encode/decode
  • Reworte StrInStr function. (Should have been called CharInStr. Not sure what I was thinking..)
  • Reworte _Listview_AddArray example. Previous would not work correctly if passed 1d array. 

X64 Support:

I remember quite a while back reading the FASM forum thread where the fasm.dll is posted and there is some talk about x64 support and pretty much goes on to say that it is indeed not supported and would take a lot of rewrite to get it there.  As of now nothing has changed about that, BUT it is a little misleading..expecially for the way we are using it. The other day while  reviewing the fasm.dll source, I noticed that it included "x86_64.inc" file and it dawned on me. Just because the dll cant run in 64bit mode doesn't mean it cant generate 64bit code. Thats two totally different things. So I did some quick tests were I generate the 64bit opcode while running in a 32bit process, then take the opcode and place it in a 64bit process. All worked good :sorcerer:  

So right now for a quick work around to get 64bit support, I made a few modifications to wards library that when running in 64bit mode, at compile time I simply place the source on the clipboard, launch a separate script in 32bit mode, generate the code and then pass it back. So far its been working pretty well. 

I don't have full support to all my original functions yet but definitely plan to. I have written a few examples to show the functionality and whats currently supported. Pretty much anything you don't see me using has not been included. The examples are testing strings, getting the address of "GetProcAddress", and Base64 Decode.If you decide to play around with it, remember the calling convention is much different than x86 in how the parameters get passed. I'm still learning myself so I'm not going to sit hear and try to educate anyone, just wanted to point that out. 

Note that due to the modifications of wards libaray, I have now included it in the package. 

Edited by Beege
Link to comment
Share on other sites

I would be cool to have some lessions how to use Asm e.g. for doing some calculations, array r/w, struct r/w, etc., something like "Asm for dummies".

Thanks for efforts on this project.


Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Hey UEZ, Thanks for the comments. For structures and arrays Ive really tried to take all the confusion away by making the _FASMDllStuct*** functions. The operate the same way autoit functions do but handle all the calculations for you. A small tutorial on how its being done could be arranged though ;)

Link to comment
Share on other sites

  • 2 years later...

I've been playing with this. It's not working in 3.3.14 or 3.3.12, but it's working in To make it work in 3.3.14 insert _ArrayAdd from in bottom of FASMEx.au3:

Func _ArrayAdd_33102(ByRef $avArray, $vValue)
  If Not IsArray($avArray) Then Return SetError(1, 0, -1)
  If UBound($avArray, 0) <> 1 Then Return SetError(2, 0, -1)

  Local $iUBound = UBound($avArray)
  ReDim $avArray[$iUBound + 1]
  $avArray[$iUBound] = $vValue
  Return $iUBound
EndFunc   ;==>_ArrayAdd_33102

and replace all occurrences of _ArrayAdd with _ArrayAdd_33102.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...