Value in Carry Flag

assembly, masm, x86

Solution

That's what "add-with-carry" is for:

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

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

setc bl     ; BL = CF ? 1 : 0

Problem

If I do the following (where `cx` has 0b1011 or 11 in decimal prior to the shift): ``` shl cx, 1 ``` After `shl`, the carry flag should be set. As `shl` will move 0b1011 to 0b0110 and 1 will be in `CF`. My question is: how do I access the value in the carry flag? Let's say I want to append it to register `bx`, obviously `mov bx, cf` does not work so how would you go about doing that?

Original source