Hello! Anyone could help me with this problem? I'm trying to pass an integer array to a stack, but i don't know how to. Thanks.
Well, usually you would obtain the address of the array through 'LEA' then pass that as a dword parameter on the stack.
start PROC
LOCAL iArray[256]:DWORD ; 256 integers
; fill the array
mov ECX, 256
lea EDI, iArray
@@:
mov , ECX
dec ECX
test ECX, ECX
jnz @B
; Call Proc1 with address of iArray as parameter
lea EAX, iArray
push EAX
call Proc1
; Exit
push 0
call ExitProcess
ENDP
Proc1 PROC lpiArray:DWORD
; Lets do something with the array
mov ECX, 256
mov EDI, lpiArray
@@:
mov EAX,
add EAX, ECX
mov , EAX
dec ECX
test ECX, ECX
jnz @B
ret
ENDP
Also be sure to remember, that the maximum addressable array index is always n-1. For "256 DWORDS", that would mean indexing 0 through 255.
This forum is really helping me to develop my knowledges in assembly language. Thanks to all forum creators :D