Author Topic: Compiling Nasm from sources  (Read 12858 times)

Klod

  • Guest
Compiling Nasm from sources
« on: August 09, 2010, 03:41:16 AM »
This post by Keith Kanios has prompted me for this post. It is in the "Announcements". I put it her for everyone to see. If it should be attached to the above thread, feel free to move it.
http://forum.nasm.us/index.php?topic=860.msg2912#msg2912

This is a preliminary announcement regarding the rewrite/revamp of the NASM preprocessor.


Quote
New NASM Directives:
%rmacro: Recursive Macro, can be called arbitrarily deep (really high limit [2^20] set to catch infinite loops.)
%irmacro: Same as above, except case-insensitive like %imacro.
%exitmacro: Terminates the current macro invocation, much like %exitrep; can be nested in other preprocessor directives (e.g. %if/%endif) within the macro, with exception of another macro, of course.

%while/%endwhile/%exitwhile: A fusion between %rep and %if.
%comment/%endcomment: Comment block for long/multi-line comments. A little syntactic sugar, if you will.
%final: Causes rest of line after %final to be preprocessed after all other "normal" preprocessing is complete. Multiple %final directives work like the x86 stack, LIFO/FILO.

While reading the above post, it became apparent to me that I will need to build nasm to be able to experiment  with the latest implementations and possibly take part of the discussions regarding changes/enhancements etc. Up to now I have been a "user" of Nasm without any regards to where the developing team would take it. After all i could always go back to Masm >:(

I have never tried to compile Nasm from sources and after downloading Keith's files, come to realize that I need help doing this.
If someone could give me pointers or possibly a batch file to compile Nasm from sources, I would be much obliged. Currently I use Win 32 on XP pro.

Regards
Klod

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: Compiling Nasm from sources
« Reply #1 on: August 09, 2010, 04:08:31 AM »
The best thing to do when attempting to build Nasm from source is to have Visual Studio installed (I personally use VS2005 Standard), open a VS configured command prompt from your Visual Studio Tools menu, navigate to the nasm source root folder, then
Code: [Select]
nmake /f Mkfiles/msvc.mak

Read the INSTALL document for additional info. The Nasm guys have made it very easy for building from source.
It's pretty cool to be able to build and run a 64 bit version :)

I also make use of VS setenv.cmd to switch back and forth between debug and retail. If you get stuck just let me know...

Offline Keith Kanios

  • Full Member
  • **
  • Posts: 383
  • Country: us
    • Personal Homepage
Re: Compiling Nasm from sources
« Reply #2 on: August 09, 2010, 06:27:19 AM »
Currently I use Win 32 on XP pro.

I've provided links to the latest Win32 binaries (exe files) within the aforementioned post. I will continue to update them as things change.

As a matter of fact, I've just updated the binaries a few minutes ago with the latest changes, and it looks like we are getting really close to a solid/stable revamped preprocessor :)

Klod

  • Guest
Re: Compiling Nasm from sources
« Reply #3 on: August 12, 2010, 03:34:42 AM »
Hi Rob
I had been away for a few days but had read your post. I do not have Visual Studio. For whatever little c stuff I do, I have MinGW on my system. I think i had read somewhere that gcc is being used to assemble nasm or is this just on unix platform?
Klod

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: Compiling Nasm from sources
« Reply #4 on: August 12, 2010, 05:57:22 AM »
Hi Rob
I had been away for a few days but had read your post. I do not have Visual Studio. For whatever little c stuff I do, I have MinGW on my system. I think i had read somewhere that gcc is being used to assemble nasm or is this just on unix platform?
Klod

Hi Klod,

MinGW can indeed be used to build executables on Windows. I've used MSYS to create my *nix like environment and subsequently build applications targeting win32 using the mingw-gcc tools.  I must admit that I've not built win64 exes or used gdb with MinGW for debugging though as most of my work involves straight win32/64 coding using VS and the WinDbg/CDB debuggers (two very powerful tools that any serious coder simply must be familiar with).

I would recommend that you download the http://www.microsoft.com/whdc/devtools/debugging/installx86.mspxDebugging Tools for Windows if you plan on developing assembly applications targeting win32, or see http://www.microsoft.com/whdc/devtools/debugging/install64bit.mspx for win64.