Re: twos complement and the CF (carry flag)
- From: Herbert Kleebauer <klee@xxxxxxxxx>
- Date: Mon, 29 Jan 2007 20:12:00 +0200
LuB wrote:
Or do mean the generating hardware? For a subtraction the Carry
generated by the adder has to be inverted to produce the correct Carry.
Ahhhhhh, do you mean ... when using SUB we must invert the resulting
CARRY FLAG? IE: if CARRY FLAG=0, then invert that ... so CARRY FLAG=1.
We want a-b but we calculate
a + 2th complement(b) = a + (2^8-b) = 2^8 + (a-b)
so, if a>=b we get a Carry because of the 2^8 and if a<b we don't
get a Carry because the Carry of the subtraction is neutralized
by the 2^8. To get the correct Carry, we have to invert the Carry
generated by the adder.
.
- References:
- twos complement and the CF (carry flag)
- From: LuB
- Re: twos complement and the CF (carry flag)
- From: Herbert Kleebauer
- Re: twos complement and the CF (carry flag)
- From: LuB
- twos complement and the CF (carry flag)
- Prev by Date: Re: twos complement and the CF (carry flag)
- Next by Date: Re: help for rsa algorithm in assembly
- Previous by thread: Re: twos complement and the CF (carry flag)
- Next by thread: Re: my little implementation of malloc
- Index(es):
Relevant Pages
|