Question
ARM ASSEMBLY In this exercise you are going write a function that follows the ABI standards. This function is going to perform integer division and
ARM ASSEMBLY In this exercise you are going write a function that follows the ABI standards. This function is going to perform integer division and must be named div. You should use the code from Figure 12b as the starting point for your division code. Note that in order to follow the ABI standards of where parameters go, you will have to modify this code. Your function should compute R0 / R1 and put the quotient in R0. (You can ignore the remainder.) Be sure to PUSH LR and any registers you use (R4-R12) on the stack at the beginning of your function and POP them off at the end. In PA5-2.s you are given some code that will test your div function. Do not modify this code. Your code for div should go at the end of the file. The results that you should get are shown in the comments of the code
;---------------------
; Programming Assignment 5, Problem 2
; Your required header information goes here
;---------------------
; You are to write a function that performs integer division
; Your function must be called div. It takes two values, a and b,
; and should return a/b. Code is given for you that tests
; your program. Upon successful completion the following values
; should be in the registers:
; R5 = 0
; R6 = 1
; R7 = 11
; R8 = 4
; R9 = 5
tester ; DO NOT TOUCH!
MOV R0, #5
MOV R1, #9
BL div
MOV R5, R0
MOV R0, #9
MOV R1, #5
BL div
MOV R6, R0
MOV R0, #80
MOV R1, #7
BL div
MOV R7, R0
MOV R0, #19
MOV R1, #4
BL div
MOV R8, R0
MOV R0, #60
MOV R1, #12
BL div
MOV R9, R0
END
;---------------------
; div function. Your code goes here!
;---------------------
div PUSH {LR}
; your code here
POP {PC}
.
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