Merge two sorted arrays:
Source: Merge two sorted arrays – GeeksforGeeks 裑η Method 3
Time complexity: O(n1 + n2)
Lab 02: Requirement Description
β’ Addressing Mode Guideline video: https://www.youtube.com/watch?v=NuTuCi2JEw8 hackmd: https://hackmd.io/S9oYQa4NSBqPdQWdMRJpFQ?view
β’ Basic
Description:
Please store 0x01 at Data Memory address 0x100, and store 0x01 at Data Memory address 0x101. Next, please use at least one indirect addressing register, so that the values of the Data Memory addresses 0x102~0x108 are the sum of the values of the previous two addresses.
For example: The value of Data Memory address 0x102 is the sum of the
value of Data Memory address 0x100 and the value of Data
Memory address 0x101,
the value of Data Memory address 0x103 is the sum of the
value of Data Memory address 0x101 and the value of Data
Memory address 0x102,
and so on, until the Data memory address 0x108.
Grading Criteria:
1. The data memory address 0x100~0x108 should be 0x01, 0x01, 0x02, 0x03, 0x05, 0x08, 0x0D, 0x15, 0x22 in sequence.
2. Please use at least one indirect addressing register.
β’ Advanced (30%):
Description:
Initialize the following 9 numbers (0x0Bγ0x05γ0x40γ0x07γ0x0Dγ 0x7Fγ0x0Aγ0x01γ0xFE) at 0x010 ~ 0x018 in Data Memory. Then, implement any sorting algorithm to sort the values and store the results at 0x010 ~ 0x018 in ascending order.
Standard of grading:
1. You must make sure that the values are sorted properly (as Figure).
2. You should use at least one indirect addressing register.
Hint: The number of the values is fixed. You do not have to consider the situation when the number of the values is changed.
β’ Bonus (20%):
Description:
In Data Memory address 0x100 ~ 0x104, store an array of 5 elements in sequence 0xa1, 0xb2, 0xc3, 0xd4, 0xe5, and in Data Memory address 0x110 ~ 0x113, store another array with 4 values in sequence 0xa7, 0xb3, 0xc9, 0xf6.
Next, please merge the two arrays into the data memory address 0x120 ~ 0x128 by means of merge two sorted arrays. The merged array is an increasing array with 9 elements.
Standard of grading:
1. You need to open File Registers in the video, and display the values in the three columns of 0x100, 0x110, and 0x120 on the screen.
2. The value of column 0x120 should be 0xa1, 0xa7, 0xb2, 0xb3, 0xc3, 0xc9, 0xd4, 0xe5, 0xf6.
3. Use at least one indirect addressing register.
Merge two sorted arrays:
Source: Method 3 in Merge two sorted arrays – GeeksforGeeks
Time complexity: O(n1 + n2)






