NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: nobody on August 14, 2007, 09:00:48 PM
-
Hi all,
Just a question. In Linux, the platform dependant code (files .S) are written in assembler, as you know. The sintax used in these files is similiar to the one used in NAMS ? I read that Linux use the AT & T sintax, the UNIX standard.
Is is correct ?
Thanks a lot
Dario
-
> The sintax used in these files is
"sintax" -> "syntax"
> similiar to the one used in NAMS
"NAMS" -> "NASM"
> read that Linux use the AT & T sintax, the UNIX standard.
Seems to :-( And NO, NASM doesn't use the "AT&T" syntax ...
-
Nasm's syntax and AT&T syntax differ quite a bit. Nasm syntax:
global _start
section .text
_start
mov eax,4
mov ebx,1
mov ecx, msg
mov edx,msg_len
int 80h
mov eax,1
int 80h
section .data
msg db 'Hello, world',0Ah
msg_len equ $-msg
(G)as syntax (AT&T):
.global _start
.text
_start:
movl $4, %eax
movl $1, %ebx
movl $msg, %ecx
movl $msg_len, %edx
int $0x80
movl %eax, %ebx
movl $1, %eax
int $0x80
.data
msg: .ascii "Hello World!\n"
msg_len = . - msg
As you can see, they look quite different, but recognizably do the same thing.
Best,
Frank
-
Thanks a lot Frank for your example and sorry for my mistakes during writing. I wanted to put the message two seconds before leaving home.
Bye
Dario