You wrote Snip f then , IF w > f then , IF w < f then> I think this might work firstly check if w=f by subtraction and checking Z and testing returning a 1 in the w register for the first result. secondly test for a carry (w>f) (2)else the result is (wf and does not need computing. Call Choice Choice SUBWF f,w ;subtract w from file BTFSC STATUS,Z ; test for zero (w=f) RETLW 1 ; exit sub w=1 (w=f) BCF STATUS,C ; clear carry before starting SUBWF f,w ; do again and check for borrow BTFSS STATUS,C ; test for carry (w>f) RETLW 2 ; exit sub w=2 (wf) by default minor fracture in the thaught process cant remember if Ive got the bit test in the correct polarity but try it and see (Its close)... Steve.....