Not only are the architectures different, but there are various assemblers using somewhat different syntaxes. Also note that there are various compilers using various libraries on different operating systems which may have slightly different names (e.g. on Linux, the function printf is just printf. on Windows however, it is _printf).
For example, here is a program using the GNU assembler (gas) for the Intel 386 (i386) processor or higher (Linux only since exiting a program in Windows is different):
Code:
.section .data
hello:
.string "Hello world!\n"
.equ hello_len, . - hello
.text
.globl _start
_start:
movl $4, %eax # 4 is the write() system call
movl $1, %ebx # stdout is the file descriptor
leal hello, %ecx # the address represented by "hello" is loaded into ecx
movl $hello_len, %edx # length of the data to write
int $0x80 # the interrupt to use in Linux to execute the write() system call
xorl %eax, %eax # eax = 0
incl %eax # eax = eax+1 = 1 (1 is the exit() call)
xorl %ebx, %ebx # ebx = 0 (the return code of the program)
int $0x80 # again, call interrupt 80h (0x80) to execute the exit() system call It's been a while since I've written any Linux ASM, but that program should not need much changing to make it work, if any at all.