This has to be in MSP430 assembly language. Thank you! Here is a link with instr
ID: 3861275 • Letter: T
Question
This has to be in MSP430 assembly language. Thank you!
Here is a link with instructions set for msp430 (pages 5-8): https://www.ti.com/sc/docs/products/micro/msp430/userguid/as_5.pdf
Write an MSP430 assembly language subroutine, REP_FREE, to examine the elements of a list of positive word-size numbers stored at location LIST_IN. The list is already sorted in ascending order. The first element is the number, n, which is the length of the array. The subroutine will copy the elements from location LIST IN to location LIST_OUT. While ignored. if an occurs more than once then the copies and In essence, the subroutine eliminates the replicated elements from LIST IN places the results in LIST_OUT. Note that you need to update number m (the first element on the top which is the actual number of elements in LIST_OUT after eliminating all replicates.
Name: Grade: 101 1) Write an MSP430 assembly language subroutine, REP FREE, to examine the elements of a list of positive word-size numbers stored at location LIST IN. The list is already sorted in ascending order. The first element is the number, n, which is the length of the array. The subroutine will copy the elements from location LIST IN to location LIST OUT. While ignored. if an occurs more than once then the copies and In essence, the subroutine eliminates the replicated elements from LIST IN places the results in LIST OUT. Note that you need to update number m (the first element on the top which is the actual number of elements in LIST OUT after eliminating all replicates.Explanation / Answer
Program : Find a sum of two integer arrays;
* Input : The input arrays are signed 16-bit integers in arr1 and arr2
* Output : Display sum of arr1 on P1OUT&P2OUT and sum of arr2 on P3OUT&P4OUT
* Modified by: A. Milenkovic, milenkovic@computer.org
* Date : September 14, 2008
* Description: MSP430 IAR EW; Demonstation of the MSP430 assembler
*------------------------------------------------------------------------------*/
#include "msp430.h" ; #define controlled include file
NAME main ; module name
PUBLIC main ; make the main label vissible
; outside this module
ORG 0FFFEh
DC16 init ; set reset vector to 'init' label
RSEG CSTACK ; pre-declaration of segment
RSEG CODE ; place program in 'CODE' segment
init: MOV #SFE(CSTACK), SP ; set up stack
main: NOP ; main program
MOV.W #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer
BIS.B #0xFF,&P1DIR ; configure P1.x as output
BIS.B #0xFF,&P2DIR ; configure P2.x as output
BIS.B #0xFF,&P3DIR ; configure P3.x as output
BIS.B #0xFF,&P4DIR ; configure P4.x as output
MOV.W #arr1, R4 ; load the starting address of the array1 into the
register R4
MOV.W #arr2, R5 ; load the starting address of the array1 into the
register R4
; Sum arr1 and display
CLR R7 ; Holds the sum
MOV #8, R10 ; number of elements in arr1
lnext1: ADD @R4+, R7 ; get next element
DEC R10
JNZ lnext1
MOV.B R7, P1OUT ; display sum of arr1
SWPB R7
MOV.B R7, P2OUT
; Sum arr2 and display
CLR R7 ; Holds the sum
MOV #7, R10 ; number of elements in arr2
lnext2: ADD @R5+, R7 ; get next element
DEC R10
JNZ lnext2
MOV.B R7, P3OUT ; display sum of arr1
SWPB R7
MOV.B R7, P4OUT
JMP $
arr1 DC16 1, 2, 3, 4, 1, 2, 3, 4 ; the first array
arr2 DC16 1, 1, 1, 1, -1, -1, -1 ; the second array
END
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.