Or rotate left until carry is set:
It’s been a while for asm, and might not work straight up, but enough to get the idea.Code:bitcount var byte bytebuff var byte NCD8: bytebuff = portX clrf _bitcount bcf status ,C findbit: incf _bitcount rrf _bytebuff btfss status ,C goto findbit return
findbit: is currently an endless loop if the port is zero, so you’d need to check for zero at the beginning.




Bookmarks