 This time, we're going to look at conditional operation. These will give us the ability to implement things like if statements. And as with the arithmetic instructions, there are a number of instructions that the machine actually provides for us. And then there are a number of common pseudo instructions that most assemblers will accept as well. In general, these instructions compare the data in two registers to see whether they're equal or not. Our pseudo instructions will allow us to do things like say, is data in the first register larger than the data in the second register? But we'll also see how we can do those comparisons ourselves. This type of instruction gives us a way to transfer control. By default, our assembly language will just start at the top of our program and run each instruction in order until it either runs out of instructions, which case would crash, or it gets to a system call that says quit the program. Our branch instructions will give you a way to say, okay, maybe I don't want to run this next instruction. Maybe I want to skip down several instructions. Maybe I want to go to a different block of code. Maybe I only want to run this block of code if something specific has occurred. For example, if I'm using the branch equal instruction, it will skip to whatever line of code I tell it to go to. If the value of my first source register is equal to the value of my second source register, but otherwise, it's just going to go around that next line of code. This is something that's important to remember about assembly language. As I mentioned before, we have no abstractions here. So the language doesn't have any formal concept of blocks. The way we're used to, we can't say run this block. If this is true, otherwise run that block. All we can do is tell the machine, go to this line of code and start running it. We will have to delineate blocks of code on our own. If we don't provide specific instructions to delineate those blocks, the machine will just keep running the next line of code. So creating an if block is really simple. If we only want to run some block of code, if A is equal to B, we might say branch not equal AB and if. So then if A is equal to B, then it will just fall through and run this block of code. Otherwise, when A is not equal to B, it skips to the end if label that I've got. Then, if A is equal to B, then it runs all this code. It fails this test, so it runs all this code, and then just keeps running afterwards. If you were hoping it had an else condition there, it doesn't know anything about that by default. I would have to add that functionality in as well. So if I do want to have something like an else condition, I'm going to need that jump instruction. This will allow me to get to the end of my if block and say, okay, I don't want to run this next block of code. That's what happens in the else condition. So instead, I want to jump over all of this code to the end if. Now I might have branch not equal AB, else. Here's all my if code, have my else label with the else code, and then the end if label at the end. That way, if A is equal to B, I run the if block. I get to that jump label. It tells me to go to the end of the if block altogether, then I would continue running my code from there. If A isn't equal to B, then I skip over the if block, I run that code, and then continue running as well. So these branch and jump instructions are really going to help us implement what we're used to for any of our usual conditional operations, if, if else. And a little bit later, we'll look at how we can use that to build loops even.