Ask Question
25 July, 03:02

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.

+3
Answers (1)
  1. 25 July, 03:20
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers