WEBVTT

1
00:00.860 --> 00:02.480
Hello and welcome back.

2
00:02.480 --> 00:07.100
In this lesson, we are going to take a look at the sign flag, -.

3
00:07.580 --> 00:12.770
This flag indicates the sign of the result of an arithmetic or logical operation.

4
00:12.770 --> 00:17.630
It is set if the result is negative or cleared if the result is positive.

5
00:17.720 --> 00:21.380
So let's take a look at x64dbg to see how it works.

6
00:21.500 --> 00:25.190
The sign flag register is over here, -, as you can see.

7
00:25.490 --> 00:27.770
So now I've opened the template two

8
00:27.800 --> 00:33.200
in the x64dbg. I have a breakpoint set, and I will now run to my breakpoint.

9
00:33.560 --> 00:36.680
Then I will step over until I reach to a blank line.

10
00:36.920 --> 00:41.180
Now I'm going to perform an arithmetic operation on -.

11
00:41.300 --> 00:43.400
I'm going to add ten to -.

12
00:43.400 --> 00:45.350
So let's do that.

13
00:45.350 --> 00:49.100
Now add -, ten.

14
00:49.790 --> 00:50.720
Click okay.

15
00:52.400 --> 00:54.620
Currently, - has got the value one,

16
00:54.620 --> 00:56.150
and I'm going to add ten to it.

17
00:56.150 --> 00:58.430
And the result should be a positive number.

18
00:58.430 --> 01:02.060
And take a look at the sign flag. Sign flag is currently cleared.

19
01:02.360 --> 01:03.740
So let's step over.

20
01:04.550 --> 01:06.140
And the result is here,

21
01:06.140 --> 01:08.000
and the sign flag is cleared,

22
01:08.210 --> 01:09.080
still cleared.

23
01:09.080 --> 01:11.660
That means the result is a positive number.

24
01:12.110 --> 01:19.460
Now let's try to do an arithmetic operation, subtraction this time, to get the result which is a negative

25
01:19.460 --> 01:20.120
number.

26
01:20.120 --> 01:21.650
And we will try that on -.

27
01:22.190 --> 01:25.010
- is now one, and I'm going to minus ten from -.

28
01:25.790 --> 01:27.440
So go to a new line.

29
01:28.490 --> 01:32.540
Type sub -, ten.

30
01:33.620 --> 01:40.580
Okay, now -, one. I'm going to minus ten from one.

31
01:40.580 --> 01:42.830
So the result should be a negative number.

32
01:43.160 --> 01:50.330
And watch the - flag. Step over. The - flag is set. It is one.

33
01:50.330 --> 01:53.450
Therefore, the result is a negative number, as you can see.

34
01:53.450 --> 01:58.370
So this is how the flag is used in the assembly programming in x64dbg.

35
01:58.820 --> 02:00.110
That's all for this video.

36
02:00.110 --> 02:01.580
Thank you for watching.