WEBVTT

00:00.400 --> 00:02.800
In the realm of assembly language programming.

00:02.830 --> 00:09.220
The JL instruction, which stands for Jump if Less, is a fundamental tool for controlling the flow

00:09.220 --> 00:14.320
of execution within a program based on a specific comparison condition.

00:14.470 --> 00:20.140
Assembly language is a low level programming language that closely corresponds to the architecture of

00:20.140 --> 00:23.440
a computer's central processing unit CPU.

00:23.470 --> 00:30.640
The JL instruction serves as a crucial role in the decision making process of a program, enabling it

00:30.640 --> 00:37.540
to dynamically alter its course of action, depending on whether one value is less than another.

00:37.570 --> 00:42.610
So here's a comprehensive breakdown of how JL instruction operates.

00:42.640 --> 00:46.630
The first is comparison comparison.

00:46.660 --> 00:51.550
The second is conditional assessment.

00:53.630 --> 00:54.200
Last month.

00:54.350 --> 00:58.040
And the third is branching.

00:59.990 --> 01:06.040
And here in comparison, initially a comparison operation takes place between two values.

01:06.050 --> 01:11.990
These values could be stored in registers, memory locations, or even immediate values embedded directly

01:11.990 --> 01:13.370
in the instruction.

01:13.370 --> 01:19.580
And here the result of the comparison dictates whether the jump occurs or not.

01:20.120 --> 01:26.360
So should the condition less than hold true, the program execution flow will divert to a new memory

01:26.360 --> 01:32.420
location, usually indicated by a label or memory address, and in branching, the actual branching

01:32.420 --> 01:35.870
or jump takes place if the condition is met.

01:35.990 --> 01:37.640
Should the condition be false?

01:37.670 --> 01:43.220
The program proceeds with a sequential execution without any shift in its flow.

01:43.900 --> 01:49.990
And now, as we do always, we will also develop a program for this, uh, execution here.

01:49.990 --> 01:52.520
And now let's begin it.

01:52.540 --> 02:01.570
So again, we will start with the defining two variables section in data section, section data, the

02:01.570 --> 02:05.140
value one and value two The value one.

02:05.140 --> 02:12.310
We will allocate memory for value one and initialize it with 15 value one DB 15.

02:12.310 --> 02:21.430
And in value two we will allocate memory for value two and initialize it with 20 value two DB 20 And

02:21.430 --> 02:25.450
after that we will also develop this write this section text.

02:27.650 --> 02:30.230
Section text and.

02:31.200 --> 02:31.740
Here.

02:31.950 --> 02:33.720
We will define this.

02:33.720 --> 02:34.890
Start here.

02:35.100 --> 02:36.390
So move.

02:39.380 --> 02:40.580
Value one.

02:41.560 --> 02:50.560
So here, move the value at memory, address value one into the Al and move B move the value at memory

02:50.560 --> 02:54.460
address value two into B al.

02:54.610 --> 02:57.250
So value two.

02:57.430 --> 03:07.090
And after that we will compare the values in Al and b cmp al, l and g l.

03:07.120 --> 03:08.320
This is for jump.

03:08.320 --> 03:14.800
If less we are now less here jump to less.

03:14.830 --> 03:18.520
If here we are telling the assembly jump to less.

03:18.520 --> 03:29.590
If a al is less than b l and here we will firstly define the not less label for now, not less.

03:29.590 --> 03:39.100
So your code here for the case when value one is not less than value.

03:39.200 --> 03:42.040
Two cmp done.

03:42.050 --> 03:51.590
So we are telling jump to done to conclude this section and we will also write this label and also we

03:51.590 --> 03:58.970
will write the less when this in less we will write the your code here.

04:00.050 --> 04:08.360
Here for the case when value1 is less than value to.

04:09.450 --> 04:11.460
And also we will write done.

04:11.460 --> 04:15.210
And after that, I will explain all of this here.

04:15.750 --> 04:19.080
And this is just a regular exit code.

04:19.080 --> 04:20.550
You can also add or.

04:21.900 --> 04:24.120
More developed as sexist quotes here.

04:25.130 --> 04:28.670
So this is just a project for explanatory purposes.

04:28.970 --> 04:34.730
And as we delve into the code, we start by defining this data section here.

04:34.730 --> 04:36.110
Memory is load.

04:36.140 --> 04:40.520
I'll allocate it for two variables Value one and value two.

04:40.550 --> 04:49.460
The DB directive indicates that each of these variables holds a byte size value, so we initialize value

04:49.460 --> 04:53.420
one with 15 and value two with 20.

04:53.630 --> 05:00.590
Setting the stage for our comparisons and transitioning to the text section where executable instructions

05:00.590 --> 05:01.470
reside.

05:01.490 --> 05:06.370
The Start label marks the entry point to our program, as you know.

05:06.380 --> 05:14.000
So we begin by using this move instruction to load the value residing in memory at the address pointed

05:14.000 --> 05:18.700
to by value one into a register.

05:18.710 --> 05:26.340
Similarly, the Move instruction transfers the value from the memory location pointed to by value two

05:26.880 --> 05:29.550
into the B register.

05:29.550 --> 05:35.970
Subsequently, the CMP instruction compares the value stored in A, L and b L.

05:36.060 --> 05:46.920
If the comparison reveals that the value in L is less than the value in b, l, we proceed to the less

05:46.920 --> 05:47.790
label.

05:47.790 --> 05:56.700
And should the comparison result indicate that the value in L is not less than the value in b l, we

05:57.270 --> 05:59.820
proceed to not less section.

05:59.820 --> 06:07.890
So here we here you will generally insert your custom set of instructions to handle scenarios where

06:08.040 --> 06:10.080
value one is not less than value.

06:10.080 --> 06:10.710
Two.

06:10.890 --> 06:20.190
Following this GMP done here so GMP done instruction allows us to skip directly to the done label as

06:20.190 --> 06:24.090
we also define this bypassing this less section.

06:24.090 --> 06:31.320
And conversely, when the comparison confirms that the value in L is indeed less than the value in b,

06:31.320 --> 06:33.510
l, we advance to the less label.

06:33.690 --> 06:41.580
So within this segment you will typically insert the instructions to be executed when value one is less

06:41.580 --> 06:42.360
than value.

06:42.360 --> 06:53.280
Two and our journey concludes at the done label here signifying signifying that the end of our program

06:53.280 --> 06:59.610
logic and this is typically where you would include instructions for program termination or any necessary

06:59.610 --> 07:00.180
cleanup.

07:00.180 --> 07:08.190
So this could encompass system calls to conclude the program or to release any resources incurred during

07:08.190 --> 07:09.060
execution.

07:09.620 --> 07:14.990
And by meticulously examining this assembly code, we have delved into the world of conditional branching

07:14.990 --> 07:21.710
and comparisons, the code flow branches based on the outcome of the comparison between value one and

07:21.710 --> 07:22.490
value two.

07:22.520 --> 07:29.270
You understanding your understanding of this branching mechanisms and comparisons will be pivotal as

07:29.270 --> 07:34.190
you advanced in your exploration of assembly programming.

07:34.280 --> 07:40.400
Embrace the learning process, continue practicing and venture deeper into the intricacies of assembly

07:40.400 --> 07:41.030
programming.

07:41.030 --> 07:42.920
So I'm waiting you in the next lecture.
