flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > fasm.dll with Delphi 2010

Author
Thread Post new topic Reply to topic
plusplus



Joined: 17 Nov 2010
Posts: 5
plusplus
Does anyone have an idea how to use fasm.dll with Delphi 2010, or even sample code.

I tried but did not get far. Crying or Very sad
Post 17 Nov 2010, 00:46
View user's profile Send private message Reply with quote
plusplus



Joined: 17 Nov 2010
Posts: 5
plusplus
no one has an idea ha, well I am trying to actually use fasm.dll as a small ASM interpreter where I pass 4 variables, do stuff in asm and then return the variables again. any idea if that would be possible, or shall I start looking for something else.
Post 17 Nov 2010, 12:08
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
Probably you have to declare functions as external in Delphi. Actually I simply can't remember what was the proper format....
Post 17 Nov 2010, 15:09
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
plusplus



Joined: 17 Nov 2010
Posts: 5
plusplus
JohnFound wrote:
Probably you have to declare functions as external in Delphi. Actually I simply can't remember what was the proper format....


I know how to load the dll, I know how to find the functions. what I dont know is how to declare the structs of asm in delphi.
Post 17 Nov 2010, 17:53
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
For what structs you are talking about? Generally in Delphi, data structures are declared with "type" and "var".
Also there are dynamic data allocation procedures (New, GetMem or both. Wink ) and also you could use API calls to allocate some memory.

Isn't it better to describe what exactly you done and what exactly the problem is. Posting of your code would be very helpful.
Now it looks like: "Help I am drowning!" Very Happy
Post 18 Nov 2010, 09:54
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
plusplus



Joined: 17 Nov 2010
Posts: 5
plusplus
1. I am loading the dll with API Call LoadLibrary - no problem
2. I have declared a proc var which corresponds to fasm_Assemble

This is where I am stuck.

The lpMemory should be a pointer to the memory block and cbMemorySize
should contain its size. In the beginning of this memory block the
FASM_STATE structure will reside (as defined in FASM.ASH). The assembler
doesn't allocate any memory beside this block, if it is not enough for
its purposes, the function returns with FASM_OUT_OF_MEMORY state.

1. how do I type FASM_STATE structure and put it into the beginning of the memory?
2. How do I read it after the execution
3. How do I pass vars
Post 18 Nov 2010, 20:53
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
Well, FASM_STATE is very simply. I believe you have to define it with:
type TFasmState record condition: cardinal; and so on.... as in Delphi (Pascal) manual.
Then you have to allocate some memory (read the Delphi/VCL manual for functions); then to assign the pointer to the pointer of type (I believe) var MyFasmState: ^TFasmState; and to use MyFasmState^ variable.
Really, I have an impression you don't speak Delphi very well. Why not to make the task fully in assembly? Wink
Post 18 Nov 2010, 21:48
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
plusplus



Joined: 17 Nov 2010
Posts: 5
plusplus
JohnFound wrote:
Well, FASM_STATE is very simply. I believe you have to define it with:
type TFasmState record condition: cardinal; and so on.... as in Delphi (Pascal) manual.
Then you have to allocate some memory (read the Delphi/VCL manual for functions); then to assign the pointer to the pointer of type (I believe) var MyFasmState: ^TFasmState; and to use MyFasmState^ variable.
Really, I have an impression you don't speak Delphi very well. Why not to make the task fully in assembly? Wink


Mhm, I will dig some more into delphi manuals, I am trying to create a fasm scripting tool for inline assembly coding.
Post 22 Nov 2010, 22:44
View user's profile Send private message Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
Perhaps its a bit too late, but this site has greate staff about using the winApi in delphi.

http://www.angelfire.com/hi5/delphizeus/

here you can finde the data types equivalents:
http://www.angelfire.com/hi5/delphizeus/lifts.html
Post 04 Dec 2010, 15:51
View user's profile Send private message Reply with quote
cg5210



Joined: 09 Dec 2010
Posts: 1
cg5210
the demo not hDisplayPipe
fasm_Assemble(lpSource,lpMemory,cbMemorySize,nPassesLimit,hDisplayPipe)

how to use hDisplayPipe
Post 09 Dec 2010, 08:23
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.