I have an assignment to make a code that will check what is the longest "string" of zeros inside a double word binary number, for example (in a Byte) if I have this number:
The answer will be 3.
The code I've written works fine until a certain point that the CF keep having zeros although it should be 1.
The loop is not infinite it ends but about half way the CF is not changing, and leads to a incorrect count of zeros in the number.
org 100h mov cx,32 notZero: shr a,1 jc notZero loop: jnc firstOne isOne: shr a,1 mov counter,0 jc isOne firstOne: add counter,1 mov al,counter cmp al,biggest jng isSmaller mov biggest,al isSmaller: shr a,1 LOOP loop mov ah,0 int 16h ret a DD 10010001100100011001100111010011b biggest DB 0 counter DB 0
Edited by iPanda: n/a