考虑以下填充dword数组的过程,它接受2个参数:在
EBP + 08h
处是数组的大小,在EBP + 0Ch
处是给定数组的偏移量。(例如:OFFSET myarray
):MyProc PROC
PUSH EBP
MOV EBP, ESP
SUB ESP, 04h
PUSH EDI
PUSH ESI
PUSH EBX
MOV EBX, [EBP + 08h] ;move the size of the array into EBX
MOV [EBP - 04h], 00h ;EBP - 04h will be the counter (or the index.)
MOV ESI, [EBP + 0Ch] ;move the offset of the array into ESI
MOV EDI, 01h
INC EBX
@@:
MOV [ESI + 04h * [EBP - 04h]], EDI ;How can I actually move EDI into
;the dword found at address ESI + 4 * the value found at address EBP - 4?
INC [EBP - 04h] ;increment the counter and the value to be stored.
INC EDI
CMP [EBP - 04h], EBX
JNE @B
POP EBX
POP ESI
POP EDI
MOV ESP, EBP
POP EBP
RET
MyProc ENDP
我试图将EDI
移动到[ESI + 04h * [EBP - 04h]]
中,这是我尝试做的一个示例,因为地址EBP - 4
处的双字是数组的索引。
是否有任何方法可以将EDI
实际移动到地址ESI + 4 * 地址 EBP - 4
处的双字中?还是我的想法有误?