Question: ARM Assembly language. You will write a program that calculates the hypotenuse of a right triangle using Pythagorean's theorem. Prompt the user to enter two
ARM Assembly language.
You will write a program that calculates the hypotenuse of a right triangle using Pythagorean's theorem.
Prompt the user to enter two integers side A and side of the right triangle.
If or is less than or equal to zero the program should prompt the user of the error and end the program.
Use the function "intSqrt" to do the square root.
You need to download the code template for this homework to work. Do not change the intSqrt.c or the tri.s file names. All code should be
written in the tri.s
How to compile:
Unlike your previous examples the code will not compile just using gcc like it did with other examples. To compile you will run this command
make build
it will compile the intSqrt.c into an object and then compile the tri.s and intSqrt.o together to make the program work. Then to run the program
use the command
tri
Submission instructions:
Submit the final version as a zip file with the following files: tri.s
Important Notes:
intSqrt wants a single parameter in rO and will return the square root into r
Here is the equation to find the hypotenuse
ARM Assembly language.
File tri.s
global main
extern intSqrt DO NOT REMOVE
align
section data
your data here
align
section rodata
your read only data here
text
main:
push lr
this is dummy code to show you how to use the intSqrt function
you can erase this and put your code here
mov r #
bl intSqrt Call a square root routine
pop pc should return if the sqrt is working
File intsqrt.c
#include
#include
uintt intSqrt uintt a
return uintt sqrtdouble a ;
File Makefile
build:
gcc c intSqrt.c o intSqrt.o
gcc o tri intSqrt.o tri.s lm
clean:
rm tri sqrto
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
