1

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 PTR [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.

danielhc
  • 479
  • 1
  • 5
  • 12

1 Answers1

5

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]
Paul R
  • 208,748
  • 37
  • 389
  • 560