Lab 5: Common Instructions
Overview
The purpose of this lab is to practice analyzing some common assembly instructions.
Part 1: Arithmetic Instructions
For this exercise, assume the following:
- The value in the
EAX
register is0x00001337
- The value in the
ECX
register is0xFFFFFFFF
- All values are 32 bits
Assume the values do not hold across each question. (Basically the values are reset for each question).
Question 1.1
What will be the value in EAX, after the following instruction?
add eax, 0xFFFF0000
Answer
0xFFFF1337
Question 1.2
What will be the value in the EAX and ECX registers, after the following instructions?
sub ecx, 0x15
add ecx, eax
inc eax
Answer
EAX
:0x1338
ECX
:0x1321
(Note: it overflowed, so this is what is in theECX
register)
Question 1.3
What is the binary representation of the number 0x0000061B
?
Answer
11000011011
Question 1.4
What is the 32-bit hexadecimal representation of the value -1563
?
Answer
0xFFFFF9E5
Question 1.5
What is the decimal representation of 0xFFFF7867
as an unsigned value?
Answer
4294932583
Question 1.6
What is the decimal representation of 0xFFFF7867
as a signed value?
Answer
-34713
Part 2: Bitwise Instructions
For this exercise, assume the following:
- The value in the
EAX
register is0xA5A50000
- The value in the
ECX
register is0xFFFFFFFF
- All values are 32 bits
Assume the values do not hold across each question. (Basically the values are reset for each question).
Question 2.1
What will be the value in the EAX
register after the following instruction?
and eax, 0x00FF00FF
Answer
0x00A50000
Question 2.2
What will be the value in the EAX
and ECX
registers, after the following
instructions?
xor eax, ecx
not ecx
Answer
EAX
:0x5A5AFFFF
ECX
:0x00000000
Question 2.3
What will be the value in the EAX
and ECX
registers, after the following
instructions?
neg ecx
not eax
xor eax, 0xFFFFFFFF
Answer
EAX
:0xA5A50000
ECX
:0x00000001