WEBVTT

00:00.770 --> 00:05.870
Hello, my name is Typhoon and in this lecture you will learn about the jump if less or equal.

00:05.900 --> 00:14.030
So jump if less or equal j l e is a conditional jump instruction in assembly language programming that

00:14.060 --> 00:18.320
directs the flow of execution based on a comparison condition.

00:18.410 --> 00:25.400
This instruction is commonly used to make decisions within programs by evaluating whether one value

00:25.400 --> 00:28.790
is less than or equal to another value.

00:28.820 --> 00:34.910
It's particularly relevant in scenarios where signed integer comparison is involved.

00:34.940 --> 00:41.330
So the first stage here, the instruction follows this general process.

00:41.390 --> 00:43.070
The comparison.

00:43.190 --> 00:48.760
The instruction begins by performing a comparison between two values.

00:48.770 --> 00:55.220
So these values would be stored in registers, memory locations or immediate values.

00:55.940 --> 00:57.440
The instruction itself.

00:59.000 --> 01:00.650
The second is conditional check.

01:00.680 --> 01:07.420
The result of the comparison is then used to determine whether the jump should occur in the case of

01:08.150 --> 01:10.880
the jump will take place if either of two.

01:11.990 --> 01:12.320
Matt.

01:13.630 --> 01:20.830
So the first is the first condition is the zero flag is there.

01:20.890 --> 01:24.040
Zero flag is set to one.

01:24.460 --> 01:36.880
This indicating that the values are equal or the sign flag is F sign flag and the and overflow flag.

01:37.560 --> 01:46.850
Like have have the same value, so indicating that the result is negative or equal.

01:46.860 --> 01:47.670
So.

01:50.510 --> 01:51.320
Equal.

01:52.560 --> 01:53.490
And.

01:58.400 --> 02:00.920
There are negative.

02:01.570 --> 02:05.080
And or negative or equal.

02:07.590 --> 02:15.300
And the last is if either of the conditions mentioned above is satisfied, the program's execution flow

02:15.300 --> 02:22.260
is altered and it jumps to a new location specified by a label or memory address.

02:22.290 --> 02:29.910
If the conditions are not met, the program continues executing the subsequent instruction sequentially

02:29.910 --> 02:33.360
without any alteration to its flow.

02:33.780 --> 02:38.640
Now we will, as we always do in this section, we will write another code.

02:39.030 --> 02:40.980
Uh, considering.

02:41.750 --> 02:42.340
This.

02:42.440 --> 02:48.890
Um, and we will build project something like jump if less or we will use this, uh, jelly here.

02:49.160 --> 02:50.480
So now.

02:51.310 --> 02:53.860
Let's get started with this here.

02:58.090 --> 03:01.390
Of course, as we always do, we will.

03:01.540 --> 03:02.500
Uh, firstly.

03:04.450 --> 03:09.070
So let's in this lecture, let's actually write our.

03:11.310 --> 03:13.410
Port with using.

03:13.410 --> 03:19.350
Yeah, we can also use this print f so we make it more functional in this lecture.

03:20.040 --> 03:23.730
But it might take a long time, but you will understand it better.

03:26.670 --> 03:30.810
Or instead of writing print f uh, which is not required at all.

03:30.810 --> 03:35.070
Uh, the in this lecture you will learn the logic and.

03:36.040 --> 03:39.190
Usage of this jar and indents.

03:39.190 --> 03:47.230
In next sections, we will develop our programs according to the, according to this, uh, logical

03:47.230 --> 03:49.060
conditions here and now.

03:49.060 --> 03:50.740
We will as always do.

03:51.310 --> 03:54.100
Uh, we will firstly define the section data.

03:54.340 --> 04:02.380
Uh, here in this data we will allocate memory for value one and initialize it with 15 value.

04:03.090 --> 04:06.480
Value of one DB and 15.

04:06.480 --> 04:12.990
And again, we will allocate memory for value two and initialize it to 15 again.

04:12.990 --> 04:18.680
And here we will create a section text Global Start.

04:18.680 --> 04:22.860
This is the starting point for our program and in start here.

04:24.060 --> 04:24.480
Art.

04:24.870 --> 04:25.500
We will.

04:26.340 --> 04:28.200
Move, Al.

04:29.850 --> 04:31.980
Uh, to value one.

04:34.990 --> 04:35.950
So we are moved.

04:36.250 --> 04:43.750
We are moving the value at memory address value one into the Al and we are doing the same for BL here.

04:43.750 --> 04:49.360
So we are moving the value at memory address value two into the BL.

04:51.610 --> 05:01.810
And here we are going to compare the result, compare the values in L and b, L, cmp, L and b, l.

05:02.860 --> 05:05.050
And we will use the jump if less.

05:05.050 --> 05:07.100
Or equal jelly.

