Question

For each part of this problem, assume the before values when the given instruction is executed. Give the requested after values. (The operand are word size to reduce the number of pairs of bits to combine.) (6 points) After Before Instruction AX: AX: FA 75 or ax, 0fff0h. SF: ZF: AX: FA 75 test ax, 0004h AX: SF: ZF: Xor dx 64C8h DX: B6 A3 DX: SF: ZF: 8 B5 Sal ax, cl AUX: CL: 04 CF: AX: AX: A8 E35 rcr ax, 1 CF: CF: 0 BAA sar bx, 3 BX: 8E BX: CF:

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a)

   or instruction will make bitwise OR operation between the 2 operands

   given ax is FA 75 and next operand is fff0

   ax in binary is 1111 1010 0111 0101

   fff0 in binary is 1111 1111 1111 0000

   Hence or operation of the both operands is 1111 1010 0111 0000

   which is FA70 in hexa decimal

   Hence After execution of the instruction

   AX : FA70h

   SF : 1 (as the MSB of the result is 1 it indicates negative number)

   ZF : 0 (as the result is non zero)

b)

   TEST instruction performs a bitwise AND on two operands

   it sets the flags CF and OF to zero, SF is set to the most significant bit of the result

   If the result is 0, the ZF is set to 1

   given ax is FA 75 and next operand is 0004

      ax in binary is 1111 1010 0111 0101

   0004 in binary is 0000 0000 0000 0100

   Hence and operation of the both operands is 0000 0000 0000 0100

   which is 0004 in hexa decimal

   Hence After execution of the instruction

   AX : 0004h

   SF : 0 (as the MSB of the result is 0 it indicates positive number)

   ZF : 0 (as the result is non zero)

c)

   xor instruction performs a bitwise XOR on two operands

   given dx is B6 A3 and next operand is 64C8

      dx in binary is 1011 0110 1010 0011

   64C8 in binary is 0110 0100 1100 1000

   Hence xor operation of the both operands is 1101 0010 0110 1011

   which is D26B in hexa decimal

   Hence After execution of the instruction

   AX : D26Bh

   SF : 1 (as the MSB of the result is 1 it indicates negative number)

   ZF : 0 (as the result is non zero)

d)

   sal instruction performs shift arithimetic left on two operands

   it will shift left by the number of bit positions equal to count and fill the vacted bit positions

   on the right with 0's

   given ax is A8 B5 and cl is 04 which means we have to shift A8 B5 by 4 positions left

   ax in binary is 1010 1000 1011 0101

   after shifting by 4 positions to left

   ax will be 1000 1011 0101 0000

   which is 8B50 in hexa decimal

   Hence After execution of the instruction

   AX : 8B50

   CF : 0 (as the 4th bit shifted to the left in AX is 0 (in the nibble 1010))

e)

   rcr instruction performs rotate right through carry on two operands

   given ax is A8 B5 and count is 01 which means we have to rotate A8 B5 by 1 position right through carry.

   ax in binary is 1010 1000 1011 0101

   after rotating A8 B5 by 1 position right through carry.

   ax will be 0101 0100 0101 1010

   which is 545A in hexa decimal

   Hence After execution of the instruction

   AX : 545A

   CF : 1 (as the 1st bit rotated to the right in AX is 1)

f)

   sar instruction performs shift arithimetic right on two operands

   it will shift right by the number of bit positions equal to count and fill the vacted bit positions

   on the left with 0's

   given BX is 8E BA and cl is 03 which means we have to shift 8E BA by 3 positions right

   BX in binary is 1000 1110 1011 1010

   after shifting by 3 positions to right

bx will be 0001 0001 1101 0111

   which is 11D7 in hexa decimal

   Hence After execution of the instruction

   BX : 11D7

   CF : 0 (as the 3rdbit shifted to the right in BX is 0 )

