More NASM with GVim
Posted
by MarkPearl
on Geeks with Blogs
See other posts from Geeks with Blogs
or by MarkPearl
Published on Mon, 09 Apr 2012 10:40:45 GMT
Indexed on
2012/04/09
17:31 UTC
Read the original article
Hit count: 231
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.
!dir
Compiling code to make an executable
There are three thing you need to specify to compile a basic file in name, they are…
- The output file format
- The output file name
- 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 temp.com
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.
© Geeks with Blogs or respective owner