WEBVTT

00:00.430 --> 00:06.880
As we approach the final lecture of this section, we encounter the assembly language instruction j

00:06.980 --> 00:10.360
p jump if below or equal.

00:11.680 --> 00:18.850
An essential command that guides the path of programs execution based on a particular comparison condition.

00:19.210 --> 00:24.550
In this section, you have been gradually building a foundation of understanding for assembler language,

00:24.550 --> 00:29.710
and the JB instruction is another stepping stone in this journey.

00:29.920 --> 00:35.980
Understanding its role and significance will serve as a bridge as you transition to the next section

00:35.980 --> 00:43.270
where we will harness the knowledge gained here to craft more advanced and sophisticated assembler programs.

00:44.970 --> 00:52.320
Imagine you are reading a book and instruction is like a crossroads in the story, a point where the

00:52.320 --> 00:56.430
plot takes a different direction depending on certain condition.

00:56.460 --> 01:03.300
Similarly, in assembly language programming, the JB jump if below or equal instruction serves as a

01:03.300 --> 01:05.430
decision making tool.

01:05.580 --> 01:08.460
Now here is how it operates.

01:10.610 --> 01:14.240
Comparing results or comparing values.

01:14.240 --> 01:22.520
So just like comparing two cups of water to see, which has more, the J.B. instruction compares two

01:22.520 --> 01:23.160
values.

01:23.180 --> 01:27.590
These values could be numbers stored in different places in your computer's memory.

01:28.240 --> 01:29.930
Making a decision.

01:29.950 --> 01:34.510
The instruction then helps your computer decide what to do next.

01:34.510 --> 01:38.320
If the first value is less than or equal to the second value.

01:38.350 --> 01:43.360
The JB instruction tells the computer to take a different path.

01:43.540 --> 01:44.620
A jump.

01:45.810 --> 01:48.660
Jump or continue if the condition is met.

01:48.690 --> 01:52.350
Your program jumps to a new section of the code.

01:52.380 --> 01:55.590
Like turning to a different chapter in a book.

01:56.080 --> 02:02.740
If the condition isn't met, the program just keeps going in order, like reading throughout the book

02:02.740 --> 02:04.240
page by page.

02:04.840 --> 02:10.960
As we conclude this section with GBA instruction, remember that you have learned here sets the stage

02:10.960 --> 02:12.900
for what's coming next.

02:13.210 --> 02:14.080
Next.

02:14.080 --> 02:19.480
And in the upcoming section, you will take the knowledge you have gained and use it to create more

02:19.480 --> 02:22.210
intricate and sophisticated assembly programs.

02:22.210 --> 02:30.700
Just as books final chapters prepares you for the sequel, your understanding of GBC paves the way for

02:30.700 --> 02:36.670
the exciting challenges and achievements that await you in your assembly programming journey.

02:36.790 --> 02:45.250
Now let's, as we always do, let's create some code and understand our deeper way.

02:50.830 --> 02:54.100
Let's firstly get started by writing section.

02:55.060 --> 02:55.320
Here.

02:56.390 --> 03:06.260
Uh, section data are value one db 15 value two DB 20.

03:06.440 --> 03:08.750
So we are allocating in.

03:09.840 --> 03:15.300
Here we are allocate memory for value one and initialize it with 15.

03:15.300 --> 03:19.020
And here we are doing the same, but we are initializing it with 20.

03:19.230 --> 03:22.530
Now we are going to section text.

03:23.330 --> 03:26.330
Text and global start.

03:26.330 --> 03:34.550
And in the start here we will load the value stored at memory address value one into al.

03:39.620 --> 03:47.180
Value one and we will load the value stored at memory address value two into pl move.

03:47.780 --> 03:48.080
PL.

03:49.550 --> 03:50.570
Value to.

03:51.550 --> 04:02.440
And here we will compare the value in A and B with this p, a, l, p, l, and after that we will use

04:02.440 --> 04:04.870
this j p.

04:05.740 --> 04:05.920
E.

04:08.410 --> 04:08.780
J.

04:08.830 --> 04:09.310
B.

04:09.910 --> 04:10.260
J.

04:10.300 --> 04:12.310
B below.

