Answered step by step
Verified Expert Solution
Question
1 Approved Answer
[2012) The program of this cxcrcisc deals with arrays of numbers and subroutines. Next page is the program outlines. At the beginning of your program
[2012) The program of this cxcrcisc deals with arrays of numbers and subroutines. Next page is the program outlines. At the beginning of your program you will allocate empty storage for two original arrays and their sorted versions. For the overall program layout, use the program skeleton file (lab2-v??-A-ski) available on Canvas. arch [16] 2.a) Complete this MSP430 assembly language program where the SORTI section sets the R4/R5/R6 parameters, which are used by the COPY and SORT subroutines to copy and sort array ARY1, R4 holds the starting address of the array. R5 holds the length of the array. Ro holds the starting location of the sorted array. COPY subroutine copies the contents of array ARY1 into ARYIS, SORT subroutine sorts the elements on ARY1S in place. SORT2 section is similar to SORT1 above using same registers. Arrays are in decimal notation! Sort Arrays in ascending order from lowest to highest value. Main Program: 16 for Program setup, and [10] for Sort Subroutine. BL_syllabu ...n (1).pdf Use the following values for the array elements. If the values in the skeleton code are different, use these values. ARY1: (10, 34, -18, 87, -65, 28, -15,-49, 61, -77,45), ARY2: (10, 90, 46, 16, -55, -39, 32, 38, 12, 54, 23) imer maxresdefa [4] 2.b) Run your program and verify the results by using the Memory Browser window in the CCS Debug view. Write the Hex Values in order: ARY1S: ARY2S: pn Shot ...52.17 PM ---- Your Sorting lab starts here arch (1) ; Memory allocation of Arrays must be done before the RESET and StopWDT ARY1 . set exe2e3 ;Memory allocation ARY1 ARY15 Ox0210 Memory allocation ARYS ARYZ . Set Bx220 ; Memory allocation ARY2 ARY2S Ox0230 Memory allocation AR25 - set . set clr clr clr ;clearing all register being use is a good ; programming practice SORTI mov.W mov.W call call PARY1, R4 initialize R4 as a pointer to array HARYIS, R6 initialize R4 as a pointer to arrayl sorteci ArraySetupl;ther call gubroutine ArraySe tun. #COPY Copy elements from ARY1 to ARYS space #SORT Sort elementa in ARAY1 call SORT 2 BL syllabu -.n (1).pdf mov.W mov.W call call call PARY2, R4 initialize R4 as a pointer to array2 HARY2S, R6 ; initialize R4 as a pointer to array2 sorti PArraysetup2ither call subroutine ArraySetup2 ACOPY Copy elements from ARY2 to LRY2s space ASORT Sort elemente in ARAY2 Mainloop imp Mainloop Infinite Loop mer ArraySetup1 mov.b mov.b mov.b 410, (R4) #, 1(R4) #_, 2(R4) ; Array element initialization Subroutine First start with the number of elements and then fill in the 10 elements. maxresdefa ret ArraySetup2 ..... Similar to ArraySetupl subroutine ret COPY ret ;Copy original Array to allocated Array- Sorted space SORT Subroutine SORT sorts array from ilowest to highest value ret bn Shot ..52.17 PM - Your Sorting lab ends here --- [2012) The program of this cxcrcisc deals with arrays of numbers and subroutines. Next page is the program outlines. At the beginning of your program you will allocate empty storage for two original arrays and their sorted versions. For the overall program layout, use the program skeleton file (lab2-v??-A-ski) available on Canvas. arch [16] 2.a) Complete this MSP430 assembly language program where the SORTI section sets the R4/R5/R6 parameters, which are used by the COPY and SORT subroutines to copy and sort array ARY1, R4 holds the starting address of the array. R5 holds the length of the array. Ro holds the starting location of the sorted array. COPY subroutine copies the contents of array ARY1 into ARYIS, SORT subroutine sorts the elements on ARY1S in place. SORT2 section is similar to SORT1 above using same registers. Arrays are in decimal notation! Sort Arrays in ascending order from lowest to highest value. Main Program: 16 for Program setup, and [10] for Sort Subroutine. BL_syllabu ...n (1).pdf Use the following values for the array elements. If the values in the skeleton code are different, use these values. ARY1: (10, 34, -18, 87, -65, 28, -15,-49, 61, -77,45), ARY2: (10, 90, 46, 16, -55, -39, 32, 38, 12, 54, 23) imer maxresdefa [4] 2.b) Run your program and verify the results by using the Memory Browser window in the CCS Debug view. Write the Hex Values in order: ARY1S: ARY2S: pn Shot ...52.17 PM ---- Your Sorting lab starts here arch (1) ; Memory allocation of Arrays must be done before the RESET and StopWDT ARY1 . set exe2e3 ;Memory allocation ARY1 ARY15 Ox0210 Memory allocation ARYS ARYZ . Set Bx220 ; Memory allocation ARY2 ARY2S Ox0230 Memory allocation AR25 - set . set clr clr clr ;clearing all register being use is a good ; programming practice SORTI mov.W mov.W call call PARY1, R4 initialize R4 as a pointer to array HARYIS, R6 initialize R4 as a pointer to arrayl sorteci ArraySetupl;ther call gubroutine ArraySe tun. #COPY Copy elements from ARY1 to ARYS space #SORT Sort elementa in ARAY1 call SORT 2 BL syllabu -.n (1).pdf mov.W mov.W call call call PARY2, R4 initialize R4 as a pointer to array2 HARY2S, R6 ; initialize R4 as a pointer to array2 sorti PArraysetup2ither call subroutine ArraySetup2 ACOPY Copy elements from ARY2 to LRY2s space ASORT Sort elemente in ARAY2 Mainloop imp Mainloop Infinite Loop mer ArraySetup1 mov.b mov.b mov.b 410, (R4) #, 1(R4) #_, 2(R4) ; Array element initialization Subroutine First start with the number of elements and then fill in the 10 elements. maxresdefa ret ArraySetup2 ..... Similar to ArraySetupl subroutine ret COPY ret ;Copy original Array to allocated Array- Sorted space SORT Subroutine SORT sorts array from ilowest to highest value ret bn Shot ..52.17 PM - Your Sorting lab ends 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