WEBVTT

00:00.650 --> 00:04.590
Hello, my name is Stephan, and in this lecture you will learn about the J.

00:04.790 --> 00:08.900
So the assembly language instruction J which stands for Jump.

00:08.930 --> 00:15.710
If above is a conditional jump operation utilized in low level programming to dictate the program's

00:15.710 --> 00:18.440
flow based on a specific comparison condition.

00:18.470 --> 00:25.490
The instruction is commonly used for unsigned integer comparisons, and the J instruction serves the

00:25.490 --> 00:33.020
purpose of deciding whether a jump should occur depending on whether one value is strictly greater than

00:33.020 --> 00:34.050
another value.

00:34.070 --> 00:36.690
So here is how it operates.

00:36.710 --> 00:38.300
The first is comparison.

00:38.330 --> 00:43.160
The instruction initiates by performing a comparison between two values.

00:43.160 --> 00:50.810
These values can be present in registers, immediate values embedded within the instruction itself or

00:50.810 --> 00:52.430
memory locations.

00:52.430 --> 00:54.830
And the second is conditional assessment.

00:54.830 --> 00:59.880
The outcome of the comparison is used to determine whether the jump should take place.

00:59.970 --> 01:01.850
Specifically the J.

01:02.430 --> 01:10.440
The jump above instruction performs a jump if the condition above holds true.

01:10.470 --> 01:17.580
In other words, if the first value is strictly greater than the second value, the jump will be executed.

01:18.380 --> 01:22.730
And the third is jump or sequential execution.

01:23.060 --> 01:30.710
So should the should the condition be satisfied The program's execution flow is altered and the program

01:30.710 --> 01:34.920
jumps to a new location specified by a label or memory address.

01:34.940 --> 01:42.020
Conversely, if the condition is not yet met or not met, the program continues with its sequential

01:42.020 --> 01:45.020
execution without any disruption.

01:45.110 --> 01:52.850
So in assembly language, a instruction is commonly represented by a mnemonic, followed by an operand

01:52.850 --> 01:57.290
indicating the target location for the jump if the condition is met.

01:57.320 --> 02:09.080
So here's an example a hypothetical assembly language syntax, CMP c x, d, x here and a above.

02:10.420 --> 02:11.200
About label.

02:11.410 --> 02:22.000
So here we are comparing values in registers C and D, and with this jump to a label if C is greater

02:22.000 --> 02:22.930
than D.

02:23.320 --> 02:30.460
So in this illustration here, the program compares the values stored in integers or stored in registers

02:30.490 --> 02:39.940
C and D, So if the value in register C x is strictly greater than the value in register D x, the program

02:39.940 --> 02:44.940
will execute a jump to the memory location labeled as a bowl.

02:45.100 --> 02:53.000
A bowl label, if the condition is not yet is not fulfilled, which is not greater than X.

02:53.050 --> 02:57.880
The program proceeds with its sequential execution.

02:58.660 --> 03:08.530
So a j instruction alongside other conditional jump instructions like JB jump below a j e jump if equal

03:08.530 --> 03:15.700
and j z jump if zero which you will learn in next lectures forms the bedrock of control flow with an

03:15.700 --> 03:17.290
assembly language programming.

03:17.320 --> 03:24.490
Collectively, these instructions empower programmers to craft intricate algorithms and logical structures

03:24.490 --> 03:28.480
at an exceptionally low level of abstraction.

03:28.510 --> 03:34.750
By harnessing these instructions, programmers can create a decision based behaviors and sophisticated

03:34.750 --> 03:41.290
branching mechanisms that are crucial for building efficient and functional assembly language programs.

03:41.380 --> 03:47.530
Now, what we're going to always do in this section, we will also create an example skeleton for this

03:47.620 --> 03:48.520
logic.

03:49.060 --> 03:51.250
Now what we're going to do is.

03:52.430 --> 03:53.240
We will.

03:54.120 --> 03:56.880
Again use the defined two values.

03:58.320 --> 04:00.690
And continue our execution.

04:01.850 --> 04:04.480
By execution, I mean the writing, our codes.

04:04.490 --> 04:11.000
So as we always do, we will define again the section data with two values in it.

04:11.330 --> 04:23.450
We will allocate memory for a value one and initialize it with 2025 value, one value one TB and 25.

04:23.450 --> 04:30.500
And we will allocate memory for value two and initialize it with the 20.

04:33.100 --> 04:38.800
And also we will create a section section text.

04:40.580 --> 04:41.600
Action text.

04:41.600 --> 04:48.020
And here we will create a global global start here and in start.

04:49.250 --> 04:49.610
Will.

04:51.000 --> 04:52.490
Move, Al.

04:54.010 --> 04:54.790
Value.

04:54.820 --> 04:56.380
Value one.

04:56.770 --> 05:05.920
Here we are loading the value stored at memory address value one into a l here, which we will do the

05:05.920 --> 05:11.750
same a l register with which we will do the same for the b l as well.

05:11.770 --> 05:14.770
So move b l.

05:16.110 --> 05:23.290
Uh, value to your, uh, we are going to do load the value stored at memory address value two into

05:23.310 --> 05:27.900
BL registers and we will always do a l bl.

05:27.900 --> 05:32.370
So here we are comparing the values in A, L and b l.

