Flags are basically single-bits that certain instructions set or reset under certain conditions. I'd recommend checking the manual (
UM0077.pdf) to see which instructions change which flags, as some instructions change flags for what initially seems like no reason.
Most of the instructions that affect control flow (e.g. call, jp, ret) have conditional versions that use flags. So,
jp c,location will only jump if the carry (c) flag is 1, and
jp nc,location will only jump if it's 0.
The flags you'll use most often:
The carry flag, c, is set when an addition or subtraction results in a carry or borrow.
The zero flag, z, is set when an addition, subtraction, or bitwise operation results in 0.
The sign flag is set when an operation results in a negative number. Rather than using s and ns, you use p and m for plus and minus.
For example, if you wanted to return if a is 42, you could do:
Code: cp a,42
ret z
cp does a subtraction and then discards the result. If a is 42, the result of that subtraction will be 0 and the zero flag will be set. If the zero flag is set, ret z will return.