1 00:00:00,800 --> 00:00:05,330 Hello, my name is Typhoon, and in this lecture you will learn about the jump if greater. 2 00:00:05,330 --> 00:00:10,660 So continuing our exploration, we arrive at a doorstep of G. 3 00:00:10,710 --> 00:00:11,090 G. 4 00:00:11,690 --> 00:00:16,190 This is a cryptic command denoting jump if greater. 5 00:00:16,190 --> 00:00:23,270 So this particular instruction orchestrates a sophisticated dance involving the sign flag. 6 00:00:23,310 --> 00:00:25,400 This the SF? 7 00:00:26,300 --> 00:00:27,280 This is the. 8 00:00:28,770 --> 00:00:30,300 Sign flag. 9 00:00:30,940 --> 00:00:34,570 Uh, the over flag and the zero flag also. 10 00:00:34,690 --> 00:00:42,160 So they are combined Symphony orchestra is to result in zero signifies a clear message. 11 00:00:42,190 --> 00:00:45,190 The result is not less than or equal to. 12 00:00:45,310 --> 00:00:53,380 So with a G we find ourselves embarking on an expedition through Sindh comparisons skillfully handling 13 00:00:53,380 --> 00:00:58,140 situations where one value genuinely surpasses another. 14 00:00:58,150 --> 00:00:59,020 So. 15 00:01:00,020 --> 00:01:08,180 As I said, we are involving here sign flag, the overflow flag and zero flag as well. 16 00:01:08,270 --> 00:01:16,130 And here we will create another example of our coding example here, just with just like we did in previous 17 00:01:16,130 --> 00:01:16,850 lectures. 18 00:01:16,850 --> 00:01:19,850 So we will create a section data fastly. 19 00:01:20,300 --> 00:01:30,950 The we will create define a byte with a value of 30 while value one db 30 here value two db. 20 00:01:31,890 --> 00:01:35,280 20, we are defining another byte with a value of 20. 21 00:01:35,280 --> 00:01:39,030 And here we will write our text here. 22 00:01:39,060 --> 00:01:40,080 Global. 23 00:01:48,730 --> 00:01:53,200 And here we will write a start here. 24 00:01:55,500 --> 00:01:55,940 Move. 25 00:01:56,950 --> 00:01:57,730 Al. 26 00:01:58,560 --> 00:01:59,330 Bite. 27 00:02:00,330 --> 00:02:01,380 Value of one. 28 00:02:01,410 --> 00:02:09,000 Here we are moving the value of, um, value of value one into the al register. 29 00:02:09,000 --> 00:02:09,690 And. 30 00:02:09,690 --> 00:02:12,960 And here, move dl. 31 00:02:14,010 --> 00:02:14,760 Fight. 32 00:02:16,940 --> 00:02:17,590 White. 33 00:02:18,870 --> 00:02:20,640 Value two. 34 00:02:20,760 --> 00:02:28,140 And here we are moving the value of value two into the B register. 35 00:02:28,140 --> 00: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, 36 00:02:37,920 --> 00:02:43,410 and after that we will use the G here, G. 37 00:02:45,780 --> 00:02:49,200 Here and name the label. 38 00:02:51,950 --> 00:02:53,870 Big greater. 39 00:02:53,870 --> 00:02:55,660 So here we are. 40 00:02:55,810 --> 00:02:56,330 Jump. 41 00:02:56,450 --> 00:03:00,200 We are telling the assembly code that jump two reader. 42 00:03:00,290 --> 00:03:01,400 Reader label. 43 00:03:01,400 --> 00:03:05,330 If a L is greater than b l. 44 00:03:05,330 --> 00:03:09,200 So if it's not great, we will also write this label here. 45 00:03:09,200 --> 00:03:10,250 So not. 46 00:03:10,980 --> 00:03:11,450 Sir. 47 00:03:11,880 --> 00:03:20,040 So this case, you will write your code here, your code here for not reader case. 48 00:03:20,040 --> 00:03:23,430 And as well we will jump. 49 00:03:23,460 --> 00:03:26,550 GMP, GMP done here. 50 00:03:26,640 --> 00:03:32,550 So we are giving the jump to the done label in this case. 51 00:03:32,550 --> 00:03:35,780 So if it's not greater, you need to jump to the done label. 52 00:03:35,790 --> 00:03:39,270 But first let's actually write the greater label. 53 00:03:39,360 --> 00: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 54 00:03:51,270 --> 00:03:55,050 here since we are jumping to the done label here. 55 00:03:56,010 --> 00:03:58,050 So we are obligated to write it. 56 00:03:58,050 --> 00:04:01,260 So here we are At first we are exit. 57 00:04:05,820 --> 00:04:09,810 And it will move racks fixed. 58 00:04:10,140 --> 00:04:14,160 As you already know, we use it almost 100 times. 59 00:04:14,160 --> 00:04:19,130 This is a fiscal number for exit and X or D. 60 00:04:21,160 --> 00:04:23,710 This is the exit status zero. 61 00:04:23,710 --> 00:04:25,720 And after that, we will call the Cisco. 62 00:04:25,750 --> 00:04:26,560 That's it. 63 00:04:27,400 --> 00:04:27,730 Here. 64 00:04:27,730 --> 00:04:31,930 I will explain this again from the start here. 65 00:04:31,930 --> 00:04:39,580 So in data section we here, we have two values are defined value one and value two the value value 66 00:04:39,580 --> 00: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. 67 00:04:48,130 --> 00:04:50,410 And we have the text section here. 68 00:04:50,410 --> 00:04:54,550 This text section contains the actual code of the program, as you know here. 69 00:04:54,550 --> 00:05:01,480 So the Start label is the entry point of the program and we also have the loading values here. 70 00:05:01,480 --> 00:05:03,130 This move instructions. 71 00:05:05,570 --> 00:05:14,130 The move Al byte value one instruction loads the value of value one into the Al register. 72 00:05:14,150 --> 00:05:19,940 It uses the byte keyword to indicate that only a single byte is being loaded. 73 00:05:19,940 --> 00:05:29,900 And similarly the byte value two loads, the loads, the value of value two into the Belle Register 74 00:05:29,900 --> 00:05:30,590 as well. 75 00:05:31,310 --> 00:05:37,550 And again, we are using this byte keyword to indicate that only a single byte is being loaded. 76 00:05:37,550 --> 00:05:41,510 And here we also have CMP instruction. 77 00:05:41,990 --> 00:05:51,320 This the CMP ILB instruction compares the values in the A, L and b l register, and this comparison 78 00:05:51,320 --> 00:05:59,270 sets various flags, including the ZF0 flag, which indicates whether the two values are equal. 79 00:05:59,270 --> 00:06:03,110 And here we also have the conditional jump here. 80 00:06:03,470 --> 00:06:04,220 This. 81 00:06:05,400 --> 00:06:09,710 Uh, g g g g instruction. 82 00:06:10,230 --> 00:06:17,490 So this, uh, g greeter instruction checks the result of the comparison. 83 00:06:17,490 --> 00: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. 84 00:06:29,400 --> 00:06:34,050 Otherwise it falls through to not greeter label. 85 00:06:34,050 --> 00:06:39,900 And we have the labels here, uh, this greeter greeter and not greeter. 86 00:06:40,710 --> 00:06:47,520 So the greeter label is where you can write code that executes when value one. 87 00:06:48,960 --> 00:06:59,190 Is greater than value two and the not greater label is for writing code that executes when value one 88 00:06:59,190 --> 00:07:01,390 is not greater than value two. 89 00:07:01,410 --> 00:07:04,200 So the value two is greater than value one. 90 00:07:04,200 --> 00:07:09,090 And at the end of it we have this done label. 91 00:07:09,480 --> 00:07:16,740 The program flow reaches the done label after executing the relevant code based on the comparison and 92 00:07:16,740 --> 00:07:19,540 we have mov rax 60. 93 00:07:19,560 --> 00:07:23,640 This instruction sets the syscall number for the exit system call. 94 00:07:23,670 --> 00:07:26,400 We have X or die or die. 95 00:07:26,430 --> 00:07:33,360 This clears the die register as well as this is the exit status parameter and the syscall instruction 96 00:07:33,360 --> 00:07:37,350 performs the exit syscall terminating the program. 97 00:07:37,350 --> 00:07:44,250 So this code demonstrates this example of using conditional branching in assembly to execute different 98 00:07:44,250 --> 00:07:48,880 code path paths based on the result of the comparison. 99 00:07:48,880 --> 00:07:52,600 So that's it with our lecture, and I'm waiting you in the next lecture.