What is the Machine language equivalent for the following Assembly language inst
ID: 3912154 • Letter: W
Question
What is the Machine language equivalent for the following Assembly language instructions? Assume Figures 6.5 and 6.13 below.
DECREMENT X
COMPARE Y
FIGURE 6.5 FIGURE 6.13 Binary Op Code Operation LOAD X STORE X CLEARX ADD X INCREMENT X SUBTRACT X DECREMENT X COMPAREX Instruction Format: Op Code 4 bits Address 12 bits Meaning R ? CON(X) 0-CONÇX Object Program: 0010 Machine Language Instruction 1101 000000001001 1101 000000001010 0000 000000001001 0111 000000001010 1001 000000000111 1110 000000001001 1000 1110 000000001010 ess Meaning 0100 0101 0110 0111 CON(X) + 1 ? CON(X) 0010 LOAD X COMPARE Y JUMPGT DONE OUTX JUMP LOOP OUT Y CON(X)-1-CONCX) if CONCX)> R then GT 1 else 0 if CON(X) = R then EQ = 1 else? if CON(X)Explanation / Answer
To write the machine language instructions corresponding to these first try to identify the operation code opcode that has to be used to perform the given operation. From the figure 1 we can easily find out these binary opcodes for some instructions given.
Now from the second figure where a sample code is given we get idea that the machine instruction is written by first writing the 4 bit opcode and then following it with 12 bit memory address where the operation has to be performed.
Now in the figure 2 references of X and Y are used for the memory addresses 000000001001 and 0000000001010 respectively. And the memory addresses used in given questions are also same so we can replace them with these references in writing assembly language code.
DECREMENT X :
0110 000000001001
COMPARE Y:
0111 000000001010
Hope this helps
please upvote
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.