So, i've tried calculating the average of an array and it's all good with calculating the sum, but when I go on to dividing it, the EAX register doesn't change. Here is the code:
> .386 .model flat, stdcall
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> includelib msvcrt.lib extern exit: proc
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ;declaram simbolul start ca public - de acolo incepe executia public
> start
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ;declararea datelor .data
>
> array db 5,21,4,6,7,11 lengtharray dw $-array sum db 0 q db 0 r db 0
> .code start:
> mov eax, 0
> mov ebx,0
> mov esi, 0
> mov ecx, 0
> mov al,0
> mov cx, lengtharray
>
> et_loop: add al, array[esi]
> inc esi
> loop et_loop
>
> mov bx,lengtharray
> div bx
>
>
> push 0
> call exit
> end start