汇编语言堆栈框架和数组

时间:2014-04-28 23:19:11

标签: c++ arrays assembly masm stackframe

我正在尝试使用汇编语言创建一个程序,将数组X复制到堆栈框架,并在退出程序之前在屏幕上显示堆栈框架。这是我到目前为止所写的,它只是给我错误,因为它不是在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

这是将数组添加到堆栈的正确方法吗?我该如何显示其内容?

0 个答案:

没有答案