What will the carry flag (CF), the overflow flag (OF), the sign flag (SF) and the zero flag (ZF) be set to if the following arithmetic is done in an 8-bit register?
0xFE + 0xFB
- CF=1, OF=0, SF=1, ZF=0
- CF=1, OF=1, SF=0, ZF=0
- CF=1, OF=0, SF=1, ZF=1
- CF=1, OF=1, SF=1, ZF=0
- None of the above.
Thanks
Exercise question from William Stallings - Computer organization and architecture.
CF = 1
because there is an overflow (the unsigned result is 0x1F9 which does not fit in 8 bits)OF = 0
because we add 2 negative numbers and the result is also negativeSF = 1
because the result is negative (bit 7 of the result is set)ZF = 0
because the result is not zeroSo the answer is 1. Also see about assembly CF(Carry) and OF(Overflow) flag