Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ARM ASSEMBLY PLEASE LOOK AT STARTER CODE In this problem Ive given you some starter code and a function in the file PA5-2.s This function

ARM ASSEMBLY PLEASE LOOK AT STARTER CODE In this problem Ive given you some starter code and a function in the file PA5-2.s This function is called pow and follows the ABI standards for parameter and return value locations. This function computes ab where a and b are integer values. This function is completed for you and you should not modify it. Your task, is to use the pow function to compute a_valb_val 3*a_val. You will need to get a_val and b_val into the appropriate registers, call pow (using BL), then use the result and perform the rest of the computation. Your final answer should be in R4 when the program completes.

;---------------------

; Programming Assignment 5, Problem 1

; Your required header information goes here

;---------------------

; In those you will use the provided function pow to compute

; a^b - 3a

; You must set up the arguments to pow and call it using BL

; The result should be in R4 after the program completes

a_val DCD 3

b_val DCD 4

begin

; Your code goes here

;---------------------

; pow function. DO NOT CHANGE!

;---------------------

pow PUSH {LR}

PUSH {R4-R6}

MOV R4, R1

MOV R5, #1

loop CMP R4, #0

BEQ exit

MUL R5, R0, R5

SUB R4, R4, #1

BAL loop

exit MOV R0, R5

POP {R4-R6}

POP {PC}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How would you describe your typical day at work?

Answered: 1 week ago