0

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!'
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by jt_murphree
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.