05:33.370 --> 05:37.480
And here we will use this jump ball.

05:38.170 --> 05:39.690
And here we will create.

05:39.700 --> 05:51.790
So if l as I explained here at the beginning of this lecture, if l is a bow here is if l is above j

05:51.820 --> 05:56.140
a jump if a ball b l jump to the above label.

05:56.140 --> 06:02.290
So we will create both of these labels here, not above, above and done as we always do, but here

06:02.290 --> 06:04.750
we are comparing L, A and b, L.

06:04.930 --> 06:08.350
So let's firstly create the not a ball.

06:10.190 --> 06:24.950
And here your code here, your code here for the scenario when value one is not above value two and

06:24.950 --> 06:26.290
GMP done.

06:26.300 --> 06:34.640
Here we are jump to the done which we will create as label right now to finalize this section and also

06:34.640 --> 06:37.310
we will create above here above.

06:37.910 --> 06:52.430
So your code here for for the scenario when value one is above value value two and here we will also

06:52.430 --> 06:54.080
create a done here.

06:55.490 --> 06:58.790
I'm here and exit code here.

06:58.820 --> 07:04.280
Like we here we are all the registers and Siskel at the end.

07:04.280 --> 07:05.750
And after that read here.

07:05.750 --> 07:07.340
But we will notice here.

07:07.340 --> 07:13.940
So this is just a skeleton of how this jumping robot works as the previous ones.

07:14.650 --> 07:15.670
So that's, uh.

07:15.670 --> 07:21.400
So this program is not fully functional yet, but we can just add the slightly exit code, but we don't

07:21.400 --> 07:22.510
need that here.

07:22.780 --> 07:27.350
So now I will start from the beginning, as I always do.

07:27.380 --> 07:35.140
So we initiate this exploration by setting up this data section where memory is allocated to accommodate

07:35.140 --> 07:38.110
the variables value one and value two.

07:38.140 --> 07:46.810
So these variables take on a specific values value one being assigned 21, 20, 25 and value two taking

07:46.810 --> 07:55.720
on 20 forming the foundation of our comparisons and here in text section, our focal point of executable

07:55.720 --> 08:00.540
instructions, we encounter this Start label as our entry point.

08:00.550 --> 08:04.570
Our journey into code begins with the Move instruction.

08:05.430 --> 08:11.550
And it is a mechanism through which we transfer the value stored in memory at the address specified

08:11.550 --> 08:16.110
by value one and into the Al register here.

08:16.140 --> 08:24.660
Similarly, the subsequent MOV instruction performs a parallel action for value two loading its value

08:24.660 --> 08:29.430
into PL register and this process sets the stage for comparison.

08:29.640 --> 08:37.050
The comparison comparison unfolds through the CMP instruction, subjecting the value stored in Al and

08:38.160 --> 08:43.170
here if the comparison reveals that the value in Al.

08:44.070 --> 08:45.780
Represses the value in.

08:46.950 --> 08:55.290
The j jump of above instructions ushers us into the above label domain.

08:55.710 --> 09:00.690
In this case, as you know, the value one is 25 and value two is 20.

09:00.690 --> 09:04.770
And in this case the above condition will met.

09:06.160 --> 09:06.760
And.

09:08.800 --> 09:16.060
After that, in cases where the comparison outcomes refuses the notion of value one surpassing value

09:16.060 --> 09:17.830
to the not above.

09:17.830 --> 09:18.070
Here.

09:18.070 --> 09:21.090
In this case, it should be for, for example, ten.

09:21.100 --> 09:23.800
In this case, the note above will execute.

09:23.830 --> 09:25.000
That's it here.

09:26.140 --> 09:26.890
And.

09:28.180 --> 09:31.720
And this is your, uh, here in not above.

09:31.750 --> 09:40.510
This is your arena, uh, to insert instructions, catering to scenarios where value one does not outpace

09:40.510 --> 09:41.500
value two.

09:41.500 --> 09:49.870
And the journey then leads us to the lay down label marking a point of conclusion for this particular

09:49.870 --> 09:51.070
code segment.

09:51.190 --> 09:57.100
On the other hand, the above label offers a contrasting sphere.

09:57.130 --> 10:03.070
This is where you would typically insert instruction designed to address cases where value one is indeed

10:03.070 --> 10:06.910
exceeds value two, and that's it.

10:06.910 --> 10:16.540
After that, here we have done and here our educational odyssey reaches its pinnacle with the done label

10:16.540 --> 10:20.020
encapsulating the conclusion of the program's logic.

10:20.290 --> 10:25.480
This is the appropriate place to include instructions for program termination or any necessary.

10:27.450 --> 10:35.460
And by delving into this assembly code, we have traversed the realm of conditional branching and comparisons.

10:35.670 --> 10:41.820
Armed with the ability to discover scenarios where value one is above value two.

10:42.600 --> 10:48.510
Your comprehension of these intricate mechanisms is a key asset as you delve deeper into the world of

10:48.510 --> 10:49.710
assembly programming.

10:49.920 --> 10:57.120
Continue your journey exploring the intricacies and applications of assembly programming with enthusiasm

10:57.120 --> 10:58.320
and dedication.

10:58.470 --> 10:59.430
Happy Learning.
