开发者

Beginner Assembler Help

Can someone please explain in simple开发者_如何学运维 terms how the AND, SHL and CMP commands work? Thanks.


AND - One 0 bit means 0 as a result

1 And 0 = 0
0 And 1 = 0
1 And 1 = 1

5 AND 3 0101 AND 0011 (binary)

     0101
AND  0011
     ----
     0001

SHL - Shift Left

SHL EAX, 1 -> shift left one bit

SHL 5, 1 -> 5 is 0101 in binary, so if one shift left it becomes 1010(A)

CMP - Compare, it's general purpose and depends on cpu eflags.

CMP EAX,5
JE wherever   (if eax equals 5, the zero flag is set and jump is made)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