Crash_Override
Crash_Override

Reputation: 368

Beginner Assembler Help

Can someone please explain in simple terms how the AND, SHL and CMP commands work? Thanks.

Upvotes: 0

Views: 357

Answers (1)

Spyros
Spyros

Reputation: 48636

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)

Upvotes: 1

Related Questions