Jose wrote:
"Carry is when addign through 0"
I'll stick to 8-bit numbers for this example of the the carry flag.
Let's say you have the number 255 (1111 1111) stored in R0 and you want to add 1 to it. Where that 255 came from isn't important.
255+1=256
or, in binary
1111 1111 + 0000 0001 = 1 0000 0000
The result is a 9 bit answer. That first binary 1 after the equal sign is a carry from the addition. Our hypothetical 8-bit micro knows that you just added two numbers together that results in a number that needs more than 8 bits to represent. So, to indicated that fact, the carry flag is set.
On some micros, the carry flag can be set by rotate/shift operations. For example, lets say 1001 1001 is stored in R0 and you're about to execute a left shift on it.
1. R0 = 1001 1001 C=0
2. R0 = 0011 0010 C=1 (The left shift just happened)
The leading 1 that was in R0 got shifted into the carry flag. Bear in mind this example may not be true on all micros. You'll have to check the micro documentation to be sure.
As far as the V flag, I don't know. I'm a wimp. If I need signed math, I use C. My guess is that the V flag get set if you perform an addition that causes your number to exeed 0111 1111.