Ask Question
31 July, 20:22

Write a program that counts the number of bits equal to one in R1, and stores the result in R2. For example, if R1=x0A0C, then R2=x0004 after the program runs. To receive credit, you can only modify the contents of R1 and R2, and no other register, and your solution should have no more than 9 lines of code.

+4
Answers (1)
  1. 31 July, 22:41
    0
    MOV R1, $0A0C;

    MOV R2, #0;

    L1 : MOV R1, R1, LSL #1;

    ADC R2, R2, #1;

    CMP R1, #0;

    BNE L1;
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a program that counts the number of bits equal to one in R1, and stores the result in R2. For example, if R1=x0A0C, then R2=x0004 ...” in 📙 Engineering if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers