Question: Write an ARM Assembly program called BMICalculator that will calculate the body mass index (BMI) using weight in pounds and height in inches by evaluating
Write an ARM Assembly program called BMICalculator that will calculate the body mass index (BMI) using weight in pounds and height in inches by evaluating the following expression, placing the result in register r0. BMI = (weightInPounds * conversionFactor) / (heightInInches * heightInInches)
BMI = (150 * 703)/(64*64) Your program should use the following data definitions: weightInPounds DCD 150 heightInInches DCD 64 The EQU directive gives a symbolic name to a numeric constant. Use EQU directive to give a conversionFactor name to 703.
Syntax: name EQU expr{, type} Example: temperature EQU 20 ; assigns the value 20 to the symbol temperature. Use LDR instruction to load weightInPounds, heightInInches, and conversionFactor into registers r1, r2, and r3 respectively. To load heightInInches to a register using LDR is optional. There is not a divide instruction, but you can use the LSR (logical shift right) to simulate division by powers of two. Use hexadecimal calculator to verify your result.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
