Question: [20] 3) Implement the following arithmetic function using subroutines and develop the code to be as efficient as possible. The only input to the function
![[20] 3) Implement the following arithmetic function using subroutines and develop](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66ef5f8d85c23_59766ef5f8d12f21.jpg)
[20] 3) Implement the following arithmetic function using subroutines and develop the code to be as efficient as possible. The only input to the function is variable (a) that is initialized in register R4 at the beginning of the program to 5 and maintained thereafter. The X calculation result is stored in R5. The final answer, F, is stored in R7 F-(X450) (20) where X = [12] 3.a) Write an MSP430 assembly language program that implements the above function using subroutines for Multiplication and Factorial. The overall program structure should be as follows. Please note that the multiply subroutine is included in the skeleton code. Please review how it works: Initialize stack pointer ;Stop RESET mov.w # STACK END,SP #NDTPW+NDTHOLD,&MDTCTL WDT StopWDT LAB2 CLEAR mov . w mov.w #5, R4 Load "a" into R4 clr RS clr R6 Clr R7 clear the entire register clear the entire register clear the entire register ;the calculation part of your program taking value of R4 as an input and returning result X in R5 XCALC the final part of your program ;taking inputs from R5 and returning result F in R7 FCALC MainLoop jmp Mainloop Infinite Loop MULT Included in the skeleton code [2] for Main Program-[1] XCALC, [1] FCALC [10] for Factorial Subroutine
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
