【发布时间】:2024-04-13 16:25:02
【问题描述】:
考虑以下用值填充双字数组并接受 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 * the dword at address EBP - 4 的双字中?还是我看错了?
【问题讨论】:
标签: assembly x86 masm dereference