A83: Re: CP?


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

A83: Re: CP?




There are only flags to worry about:  the carry flag and the sign flag.  You
will probably not need the sign flag for anything, unless you using signed
numbers.  The carry flag is set if the operation produced a "carry", meaning
that the result overflowed and had to be truncated.  The sign flag is
exactly the same way, except that it is for signed numbers, and the carry
flag is for unsigned:

ld a,5
cp 6     ; 5 - 6 = -1 = 255

The carry flag will be set.

ld a,9
cp 1    ; 9 - 1 = 8

The carry flag will be cleared.


--
David Phillips <electrum@tfs.net>
ICQ: 13811951
AOL/AIM: Electrum32
86 Central: http://www.tfs.net/~electrum/

-----Original Message-----
From: Henry Davidowich <rdaneelolivaw@hotmail.com>
To: assembly-83@lists.ticalc.org <assembly-83@lists.ticalc.org>
Date: Wednesday, October 21, 1998 5:06 PM
Subject: A83: CP?


>
>How does the "cp" affect the flag register?  I understand the zero flag
>concept, but what about other items (such as... the carry flag)?
>Thanks.
>
>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com