Myke, Keith, thanks for your help sofar. While you were cooking up your solutions I devised the following possible solution. What I did not mention is that inloc and outloc are buffer pointers that cycle over the values 0x0c and 0x24. My solution, if it works which I don't know yet: ; if inloc is within buf max places of outloc then hold input ; if out > in then if (o ut - in) < 5 hold ; else if out < in then if (in - out) > 19 hold movf InLoc, W subwf OutLoc, W btfss _c ; if C = 1 then inloc > outloc ((out - in) in W) goto inGTout sublw 5 btfsc _c goto hold goto RestoreIntStatus ; else ready inGTout: ; test if in-out > 19 movf OutLoc, W subwf InLoc, W sublw D'19' btfsc _c ; goto RestoreIntStatus ; else ready hold: data_off ; no more data please One question about Myke's solution: In PIC assembler, using "w" as "temp", this would be: movf outloc, w subwf inloc, w btfss STATUS, C ; Skip Next if we don't have a Negative sublw 0 ; Make the Negative Positive >>>> addlw 0 - 4 ; Subtract 4 from the absolute value btfsc STATUS, C goto X ; Value is Greater than 4... I don't understand the addlw 0 - 4 line. It is supposed to substract. Shouldn't it read sublw 4 Ronald