Hello and welcome back.
In this lesson, we are going to learn about INC and DEC. INC is to increment, and DEC is to decrement.
So there are basically these two forms.
We have the INC register and INC memory.
We also have the DEC register and DEC memory.
So INC will increase the whatever value in register by one.
And it also increases whatever value is in the memory by one.
DEC will have the opposite effect. That will decrease whatever in the register by one.
It will also decrease whatever in the memory by one.
So let's open up our x64dbg now and try this.
So we put a breakpoint, and we run to our breakpoint.
Then we step over until we come to this line.
Now we will put a value in the register of 10.
So we right-click in our -, modify, and put one over there. Click okay.
So now we have 1 in -.
So now we are going to increment our -.
So let's enter the instruction INC -.
Then we step over that, and now our - becomes two.
Now we'll try a memory.
So let's select Dump 1 as a default.
Click on memory map.
Go to the BSS segment for variables, and then double-click on it.
And then at the bottom, Dump 1.
Scroll down.
Look for blank empty space.
This one, maybe.
And then right-click and put a value there. Binary edit.
And let's put 03 03.
Click okay.
And then we have three there now.
Right-click this address.
Copy address.
So now we are going to INC the memory location, this memory location, and see what happens to three.
So let's assemble an instruction for INC. Type INC keyword.
BYTE PTR, and then put your memory there.
Then you have copied.
Click okay.
So now we are going to execute this and watch what happens here.
And you will see that the value in this location of memory has been incremented by one.
So now it becomes four.
Previously it was three.
Now we'll take a look at the reverse of INC. We will study DEC.
So now we are going to do the reverse of what we did for -.
We are going to decrement our -.
So let's do that now.
Assemble DEC -.
Click okay, and let's execute this instruction and watch our -.
Currently it's two. Step over, and our - becomes one.
So it has decremented it by one.
Now we'll try decrement memory.
So again, we copy this memory here.
Then we go to this line and assemble a decrement for that memory.
BYTE PTR.
And then okay. Now we are going to execute this line and see what happens to the value in this memory.
It has decreased by one, and now it becomes three.
So this is how you can use the INC and DEC instructions in your x64dbg.
That's all for this video.
Thank you for watching.