Question: Convert the given code fragment to assembly code fragment, using only instructions of the following types. These instructions are generally discussed in class. Here X,Y,Z

Convert the given code fragment to assembly code fragment,

using only instructions of the following types.

These instructions are generally discussed in class. Here X,Y,Z are any memory locations; R, R1, R2 are any general registers; L is a label in the code (you can use any names as labels, ex. L, L1, L2 etc. ).

load X, R //copy contents of memory location X into R.

store R, X //Store contents of R into Mem location X

cmp R1, R2 //Compute R1-R2 and update condition codes;

//throw away result of subtraction.

jmp L //Jump to location L in the code.

jmpp L //If P bit is 1, Jump to location L in the code

add X, R //Add contents of X,R and store result in R;

//Also update the condition codes.

Be careful about what type of argument is allowed in the instruction (Memory or Register).

Do Not use any other instructions (in this, or some other, assembly language).

I cannot get into syntax and semantics of your assembly language or its presumed cpu architecture.

So follow the instructions in the question.

The code segment:

while ((X < Y) AND (Y < Z)) X = X + Z;

L:

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!