does this work? neg_BARG comf BARGB3,f comf BARGB2,f comf BARGB1,f comf BARGB0,f incf BARGB3 btfsc STATUS,Z incf BARGB2 btfsc STATUS,Z incf BARGB1 btfsc STATUS,Z incf BARGB0 retlw 0 Peter van Hoof ------------- mailto:pvh@vertonet.com http://go.to/pvh > I am looking for a code fragment which calcuates the two's > complemnt of a 32 > bit word (4 bytes) > > I'd prefer a specific code fragment. > > The fragment below is close, but it doesn't work > > ;This changes BARG into -BARG in two's complement form > ; BARGB3 is the low byte,.... BARGB0 is the high byte > > neg_BARG comf BARGB3 > incf BARGB3 > btfsc STATUS,Z > decf BARGB2 > comf BARGB2 > ; > incf BARGB2 > btfsc STATUS,Z > decf BARGB1 > comf BARGB1 > ; > incf BARGB1 > btfsc STATUS,Z > decf BARGB0 > comf BARGB0 > retlw 0 > > > Thank you