It's my first post in stackoverflow. I'm trying to make a stack frame procedure, but I don't know why in the Loop it says" Access violation reading location 0x0033B000." Hope someone can help me with this.
Here's the code:
INCLUDE Irvine32.inc
.data
arr1 SDWORD -4, 7, -5, 3, 6, 2
arr2 SDWORD 4, 7, 5
msg1 byte "Average 1: ",0
msg2 byte "Average 2: ",0
.code
main PROC
push LENGTHOF arr1
push OFFSET arr1
call computeAve
mov edx,offset msg1
call writestring
call writeint
call crlf
push LENGTHOF arr2
push OFFSET arr2
call computeAve
mov edx,offset msg2
call writestring
call writeint
call crlf
main ENDP
computeAve PROC
push ebp
mov ebp,esp
mov esi,[ebp+8]
mov eax,0
mov ecx,[ebp+12]
add eax, [esi]
L1:
add eax,[esi]
add esi,4
Loop L1
mov edx,0
mov ebx,[ebp+12]
idiv ebx
pop ebp
ret 8
computeAve ENDP
End main