x86 Assembler: shl and other instructions
I'm trying to understand some assembler code inside a loop. The loop runs from 1 to 255 and does the following inside the loop:
mov eax,DWORD PT开发者_如何学运维R [ebp-0x4]
shl eax,0x2
add eax,DWORD PTR [ebp+0x8]
mov DWORD PTR [eax],0x0
Here the DWORD PTR [ebp-0x4]
refers to the number going from 1 to 255.
Can someone figure out what is going on here? Thanks.
It's just zeroing an array apparently:
mov eax,DWORD PTR [ebp-0x4] ; load index
shl eax,0x2 ; multiply index by 4 to get byte offset
add eax,DWORD PTR [ebp+0x8] ; add byte offset to array base address
mov DWORD PTR [eax],0x0 ; zero value at array[index]
精彩评论