I'm trying to create a program in assembly language that copies array X
to the stack frame and displays the stack frame on the screen before exit from the procedure. This is what I wrote so far, and it is only giving me errors as it is not compiling on Microsoft C++ Visual Studio.
ExitProcess PROTO, dwExitCode:DWORD
calSumP PROTO,baseP:ptr dword, sumP:ptr dword, incre:dword, count:dword
.data
X sdword 10, -10, 20, -20, 30, -30, 40, -40
.code
begin:
invoke calSumP,addr X, addr X, type X, lengthof X
invoke exitProcess,0
calSumP
proc,baseP:ptr dword, sumP:ptr dword, incre:dword, count:dword
local array1[8]:dword
mov esi,[ebp+8]
mov esi,[ebp+12]
mov esi,[ebp+16]
mov esi,[ebp+20]
mov esi,[ebp+24]
mov esi,[ebp+28]
mov esi,[ebp+32]
mov esi,[ebp+36]
mov eax,0
nextP:
add eax,[esi]
loop nextP
ret
calSumP endp
invoke ExitProcess,0
end begin
Is this the proper way to add the array to the stack? How would I display its contents?