04:13.230 --> 04:13.800
Or.

04:15.660 --> 04:16.200
Equal.

04:17.540 --> 04:18.810
And here we are.

04:18.840 --> 04:26.180
Uh, we are performing a comparison between the values in A, L and b, l, and here we are.

04:26.690 --> 04:27.310
Jump.

04:27.320 --> 04:36.890
We are telling the assembly to jump to below or equal if l is below or equal to b l, and after that

04:36.920 --> 04:42.650
we will write not below or equal label.

04:42.650 --> 04:55.060
And here you will insert in insert your code here, put here to code here and in this case.

04:55.070 --> 05:02.810
So in this case, this means that value one is not below or equal to value.

05:02.810 --> 05:16.580
Two value one is not below or equal or equal to value to value two And we will also create this below

05:16.580 --> 05:17.700
or equal label.

05:19.490 --> 05:24.670
Below or equal label where our condition is met.

05:24.680 --> 05:29.210
So insert your code here.

05:29.480 --> 05:33.200
So let's fix that your code here.

05:33.530 --> 05:34.910
So if we.

05:38.420 --> 05:45.050
If you make this like change the value to 2020 here because it also it will be more logical for this

05:45.050 --> 05:45.670
example.

05:45.680 --> 05:50.060
But yes, we can also do 15 or 20 so we can do whatever value we want.

05:50.810 --> 05:52.310
Your code here.

05:52.310 --> 05:59.780
So where value one is below or equal to value two.

06:01.250 --> 06:02.030
And that's it.

06:02.030 --> 06:06.470
So here we need to create this down here.

06:07.690 --> 06:10.840
Here, we will insert our exit code.

06:12.280 --> 06:13.690
Here in.

06:14.780 --> 06:18.590
Insert your exit code here.

06:18.770 --> 06:20.990
And now let's.

06:22.630 --> 06:25.850
Explain this in more technical way here.

06:25.850 --> 06:30.870
So in this data section, memory allocation, Memory.

06:30.890 --> 06:41.750
Memory allocation is dedicated to value one which which here which value one is initialized with 20

06:41.750 --> 06:50.870
and here we in value two we are doing the same, which is similarly memory is allocated for value two

06:50.870 --> 06:52.760
and initialized to.

06:53.710 --> 06:55.450
20 as well.

06:56.130 --> 06:57.720
And after that.

06:58.780 --> 07:07.180
Uh, in this start, our process commences with the move instruction responsible for loading the byte

07:07.180 --> 07:14.860
size value, uh, from memory location value one into the Al register.

07:14.860 --> 07:21.670
And in parallel the Move instruction accomplishes the same loading the byte size value from memory location

07:21.670 --> 07:30.880
value two into the Belle Register and here we the CMP instruction carries out a meticulous comparison

07:30.880 --> 07:34.570
between the contents of Al and Belle registers.

07:34.570 --> 07:43.930
And here the after that the JB The decision making aspect of our journey unfolds with the J.B., which

07:43.930 --> 07:46.240
is jump if below or equal instruction.

07:46.240 --> 07:56.040
It gets us to the below or equal label if a a al is below or equal to Belle.

07:56.320 --> 08:05.660
And after that here for this segment provides you with the technical canvas to implement codes specifically

08:05.660 --> 08:11.180
tailored to a scenarios where value one is not below or equal to value.

08:11.180 --> 08:11.840
Two.

08:12.610 --> 08:18.160
And here in below or equal label we have in the space.

08:18.160 --> 08:25.540
Your technical prowess takes center stage allowing you to craft code addressing scenarios where value

08:25.570 --> 08:26.410
has value.

08:26.410 --> 08:31.270
One is indeed below or equal to value two and in done.

08:31.480 --> 08:39.820
This is the conclusion of our journeys marked by the down label indicating the final stage of our program's

08:39.850 --> 08:40.750
execution.

08:41.780 --> 08:49.460
And as we navigate this assembly code, we navigate the intricate arrays of conditional branching and

08:49.460 --> 08:56.510
comparisons encapsulating scenarios where value one is either below or equal to value.

08:56.510 --> 08:57.110
Two.
