C Board  

Go Back   C Board > Community Boards > Tech Board

Reply
 
LinkBack Thread Tools Display Modes
Old 01-13-2009, 12:58 PM   #1
Ugly C Lover
 
audinue's Avatar
 
Join Date: Jun 2008
Location: Indonesia
Posts: 479
Question Nasm

Anyone using NASM?
How is it? How about GAS, MASM, TASM?
__________________
Just GET it OFF out my mind!!
audinue is offline   Reply With Quote
Old 01-13-2009, 01:02 PM   #2
Registered User
 
Join Date: Oct 2008
Posts: 563
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...
EVOEx is offline   Reply With Quote
Old 01-13-2009, 01:09 PM   #3
Ugly C Lover
 
audinue's Avatar
 
Join Date: Jun 2008
Location: Indonesia
Posts: 479
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!!
audinue is offline   Reply With Quote
Old 01-13-2009, 02:07 PM   #4
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,768
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.
__________________
"Congratulations on your purchase. To begin using your quantum computer, set the power switch to both off and on simultaneously." -- raftpeople@slashdot
brewbuck is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
NASM 'import' directive failing with "Expected an instruction" error? hauzer Windows Programming 3 04-26-2009 05:59 AM
What's wrong with my Allegro? kooma Game Programming 4 12-28-2007 02:42 AM
More with NASM Lurker A Brief History of Cprogramming.com 3 11-13-2003 05:28 PM
Asm + C++ JaWiB C++ Programming 17 06-26-2003 03:13 PM
Getting a return value from a DLL in (N)ASM dirkduck C++ Programming 2 08-02-2002 02:13 AM


All times are GMT -6. The time now is 01:31 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22