0

我正在尝试用汇编语言创建一个程序,将数组复制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

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

4

0 回答 0