Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. What will be the value in EAX after the following lines execute? mov eax, 100

ID: 3564615 • Letter: 1

Question

1. What will be the value in EAX after the following lines execute?

mov eax, 1002FFFFh

inc ax

2. What will be the value in EAX after the following lines execute?

mov eax, 1002FFFFh

neg ax

3. What will be the value of EAX and the Sign flag after the following lines execute?

mov eax, 5

sub eax, 6

4. What value will RAX contain after the following instruction executes?

mov rax, 44445555h

5. What value will EAX contain after the following instructions execute?

.data

dVal DWORD 12345678h

.code

mov ax, 3

mov WORD PTR dVal+2, ax

mov eax, dVal

6. For each of the following statements, state whether or not the instruction is valid:

a. mov ax, var1?

b. mov ax, var2

c. mov eax, var3

d. mov var2, var3

e. movzx ax, var2

f. movzx var2, al

7. What will be the value of the destination operand after each of the following instructions execute in sequence?

mov ax, var2 ; a.

mov ax, [var2+4] ; b.

mov ax, var3 ; c.

mov ax, [var3-2] ; d.

If you could also please provide explanations of the answers it would be appreciated. The books examples, if they exist at all, are not explanatory at all.

Explanation / Answer

1. What will be the value in EAX after the following lines execute?

mov eax, 1002FFFFh ; move into eax the hex value 1002FFFF little indian: FFFF2001

inc ax ; ax gets the least significant 16 bits of eax, so increment those 16 bits by 1: answer: 10020000 (All the F's go to 0 and the Auxillar Carry flag is set

2. What will be the value in EAX after the following lines execute?

mov eax, 1002FFFFh ; same as before

neg ax ; negates (returns two's compliment) of the least sig 16 bits, so: answer: 10020001 littleendian: 10002001

3. What will be the value of EAX and the Sign flag after the following lines execute?

mov eax, 5 ; move the value 5 into eax

sub eax, 6 ; subtract 6 from 5. This results in a negative answer, so the number is converted to two's compliment: answer: FFFFFFFF

4. What value will RAX contain after the following instruction executes?

mov rax, 44445555h ; rax is for 64-bit processors. It includes the full 64-bit space, eax is the 32bit, ax is the 16, and so on. answer: 0000000044445555 or littleendian: 5555444400000000

5. What value will EAX contain after the following instructions execute?

.data

dVal DWORD 12345678h

.code

mov ax, 3

mov WORD PTR dVal+2, ax //Moves one word selection (16 bytes) offset 2, so moves 1234h and stores in dVal

mov eax, dVal ; move value of dVal into eax; so answer = 00001234 littleendian: 12340000

6. For each of the following statements, state whether or not the instruction is valid:

a. mov ax, var1? invalid

b. mov ax, var2 valid

c. mov eax, var3 valid

d. mov var2, var3 invalid

e. movzx ax, var2 valid

f. movzx var2, al invalid

7. What will be the value of the destination operand after each of the following instructions execute in sequence?

mov ax, var2 ; a. var2

mov ax, [var2+4] ; b. 4th byte of var2

mov ax, var3 ; c. var3

mov ax, [var3-2] ; d. -2 memory byte offset of var3