WEBVTT

1
00:01.730 --> 00:03.230
Hello and welcome back.

2
00:03.230 --> 00:10.580
In this lesson, we are going to learn about INC and DEC. INC is to increment, and DEC is to decrement.

3
00:10.730 --> 00:13.820
So there are basically these two forms.

4
00:13.820 --> 00:17.780
We have the INC register and INC memory.

5
00:18.020 --> 00:20.870
We also have the DEC register and DEC memory.

6
00:21.080 --> 00:25.160
So INC will increase the whatever value in register by one.

7
00:25.370 --> 00:30.020
And it also increases whatever value is in the memory by one.

8
00:30.350 --> 00:36.200
DEC will have the opposite effect. That will decrease whatever in the register by one.

9
00:36.440 --> 00:39.500
It will also decrease whatever in the memory by one.

10
00:39.500 --> 00:43.730
So let's open up our x64dbg now and try this.

11
00:44.480 --> 00:47.690
So we put a breakpoint, and we run to our breakpoint.

12
00:48.020 --> 00:50.450
Then we step over until we come to this line.

13
00:50.450 --> 00:54.680
Now we will put a value in the register of 10.

14
00:55.250 --> 01:01.790
So we right-click in our -, modify, and put one over there. Click okay.

15
01:03.570 --> 01:05.760
So now we have 1 in -.

16
01:06.780 --> 01:10.140
So now we are going to increment our -.

17
01:10.980 --> 01:16.590
So let's enter the instruction INC -.

18
01:19.430 --> 01:24.320
Then we step over that, and now our - becomes two.

19
01:25.400 --> 01:27.860
Now we'll try a memory.

20
01:28.370 --> 01:31.640
So let's select Dump 1 as a default.

21
01:32.180 --> 01:33.440
Click on memory map.

22
01:33.680 --> 01:39.410
Go to the BSS segment for variables, and then double-click on it.

23
01:40.640 --> 01:42.290
And then at the bottom, Dump 1.

24
01:42.290 --> 01:42.950
Scroll down.

25
01:42.950 --> 01:44.990
Look for blank empty space.

26
01:45.590 --> 01:46.850
This one, maybe.

27
01:47.030 --> 01:53.870
And then right-click and put a value there. Binary edit.

28
01:54.020 --> 01:58.010
And let's put 03 03.

29
01:58.700 --> 01:59.540
Click okay.

30
02:00.290 --> 02:02.060
And then we have three there now.

31
02:02.870 --> 02:04.160
Right-click this address.

32
02:06.600 --> 02:07.980
Copy address.

33
02:08.070 --> 02:14.730
So now we are going to INC the memory location, this memory location, and see what happens to three.

34
02:15.240 --> 02:21.150
So let's assemble an instruction for INC. Type INC keyword.

35
02:22.790 --> 02:28.250
BYTE PTR, and then put your memory there.

36
02:30.810 --> 02:31.560
Then you have copied.

37
02:32.130 --> 02:33.180
Click okay.

38
02:34.740 --> 02:38.340
So now we are going to execute this and watch what happens here.

39
02:40.350 --> 02:47.280
And you will see that the value in this location of memory has been incremented by one.

40
02:47.340 --> 02:48.900
So now it becomes four.

41
02:48.900 --> 02:50.250
Previously it was three.

42
02:51.060 --> 02:55.320
Now we'll take a look at the reverse of INC. We will study DEC.

43
02:56.010 --> 02:59.430
So now we are going to do the reverse of what we did for -.

44
02:59.460 --> 03:01.380
We are going to decrement our -.

45
03:01.380 --> 03:02.580
So let's do that now.

46
03:04.290 --> 03:06.720
Assemble DEC -.

47
03:09.700 --> 03:15.880
Click okay, and let's execute this instruction and watch our -.

48
03:16.030 --> 03:22.540
Currently it's two. Step over, and our - becomes one.

49
03:23.140 --> 03:25.660
So it has decremented it by one.

50
03:26.260 --> 03:28.810
Now we'll try decrement memory.

51
03:28.930 --> 03:31.570
So again, we copy this memory here.

52
03:34.850 --> 03:40.190
Then we go to this line and assemble a decrement for that memory.

53
03:42.480 --> 03:44.850
BYTE PTR.

54
03:48.030 --> 03:57.060
And then okay. Now we are going to execute this line and see what happens to the value in this memory.

55
03:59.260 --> 04:02.440
It has decreased by one, and now it becomes three.

56
04:02.740 --> 04:08.620
So this is how you can use the INC and DEC instructions in your x64dbg.

57
04:09.460 --> 04:10.840
That's all for this video.

58
04:10.840 --> 04:12.250
Thank you for watching.