In: Computer Science
Understanding Assembly Language. For each problem, show the contents or setting of the requested items after executing the instructions.
mov eax, 0FFFFFBFDh ; i.e., -1027
mov ebx, -16 ; i.e., FFFFFFF0h
mov edx, 0
idiv bl
Show the hexadecimal digits in eax:_______________
Show the hexadecimal digits in edx:_______________
mov eax, 0FFFFFBFDh ; i.e., -1027
mov ebx, -16 ; i.e., FFFFFFF0h
mov edx, 0
cwd
idiv bx
Show the hexadecimal digits in eax:_______________
Show the hexadecimal digits in edx:_______________
mov eax, 0FFFFFBFDh ; i.e., -1027
mov ebx, -16 ; i.e., FFFFFFF0h
mov edx, 0
cdq
idiv ebx
Show the hexadecimal digits in eax:_______________
Show the hexadecimal digits in edx:_______________
mov eax, 0FFFFFBFDh ; i.e., -1027 => eax = 0xFFFFFBFD => ax = 0xFBFD
mov ebx, -16; i.e., FFFFFFF0h => ebx = 0xFFFFFFF0 => bl = 0xF0
mov edx, 0 => edx = 0x00000000
idiv bl =>
=> al = ax/bl = 0xFBFD / 0xF0 = 0x40
=> ah = ax%bl = 0xFBFD % 0xF0 = 0x03
Show the hexadecimal digits in eax: 0xFFFF0340
Show the hexadecimal digits in edx: 0x00000000
mov eax, 0FFFFFBFDh ; i.e., -1027 => eax = 0xFFFFFBFD => ax = 0xFBFD
mov ebx, -16 ; i.e., FFFFFFF0h => ebx = 0xFFFFFFF0 => bx = 0xFFF0
mov edx, 0 => edx = 0x00000000
cwd => Sign Extend AX into DX => dx:ax = 0xFFFFFBFD
idiv bx =>
=> ax = dx:ax/bx = 0xFFFFFBFD / 0xFFF0 = 0x0040
=> dx = dx:ax%bx = 0xFFFFFBFD % 0xFFF0 = 0x0003
Show the hexadecimal digits in eax: 0xFFFF0040
Show the hexadecimal digits in edx: 0x00000003
mov eax, 0FFFFFBFDh ; i.e., -1027 => eax = 0xFFFFFBFD
mov ebx, -16; i.e., FFFFFFF0h => ebx = 0xFFFFFFF0
mov edx, 0 => edx = 0x00000000
cdq => Sign Extend eax into edx => edx:eax = 0x00000000FFFFFBFD
idiv ebx =>
=> eax = edx:eax/ebx = 0x00000000FFFFFBFD / 0xFFFFFFF0 = 0x00000040
=> edx = edx:eax%ebx = 0x00000000FFFFFBFD % 0xFFFFFFF0 = 0x00000003
Show the hexadecimal digits in eax: 0x00000040
Show the hexadecimal digits in edx: 0x00000003