Add a comment
Know the answer?
Add Answer to:
For each part of this problem, assume the "before" values when the given instruction is executed....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 12. For each instruction in this question, assume that register contains the given contents before the...

    12. For each instruction in this question, assume that register contains the given contents before the instruction is executed. All values are Hex, Contents of the register (Before) al-coh Contents of the register (After) Instruction ZF CF OF SF | add al, 40h ;assume values are unsigned Int | add bh, 9Ah ;assume values are signed Int | add cl, 52h ;assume values are signed Int | add bh, 01h ;assume values are bh=66h cl=40h bh= the value from unsigned...

  • Moving to another question will save is response. Question 4 Assume that before the instruction is...

    Moving to another question will save is response. Question 4 Assume that before the instruction is executed, the flags are CF=1, ZF=1 and SF=1 and the Registers have the values AL=OXAF, BL=0x75 CL=0x48 and DL=OXEA. What are the values of the flags after the instruction ADD AL, OxF4 executes? CF = ZF = SF = A Moving to another question will save this response.

  • b. A microprocessor has an instruction set that consists of 117 instructions, which need fetch, decode, read operand, execute, write and interrupt stages. Assume that as an average, each stage requir...

    b. A microprocessor has an instruction set that consists of 117 instructions, which need fetch, decode, read operand, execute, write and interrupt stages. Assume that as an average, each stage requires three micro- operations to complete. Also, assume that the control memory is N bits wide (i.e., control field bits + address selection field bits + address-one bits + address-two bits N bits). The control field bits are 15 and there are 15 flags to be monitored. i. How many...

  • Answer as soon as impossible .. before 30 mins please 1. State which one instruction (OSR,...

    Answer as soon as impossible .. before 30 mins please 1. State which one instruction (OSR, LIM, FFU,LPU, S00, TND, NEQ. SBR, RET) is best suited to the application shown Make a subroutine stop running and return control to the routine that called b)Store a group of 8 binary bits by moving bits in one at a timae )Determine if a number is outside of a specitied range d.) Remove the most recenty added word of data from a register...

  • 1. Assume that you are given values in eax, ebx, ecx. Write an assembly code that...

    1. Assume that you are given values in eax, ebx, ecx. Write an assembly code that does the following: eax = (ecx + edx ) - (eax + ebx) 2. Write a piece of code that copies the number inside al to ch. Example: Assume that Initially eax = 0x15DBCB19. At the end of your code ecx = 0x00001900. Your code must be as efficient as possible. 3. You are given eax = 0x5. Write one line of code in...

  • Anyone explain to (i), (ii) How can we get the instruction words and R8=?[hex]? (i) instruction...

    Anyone explain to (i), (ii) How can we get the instruction words and R8=?[hex]? (i) instruction words[hex] is 0x4508, and R8= 0xF002 How can I get that? (ii) instruction words[hex] is 0x4548 and R8=0x0002 How can I get that? Consider the following instructions given in the table below. For each instruction determine its length (in words), the instruction words (in hexadecimal), source operand addressing mode, and the content of register R7 after execution of each instruction. Fill in the empty...

  • Problem: On an ARM processor using big endian format, given the following memory map and [R1]...

    Problem: On an ARM processor using big endian format, given the following memory map and [R1] = 0xA10E0C2D, [R2] = 0x00000060, [R3] = 0x00000002, [R4] = 0x0000000C, predict [R1] and [R2] and draw the updated memory map after an ARM data transfer instruction is executed in EACH case. (hint: (1) in this map, each memory location is a word long and occupies 4 bytes; also you only need to draw the section of the memory including the changed word and...

  • Problem: On an ARM processor using big endian format, given the following memory map and [R1]...

    Problem: On an ARM processor using big endian format, given the following memory map and [R1] = 0xA10E0C2D, [R2] = 0x00000060, [R3] = 0x00000002, [R4] = 0x0000000C, predict [R1] and [R2] and draw the updated memory map after an ARM data transfer instruction is executed in EACH case. (hint: (1) in this map, each memory location is a word long and occupies 4 bytes; also you only need to draw the section of the memory including the changed word and...

  • D Question 3 12 pts (Important: For this problem, assume that the right-most cell is the low-orde...

    D Question 3 12 pts (Important: For this problem, assume that the right-most cell is the low-order value) Assume before the operation the two XMM registers containing the following values XMMO XMMO0 XMM01 XMM02 XMMO3 4.115 -5.65 3.275 2.7 XMM1 ХММ 10 ХММ 11|XMM12XMM13 8.25 15.75 -3.0 22.2 Now suppose the following command is executed: subss xmmO, xmm1 What values will be in XMMO after the instruction finished execution? Answer in decimal. XMM00: XMM01: XMM02: XMM03: D Question 3 12...

  • swers. You may assume that every ce. Questions that ask for a best or maximal/minimal For...

    swers. You may assume that every ce. Questions that ask for a best or maximal/minimal For questions 1 through 20, circle ALL correct an question has at least one correct choi an swer always have only one correct answer. Partial credit may be given if your selected answers are sufficiently close to the correct response. This section is worth 40 points. Make sure to put your name on each sheet. Suppose you are to encode a two-address instruction with 8...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT