Questions tagged [carryflag]

A carry flag usually indicates whether an arithmetic instruction (e.g. addition or subtraction) has resulted in a carry or borrow. This flag can then be used as the basis for a conditional branch or other conditional execution.

On x86 processors, the carry flag is denoted CF and is the low bit of the FLAGS (or EFLAGS or rFLAGS) register.

This tag is for questions about how the carry flag operates, how to use it, and related topics.

112 questions
-1
votes
2 answers

Carry Flag Assembly Language

Why is the Carry Flag set at 255 in this code INCLUDE Irvine32.inc .data .code main PROC ;adding 1 to 255 rolls AL over to zero: mov al,255 add al,1 ; AL=0, CF=1 (unsigned overflow) call DumpRegs ;subtracting larger number from smaller: sub…
jake craigslist
  • 303
  • 3
  • 12
-2
votes
1 answer

How can I set the carryflag adding two numbers (32bit)

i got two numbers by using read_int, and added two numbers. And finally i checked the EFLAGS (dump_regs). So, to set carry flag, I tried "4,294,967,295 + 1" but, carry flag didn't set.('CF' didn't show in screen ) What numbers do i need if i want to…
Forestellar
  • 23
  • 1
  • 5
-2
votes
2 answers

How I make an addition of two numbers of 32 bits in Assembly using ADC?

How I make an addition of two numbers of 32 bits in Assembly using ADC?
ebed
  • 1
  • 1
  • 1
-2
votes
1 answer

Why was the carry flag set here?

I was wondering if anyone can give me some site with lots of practice with these flags, especially the carry and overflow flag. Anyways my question is this. I'm looking at lecture notes and I see for a 5-bit comparisons Cmp $12, $6 becomes 00110 -…
User
  • 1
  • 2
-3
votes
1 answer

will carry flag be set after cmp[.b] #4, #-1 ? [MSP430 16 bit]

[MSP430 16 bit] 0x437c mov[.b] #-1, r12 0x926c cmp[.b] #4, r12 0x2801 jlo 0xda36 Could anyone help me calculation (cmp[.b] #4, r12 ) with Binary? Example : r12-#4= 1111111111111111 - 0100 @@? I dont know how to calculation cmp with…
鍾豐吉
  • 11
  • 3
-4
votes
1 answer

Why carry bit is not 1 never? I looked in the program memory and never 1, just 0

I am writing a C program to generate Fibonacci numbers until 255 (as 8-bit values) using pic16f887. I try to check the carry bit from STATUS which is bit 0 (LSB) (I checked the datasheet), but all the time is 0. #include #define N 20…
-4
votes
1 answer

I want to change the condition, but I can't

Problem: Children are taught to add multi-digit numbers from right to left, one digit at a time. Many find the “carry” operation, where a 1 is carried from one digit position to the next, to be a significant challenge. Your job is to count the…
Son
  • 1
  • 1
1 2 3 4 5 6 7
8