1 00:00:00,430 --> 00:00:06,910 As we approach the final lecture of this section, we encounter the assembly language instruction j 2 00:00:06,980 --> 00:00:10,360 p jump if below or equal. 3 00:00:11,680 --> 00:00:18,850 An essential command that guides the path of programs execution based on a particular comparison condition. 4 00:00:19,210 --> 00:00:24,550 In this section, you have been gradually building a foundation of understanding for assembler language, 5 00:00:24,550 --> 00:00:29,710 and the JB instruction is another stepping stone in this journey. 6 00:00:29,920 --> 00:00:35,980 Understanding its role and significance will serve as a bridge as you transition to the next section 7 00:00:35,980 --> 00:00:43,270 where we will harness the knowledge gained here to craft more advanced and sophisticated assembler programs. 8 00:00:44,970 --> 00:00:52,320 Imagine you are reading a book and instruction is like a crossroads in the story, a point where the 9 00:00:52,320 --> 00:00:56,430 plot takes a different direction depending on certain condition. 10 00:00:56,460 --> 00:01:03,300 Similarly, in assembly language programming, the JB jump if below or equal instruction serves as a 11 00:01:03,300 --> 00:01:05,430 decision making tool. 12 00:01:05,580 --> 00:01:08,460 Now here is how it operates. 13 00:01:10,610 --> 00:01:14,240 Comparing results or comparing values. 14 00:01:14,240 --> 00:01:22,520 So just like comparing two cups of water to see, which has more, the J.B. instruction compares two 15 00:01:22,520 --> 00:01:23,160 values. 16 00:01:23,180 --> 00:01:27,590 These values could be numbers stored in different places in your computer's memory. 17 00:01:28,240 --> 00:01:29,930 Making a decision. 18 00:01:29,950 --> 00:01:34,510 The instruction then helps your computer decide what to do next. 19 00:01:34,510 --> 00:01:38,320 If the first value is less than or equal to the second value. 20 00:01:38,350 --> 00:01:43,360 The JB instruction tells the computer to take a different path. 21 00:01:43,540 --> 00:01:44,620 A jump. 22 00:01:45,810 --> 00:01:48,660 Jump or continue if the condition is met. 23 00:01:48,690 --> 00:01:52,350 Your program jumps to a new section of the code. 24 00:01:52,380 --> 00:01:55,590 Like turning to a different chapter in a book. 25 00:01:56,080 --> 00:02:02,740 If the condition isn't met, the program just keeps going in order, like reading throughout the book 26 00:02:02,740 --> 00:02:04,240 page by page. 27 00:02:04,840 --> 00:02:10,960 As we conclude this section with GBA instruction, remember that you have learned here sets the stage 28 00:02:10,960 --> 00:02:12,900 for what's coming next. 29 00:02:13,210 --> 00:02:14,080 Next. 30 00:02:14,080 --> 00:02:19,480 And in the upcoming section, you will take the knowledge you have gained and use it to create more 31 00:02:19,480 --> 00:02:22,210 intricate and sophisticated assembly programs. 32 00:02:22,210 --> 00:02:30,700 Just as books final chapters prepares you for the sequel, your understanding of GBC paves the way for 33 00:02:30,700 --> 00:02:36,670 the exciting challenges and achievements that await you in your assembly programming journey. 34 00:02:36,790 --> 00:02:45,250 Now let's, as we always do, let's create some code and understand our deeper way. 35 00:02:50,830 --> 00:02:54,100 Let's firstly get started by writing section. 36 00:02:55,060 --> 00:02:55,320 Here. 37 00:02:56,390 --> 00:03:06,260 Uh, section data are value one db 15 value two DB 20. 38 00:03:06,440 --> 00:03:08,750 So we are allocating in. 39 00:03:09,840 --> 00:03:15,300 Here we are allocate memory for value one and initialize it with 15. 40 00:03:15,300 --> 00:03:19,020 And here we are doing the same, but we are initializing it with 20. 41 00:03:19,230 --> 00:03:22,530 Now we are going to section text. 42 00:03:23,330 --> 00:03:26,330 Text and global start. 43 00:03:26,330 --> 00:03:34,550 And in the start here we will load the value stored at memory address value one into al. 44 00:03:39,620 --> 00:03:47,180 Value one and we will load the value stored at memory address value two into pl move. 45 00:03:47,780 --> 00:03:48,080 PL. 46 00:03:49,550 --> 00:03:50,570 Value to. 47 00:03:51,550 --> 00: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 48 00:04:02,440 --> 00:04:04,870 this j p. 49 00:04:05,740 --> 00:04:05,950 E. 50 00:04:08,410 --> 00:04:08,780 J. 51 00:04:08,830 --> 00:04:09,310 B. 52 00:04:09,910 --> 00:04:10,260 J. 53 00:04:10,300 --> 00:04:12,310 B below. 54 00:04:13,230 --> 00:04:13,800 Or. 55 00:04:15,660 --> 00:04:16,200 Equal. 56 00:04:17,540 --> 00:04:18,810 And here we are. 57 00:04:18,840 --> 00:04:26,180 Uh, we are performing a comparison between the values in A, L and b, l, and here we are. 58 00:04:26,690 --> 00:04:27,310 Jump. 59 00:04:27,320 --> 00: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 60 00:04:36,920 --> 00:04:42,650 we will write not below or equal label. 61 00:04:42,650 --> 00:04:55,060 And here you will insert in insert your code here, put here to code here and in this case. 62 00:04:55,070 --> 00:05:02,810 So in this case, this means that value one is not below or equal to value. 63 00:05:02,810 --> 00: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 64 00:05:16,580 --> 00:05:17,700 or equal label. 65 00:05:19,490 --> 00:05:24,670 Below or equal label where our condition is met. 66 00:05:24,680 --> 00:05:29,210 So insert your code here. 67 00:05:29,480 --> 00:05:33,200 So let's fix that your code here. 68 00:05:33,530 --> 00:05:34,910 So if we. 69 00:05:38,420 --> 00:05:45,050 If you make this like change the value to 2020 here because it also it will be more logical for this 70 00:05:45,050 --> 00:05:45,670 example. 71 00:05:45,680 --> 00:05:50,060 But yes, we can also do 15 or 20 so we can do whatever value we want. 72 00:05:50,810 --> 00:05:52,310 Your code here. 73 00:05:52,310 --> 00:05:59,780 So where value one is below or equal to value two. 74 00:06:01,250 --> 00:06:02,030 And that's it. 75 00:06:02,030 --> 00:06:06,470 So here we need to create this down here. 76 00:06:07,690 --> 00:06:10,840 Here, we will insert our exit code. 77 00:06:12,280 --> 00:06:13,690 Here in. 78 00:06:14,780 --> 00:06:18,590 Insert your exit code here. 79 00:06:18,770 --> 00:06:20,990 And now let's. 80 00:06:22,610 --> 00:06:25,850 Explain this in more technical way here. 81 00:06:25,850 --> 00:06:30,860 So in this data section, memory allocation, Memory. 82 00:06:30,890 --> 00:06:41,750 Memory allocation is dedicated to value one which which here which value one is initialized with 20 83 00:06:41,750 --> 00:06:50,870 and here we in value two we are doing the same, which is similarly memory is allocated for value two 84 00:06:50,870 --> 00:06:52,760 and initialized to. 85 00:06:53,710 --> 00:06:55,450 20 as well. 86 00:06:56,130 --> 00:06:57,720 And after that. 87 00:06:58,780 --> 00:07:07,180 Uh, in this start, our process commences with the move instruction responsible for loading the byte 88 00:07:07,180 --> 00:07:14,860 size value, uh, from memory location value one into the Al register. 89 00:07:14,860 --> 00:07:21,670 And in parallel the Move instruction accomplishes the same loading the byte size value from memory location 90 00:07:21,670 --> 00:07:30,880 value two into the Belle Register and here we the CMP instruction carries out a meticulous comparison 91 00:07:30,880 --> 00:07:34,570 between the contents of Al and Belle registers. 92 00:07:34,570 --> 00:07:43,930 And here the after that the JB The decision making aspect of our journey unfolds with the J.B., which 93 00:07:43,930 --> 00:07:46,240 is jump if below or equal instruction. 94 00:07:46,240 --> 00:07:56,040 It gets us to the below or equal label if a a al is below or equal to Belle. 95 00:07:56,320 --> 00:08:05,660 And after that here for this segment provides you with the technical canvas to implement codes specifically 96 00:08:05,660 --> 00:08:11,180 tailored to a scenarios where value one is not below or equal to value. 97 00:08:11,180 --> 00:08:11,840 Two. 98 00:08:12,610 --> 00:08:18,160 And here in below or equal label we have in the space. 99 00:08:18,160 --> 00:08:25,540 Your technical prowess takes center stage allowing you to craft code addressing scenarios where value 100 00:08:25,570 --> 00:08:26,410 has value. 101 00:08:26,410 --> 00:08:31,270 One is indeed below or equal to value two and in done. 102 00:08:31,480 --> 00:08:39,820 This is the conclusion of our journeys marked by the down label indicating the final stage of our program's 103 00:08:39,850 --> 00:08:40,750 execution. 104 00:08:41,780 --> 00:08:49,460 And as we navigate this assembly code, we navigate the intricate arrays of conditional branching and 105 00:08:49,460 --> 00:08:56,510 comparisons encapsulating scenarios where value one is either below or equal to value. 106 00:08:56,510 --> 00:08:57,110 Two.