why segment fault?
the code i wrote is to find the biggest number in num,but it shows segment fault when i run it.
nasm -f elf and.asm -o and.o
gcc -o and.o
./and
segment fault
////////////////////////////////////
section .data
num db -19,28,37,-46,55,61,-74,88
count equ $-num
max db 'max=?',0dh,0ah,'$'
section .text
global main
main:
mov al,0
mov ebx,num
mov ecx,[count]
last:
cmp [ebx],al
jc next
mov al,[ebx]
next:
inc ebx
loop last
mov [max+4],al
mov eax,4
mov ebx,1
mov ecx,max
mov edx,8
int 80h
mov eax,1
int 80h
|