Question

In: Computer Science

Each of these problems gives "before" conditions and instruction. Give the indicated "after" state. Data should...

Each of these problems gives "before" conditions and instruction. Give the indicated "after" state. Data should appear as hexadecimal values. All instructions are valid.

Before instruction executed after

1) ECX: 0A 00 BF 7A mov ECX, -127 ECX:

2) ECX: FF FF FF C8 add ch, 2 ECX:

ZF: SF: CF: OF:

3) EAX: 12 34 56 78 xchg ah, al EAX:

4) EDX: DD FF 00 01 neg dl EDX:

ZF: SF:

5) EAX: 01 00 05 45 sub ah, 11b EAX:

ZF: SF: CF: OF:

6) EAX: 00 0F 00 01 mul bx EAX:

     EBX: 11 FF 00 0A EDX:

     EDX:37 01 00 00

7) EAX: 00 00 00 1A div ECX EDX:

    EAX:00 00 00 01

    ECX: 00 00 00 0E

    EDX:00 00 00 0C

8) ECX: 0A 00 BF 7A movsx ECX, ch ECX:  

9) EAX: 0A FF BF 7A movzx ax, al EAX:

Solutions

Expert Solution

(1) Instruction mov ECX, -127 and Before ECX = 0A 00 BF 7A

Answer: ECX = FF FF FF 81 (hexadecimal)

Description:

• mov ECX, -127 ; move decimal value -127 to ECX register.

• Signed decimal value will be stored in 2's complement form.

• So, -12710 = 111111111111111111111111100000012 = FF FF FF 8116 in 2's complement form.

• Register ECX = FF FF FF 81.

(2) Instruction: add ch, 2 and Befor ECX = FF FF FF C8

Answer: ECX: FF FF 01 C8 (hexadecimal) and ZF: SF: CF: OF = 0 : 1 : 1: 0

Description:

• add ch, 2 ; Addition. Register CH = CH + 2.

• Register CH in ECX register is from bit 8 to 15.

• Here, CH = FF. Performing the addition CH = CH + 2 = FF + 2 = 01 with carry = 1.

• Register ECX = FF FF 01 C8.

• It will set the carry flag and the sign flag.

• Carry Flag = 1 and Sign Flag = 1

(3) Instruction xchg ah, al and Before EAX: 12 34 56 78

Answer: EAX = 12 34 78 56

Description:

• xchg ah, al ; Exchange the content of the registers. Put AH in AL and AL in AH register.

• Before register AH = 56 and AL = 78. After executing the exchange instruction, AH = 78 and AL = 56. So, register EAX = 12 34 78 56.

(4) Instruction neg dl and Before EDX: DD FF 00 01

Answer: EDX = DD FF 00 FF and ZF : SF = 0 : 1

Description:

• neg dl ; Two's Complement Negation.  

• This instruction multiplies the operand by -1. That means it makes the positive value to negative and negative value to positive value.

