Answered step by step
Verified Expert Solution
Question
1 Approved Answer
at by CDA3331C Intro to Microcomputers Lab Assignment main main RS/ Name: Grade: /20 [20] 2) The program of this exercise deals with arrays of
at by CDA3331C Intro to Microcomputers Lab Assignment main main RS/ Name: Grade: /20 [20] 2) The program of this exercise 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-v12-A-skl) available on Canvas. [16] 2.a) Complete this MSP430 assembly language program where the SORTI section sets the R4/RS/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, R6 holds the starting location of the sorted array. COPY subroutine copies the contents of array ARY! into ARYIS. SORT subroutine sorts the elements on ARYIS in place. SORT2 section is similar to SORTI above using same registers. Arrays are in decimal notation! Sort Arrays in ascending order from lowest to highest value. Main Program: [6] for Program setup, and [10] for Sort Subroutine. Use the following values for the array elements. If the values in the skeleton code are different use these values. ARYI: (10, 34, -18, 87, -65, 28, -15,-49, 61, -77,45), ARY2: (10, 90, 46, 16, -55, -39, 32, 38, 12, 54, 23) 14 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: ARYIS: ARY2S: Grade: 12 Your Sorting lab starts here Memory allocation of Arrays must be done before the RESET and StopwDT ARY1 ex0200 Memory allocation ARY1 ARVES exa210 Memory allocation ARYS ARYZ ex220 Memory allocation ARY ARYS exe23e Memory allocation AR25 ;clearing all register being use is a good programming practice HARY initialize R4 as a pointer to array #ARYS, R6 initialize 84 as a pointer to arrayl sorted Arraysetup..then call subroutine ArraySetup #COPY Copy elements from ARY1 to ARYS Space #SORT Sore elementi ARAYI call , call CA 11 CN11 ARY2 R inti R apointer to array2 FARY2S, R6 as a pointer to array2 sorted ArraySetup2; then call subroutine ArraySetup COPY copy Blements from ARY2 ARY2S space SORT Sort elements in ARAY2 Mainloop imp Mainloop Infinite Loop ArraySetupi mov.b 010, (R4) 2 . 1(R4) 2(R4 Array element initialization Subroutine First start with the number of elements and then 111 in the 1e elements. mov.b ArraySetup2 te Arraysetup! ubroutine COPY copy original array to allocated Array Sorced space hiran Your Sorting lab ends hers at by CDA3331C Intro to Microcomputers Lab Assignment main main RS/ Name: Grade: /20 [20] 2) The program of this exercise 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-v12-A-skl) available on Canvas. [16] 2.a) Complete this MSP430 assembly language program where the SORTI section sets the R4/RS/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, R6 holds the starting location of the sorted array. COPY subroutine copies the contents of array ARY! into ARYIS. SORT subroutine sorts the elements on ARYIS in place. SORT2 section is similar to SORTI above using same registers. Arrays are in decimal notation! Sort Arrays in ascending order from lowest to highest value. Main Program: [6] for Program setup, and [10] for Sort Subroutine. Use the following values for the array elements. If the values in the skeleton code are different use these values. ARYI: (10, 34, -18, 87, -65, 28, -15,-49, 61, -77,45), ARY2: (10, 90, 46, 16, -55, -39, 32, 38, 12, 54, 23) 14 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: ARYIS: ARY2S: Grade: 12 Your Sorting lab starts here Memory allocation of Arrays must be done before the RESET and StopwDT ARY1 ex0200 Memory allocation ARY1 ARVES exa210 Memory allocation ARYS ARYZ ex220 Memory allocation ARY ARYS exe23e Memory allocation AR25 ;clearing all register being use is a good programming practice HARY initialize R4 as a pointer to array #ARYS, R6 initialize 84 as a pointer to arrayl sorted Arraysetup..then call subroutine ArraySetup #COPY Copy elements from ARY1 to ARYS Space #SORT Sore elementi ARAYI call , call CA 11 CN11 ARY2 R inti R apointer to array2 FARY2S, R6 as a pointer to array2 sorted ArraySetup2; then call subroutine ArraySetup COPY copy Blements from ARY2 ARY2S space SORT Sort elements in ARAY2 Mainloop imp Mainloop Infinite Loop ArraySetupi mov.b 010, (R4) 2 . 1(R4) 2(R4 Array element initialization Subroutine First start with the number of elements and then 111 in the 1e elements. mov.b ArraySetup2 te Arraysetup! ubroutine COPY copy original array to allocated Array Sorced space hiran Your Sorting lab ends hers
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