Ask Question
18 August, 07:23

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. 18 August, 09:44
    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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers