Witam,
może ktoś zerknąć co jest nie tak w tym kodzie. Cały czas dostaje błąd wykonania (SIGSEGV)
section .data
section .bss
buf: resb 4
section .text
global _start
_start:
call scanf
call zamiana
push eax
call scanf
call zamiana
push eax
pop eax
pop ebx
add eax,ebx
call string
call print
call exit
exit:
mov eax, 01h
xor ebx, ebx
int 80h
ret
scanf:
mov eax,03h
mov ebx,00h
mov ecx,buf
mov edx,4
int 80h
ret
print:
mov eax,04h
mov ebx,01h
mov ecx,buf
mov edx,4
int 80h
ret
zamiana:
mov esi,buf
xor ecx,ecx
mov ecx,eax
dec ecx
xor eax,eax
xor ebx,ebx
mov edi,10
L1:
mul edi
mov bl,byte [esi]
inc esi
and bl,0Fh
add eax,ebx
loop L1
ret
string:
mov edi,10
xor ecx,ecx
J1:
xor edx,edx
div edi
push edx
inc ecx
or eax,eax
jnz J1
cld
mov edi,buf
L2:
pop eax
add al,'0'
stosb
loop L2
add al,0Ah
ret
Z góry dzięki.