Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an MSP430 assembly language subroutine, REP FREE, to er examine the elemen

ID: 3602665 • Letter: W

Question

Write an MSP430 assembly language subroutine, REP FREE, to er examine the elements of a ascending orumbers stored at location LIST_IN. The list is already sorted in an subroutine will copy the elements from location LIST IN to copying, if an element occurs ignored. In essence, the sub h is the length of the array. The location LIST OUT. While order. The first element is the number, n, whic more than once (repeated), then the repeated copies are iminates the replicated elements from LIST_IN and places the results in LIST_OUT. Note that you need to update sumour after eliminating all the top m) which is the actual number of elements in replicates (Note: m

Explanation / Answer

ANSWER:

code:

REP_FREE CSECT

#the base reg is initiated

USING REMDUP,t15

#store values

SR t6,t6

#load

LA t8,1

#to initialize the array   

LOOP_in C t8,N

BH LOOP_out2

LR t1,t8   

SLA t1,2

L t9,T-4(t1)

LR t7,t8   

BCTR t7,0

in_J C t7,=F'1'

BL LOOP_out1

LR t1,t7   

SLA t1,2

L t2,T-4(t1)

  

CR t9,t2   

BE LOOP_IT

  

#j = j -1

BCTR t7,0   

B in_J

LOOP_out1 LA t6,1(t6)

LR t1,t6   

SLA t1,2

ST t9,T-4(t1)

LOOP_IT LA t8,1(t8)

B LOOP_in

LOOP_out2 LA t10,PG

LA t8,1

LOOP CR t8,t6   

BH LOOP_out

LR t1,t8   

SLA t1,2

L t2,T-4(t1)

XDECO t2,PG+80

# outputs t(k) on 3 char

MVC 0(3,t10),PG+89

LA t10,3(t10)   

LA t8,1(t8)   

B LOOP

# buffer print

#transfer to another one by removing the repeated values

LOOP_out XPRNT PG,80   

# return code set

XR t15,t15   

# caller return   

BR R14   

T DC F'4',F'5',F'5',F'8',F'9',F'9',F'9',F'9',F'12',F'12'

DC F'13',F'14',F'14',F'15',F'16'   

N DC A((N-T)/4)   

PG DC CL92' '

YREGS

END REP_FREE

SAMPLE OUTPUT:

4 5 8 9 12 13 14 15 16

--> initialize the base register value

--> The subroutine is REP_FREE

--> LIST_IN for initial values

--> Now remove the duplicate elements

--> Copy it to another location

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote