Values That Are Saved In The Respective Register After Executing

0

QUESTION: Fill the gaps with the values that are saved in the respective register after executing the respective line. Enter all values in hexadecimal and in 32 bits.

MY THINKING: I'm new at Assembly. I know that values like EAX, EBX, ECX, EDX, ESI, EDI, ESP, or EBP are for any 32-bit register. Or the values like AX, BX, CX, or DX are for any 16-bit register. I've read that xor eax, eax — set the contents of EAX to zero. That means that the first gap is 0x00000000, right? Second gap copies the 0x12345678 into eax. That means eax = 0x12345678. 3rd gap should be 0x00000000 too, because 0 copies the value into ebx? And for other gaps I could not find anything.

xor eax, eax           ; eax = 0x00000000 (Gap 1)
mov eax, 0x12345678    ; eax = 0x12345678 (Gap 2)
mov ebx, 0
mov bx, ax             ; ebx = 0x00005678 (Gap 3)
mov bl, ah             ; ebx = 0x00005656 (Gap 4)
mov eax, 0xFFFFFFFF   
sar eax, 8             ; eax = 0xFFFFFFFF (Gap 5)
shr eax, 8             ; eax = 0x00000000 (Gap 6)
sar eax, 8             ; eax = 0x00000000 (Gap 7)
ror eax, 8             ; eax = 0x00000000 (Gap 8)
assembly
x86
cpu-registers
asked on Stack Overflow Mar 29, 2020 by certi • edited Mar 29, 2020 by certi

1 Answer

0
mov eax, 0x12345678    ; eax = 0x12345678 (Gap 2)
mov ebx, 0
mov bx, ax             ; ebx = 0x00005678 (Gap 3)
mov bl, ah             ; ebx = 0x00005656 (Gap 4)
mov eax, 0xFFFFFFFF   
sar eax, 8             ; eax = 0xFFFFFFFF (Gap 5)
shr eax, 8             ; eax = 0x00FFFFFF (Gap 6)
sar eax, 8             ; eax = 0x0000FFFF(Gap 7)
ror eax, 8             ; eax = 0xFF0000FF(Gap 8)

I think I got it.

answered on Stack Overflow Mar 29, 2020 by certi

User contributions licensed under CC BY-SA 3.0