flat assembler
Message board for the users of flat assembler.

Index > Main > FASM - Command line

Author
Thread Post new topic Reply to topic
HD Blood



Joined: 23 Apr 2012
Posts: 3
HD Blood
Hi everyone,

It was a bit difficult to choose the right board, but I think my question can go under Main? Correct me if I'm wrong. ^^

I want to know how I use the FASM.exe.. the command line one? Which arguments do you have to pas, in order to compile a .exe? The documentation says you have to pass the pathname of your .asm file and a pathname with the name of your exe. Do I have to send additional "-" and "-o" or something similar?

Must say: I'm trying to do this, without the command line? I have another program, where you can drag your files into the window. Then my program tries to pass the right arguments to the FASM.exe.

My argument now looks like this: "C:\FASM\PROJECTS\Repeat.asm C:\FASM\Compiled.exe"
I've also try'd this: "-C:\FASM\PROJECTS\Repeat.asm -C:\FASM\Compiled.exe"
But with no succes?

Greets Dyon
Post 24 Apr 2012, 06:29
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
You should read the section 1.1.2 of the FASM manual.

Note, you can't affect the output of FASM from the command line. From the same source file, FASM will always generate the same output.
Post 24 Apr 2012, 07:02
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
HD Blood



Joined: 23 Apr 2012
Posts: 3
HD Blood
JohnFound wrote:
You should read the section 1.1.2 of the FASM manual.
Note, you can't affect the output of FASM from the command line. From the same source file, FASM will always generate the same output.


I have read the manual, but I don't get what I'm doing wrong?

Manual wrote:
If no second parameter is given, the name for output file will be guessed automatically.

So far, I have tried:
- Drag and drop the source to the compiler
- Pass 1 argument to the compiler: "sourcepath\source.asm"
- Pass 1 argument to the compiler, which contains both source and destination path: "sourcepath\source.asm destinationpath\compiled.exe"
- Pass 2 arguments to the compiler with an shortcut (Don't know if I'm doing it right?): "pathtocompiler\FASM.exe -sourcepath\source.asm -destinationpath\compiled.exe"

My source file looks like:
Code:
include 'win32ax.inc'

.code

  start:
       invoke  MessageBox,HWND_DESKTOP,"Start",invoke GetCommandLine,MB_OK

    repeat 10000000
         add ecx,1
       end repeat

       invoke  MessageBox,HWND_DESKTOP,"Stop",invoke GetCommandLine,MB_OK
       invoke  ExitProcess,0

.end start    


JohnFound wrote:
Note, you can't affect the output of FASM from the command line. From the same source file, FASM will always generate the same output.

What do you mean? So I can't determine where my exe will be placed? Then why do you have to pass the second argument? Can you explain a little more? I don't exactly get it?

Dyon.
Post 24 Apr 2012, 08:25
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17474
Location: In your JS exploiting you and your system
revolution
At the command prompt type:
Code:
c:\>fasm MyUberSource.asm MyUberProgram.exe    
Post 24 Apr 2012, 08:34
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
Your example compiles OK for me.
You probably didn't set the path to the include files properly. Use "INCLUDE" environment variable, or simply explicitly set the full path in the include clause in your source file.

About the second note: You can, of course, set the target name in the command line. But you can't change the type or content of the binary file from the command line. For example - the source from your example will always compile to 32bit windows PE file. You can change the file name, but the content of the file will always be the same.
Post 24 Apr 2012, 08:42
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
HD Blood



Joined: 23 Apr 2012
Posts: 3
HD Blood
JohnFound wrote:
environment variable, or simply explicitly set the full path in the include clause in your source file.

Aah, you are right. He didn't find the include file. Now it works fine!
Thank you ^^

JohnFound wrote:

About the second note: You can, of course, set the target name in the command line. But you can't change the type or content of the binary file from the command line. For example - the source from your example will always compile to 32bit windows PE file. You can change the file name, but the content of the file will always be the same.

Oh ok. I didn't know that. Thanks. Wink

Dyon.
Post 24 Apr 2012, 08:58
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 YouTube, Twitter.

Website powered by rwasa.