Question: [Comp Architecture w/ Assembly] Using this array: threeints: .word 5, 255, -5 Write a program which uses branching instructions to rearrange the values of threeints
[Comp Architecture w/ Assembly] Using this array:
threeints: .word 5, 255, -5
Write a program which uses branching instructions to rearrange the values of threeints such that:
the smallest value of threeints is placed into the memory location of threeintss first element
the second smallest value of threeints is placed into the memory location of threeintss second element
the largest value of threeints is placed to the memory location of threeintss third element
Branching instructions should be used to implement the following high level if conditional logic:
if the first element is greater than the third element
take the original value in the memory location of threeints first element and place it into a register
take the original value in the memory location of threeints third element and place it into another register
take the smallest value of threeint and place it into the memory location of threeints first element
take the original value that was in the memory location of threeints first element and place it into the memory location of threeints third element
if the second element is greater than the third element
take the value in the memory location of threeints second element and place it into a register
take the value in the memory location of threeints third element and place it into another register
take the second smallest value of threeint and place it into the memory location of threeints second element
take the original value that was in the memory location of threeints second element and place it into the memory location of threeints third element
The program should complete when threeint's smallest value is placed in the first element, threeint's second smallest value is placed in the second element, and threeint's largest value is placed in the third element.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
