I have problem with compiling my programs in Linux(Slackware) with NASM
nasm -o hello hello.S
i dont know does i doing something wrong or does context of writing a assembly code are different for different processors and processors words???
here are my code : the result of code are Segmetation fault

section .text
global main
main:
xor        eax,eax
xor        ebx,ebx
xor        ecx,ecx
xor        edx,edx
jmp short string
code:
pop        ecx
mov        bl,1
mov        dl,13
mov        al,4
int        0x80
dec        bl
mov        al,1
int        0x80
string:
call      code
db         'Hello, world!'

Well first of all the declaration of the string should not be in the .text section and there should be a name associated with it. The second problem is that you are doing a call to code when you should just do a jump. However, even if you fix all that this code would perform an infinite loop. When you get to the end of the code lable you call code again and there is no decision structure to end the program.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.