Re: twos complement and the CF (carry flag)



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.
.



Relevant Pages

  • Reverse large files
    ... Can someone explain why the following code doesn't invert a selection of 60,000 words. ... Sub ReverseSelection02() ... Dim strA As String ...
    (microsoft.public.word.vba.general)
  • Re: Magnify Area under Mouse Coordinates
    ... Were you able to invert colors and still be able to magnify transparent ... or layered windows? ... > Private Sub Form1_Click(ByVal sender As Object, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Problem using a for loop to delete rows and columns from a
    ... This will not invert and I cannot work out the column vector I am trying to sub the 0's back into now. ... I hope I'm making sense. ...
    (comp.soft-sys.matlab)