Question
Hello! I need assistance writing the code below in ARM assembly on my raspberry pi. Please leave comments explaining how you programmed the solution and
Hello! I need assistance writing the code below in ARM assembly on my raspberry pi. Please leave comments explaining how you programmed the solution and why! Thank you!
Given the c++ code below, please write an assembler to compute the answer as shown.
Remember that the first parameter will be in r0, the second parameter will be in r1.
You are to write a loop that goes from r0 to r1 and adds up the answer, returning the answer in r0.
C++ PROGRAM:
#include
using namespace std;
// r0 r0, r1
extern int sum(int a, int b); //_Z3sumii
int main() {
cout << sum(1, 3) << ' '; // should print 6 (1+2+3)
cout << sum(2, 4) << ' '; // should print 9 (2+3+4)
cout << sum(1, 10) << ' '; // should print 55
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started