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 R refers to the CPU register R R refers to the CPU
register R and Array is an array of byte values allocated in memory.
R
for R; R; R
R R ArrayR
a
Write an assembly language code fragment to implement the loop expression as follows.
Use a conditional branch instruction, ie Bcond for loop control.
Use indexed mode addressing to access the array: RBase RIndex Use one register to hold the base, ie 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, ie Bcond for loop control.
Use displacement mode addressing to access the array, where the displacement is
such that there is effectively register indirect mode addressing: RIndirect # 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
