Question: This problem explores two strategies for accessing the elements of an array to implement the following loop expression, where R 0 refers to the CPU

This problem explores two strategies for accessing the elements of an array to implement the
following loop expression, where R0 refers to the CPU register R0, R1 refers to the CPU
register R1, and Array is an array of byte values allocated in memory.
R0=0
for (R1=0; R1<100; R1++)
R0= R0+ Array[R1]
a.
Write an assembly language code fragment to implement the loop expression as follows.
Use a conditional branch instruction, (i.e., Bcond), for loop control.
Use indexed mode addressing to access the array: [RBase, RIndex]. Use one register to hold the base, (i.e., starting), address of each array. Use another register to hold the index of the element being accessed.
b. Write an assembly language code fragment to implement the loop expression as follows.
Use a conditional branch instruction, (i.e., Bcond) for loop control.
Use displacement mode addressing to access the array, where the displacement is 0
such that there is effectively register indirect mode addressing: [RIndirect, #0] Use one register to hold the address of the array element being acces

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 Programming Questions!