Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Objective Write ARM an assembly language routine called div and mod. The routine takes a signed dividend and divisor and returns the quotient and remainder.
Objective Write ARM an assembly language routine called div and mod. The routine takes a signed dividend and divisor and returns the quotient and remainder. The quotient returned should be returned as a signed number and the remainder as an unsigned number (magnitude). All signed numbers are represented using two's complement notation. For example, calling the routine with a dividend of -871 and a divisor of 23 returns a quotient of -37 and a remainder of 20 The dividend is passed into the routine in rI, and the divisor in r0. The routines return the quotient in rl and the remainder in . All values passed into the routines will not exceed the range of signed numbers that can be represented using 16 bits. Testing The following C program can be used to test your code. The program allows both routines to be tested This code is available online on the labs page of the course website. Save the file as lab2wrapper.c extern int div _and mod (int divisor, int dividend); int main() div and mod (21,-4798) Skeleton Code The following skeleton code can be used to get you started. It is available online on the labs page of the course website. Save the file as lab2.s text global div_and _mod div_and _mod: STMFD r13!, r2-r12, rl4) ; Your code for the signed division/mod routine goes here. ; The dividend is passed in r0 and the divisor in rl. ; The quotient is returned in r0 and the remainder in rl. LDMFD r13!, r2-r12, rl4) MOV pc,lr ; Return to the C program .end
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