Value in carry flag

If I do the following (where it cxhas 0b1011 or 11 in decimal before shift):

 shl cx, 1

After shlthat, the carry flag should be set. Since it shlwill move 0b1011 to 0b0110, and 1 will be in CF.

My question is: how do I access the value in the carry flag? Say I want to add it for registration bx, obviously that mov bx, cfdoesn't work, so how would you do it?

+4
source share
2 answers

What is add-with-carry for:

adc bx, 0   ; adds "0" plus the value of CF to bx

If you want to set the (byte) register exactly to the value of the carry flag, use "set-if-carry":

setc bl     ; BL = CF ? 1 : 0
+8

, JC JNC, , .

PUSHFD EFLAGS .

+1

Source: https://habr.com/ru/post/1527594/


All Articles