WEBVTT

00:00.800 --> 00:05.330
Hello, my name is Typhoon, and in this lecture you will learn about the jump if greater.

00:05.330 --> 00:10.670
So continuing our exploration, we arrive at a doorstep of G.

00:10.710 --> 00:11.090
G.

00:11.690 --> 00:16.190
This is a cryptic command denoting jump if greater.

00:16.190 --> 00:23.270
So this particular instruction orchestrates a sophisticated dance involving the sign flag.

00:23.310 --> 00:25.410
This the SF?

00:26.300 --> 00:27.280
This is the.

00:28.770 --> 00:30.300
Sign flag.

00:30.940 --> 00:34.570
Uh, the over flag and the zero flag also.

00:34.690 --> 00:42.160
So they are combined Symphony orchestra is to result in zero signifies a clear message.

00:42.190 --> 00:45.190
The result is not less than or equal to.

00:45.310 --> 00:53.380
So with a G we find ourselves embarking on an expedition through sound comparisons, skillfully handling

00:53.380 --> 00:58.140
situations where one value genuinely surpasses another.

00:58.150 --> 00:59.020
So.

01:00.020 --> 01:08.180
As I said, we are involving here sign flag, the overflow flag and zero flag as well.

01:08.270 --> 01:16.130
And here we will create another example of our coding example here, just with just like we did in previous

01:16.130 --> 01:16.850
lectures.

01:16.850 --> 01:19.880
So we will create a section data fastly.

01:20.300 --> 01:30.950
The we will create define a byte with a value of 30 while value one db 30 here value two db.

01:31.890 --> 01:35.280
20, we are defining another byte with a value of 20.

01:35.280 --> 01:39.030
And here we will write our text here.

01:39.060 --> 01:40.080
Global.

01:48.730 --> 01:53.200
And here we will write a start here.

01:55.500 --> 01:55.940
Move.

01:56.950 --> 01:57.730
Al.

01:58.560 --> 01:59.330
Bite.

02:00.330 --> 02:01.380
Value of one.

02:01.410 --> 02:09.000
Here we are moving the value of, um, value of value one into the al register.

02:09.000 --> 02:09.690
And.

02:09.690 --> 02:12.960
And here, move dl.

02:14.010 --> 02:14.760
Fight.

02:16.940 --> 02:17.590
White.

02:18.870 --> 02:20.640
Value two.

02:20.760 --> 02:28.140
And here we are moving the value of value two into the B register.

02:28.140 --> 02:37.560
And now we are comparing the values in A and B In order to do that, we will use the CMP, L and L,

02:37.920 --> 02:43.410
and after that we will use the G here, G.

02:45.780 --> 02:49.200
Here and name the label.

02:51.950 --> 02:53.870
Big greater.

02:53.870 --> 02:55.660
So here we are.

02:55.810 --> 02:56.330
Jump.

02:56.450 --> 03:00.200
We are telling the assembly code that jump two reader.

03:00.290 --> 03:01.400
Reader label.

03:01.400 --> 03:05.330
If a L is greater than b l.

03:05.330 --> 03:09.200
So if it's not great, we will also write this label here.

03:09.200 --> 03:10.250
So not.

03:10.980 --> 03:11.450
Sir.

03:11.880 --> 03:20.040
So this case, you will write your code here, your code here for not reader case.

03:20.040 --> 03:23.430
And as well we will jump.

03:23.460 --> 03:26.550
GMP, GMP done here.

03:26.640 --> 03:32.550
So we are giving the jump to the done label in this case.

03:32.550 --> 03:35.780
So if it's not greater, you need to jump to the done label.

03:35.790 --> 03:39.270
But first let's actually write the greater label.

03:39.360 --> 03:51.270
So reader, this case the we are your code here for reader case and we will also need to write a done

03:51.270 --> 03:55.050
here since we are jumping to the done label here.

03:56.010 --> 03:58.050
So we are obligated to write it.

03:58.050 --> 04:01.260
So here we are At first we are exit.

04:05.820 --> 04:09.810
And it will move racks fixed.

04:10.140 --> 04:14.160
As you already know, we use it almost 100 times.

04:14.160 --> 04:19.130
This is a fiscal number for exit and X or D.

04:21.160 --> 04:23.710
This is the exit status zero.

04:23.710 --> 04:25.720
And after that, we will call the Cisco.

04:25.750 --> 04:26.560
That's it.

04:27.400 --> 04:27.730
Here.

04:27.730 --> 04:31.930
I will explain this again from the start here.

04:31.930 --> 04:39.580
So in data section we here, we have two values are defined value one and value two the value value

04:39.580 --> 04:48.100
one is defined as a byte with the value of 30 and value two is defined as a byte with the value of 20.

04:48.130 --> 04:50.410
And we have the text section here.

04:50.410 --> 04:54.550
This text section contains the actual code of the program, as you know here.

04:54.550 --> 05:01.480
So the Start label is the entry point of the program and we also have the loading values here.

05:01.480 --> 05:03.130
This move instructions.

05:05.570 --> 05:14.120
The move Al byte value one instruction loads the value of value one into the Al register.

05:14.150 --> 05:19.940
It uses the byte keyword to indicate that only a single byte is being loaded.

05:19.940 --> 05:29.900
And similarly the byte value two loads, the loads, the value of value two into the Belle Register

05:29.900 --> 05:30.590
as well.

05:31.310 --> 05:37.550
And again, we are using this byte keyword to indicate that only a single byte is being loaded.

05:37.550 --> 05:41.510
And here we also have CMP instruction.

05:41.990 --> 05:51.320
This the CMP ILB instruction compares the values in the A, L and b l register, and this comparison

05:51.320 --> 05:59.270
sets various flags, including the ZF0 flag, which indicates whether the two values are equal.

05:59.270 --> 06:03.110
And here we also have the conditional jump here.

06:03.470 --> 06:04.220
This.

06:05.400 --> 06:09.710
Uh, g g g g instruction.

06:10.230 --> 06:17.490
So this, uh, g greeter instruction checks the result of the comparison.

06:17.490 --> 06:29.400
And if the Z is F is not set because a g f is greater than b, L, it jumps to the greeter label.

06:29.400 --> 06:34.050
Otherwise it falls through to not greeter label.

06:34.050 --> 06:39.900
And we have the labels here, uh, this greeter greeter and not greeter.

06:40.710 --> 06:47.520
So the greeter label is where you can write code that executes when value one.

06:48.960 --> 06:59.190
Is greater than value two and the not greater label is for writing code that executes when value one

06:59.190 --> 07:01.390
is not greater than value two.

07:01.410 --> 07:04.200
So the value two is greater than value one.

07:04.200 --> 07:09.090
And at the end of it we have this done label.

07:09.480 --> 07:16.740
The program flow reaches the done label after executing the relevant code based on the comparison and

07:16.740 --> 07:19.540
we have mov rax 60.

07:19.560 --> 07:23.640
This instruction sets the syscall number for the exit system call.

07:23.670 --> 07:26.400
We have X or die or die.

07:26.430 --> 07:33.360
This clears the die register as well as this is the exit status parameter and the syscall instruction

07:33.360 --> 07:37.350
performs the exit syscall terminating the program.

07:37.350 --> 07:44.250
So this code demonstrates this example of using conditional branching in assembly to execute different

07:44.250 --> 07:48.880
code path paths based on the result of the comparison.

07:48.880 --> 07:52.600
So that's it with our lecture, and I'm waiting you in the next lecture.
