2. What will be the value in EDX after each of the lines marked (a) and (b) execute? .data one WORD 8002h two WORD 4321h .code mov edx,21348041h movsx edx,one ; (a) movsx edx,two ; (b)
Question
- What will be the value in EDX after each of the lines marked (a) and (b) execute? .data one WORD 8002h two WORD 4321h .code mov edx,21348041h movsx edx,one ; (a) movsx edx,two ; (b)
Solution
The movsx instruction sign-extends the source operand to the size of the destination operand. It fills the upper half of the destination with the most significant bit of the source, effectively extending the sign bit.
Here's what happens after each line:
(a) movsx edx,one
The value of one is 8002h (or 32770 in decimal). This is a positive number, so the sign bit is 0. Therefore, EDX will be filled with the value 00008002h.
(b) movsx edx,two
The value of two is 4321h (or 17185 in decimal). This is also a positive number, so the sign bit is 0. Therefore, EDX will be filled with the value 00004321h.
Similar Questions
. 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
What will be the value in EAX after the following lines execute?mov eax, 1002FFFFhneg ax
What will be the value in EAX after the following lines execute?mov eax, 30020000hdec ax
Given that general purpose register $1 has the value 10 in it, and $2 has the value 6, whichone of the following lines results in the value 26 being stored in $2?a. addi $1, $2, 10b. addi $1, $2, 0x10c. addi $2, $1, 10d. addi $2, $1, 0x10
3)Next, line 22 executes. What is the new value of casablanca.value?CheckShow answer4)Next, line 23 executes. What is the value of result1?CheckShow answer5)Next, line 24 executes. What is the value of result2?
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.