Andrew Warren wrote:
{Quote hidden}>
> > Really, I'm doing a greater than/less than/equal to thing, so,
> > first I should check the Z flag to see if the result was zero, if
> > it was, I'll branch, if not, then test the C flag and go from
> > there, right?
>
> Actually, it'll be faster to check the C flag first, then only
> check the Z flag if the C flag was set... That way, you only
> check one flag when the result is negative (a much more-likely
> occurence than a "0" result).
>
> > So, when using 'subwf':
> > If (f) - (W) is positive,
> > (f) > (W) / Z = 0, C = 1.
> > If (f) - (W) is zero,
> > (f) = (W) / Z = 1, C = 1.
> > If (f) - (W) is negative,
> > (f) < (W) / Z = 0, C = 0.
> >
> > Is everything I said about the flags correct?
>
> Yes, if you treat the contents of "f" and "w" as unsigned (i.e.,
> non-negative) numbers.
Okay, this works! Thanks!
Now I've run into another problem, though. What's the quickest way to
check if a number is negative? Can I just test bit 7? I just tried
subtracting 0 from the register using 'subwf', but that seems to
_always_ leave the C flag set. And if I add 0 using 'addwf', it always
leaves the C flag clear. Will just tesing bit 7 of the reg always work?
Thanks again,
--
~Keith
.....tsk3000KILLspam
.....Prodigy.Net
http://pages.prodigy.net/tsk3000/