суббота, 9 апреля 2022 г.

Ассемблерная заметка №2

Об инструкции CMP


Furthermore, with the CMP instruction, the destination operand doesn't change. Just the flags.

Let me illustrate. Let's say EAX = 00000005 and EBX = 00000005. If we do this arithmetic operation:

CMP EAX, EBX

What's happening, is in effect this:

EAX - EBX ----> 00000005 - 00000005

Since the result would be 0, but we don't change the destination operand in a CMP instruction, the zero flag is set to 1 (since it's true).

So, as we saw, depending on the result of the previous arithmetic operation, flags can be set accordingly:


enter image description here

Комментариев нет:

Отправить комментарий