x86汇编程序:shl和其他说明 [英] x86 Assembler: shl and other instructions

查看:137
本文介绍了x86汇编程序:shl和其他说明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图理解循环中的一些汇编代码.循环从1到255,并在循环内执行以下操作:

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

此处DWORD PTR [ebp-0x4]是指从1到255的数字.

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.

推荐答案

显然只是将数组归零:

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]

这篇关于x86汇编程序:shl和其他说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