Question: 8. (24 points) Write an assembly subroutine to count the number of 1's in a 32-bit data element. Your main program should read the data

 8. (24 points) Write an assembly subroutine to count the number

8. (24 points) Write an assembly subroutine to count the number of 1's in a 32-bit data element. Your main program should read the data element from address Ox00101000, and pass the data into the subroutine in ro. Assume your subroutine might call another subroutine, and preserve context as appropriate. Return the number of 1's in R1. Extra credit: pass the data element into the subroutine on the stack, and again, preserve context as appropriate. .text .global main .set datal, 0x00101000 main: @your code here... bl countones loop: b loop countones: @your code here... 8. (24 points) Write an assembly subroutine to count the number of 1's in a 32-bit data element. Your main program should read the data element from address Ox00101000, and pass the data into the subroutine in ro. Assume your subroutine might call another subroutine, and preserve context as appropriate. Return the number of 1's in R1. Extra credit: pass the data element into the subroutine on the stack, and again, preserve context as appropriate. .text .global main .set datal, 0x00101000 main: @your code here... bl countones loop: b loop countones: @your code here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!