Write a program in assembly language 8086 not 8085 to find t
Solution
Solution :
The logic here is if a number is divisible by 2 , it will have 0 in the LSB.
If it is divisible by 2 , 2 times it will have two 0\'s in LSBs.
If it is divisible by 2 , n times it will have n 0\'s in the LSBs.
Examples
To find number of twos that divide the given number using 8086, We right shift the contents of the register in which the number is and the check carry flag for zero. We repeat until we get a one and count the number of times which will be required answer.
The code segment is given below
-----------------------------------------------------------------------------------------------
out_of_loop ------- ; code continues as required from here
----------------------------------------------------------------------------------------------------------------------------------
CX will contain the answer after exiting from loop.
