Re: A82: NEG and CPL
[Prev][Next][Index][Thread]
Re: A82: NEG and CPL
In a message dated 11/15/98 7:38:47 AM Eastern Standard Time,
wouter.demuynck@student.kuleuven.ac.be writes:
> One question:
>
> What's the difference between NEG and CPL again? NEG gets the two's
> complement and CPL the one's compliment, but how is that one's
> complement calculated?
>
> Suppose A = $14
>
> What will be the result of NEG A and CPL A ?
>
> Thanks
>
> Wouter
NEG = negate accumulator (not NEG A, just NEG)
CPL = compliment accumulator (not CPL A, just CPL
CPL is (i think) the same as XOR $FF unless the flags are set differently.
You just reverse every bit in A.
So if A is $14, which is %0001 0100...
CPL gives %1110 1011 which is $EB
NEG gives %1110 1100 which is $EC
the difference between one's compliment and two's compliment is the addition
of one
Hope that helped...
~Adamman