Yes this is quite hard. I find it easier to show the state of the flags in a table, consider: movfw X subwf Y,w This subtracts X from Y and leaves the result in W. Now look at flags for the compare operations: X=Y C=0 Z=Don't Care X>Y C=0, Z=0 X!=Y Z=1 Hope this helps! (Mind you it would have been easier if Microchip had simply put the logic in Hardware to "correct" the carry flag after a subtraction ! Robin Abbott - robin.abbott@dial.pipex.com ************************************************************************** * * Forest Electronic Developments * http://dspace.dial.pipex.com/robin.abbott/FED * ************************************************************************** ----- Original Message ----- From: Tony Nixon To: Sent: 30 September 1999 01:59 Subject: Compares > Hi all, > > I don't know why, but I "still" get confused when doing things like this > in assembler. > > if RAMx > RAMy then > > I just can't seem to keep in my mind what is needed especially when a > SUBLW instruction is involved. > > So, to make it easier on myself and others, I've posted a small text > file which lists probably all the variations for basic number > comparisons in 8 and 16 bit format. There are two sets, one give a true > branch and the other gives a false branch. > > If anyones interested, the link is > > http://www.picnpoke.com/projects/compares.txt > > -- > Best regards > > Tony > > http://www.picnpoke.com > Email sales@picnpoke.com