• Here, DL = 01. After the instruction, DL = FF (2's complement form of -1) and Sign flag = 1.

• EDX = DD FF 00 FF

(5) Instruction sub ah, 11b and Before EAX: 01 00 05 45

Answer: EAX = 01 00 02 45 and ZF: SF: CF: OF = 0 : 0 : 0 : 0

Description:

• sub ah, 11b ; Subtract. AH = AH - 11(binary)

• Before AH = 05. Performing the subtraction AH = 05 = 0000 0101 - 0000 0011 = 0000 0011.

• EAX = 01 00 02 45

• Flags will be not affected by provided instruction.

(6) Instruction mul bx and Before EBX: 11 FF 00 0A, EAX: 00 0F 00 01, EDX:37 01 00 00

Answer: EAX = 00 0F 00 0A

Description:

• mul bx ; Multiplication. Multiply BX with AX register. AX * BX = DX : AX.

• Here, AX = 00 01 and BX = 00 0A. Performing the multiplication AX * BX = 00 01 * 00 0A = 00 0A.

• So, the Register AX = 00 0A

• Register EAX = 00 0F 00 0A.

(7) Instruction div ECX and Before EAX: 00 00 00 1A,   ECX: 00 00 00 0E,   EDX : 00 00 00 0C

Answer:  EDX = 00 00 00 0C and EAX = 00 00 00 01

Description:

• div ECX; Division. Divide the ECX from the EAX register.

• EDX: EAX / ECX = Quotient in EAX and Remainder in EDX.

• Dividing 00 00 00 1A / 00 00 00 0E = EAX: 00 00 00 01 and EDX: 00 00 00 0C.

• So, EAX = 00 00 00 01.

  

     

(8) Instruction movsx ECX, ch and Before ECX: 0A 00 BF 7A

Answer: ECX = FF FF BF 7A

Description:

• movsx ECX, ch; Move with sign extension. Destination = sign-extended (source)

• Moves the source operand to destination operand with extending sign bit from 16 to 32 bit.

• Here, CH = BF. Move the value of CH to ECX and copy the sign bit = 1 from 16 to 32 bit.

• Register ECX = 1111 1111 1111 1111 1011 1111 0111 1010 = FF FF BF 7A.

(9) Instruction movzx ax, al and Before EAX: 0A FF BF 7A

Answer: EAX = 0A FF 00 7A

Description:  

• movzx ax, al ; Move with zero extension. Destination = zero-extended (source)

• Moves the source operand to destination operand with extending zero from 15 to 8 bit.

• Here, AL = 7A. Move the value of AL to AX and copy the zero from 15 to 8 bit.

• Register EAX =0000 1010 1111 1111 0000 0000 0111 1010 = 0A FF 00 7A


Related Solutions

PLEASE CLEARLY STATE AND ANSWER EACH QUESTION ( 1THROUGH 6) The following data gives the selling...
PLEASE CLEARLY STATE AND ANSWER EACH QUESTION ( 1THROUGH 6) The following data gives the selling price, square footage, number of bedrooms, and age (in years) of condominiums that were sold in a neighborhood in the Bronx in the past six months Selling Price Square Footage No. of Bedrooms Age of Condo 64000 1670 2 30 59000 1339 2 25 61500 1712 3 30 79000 1840 3 40 87500 2300 3 18 92500 2234 3 30 95000 2311 3 19...
Five sophomores were given an English achievement test before and after receiving instruction in basic grammar....
Five sophomores were given an English achievement test before and after receiving instruction in basic grammar. The mean difference score is -0.40, and the estimated variance for the difference scores is 8.3. Using the .05 significance level (and five steps of hypothesis testing) is it reasonable to conclude that future students would show higher scores after instruction? Step I: -Population 1: -Population 2: - Research hypothesis: Null hypothesis: Step II: Give the characteristics of the comparison distribution -The shape is:...
Five university students were given an English achievement test before and after receiving instruction in basic...
Five university students were given an English achievement test before and after receiving instruction in basic grammar. Their scores are shown below: Student Before After A 20 18 B 18 22 C 17 15 D 16 17 E 12 9 Should we conclude that future students would show higher scores after instruction? Use the .05 significance level. Use hypothesis testing.
One group of 5 sophomores were given and English achievement test before and after receiving instruction...
One group of 5 sophomores were given and English achievement test before and after receiving instruction in basic grammar. Is it reasonable to conclude that future students would show higher scores after instruction? Test with α = .05, one tail. Copy the following data to a sheet of paper and calculate the SS and other quantities needed. 1.Calculate the variance of the difference column 2. calculate the standard error 3. enter the degrees of freedom 4. Enter the tabled critical...
Determine how much is in each account on the basis of the indicated compounding after the...
Determine how much is in each account on the basis of the indicated compounding after the specified years have passed; P is the initial principal, and r is the annual rate given as a percent. (Round your answers to the nearest cent.) after one year where P = $7100 and r = 8.8% (a) compounded annually $________ (b) compounded quarterly $_______ (c) compounded monthly $_______ (d) compounded weekly $_______ (e) compounded daily $________
Use Excel to test. For each paired difference, compute After – Before. In Data Analysis, t-Test:...
Use Excel to test. For each paired difference, compute After – Before. In Data Analysis, t-Test: Paired Two Sample for means, select the After data for Variable 1 Range. Note that the critical value output by Data Analysis for this test is always positive. In this problem, the sign of the critical value is negative corresponding to 1-tailed test with lower reject region and negative lower critical value.                Person   Before   After    1   176   164   ...
For each of the problems that ask if there is a significant difference, state a null...
For each of the problems that ask if there is a significant difference, state a null hypothesis for that problem. Assume that P<0.05 is statistically significant. Sixteen students recently measured the sodium concentration in their sera with the NOVA 5 Analyzer and with the Roche c311 Analyzer. Student           NOVA 5         c311      1                      139             137      2                      142             144      3                      141             137      4                      139             139      5                      144             139      6                      147            ...
In this exercise, find the values of the unknown constants so that the indicated conditions are met for each function:
In this exercise, find the values of the unknown constants so that the indicated conditions are met for each function: (a) f(t) = At2 + B; given f(0) = 2 and f(−2) = −10. (b) f(t) = Ct3 + D; given f(0) = −5 and f(3) = 49. (c) f(t) = A t 2 + B , given f(0) = 3 and f(−2) = 1.5 (d) f(t) = A t + B , given f(2) = 0.4 and f(8) =...
*Should causality be assessed before or after evaluating validity? Why?    *At the completion of a...
*Should causality be assessed before or after evaluating validity? Why?    *At the completion of a study, a statistical test was performed and a P value of .02 was obtained. State the meaning of this P value. Are these results statistically significant? Why?
Please make sure to give practice problems for each given scenario in the quantitative problems and...
Please make sure to give practice problems for each given scenario in the quantitative problems and to explain the qualitative problems, thoroughly. The final exam is this Friday so please answer ASAP. Quantitative problems 1. Circuit with capacitors and resistor (charging and discharging), and/or an inductor and a resistor. 2. Kirchhoff problem. 3. Force and maybe torque on a wire in a magnetic field. 4. AC circuit problem with transformers, root mean square quantities, and power. 5. AC circuits problem...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT