Question: using assembly below near the end of the code why do we write r3 into r0? how is that not altering our data? and why
using assembly below near the end of the code why do we write r3 into r0? how is that not altering our data? and why are we doing this

Write a program that uses a subroutine to find how many 1-bits exists in a 32-bit number. AREA EXPORT ENTRY CountOnes, CODE main PROC LDR re, -0xFOFOFOFO BL Count One Bits _main ; number to be checked stop stop ENDP Count One_Bits PROC LDR rl, -32 ; 32-bit loop counter LDR r3, -0; coun Loop ; 1 in MSB? ; if so, increment count CMP re, #0 ADDLT r3, r3, #1 MOV re, re, LSL #1 ; shift out MSB SUBS r1, r1, #1 BNE Loop MOV re, r3 ENDP END
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
