Thread: Nasm

  1. #1
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489

    Question Nasm

    Anyone using NASM?
    How is it? How about GAS, MASM, TASM?
    Just GET it OFF out my mind!!

  2. #2
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    I kind of like nasm. But I did have some problems writing windows applications with it. With masm this is really easy, but I hate the forced stupid bloated microsoft syntax that comes with it. The others I don't know.

    My advise is to try nasm first. Nice, plain syntax that assembly should be. Unless of course you like the ms syntax...

  3. #3
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489
    Quote Originally Posted by EVOEx View Post
    I kind of like nasm. But I did have some problems writing windows applications with it. With masm this is really easy, but I hate the forced stupid bloated microsoft syntax that comes with it. The others I don't know.

    My advise is to try nasm first. Nice, plain syntax that assembly should be. Unless of course you like the ms syntax...
    Any tutorial/something that may help a newbie?

    I've downloaded nasm-2.06rc1 from sf.net and trying to compile this one but it says:
    test.asm:4: error: parser: instruction expected

    Code:
    section .text 
    extern  _MessageBoxA@16 
    %if     __NASM_VERSION_ID__ >= 0x02030000 
    safeseh handler         ; register handler as "safe handler" 
    %endif 
    handler: 
            push    DWORD 1 ; MB_OKCANCEL 
            push    DWORD caption 
            push    DWORD text 
            push    DWORD 0 
            call    _MessageBoxA@16 
            sub     eax,1   ; incidentally suits as return value 
                            ; for exception handler 
            ret 
    global  _main 
    _main: 
            push    DWORD handler 
            push    DWORD [fs:0] 
            mov     DWORD [fs:0],esp ; engage exception handler 
            xor     eax,eax 
            mov     eax,DWORD[eax]   ; cause exception 
            pop     DWORD [fs:0]     ; disengage exception handler 
            add     esp,4 
            ret 
    text:   db      'OK to rethrow, CANCEL to generate core dump',0 
    caption:db      'SEGV',0 
     
    section .drectve info 
            db      '/defaultlib:user32.lib /defaultlib:msvcrt.lib '
    Got it from manual page.
    Just GET it OFF out my mind!!

  4. #4
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by audinue View Post
    Anyone using NASM?
    How is it? How about GAS, MASM, TASM?
    I'd stay away from gas unless you actually need it. It was meant more as a back-end assembler for the GNU compiler suite, not an every day assembler, so it lacks some of the conveniences of other assemblers. But sometimes you can only accomplish certain things with gas.

    When you don't need the special features of gas, I'd use NASM.

    Both gas and NASM can produce native object code, so there's no problem using both of them in the same project if you want.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 04-26-2009, 05:59 AM
  2. What's wrong with my Allegro?
    By kooma in forum Game Programming
    Replies: 4
    Last Post: 12-28-2007, 02:42 AM
  3. More with NASM
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 11-13-2003, 05:28 PM
  4. Asm + C++
    By JaWiB in forum C++ Programming
    Replies: 17
    Last Post: 06-26-2003, 03:13 PM
  5. Getting a return value from a DLL in (N)ASM
    By dirkduck in forum C++ Programming
    Replies: 2
    Last Post: 08-02-2002, 02:13 AM