flat assembler
Message board for the users of flat assembler.

Index > Windows > Using assembler in source code

Author
Thread Post new topic Reply to topic
Imagist



Joined: 13 Jun 2004
Posts: 114
Location: Pennsylvania (USA)
Imagist 28 Aug 2004, 06:05
If I wanted to use the flat assembler within my code, how would I go about doing it. For example, if I wanted to write a simple program where a text box pops up, the user types in the name of the file to be assembled, and the program then calls flat assembler to assemble it (this is simplistic for example's sake). Fresh does this, I think, and I would like to know how.

_________________
Many things are possible. Few things are likely.
Post 28 Aug 2004, 06:05
View user's profile Send private message Visit poster's website Reply with quote
ShortCoder



Joined: 07 May 2004
Posts: 105
ShortCoder 28 Aug 2004, 06:45
In C, you can just do something like

Code:
system("program");
    

Where program is replaced by the name of the program and command line you wish to call. You WANT the quotes;)

For example, a common usage is

Code:
system("pause");
    

to use the shell pause command.

So, to use fasm to assemble example.asm, you'd do
Code:
system("fasm example.asm");
    


Is this what you wanted?

_________________
Boycott Symantec/Norton/PowerQuest whenever possible
Post 28 Aug 2004, 06:45
View user's profile Send private message Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy 28 Aug 2004, 06:53
I think he mean including the source code of fasm in his own program and then call the assembler...? Do you Imagist?
Post 28 Aug 2004, 06:53
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 28 Aug 2004, 09:45
is there some include binary code directive in C?
Post 28 Aug 2004, 09:45
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 28 Aug 2004, 11:05
Quote:
is there some include binary code directive in C?


No.
Post 28 Aug 2004, 11:05
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 28 Aug 2004, 13:05
Imagist wrote:
Fresh does this, I think, and I would like to know how.


Well, in Fresh, FASM is not external module, but built-in. You simply can download Fresh sources and see yourself. It is not too complex. In generally, you need to create one "interface" module to the core FASM modules. Read Privalov's documentation on FASM internals (it is included in Fresh sources also) - there are all requirements for the interface module functions. Fresh uses all core modules without any changes.
Of course you can use FASM as external program as well.

Regards
Post 28 Aug 2004, 13:05
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Imagist



Joined: 13 Jun 2004
Posts: 114
Location: Pennsylvania (USA)
Imagist 28 Aug 2004, 15:49
ShortCoder had what I wanted, but I wanted to be able to do it in FASM, not C. I may use the method JohnFound described.

Basically, I am building an HLL compiler which will compile the source code into a .asm file. There would be an option then to edit the .asm file, or to assemble it automatically.
Post 28 Aug 2004, 15:49
View user's profile Send private message Visit poster's website Reply with quote
Imagist



Joined: 13 Jun 2004
Posts: 114
Location: Pennsylvania (USA)
Imagist 29 Aug 2004, 20:15
This is really a Java question, but the problem might be with how I am calling FASM in the parentheses. Note that I am calling FASMW instead of FASM, since there is no file called FASM except a .ini in the source file.

Code:
public class PreCompiler{
      public static void compile(String filename){
           //String output=ReadWriteFile.readFile(filename);
           Process p=Runtime.getRuntime().exec("C:\Program-Files\fasmw152\FASMW.EXE");
                System.out.print(output);
   }
}    
Post 29 Aug 2004, 20:15
View user's profile Send private message Visit poster's website 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.