NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: Special Link 2 on August 22, 2015, 04:52:08 PM

Title: How do I make an EXE? (question 2)
Post by: Special Link 2 on August 22, 2015, 04:52:08 PM
I have a file called 'hello.txt' with Assembly code, but I do not even know how to begin to convert to exe,



Someone please can explain step by step how do I convert to exe? :(  Note: please a very detailed explanation because I am too inexperienced.


My operating system is Windows 7 in Portuguese
Title: Re: How do I make an EXE? (question 2)
Post by: Frank Kotler on August 22, 2015, 06:54:14 PM
Depends on the contents of your "hello.txt" file. Usually, you will use Nasm to assemble "hello.txt" to "hello.obj" and then use a linker to create "hello.exe" from "hello.obj".

Since Nasm will produce several types of linkable object file, we need to tell Nasm which kind we want. Probably:
Code: [Select]
nasm -f win32 hello.txt
or
Code: [Select]
nasm -f win64 hello.txt
or possibly...
Code: [Select]
nasm -f obj hello.txt
(in this case you may want to find a different source file - this is "obsolete", but should still work)

Then you'll need a linker. Jeremy Gordon's "golink" is probably your best bet unless you have another you prefer:
http://www.godevtool.com/

If that doesn't fall into place, you may need to show us "hello.txt".

What was question 1? :)

Best,
Frank

Title: Re: How do I make an EXE? (question 2)
Post by: Special Link 2 on August 22, 2015, 09:51:23 PM
so far did not understand was nothing.

1) only cmd.exe used only three times in my life, this is the fourth

2) I do not know if what I'm writing in cmd.exe is right or wrong, I do not know what the order of writing


3) this code that you insert when I said in cmd.exe?

 the file hello.txt is in E: \ or whatever address is E: \ hello.txt

the nasm.exe is in C: \ Users \ Speciallink \ nasm-2:11:08 ie the address is C: \ Users \ Speciallink \ nasm-2.11.08 \ nasm.exe


when I open cmd.exe is already written C: \ Users \ Speciallink \
and then I write what I want and looks like this:



C: \ Users \ Speciallink> nasm-2.11.08 \ nasm.exe nasm -f win32 hello.txt -IE: \ hello.txt

then the cmd.exe says:


nasm: error: more than one imput file specied

type 'nasm -h' for help

C: \ Users \ Speciallink>



hello.txt the content is this:



Title: Re: How do I make an EXE? (question 2)
Post by: Frank Kotler on August 22, 2015, 10:44:26 PM
Well... the last time I ran Windows, Win98 was current, so I'm not going to be able to help you much with OS questions! I can tell you for sure you'll need some different source code - what you've got is for Linux. The "int 80h" is the tipoff. Code for Windows would probably say "extern" - maybe "extern ExitProcess" would be good to look for?

The error "more than one input file specified" may be just because you said both "nasm.exe" and "nasm", but that's just a guess. You'll need different source code anyway... or install Linux. :)

Can some Windows user get Special Link 2 on the right track? It'll go along easier once you get started - honest!

Best,
Frank

Edit: This might be someplace to start. At least it's got some valid Windows code...
http://forum.nasm.us/index.php?topic=1918.0
Title: Re: How do I make an EXE? (question 2)
Post by: nalsakas on September 11, 2015, 09:58:24 PM
This guy wants to make an Windows executable but assembly file content shows "int 80h" linux kernel system calls. Confused  :-\ Seems like he is using wrong file for windows platform.