05:08.380 --> 05:12.430
Uh, less or equal equal here.

05:12.430 --> 05:24.010
So here we will jump to less or equal if l is less than or equal to equal to b l, And here we will

05:24.010 --> 05:29.020
write note we will first create a note less or.

05:29.850 --> 05:31.320
Equal here.

05:31.350 --> 05:33.540
So your code.

05:34.170 --> 05:45.510
Here for the case when value one is not less than or equal to value two here.

05:45.510 --> 05:46.050
Right?

05:46.050 --> 05:56.880
So value two and we are going to jump to done done to conclude this section and we will also develop

05:56.910 --> 05:57.690
done here.

05:57.690 --> 05:59.850
Jump JMP done.

06:00.570 --> 06:01.470
And.

06:02.190 --> 06:05.970
We will create a less or equal.

06:07.290 --> 06:18.960
So your code here for for the case when value one is less than or equal actually.

06:21.320 --> 06:21.680
So.

06:24.190 --> 06:29.260
Is not less and here is less than or equal to value.

06:29.260 --> 06:34.690
One value one or value value two.

06:34.930 --> 06:41.530
Let's make this not uppercase to make sure shown yes less than or equal to.

06:41.530 --> 06:44.560
And we will create our exit code.

06:47.710 --> 06:51.130
And this is your exit code here.

06:51.130 --> 06:58.810
And in this session, we are about to embark on an in-depth journey through the assembly code here.

06:58.810 --> 07:00.010
And our.

07:01.010 --> 07:06.620
Goal is to meticulously analyze each line and unravel the logic behind the conditional branching and

07:06.620 --> 07:07.640
comparisons.

07:07.700 --> 07:11.030
So let's begin this and here.

07:12.000 --> 07:18.540
Our journey commences with the declaration of the data section where, um, we allocate memory to store

07:18.540 --> 07:21.660
two variables value one and value two.

07:21.660 --> 07:24.500
Both variables are initialized to 15.

07:24.510 --> 07:30.390
So setting the stage for our comparison again and transitioning to the text section where executable

07:30.390 --> 07:36.990
instructions reside, the Start label serves as our global entry point, as I always say.

07:37.410 --> 07:41.100
Um, and we start by employing this move again.

07:41.850 --> 07:48.450
Uh, move instruction to load the value residing in memory at the address pointed to by value one into

07:48.450 --> 07:49.800
the al register.

07:49.800 --> 07:56.190
Similarly, move instruction transfers the value from the memory location pointed to value two into

07:56.190 --> 07:57.900
the Belle Register.

07:57.960 --> 08:04.720
Following this instruction undertakes a comparison between the value stored in Al and b l.

08:04.770 --> 08:13.480
If the comparison determines that the value in Al is less than or equal to the value in b l, we proceed

08:13.480 --> 08:15.190
to the less.

08:16.180 --> 08:18.310
Or equal labor.

08:18.520 --> 08:24.820
So in scenarios where the comparison result indicates that the value in Al is not less than or equal

08:24.820 --> 08:31.600
to value on PL, we danced to the not less or equal section here.

08:31.600 --> 08:37.540
You will typically insert your custom set of instructions to handle cases where value one is not less

08:37.540 --> 08:38.920
than or equal to value.

08:38.920 --> 08:39.370
Two.

08:39.460 --> 08:43.480
Subsequently, GMP uh, done here.

08:43.630 --> 08:49.900
Uh, instruction enables us to bypass the less or equal to actually.

08:49.900 --> 08:50.470
Yeah, less.

08:50.470 --> 08:51.610
Or equal to.

08:52.500 --> 08:57.180
Uh section and head directly to done label.

08:57.180 --> 09:04.830
And conversely, when the comparison, uh, confirms that the value in Al is indeed less than or equal

09:04.860 --> 09:09.000
to the value in B, we proceed to the less or equal label.

09:09.000 --> 09:15.450
So with this segment, you will typically insert instructions to be executed when value of one is less

09:15.450 --> 09:17.130
than or equal to value.

09:17.130 --> 09:17.600
Two.

09:17.610 --> 09:25.140
And our journey culminates at the done label marking at the end of our program Logic.

09:25.290 --> 09:33.240
So this is the ideal location to include instructions for program termination or any necessary cleanup

09:33.480 --> 09:36.840
might involve system calls or resource management.

09:36.960 --> 09:39.570
And that's it with our lecture.

09:39.900 --> 09:42.750
Uh, jump if less or equal here.

09:42.750 --> 09:43.530
So.

09:44.550 --> 09:45.420
This, actually.

09:46.930 --> 09:48.730
Like, almost.

09:49.780 --> 09:55.420
The chord structure is almost the same as previous ones, but here the logic is different.

09:55.420 --> 09:57.460
So I'm waiting you in next lecture.
