[英]What does this instruction do in assembly?
So I don't know what this instruction does as I am starting just assembly. 因此,我在开始汇编时就不知道该指令的作用。
What does this instruction do? 这条指令做什么?
cmp byte ptr [edi],00 add [eax],al
In fact,Those are two seprate instructions : 实际上,这是两个单独的指令:
cmp byte ptr [edi],00
add [eax],al
The first one goes to memory address pointed by edi
register & fetches the first byte starting from that address , then comparing it to 00=0
. 第一个进入
edi
寄存器指向的内存地址,并从该地址开始获取第一个字节,然后将其与00=0
进行比较。
The second instruction throws away the result of the first instruction by overwriting all the flags without depending on them. 第二条指令通过覆盖所有标志而不依赖它们来丢弃第一条指令的结果。
It moves the content of al
(8-bit register) to memory location pointed by EAX
, but since al
is the lowest byte of eax
, its just like we are copying the lowest byte in the address pointed by eax
to memory location pointed by that address (which i think is meaningless). 它将
al
(8位寄存器)的内容移动到EAX
指向的内存位置,但是由于al
是eax
的最低字节,就像我们将eax
指向的地址中的最低字节复制到该地址所指向的那样地址(我认为这毫无意义)。
Before execution: Suppose eax=0x00405060
执行之前:假设
eax=0x00405060
--------------------
Address | Content (1byte)
--------------------
0x00405060 | 00
After Execution: eax=0x00405060
(doesn't change) 执行后:
eax=0x00405060
(不变)
--------------------
Address | Content (1byte)
--------------------
0x00405060 | 60
If you notice after the instruction execution, we have copied the lowest byte of the address (60) to memory location pointed by that address. 如果您在指令执行后注意到,我们已将地址的最低字节(60)复制到该地址所指向的存储器位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.