WEBVTT

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

2
00:03.050 --> 00:07.310
In this lesson, we are going to take a look at the negate instruction.

3
00:07.760 --> 00:14.930
So we have two forms: the negate the register, and also the negate the memory.

4
00:15.170 --> 00:17.600
Negate reverses the sign.

5
00:17.600 --> 00:21.440
So if it's negative one, it becomes positive one.

6
00:21.440 --> 00:23.870
And if it's in memory, same thing.

7
00:23.870 --> 00:26.930
Negative one becomes positive one, and vice versa.

8
00:27.230 --> 00:30.410
And if we negate zero, it remains unchanged.

9
00:30.530 --> 00:34.490
So let's open up our x64dbg and try this now.

10
00:37.990 --> 00:43.960
So we put a breakpoint here, run to it, and step over until we come to this line.

11
00:44.470 --> 00:50.800
Now we are going to modify the value in the - register by right-clicking it.

12
00:51.490 --> 00:57.880
Click Modify Value, and we'll key in a negative one.

13
00:59.890 --> 01:01.090
And click okay.

14
01:01.150 --> 01:04.000
So negative one is denoted by all F's.

15
01:05.020 --> 01:09.760
Now we are going to insert our instruction here.

16
01:10.480 --> 01:16.270
Negate -, and then we step over.

17
01:18.110 --> 01:23.840
And now we see the value in register has been negated.

18
01:23.870 --> 01:25.070
It has been reversed.

19
01:25.430 --> 01:28.580
Previously it was all F's, which meant negative one.

20
01:28.610 --> 01:30.350
Now it became positive one.

21
01:31.220 --> 01:34.370
Now let's try to negate the zero and see what happens.

22
01:34.400 --> 01:37.790
So let's try to change now the value in -.

23
01:38.030 --> 01:40.940
We put zero in here. Right-click, modify -.

24
01:41.870 --> 01:43.010
Insert zero there.

25
01:44.150 --> 01:46.430
And now we try to negate zero.

26
01:49.490 --> 01:56.450
Negate -, click okay, and we step over, and we notice there is no change.

27
01:56.450 --> 01:58.070
So zero remains zero.

28
01:58.790 --> 02:04.250
Now we look at memory. Negate memory. Select Dump 1 to make it the default dump.

29
02:04.340 --> 02:12.740
Then go to Memory Map and double-click on the BSS segment, and then choose the empty space.

30
02:12.740 --> 02:18.020
Here, right-click on this and binary edit.

31
02:19.400 --> 02:25.370
So over here, let us put positive one in here. Zero one, okay, okay.

32
02:25.370 --> 02:29.240
So now we have positive one at this memory address. We are going to negate it.

33
02:29.660 --> 02:31.580
So let's right-click on this.

34
02:33.900 --> 02:34.800
Copy.

35
02:36.580 --> 02:40.330
Address, and we enter our instruction.

36
02:40.690 --> 02:48.250
Negate keyword, BYTE PTR, and paste our address there.

37
02:49.120 --> 02:50.110
Click okay.

38
02:51.340 --> 02:54.910
So let's step over this instruction now and see what happens to our value.

39
02:55.720 --> 02:56.590
Step over.

40
02:58.960 --> 03:01.240
And it became negative one, all F's.

41
03:01.780 --> 03:06.700
So this is how you can use the negate instruction in the x64dbg.

42
03:07.240 --> 03:08.590
That's all for this video.

43
03:08.590 --> 03:09.820
Thank you for watching.