‫Welcome.
‫So in this lecture, we're going to explain what logic gates and how the process works internally.
‫This is important for you to understand so you understand how our assembly language is working.
‫Now, essentially what happens is an instruction is binary, right?
‫And it gets passed through a circuit in the process which results in an outcome.
‫And how these how these are integrated in the process is by using what's known as logic, gates, logic,
‫gates, basically the way you position transistors to make certain logic happen, such as an and gate
‫on all gates or XOL gates, each of those gates do different things.
‫So we're now going to explain what all of those gates do.
‫And I'm going to hopefully give you more of an insight of how instruction sets work.
‫Hey, guys.
‫OK, so I've got a little circuit simulator here and I'm going to try to explain how the instruction
‫sets in a process of work.
‫So I'm going to get rid of this for now.
‫Essentially in the process, you have what's known as an instruction set.
‫Now, all of the instructions say is is circuits arranged in a certain way.
‫And then obviously they're quite complicated because they're the fundamentals of your process of core.
‫So you have you know, you have circuits such as the ACLU, which is responsible for adding and multiplication,
‫stuff like that.
‫Mathematics and our actual instructions are also pass through this.
‫And essentially, when we write assembly and we pass through, an assembler is converted to its binary
‫equivalent.
‫So I'm just going to make a simple circuit here now just to try and explain some of this stuff.
‫So I'm going to add a new and gate, which is and I'm going to go like this.
‫Right.
‫So at the end game, does it takes two inputs if both the one outputs, so on.
‫So let me add in a power source that.
‫So you can see I've added a power source there.
‫And I've added a power source here, so if we run that now.
‫Yes, sir, if you run that now, you can see that because both of these are on.
‫The output is on.
‫If I turn one of those off, the output is off.
‫Right on, off on, off on.
‫And I turn this one off.
‫That one goes off.
‫Turn this one on, button this one off, then it goes off.
‫So the angle basically says if both inputs are one, then the output is one.
‫So why am I explaining this?
‫Well, think of these things here as the data pins on your process.
‫Right.
‫Essentially want to read your instruction in these data.
‫Pins will be filled with these currents, these voltages that the current from the voltage.
‫Right.
‫So it's either high or low.
‫So in this case, we have in this little example I've made for you here, we have a we have data pins
‫that that it has two data pins.
‫Right.
‫So what would happen is when it loads a bike from memory, it would fill these data pins with the value
‫of that bike.
‫And obviously they'll be there would be eight of those or whatever.
‫It would assign the lower eight pins.
‫Right.
‫And then it would pass it through a much more complicated circuit than this and it would figure out
‫which instruction that you are trying to do.
‫So, for example, these two here can be expressed as one one, which equals.
‫Binary three, decimal three.
‫So because because binary one one equals decimal three, essentially in this little circuit I made here,
‫this tiny circuit, one of our instructions is, is binary one one or decimal three.
‫And if you pass in that instruction, binary one one, we just can output here.
‫Now in your processor, it's going to be more complicated than that.
‫So, you know, decimal three, this is just an example now might mean move register L to register a
‫Hajaj.
‫Now, obviously we haven't really gone to in depth registers yet, but all you need to know is registers
‫are basically tiny storage inside the processor itself outside of RAM.
‫So in that case then, you know, decimal three or binary one one as can be represented here, the current
‫will go in here.
‫Can you go in here?
‫The output to be one and then it will start and then it will go through all the circuitry to actually
‫move the value from the capacitors and move that value to the other capacitors to to move the value
‫from from one to the other, for example.
‫But that's a lot more complicated.
‫But I hope this this kind of makes sense, because this is this is how the process works internally.
‫But it is done on a much more complicated level and there would be a lot more circuitry involved to
‫perform some of the operations.
‫This is just a simple and game to show you that on the lowest level, these are the building blocks
‫and you would have thousands, millions of these in your process to make it work.
‫OK, so let me now show you an instruction set and we can go more from there.
‫So if we look by here, this is the instruction set for the 086 processor.
‫This is the we've been using Muladi Eighty-six.
‫This is is simulating this this processor essentially.
‫So you can see it has quite a few instructions here.
‫And in the process will be loads of circuitry like the ones I just did in that circuit simulator, but
‫a lot more of them and more complicated.
‫They'll be a lot of those, too.
‫So the one that receives the data, the binary equivalents of these instructions, it will it knows
‫where to reroute the electricity, the current in the processor, which makes certain things happen.
‫Right.
‫So, for example, if we look at the jump instruction by here, let may just take you to that.
‫You can clearly see here, it says an unconditional jerm transfers control to another part of the program.
‫So while this does this here would basically one once assembled the binary equivalent, the jump construction
‫would change the program county register.
‫And by the way, the program of register holds the value of the instruction in memory and RAM that you're
‫currently executing.
‫So it holds the address of where that instruction is.
‫So, for example, in the Hallowell tutorial, I told you MSDOS loves us at 100.
‫Hajjaj right.
‫Well, in that case, when it jumps to us, the program counter will be 100 hacks.
‫That will be the value of it.
‫Right.
‫So when we call the jumpier what we're basically doing, we're just changing the program counter register
‫so that it points to another part in RAM.
‫So then in the circuitry level of your processor, the binary code of this jump instruction, it will
‫go through all the and gates and all that and all the gates until it until it gets to the circuitry
‫in the process responsible for copying the value you want to jump to, to the program counter register.
‫So that's how it works.
‫It's all just clever circuitry and it's all built on logic gates.
‫OK, so I'm going to just quickly write a little program just to show you what I'm talking about.
‫Right.
‫When I do a GMP dollar, that means to just keep jumping to the same position is basically infinite.
‫It'll constantly jump back to line seven.
‫Right.
‫So it will never end.
‫I just want to show you that this is a nice, simple instruction for emulate here.
‫Now, you can see here to the right is our assembly and to the left is what's in memory at that address.
‫So you can see that the up code for jump jump is two hundred and thirty five decimal.
‫So if we now convert that to binary, you can see that 235 decimal is this binary value here.
‫So back at my circuit, essentially, you see that we have two of those lines here, right?
‫What we'll call them data lines.
‫You would have eight of those.
‫Right.
‫And then these values here will be passed in.
‫So if it's zero, then it will be off.
‫And if it's one, then it'll be all right.
‫And then that goes through all of the logic gates to produce an output like this one here.
‫And then obviously, whichever part in the process it outputs to, it would deal with that operation.
‫So in our case, we're doing a jump right now.
‫If we take a look at the second byte here, we see two, five, four, which is the set, which is the
‫value, because here we say jump one hundred H.
‫Right.
‫Because when we do jump in here, it takes our current address.
‫And what it assembles, it replaces it replaces that with the address that we're currently at.
‫Right.
‫Which is one hundred Hajj.
‫So that's how it's an infinite loop because it'll keep jumping to itself forever.
‫Right.
‫But so these two to these two bytes make up that jump construction.
‫You have the first byte here, decimal 235 binary equivalent by there.
‫And while that is a jump instruction and then the jump construction expects a second byte, which is
‫where you want to jump to.
‫And our case is two hundred fifty four decimal.
‫Right.
‫So that is how it works, essentially.
‫So if we now run this.
‫You can see is an infinite loop, so that's what I jumped as there, but I hope that makes sense about
‫how the process works because bye bye bye.
‫Explain the circuitry like this.
‫Hopefully it makes a little more sense.
‫So when we assemble our assembly code, it becomes machine code, which corresponds to the instructions
‫set here.
‫And by scrolling up, we can see all the available instructions.
‫And there's different variants of these instructions as well, by the way.
‫But your assembly will choose the right one, so you don't have to worry about that.
‫So basically, your entire process has instructions said, and this is the readable manual and how the
‫instruction set is built into the process is that it's just logic gates and transistors that make up
‫different connections and and rules of how the of how the data can be transferred along the circuit.
‫And he uses, you know, just uses physics to do that.
‫Basically, you know, like with the transistors, you can change the way the current flows.
‫So that is how it works.
‫So now that you understand that, hopefully now that clears that part of the costs up.
‫But you can drop me a message if you get into trouble with that, because it is a complicated subject.