Geeks With Blogs
Mark Pearl


Today I am bashing around with nasm again… some useful things I found…

Set the current working directory of gvim to the current file path

I have found setting the current working directory of gvim to the file location is very useful, especially if you are wanting to use commands in gvim to run your compiled code. It can be done by typing in the following in the command mode in gvim…

cd %:p:h

Once you have set it, you can use the ! to run commands you would normally run in the dos shell.. e.g.


Compiling code to make an executable

There are three thing you need to specify to compile a basic file in name, they are…

  1. The output file format
  2. The output file name
  3. The source file name

An example of this would be the following (where you have a file called temp.asm which is the source file)

nasm –f bin temp.asm –o

Output file format

The –f specifies the output file format (in this case a binary file). To get a list of the available output file formats you can type nasm –hf (for my installation bin is the default, in which case I can omit it)

Output file name

This is just the name you want the compiled file to be called. For windows machines I specify .com as my default format.

Posted on Monday, April 9, 2012 1:40 PM NASM | Back to top

Comments on this post: More NASM with GVim

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © MarkPearl | Powered by: