Hello and welcome back.
In this lesson, we are going to take a look at the negate instruction.
So we have two forms: the negate the register, and also the negate the memory.
Negate reverses the sign.
So if it's negative one, it becomes positive one.
And if it's in memory, same thing.
Negative one becomes positive one, and vice versa.
And if we negate zero, it remains unchanged.
So let's open up our x64dbg and try this now.
So we put a breakpoint here, run to it, and step over until we come to this line.
Now we are going to modify the value in the - register by right-clicking it.
Click Modify Value, and we'll key in a negative one.
And click okay.
So negative one is denoted by all F's.
Now we are going to insert our instruction here.
Negate -, and then we step over.
And now we see the value in register has been negated.
It has been reversed.
Previously it was all F's, which meant negative one.
Now it became positive one.
Now let's try to negate the zero and see what happens.
So let's try to change now the value in -.
We put zero in here. Right-click, modify -.
Insert zero there.
And now we try to negate zero.
Negate -, click okay, and we step over, and we notice there is no change.
So zero remains zero.
Now we look at memory. Negate memory. Select Dump 1 to make it the default dump.
Then go to Memory Map and double-click on the BSS segment, and then choose the empty space.
Here, right-click on this and binary edit.
So over here, let us put positive one in here. Zero one, okay, okay.
So now we have positive one at this memory address. We are going to negate it.
So let's right-click on this.
Copy.
Address, and we enter our instruction.
Negate keyword, BYTE PTR, and paste our address there.
Click okay.
So let's step over this instruction now and see what happens to our value.
Step over.
And it became negative one, all F's.
So this is how you can use the negate instruction in the x64dbg.
That's all for this video.
Thank you for watching.