Re: A86: Test Operations
[Prev][Next][Index][Thread]
Re: A86: Test Operations
In a message dated 98-06-12 11:11:33 EDT, you write:
> How do I check if A < n? A > n?
>
do
cp n
the cp instruction basically does a sub n, therefore it affects the flags,
but it doesn't change any register besides the flag register, so A has the
same value still in it.
so
cp n
jr z,A_is_equal_to_n ;since if a-n=0 then they must be equal
jr c,n_is_greater_than_A ; since if n is > then a, then we will need a carry
in a-n
jr n_is_less_than_A ;since it is the only other option
Skip Jordan
email: LGB240@aol.com
IRC: LGB240
ICQ: 12181001
Follow-Ups: