Question: 2. (15 points) An array called ARRAY1 has 200 longword-sized positive numbers, and is stored in memory at addresses starting from 0x00010000. The numbers are

 2. (15 points) An array called ARRAY1 has 200 longword-sized positive

2. (15 points) An array called ARRAY1 has 200 longword-sized positive numbers, and is stored in memory at addresses starting from 0x00010000. The numbers are supposed to be ot larger than 100 (100 in decimal) and not smaller than 201o (20 in decimal). Write a program to examine each of the 200 numbers in ARRAY1 as follows. First, if a number is out of range (i.e. larger than 100 or smaller than 20 in decimal), the number is skipped, and the program is to continue to examine the next number. If a number is within the range and is an even number, it is to be included to an array that starts in memory at address 0x00020000. In other words, the first within-the-range and even number should be copied to memory locations starting from address 0x00020000, and the second within- the-range and even number should be copied to memory locations starting from address 0x00020004, If a number is within the range and is an odd number, it is to be included to an array that starts in memory at address 0x00030000. Hint: Use separate address registers to point to the three arrays. Hint: If the least significant bit of a number (in binary) is 0, then the number is an even number if the least significant bit of a number (in binary) is 1, then the number is an odd number. To determine whether a number is even or odd, you can use either of the following two methods: 1) use ASR to shift the least significant bit to C bi in CCR, and use a conditional branch with condition on C; 2) use AND operation to clear bis -31 of the number, and then compare the result with value 1 2. (15 points) An array called ARRAY1 has 200 longword-sized positive numbers, and is stored in memory at addresses starting from 0x00010000. The numbers are supposed to be ot larger than 100 (100 in decimal) and not smaller than 201o (20 in decimal). Write a program to examine each of the 200 numbers in ARRAY1 as follows. First, if a number is out of range (i.e. larger than 100 or smaller than 20 in decimal), the number is skipped, and the program is to continue to examine the next number. If a number is within the range and is an even number, it is to be included to an array that starts in memory at address 0x00020000. In other words, the first within-the-range and even number should be copied to memory locations starting from address 0x00020000, and the second within- the-range and even number should be copied to memory locations starting from address 0x00020004, If a number is within the range and is an odd number, it is to be included to an array that starts in memory at address 0x00030000. Hint: Use separate address registers to point to the three arrays. Hint: If the least significant bit of a number (in binary) is 0, then the number is an even number if the least significant bit of a number (in binary) is 1, then the number is an odd number. To determine whether a number is even or odd, you can use either of the following two methods: 1) use ASR to shift the least significant bit to C bi in CCR, and use a conditional branch with condition on C; 2) use AND operation to clear bis -31 of the number, and then compare the result with value 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!