From: Peter L. Peres Date: Tuesday, October 24, 2000 6:16 PM > cblock > Ftemp > end cblock > > decf INDF,w ; w = (2^(N%8))-1 > movwf Ftemp ; idem > addwf INDF,w ; w = 2^((N%8)+1)-1 > xorwf INDF,w ; w = (2^(N%8))-1 > subwf Ftemp,f ; Ftemp = (2^(N%8))-1 - (2^(N%8))-1 > btfsc STATUS,Z > retlw 0 ; yes, INDF = 2^N > retlw 1 ; no, INDF = 2^N + K where K > 1 > >Note: This relies on some kind of hash that may or may not fail in certain >cases. ;-) > >Peter > Ah! And here's one that'll work on those pesky 12-bit cores that don't have a "return" opcode! Remember: write you routines so they're word-size independent. John -- John Patrick -- N9OU E-mail: jpatrick@megsinet.net Web: http://www.megsinet.net/~jpatrick -- http://www.piclist.com hint: PICList Posts must start with ONE topic: "[PIC]:","[SX]:","[AVR]:" =uP ONLY! "[EE]:","[OT]:" =Other "[BUY]:","[AD]:" =Ads