Author Topic: I dont know how to make a new file  (Read 9389 times)

nobody

  • Guest
I dont know how to make a new file
« on: August 24, 2007, 12:35:08 AM »
Hi my problem is all im new in asm, and i dont know how to star the NASM.
I decompress the file, i ty to star the program from cmd but i new some parameters for start but all ill try is useless. I need more thing than the asm.exe and the ndiasm.exe like librery or other aplication i dont know nothing about all
Any help Would be nice
Thanks

nobody

  • Guest
Re: I dont know how to make a new file
« Reply #1 on: August 24, 2007, 04:50:39 AM »
> Hi my problem is all im new in asm,

That's a problem??? Learnin' stuff is fun! And you've got a *load* of fun ahead of you! :)

> and i dont know how to star the NASM.
> I decompress the file, i ty to star the program from cmd but i new some parameters
> for start but all ill try is useless.

Getting started is the hardest part. (next to getting good at it :)

> I need more thing than the asm.exe and
> the ndiasm.exe like librery or other aplication i dont know nothing about all

The only parameter Nasm *always* requires is a file to assemble. S'pose we've got one:

org 100h

mov ah, 9
mov dx, msg
int 21h

exit:
mov ah, 4Ch
int 21h

msg db "It worked!!!$"

S'pose we've got that saved as "myfile.asm". Doing just "nasm (or nasmw) myfile.asm" should result in a "flat binary" (Nasm's default output format) file named "myfile". Even under Windows (except 64-bit Vista, I guess) that little flat binary file will run as a dos .com file - but it needs to be *named* .com! (or ".exe" would work, actually). "ren myfile myfile.com" would do it, but if we'd typed "nasm myfile.asm -o myfile.com", Nasm would take care of that for us - lower case "-o" names the output file (upper case "-O" turns on optimization - don't worry about that one yet). Besides "-f bin" (Nasm's default), the other output formats usually default to a sensible name, so this may be the only time you'll need to use "-o".

Using dos .com files isn't a bad way to learn some fundamental assembly, IMHO, but you'll probably want to move on to "real Windows programs" soon. For that, you'll probably need a linker (and perhaps a "resource compiler", after a while). It is possible to write a "real Windows" (or Linux) file using Nasm's "-f bin" mode - no linker required! - but you probably want to learn to use a linker (more flexible). For this, you'll need to specify an output format - "-f obj" or "-f win32". Which one is correct depends on which linker you've got.

Have you got a linker you use with a C compiler? Nasm will probably output something compatible with that - "-f obj" for Borland, "-f win32" for almost anything else. Anthony Williams has written a linker to "go with" Nasm - http://alink.sf.net You'll probably also want a library, or at least an .inc file with the "system equates" for Windows. Easiest way is probably to download a "package", such as:

http://www.asmcommunity.net/projects/nasm32/

Or, older but with tons of examples, NaGoA (includes an IDE, if you want one):

http://www.visual-assembler.pt.vu/

How do you feel about Yahoo? (when I was a boy, calling someone a "yahoo" was not a compliment!) There are examples (and some files you might want) in the "files" section of the Yahoo group:

http://tech.groups.yahoo.com/group/win32-nasm-users/

Included are not one, but two translations of the Iczelion tutorials, which might not be a bad place to start.

Another tutorial for Nasm, but not specific to Windows:

http://www.drpaulcarter.com/pcasm/

This'll be easier if you've already got a C compiler installed - depends on C so it can be used on any OS.

That should keep you occupied for a while - and probably raise many questions. Bring 'em on!

Best,
Frank

nobody

  • Guest
Re: I dont know how to make a new file
« Reply #2 on: August 24, 2007, 01:44:36 PM »
Thanks a lot

nobody

  • Guest
Re: I dont know how to make a new file
« Reply #3 on: August 24, 2007, 08:49:50 PM »
Hi is Cesar who did the fisrt post. I want to know if there a set of all instruction that u can use whit NASM.
i see some like:
Mov
inc
dec
add
....
But i don't think that few are all
You ask Before if i use C, and the answer is no, is there a problem.
If i get the idea of NASM , what it can do is craete another app .exe, .com, .obj ect from an asm code? so for do the code i use what for now i did in nopad.
Thank you for all that you give me before really help