Re: A86: Test Operations


[Prev][Next][Index][Thread]

Re: A86: Test Operations




At 11:22 AM 6/12/98 EDT, you wrote:
>
>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  nc_is_less_than_A  ;since it is the only other option
>
or use jp m or jp p if you're using signed numbers.

--Joshua


References: