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 - 01100 which can be changed into
00110
+10100
-------
11010
The Carry Flag CF = 1 and Overflow Flag OF = 0
Cmp $-6, $-12 is 10100 - 11010 which becomes
10100
+00110
-------
11010
CF =1 , Overflow Flag OF = 0
I believe I understand Overflow flag was set to 0 because these small number subtraction (or addition, depending on how you look at it) results in small numbers that never surpassed 2^5 range of numbers.
What about the carry? I thought it meant the last bit had a 1 carried over from the last column/bit, then that's a carry flag right?
What I mean is if it was something like
1 (carried over from last column)
1100......(random binary for the rest ...)
+ 0100......
-------------
That's how a carry flag would be set right? The 1 came from 1+1 at the 2nd from the left column.
In my two examples, these are no 1's on top of the leftmost column.
What's going on?
Thanks.