Scan for first zero bit (Assembly)?
Posted
by
cthulhu
on Stack Overflow
See other posts from Stack Overflow
or by cthulhu
Published on 2011-01-01T18:53:58Z
Indexed on
2011/01/01
20:54 UTC
Read the original article
Hit count: 275
I have some numbers in AH, AL, BL, BH registers. I need to check whether there is 0 bit in each of the registers in left half of the number. If yes, then put into check variable value 10 else -10. How can I do this?
I tried something like that:
org 100h
check dw 0
mov ah, 11111111b
mov al, 11111111b
mov bl, 11111111b
mov bh, 11111111b
mov check, -10
shr ah, 4
shr al, 4
shr bl, 4
shr bh, 4
cmp ah, 0Fh
jz first
first:
cmp al, 0Fh
jz second
second:
cmp bl, 0Fh
jz third
third:
cmp bh, 0Fh
jz final
final:
mov check, 10
ret
© Stack Overflow or respective owner