After the following MASM code is executed:
MOV EAX, 212 MOV EBX, 19 CDQ DIV EBX
What is the value in the EAX register (in decimal)?
What is the value in the EBX register (in decimal)?
What is the value in the EDX register (in decimal)?
Please up vote ,comment if any query .
Answer :
EAX =11
EBX = 19
EDX = 3
Explanation :
MOV EAX ,212 ; this instruction copy value 212 immediate value into EAX register EAX = 212
MOV EBX ,19 ; This instruction copy immediate value 19 into EBX register EBX = 19
CDQ ; this instruction convert 32 bit EAX to 64 bit EDX : EAX by copying sign bit (bit 31 ) of EAX to every bit position 0 to 31 of EDX
Suppose sign bit bit 31 is 1 of eax register so edx
EDX = FFFFFFFFh
In our program
EAX = 212 0000 0000 0000 0000 0000 0000 1101 0100 in binary
Sign bit is 0 of eax register
EDX = 00000000h
EDX : EAX = 00000000h : 000000D4 h
Next instruction
DIV EBX
this instruction divide the value of EDX : EAX by EBX
EDX : EAX / EBX
Reminder in EDX
Quotient stored in EAX
212/19 quotient = 11 reminder =3
EDX = 3
EAX = 11
EBX = 19
Please upvoe . Comment if any query .
Get Answers For Free
Most questions answered within 1 hours.