Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. (25 points) Design and write an MSP430 assembly language subroutine that returns the maximum absolute value of a signed integer array, ie, MAXABS-maximum(/a(i)/), i=0,
4. (25 points) Design and write an MSP430 assembly language subroutine that returns the maximum absolute value of a signed integer array, ie, MAXABS-maximum(/a(i)/), i=0, n-1, n>0. The main program that calls the subroutine is shown below. What does the main program do with the returned value? How do we pass the input parameters? #-STACK-END,SP RESET StopWDT mov.w ; Initialize stackpointer mov .w #WDTPWIWDTHOLD,&WDTCTL ; Stop watchdog timer main: bis . b #0xFF,8P1DIR bis.b #0xFF,8P2DIR push #arri mov . w #aend, R5 sub .w #arri, R5 rra.W R5 push R5 call #maxabs add.w #4, SP mov.b R12, P1OUT swpb R12 mov.b R12, P2OUT jmp$ ; configure P1.x as output ; configure P2.x as output push the address of arrl ; the next address ; (#aend- #arr1)/2 is the number of elements push the number of elements on the stack .int 1, 2, 3, 4, -5, 9, 12, 11 ; signed array arr1: aend: maxabs: write your code here 4. (25 points) Design and write an MSP430 assembly language subroutine that returns the maximum absolute value of a signed integer array, ie, MAXABS-maximum(/a(i)/), i=0, n-1, n>0. The main program that calls the subroutine is shown below. What does the main program do with the returned value? How do we pass the input parameters? #-STACK-END,SP RESET StopWDT mov.w ; Initialize stackpointer mov .w #WDTPWIWDTHOLD,&WDTCTL ; Stop watchdog timer main: bis . b #0xFF,8P1DIR bis.b #0xFF,8P2DIR push #arri mov . w #aend, R5 sub .w #arri, R5 rra.W R5 push R5 call #maxabs add.w #4, SP mov.b R12, P1OUT swpb R12 mov.b R12, P2OUT jmp$ ; configure P1.x as output ; configure P2.x as output push the address of arrl ; the next address ; (#aend- #arr1)/2 is the number of elements push the number of elements on the stack .int 1, 2, 3, 4, -5, 9, 12, 11 ; signed array arr1: aend: maxabs: write your code here
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