Hi all, I need a fast routine that, given a pointer to a 32 bit counter in W, decrements it and returns some flag set if the whole thing is zero. I cooked up this godawful thing, any better ideas out there? TIA - Rich ; given W=address of little-endian 32 bit variable, decrement the ; variable, return Z set if it is zero dec32 movwf FSR ; point FSR to variable LSB movlw 1 subwf INDF,f ; v[0] -= 1 skpnz ; if now 0, goto tst32 ; go check the others skpnc ; else if no borrow, return ; we are done incf FSR,f ; subwf INDF,f ; v[1] -= 1 skpnc ; if no borrow, goto dec32x ; exit incf FSR,f ; subwf INDF,f ; v[2] -= 1 skpnc ; if no borrow, goto dec32x ; exit incf FSR,f ; subwf INDF,f ; v[3] -= 1 dec32x bcf STATUS,Z ; ensure Z is clear return ; ; here, v[0] just dec'd to 0, see if the rest are as well tst32 incf FSR,f ; movf INDF,w ; w = v[1] incf FSR,f ; iorwf INDF,w ; w |= v[2] incf FSR,f ; iorwf INDF,w ; w |= v[3] return ; return Z set if v == zero