In this unit we're going to complete the description and the specification of the Hack machine language. So once again, the overall context is that we have a harder platform consisting of a construction memory, CPU in a data memory. And we have a machine language language consisting of A instructions and C instructions. We described these instructions in the previous unit. And a Hack program is a sequence of such instructions batched together. And we execute them one at a time. That's, that's, the overall picture. Now, as it turns out and this is true for every, machine language, out there. You can write programs in machine language using two different flavors, or two different languages, if you will. You can write them symbolically, using, mnemonics and friendly, symbols. And that's what we see here on the left hand side at, at the bottom of the slide. Or you can write them using agreed-upon binary codes. Now, if you write programs symbolically, you'll need someone to translate these programs from symbols to binary code. And once you do this, once the program is specified in, in binary code. You can actually take this code, load it into the computer and actually execute the code on the computer. Now, we're going to spend a whole week talking about this translation and about a very special program called an assembler. So I'm not going to spend too much time discussing the translation process. But I just want you to know that it's a challenge that has to be met somewhere when you build this computer. So here is the symbolic and binary syntax of the A-instruction. Well, the symbolic syntax is something that we've seen, before, at a certain value. And, this value can be either a number which is, at most, 2 raised to the power 15 minus 1. You may be wondering, where this number comes from and you'll see it in just a minute. Or, it may be a symbol which refers to such number, and we are going to defer the discussion of symbols, to a later unit. For example, @ 21. So, here's the same instruction in, in its binary flavor. We begin with a special code zero, which tells the computer that this is an A instruction. And then, we specify the same value that we had in the symbolic instruction, but we specify using binary code. So altogether we get something like, this example here. Once again, the first zero is something called, an op code, an operation code. And then, come 15 bits that represent the value that we want to load into the A register. And it so happens that the, hopefully, 1 0 1 0 1 is, the same as 21 in binary. What about, the C instruction? Well, the C instruction, as you recall, the symbolic definition of the C instruction is very user friendly. We have a computation, which we can store in certain destination. We have an option of jump directive, and that's, that's the great benefit of, symbolic expression. If we want to express it, in binary, then, we have to decide on some agreed upon codes. And, Norm and I have already done that when we designed this language. So here is the 16 bit specification of the same symbolic instruction. The first one is an op code. It tells the computer that this is a C instruction. If you recall we have only two types of instruction. A instruction and C instruction, and that's why we need only one code or one bit to represent the op code. Which is either zero or one. So one op code means this is C instruction. Then we have two bits which we don't use. We don't need them, and by convention, we set them to one. The next seven bits, taken together specify, what is the computation that I want to achieve? These are the control bits that will be sent later on to the ALU and will tell the ALU which computation it has to to carry out. The three bits represent the destination. And finally the last three bits represent the jump condition. That that we call this symbolically using the word, jump. So, this is the sort of the different fields of the instruction in its binary flavor. So let us now discuss the mapping between the symbolic expression of the C-instruction and the binary expression of the same instruction. Let us begin with the comp field. So here is a table that relates the symbolic computer mnemonic to their binary equivalence. What we see on the left-hand side is the the symbols, and on the right-hand side we see the binary codes. And we also have the A bits that you can see at the bottom of the table. So for example, suppose that the computation is d plus 1. You know, symbolically, we want to cause the computer to compute d plus 1. Well, we look up, the table. We see, the d plus 1 somewhere in the middle of the table. And we see that the d plus 1 is listed in the column, where a equals zero. So we know that the A bit should be zero. Then we look up the rest of the row in this table, and we see that the C bits should be 011111. So that's it. That's how we represent the operation d plus 1 in binary. It's 0 0 0 or whatever it is. I don't want to make a mistake, you just look at the table and you have it. So that's how you map from symbols to to binary codes. Okay, moving along, let's talk about the destination field. A very similar idea. We have a mapping that gives you the symbolic mnemonics on the left hand side. And in the next column you have your binary code equivalents which are very conveniently arranged from 0 0 0 to 1 1 1. Because we have eight different possible destinations. So once again, if someone gives you a particular destination, like MB. You look it up in the table and immediately you see that it relates to the binary code in this example, 0 1 1. So that's how you can translate from symbols to, binary code, if you have to. All right. Finally, let us focus on on the jump field. Almost the same as the destination. We have exactly the same concept. We have, the mnemonics, on the left hand side, and we have, eight different, possible, binary combinations, in the next column. Once again, conveniently enough, we have eight different jump, conditions. And that, and therefore, the, their binary equivalents, conveniently enough, range from 0 0 0 to 1 1 1. So, that's it. This basically, sums up the, the mapping between the symbols and the binary codes. If we want to put it all together. We can do it in one slide. And this is a complete specification of the C-instruction in all its glory, both in the symbolic rendition and in the binary rendition. And if you had to write a computer program to translate from one language to the other. You can begin to see how you can use this logic in order to write this program. And by the way, this is something that we are going to do in the last week of this course. So, now that we understand how the specific instructions look like, in both binary and symbolic. Let's move on and talk about the overall concept of a Hack program. Here's an example of a Hack program. At this level of the course, you don't have to understand the program. We're just giving you a first overview of how a program looks like and to make some, some quick observations. You know, first of all, a Hack program is a sequence of Hack instructions. This program is wrote, written using our symbolic instructions. White space is, permitted. You can throw in, empty lines, wherever you want if you think that it, improves, the readability of the program. And comments are, are welcome and can be used at will. Finally, I'd like to say that this is not a great way to write Hack code. There are better ways to to write code with less numbers and more symbols and this is something that we'll do later on the in course. Once again, for now I just want you to see an example of a typical Hack program. And if we want to run this program on the computer, we first of all must translate it into binary code. So, we have either a human assembler or a, a computer program that translates from one to the other. Once the program is expressed into binary code we can actually load it into the computer and execute it. And the program will hopefully do something useful. If not, we can go back, debug the program, recompile it or reassemble it and rerun it and so on until we are satisfied with it. So this has been the last unit in which we talked about the Hack machine language. And, in the next unit, we are going to to talk about how we can use this language to control input / output devices. Which are connected to this to the Hack computer.