Hello, I don’t understand where is the error in this simple Assembler code, that finds the max of a vector:
Here’s the code
.data
stringa: .ascii "Il_massimo_del_vettore_e’:"
vett: .byte 17,28,15,18
vett_fine:
.text
_main: **
** mov $vett_fine, %edx
** sub $vett, %edx**
** mov $0, %eax**
** mov $vett, %ebx**
** dec %dx**
** jmp passo1**
cambia_max:
** mov vett(,%ebx,1), %ebx**
** dec %dx**
** jz fine**
passo1: **
** inc %eax
** cmp vett(,%eax,1), %ebx**
** jl cambia_max**
** dec %dx**
** jnz passo1**
fine:
** mov $26, %cx**
** push %ebx**
** mov $stringa, %ebx**
** call outmess**
** pop %ebx**
** push %eax**
** push %ebx**
** call newline**
** mov %ebx, %eax**
** call outdecimal**
** pop %ebx**
** pop %eax**
** call exit**