Transcript:

What’s up, guys? I’m Marcin from raw, smart tech comm. And this is another tutorial and assembly programming this class. I’m going to show you guys how to use the MU L instruction or short for multiplication, so let’s get started. I’m going to first open up this notepad here. So this is the syntax here of a mu. L instruction and there are three versions, right, you can either use Mu L type in Mu. L, which is the instruction hit space type in a bit register or a bit memory, alright? The second version is what’s happenin. Mu L hit space and type in either a 16-bit register or 16-bit memory. Now the third version. Here we type in Mu L. We can hit space. We’re going to segment a 32-bit register or 32-bit memory, All right, the way it works is whatever is in Ail get will get multiplied all automatically, so you have to move values that you wanna multiply in Al right, it’ll multiply with whatever operand you put next to this multiplication instruction. So if it’s a 16 If sorry, if it’s a bit value you can put. BL or you can put a a bit memory operand in there, so it’ll multiply the two together and the results get stored in a X, So I’ll show you how that works right now, but first let me show you This example, so we’re going to move into Al 2h right, so then we’re going to move into BL 5 H. So this is the MU L instruction here in step in Mu L and hit space and type in our upper, and we want to multiply, which is BL, so it’s automatically going to first multiply. Whatever is in Al right, It’s going to look for whatever is a nail. They multiply it with BL because we, this is our a pair and we chose to multiply so 2 times 5 should be 10 so right here, so 2 H times 5 equals 10 H right and the results get stored in a X right and the zero flag is not set because it was no overflow. So let’s open up Mu 8086 here, so I can show you how it works, so let’s start off by moving around some values. Let’s move into a L say 5 H right, Let’s move into BL 2 H let’s hit space a couple times. Let’s use the multiplication or MU L instruction type in Mu L hit space type in the operating. We want to multiply has to be a bit operand because we’re using a bit registers up here, so I’m going to take an appeal, right, so it’s automatically going to look for whatever is in Al Right, It’s going to multiply that with ever operating. You chose to put next to the multiplication instruction here, so it’s going to multiply a what, Bo? So the results should get stored in a X, So let’s hit emulate here, so our first line of code here is highlight and move into a l5h once. I hit single step. Al should have five and it does, so our second line of code is highlighted. Move into BL to H So once I hit single step B. L should have 2h Someone hit single step as you can see. BL has 2h now right now. Our third line of code is highlighted the MU L instruction to multiply instruction and we chose a upper end of 8 bit and it’s a 8 bit register BL, So it’s going to multiply BL with L because it’s going to automatically look for whatever is in a L right we and we put 5 H in a O, and we put the 2 H and B L so it’s going to multiply 5 and 2 and so, and the results will be stored in a X So so let’s see what happens on the hit single step. Now A X has a value of zero A. That’s hexadecimal. So I’m going to copy this here. I’m going to open up my browser and I have this binary to decimal to hexadecimal a page open. Um, but I’ll leave it in the description if you guys are interested. I’m going to paste it here in hexadecimal and we hit enter and as you can see decimal of 0 a is 10 so the our answer was 10 Well, let’s look at this example here. There’s an example of a 16-bit version here, so we’re going to move into a X. Let’s say 2008 right, so then we’re going to move into B X 100 H. So it’s automatically going to look for whatever is in a X, So when we use the multiplication instruction MU L instruction down here and we type in our upper end, it’s going to first look at a X, It’s going to multiply whatever’s in a X with the operand we chose to put next to this multiplication instruction, which is BX and B. X has a value of 100 so 2,000 H Times 100 H should be 200,000 here and the carry flag would be set to 1 The reason the carry flag will be set to 1 is because for the last 4 bits here is for the ax register. The result so gets stored in the ax register and the first 4 bits here. It’s for the DX register. So if the the result is greater and four digits, the carry flag would be set and then the rest would be shifted over to DX here, so you would add a zero and then the rest will be shifted over to DX how we would get the answer, so lets. Try it out, so lets. Open up this here. Let’s replace ale with ax. Alright, let’s replace. BL with BX. Let’s change be elegant to BX, let’s change. What value do we have? Okay, let’s make a. I’ll have a value of 200 H all right or 2,000 H. I’m sorry and BX have a value of 100 H right, so let’s hit em. You like to see what happens. So the first line of code here is highlighted move into ax 2,000 H So once I hit single step, It should have 2,000 H and it does as you can see here. So our second line of code here is highlighted. Move into B X 100 H Once I hit single step, The X should have 100 H and it does right here now. Our third line of code here is highlighted. X X, right, we hit multiply. We type in Mu. L we hit spaceman and we hit our operating. We want to multiply! It first looks for our ax. It looks C whatever’s in ax. It multiplies that whatever operand you chose to put next to this multiplication instruction in this case, its B X. So X has a value of 2008 B. X has a value of 100 H Once. I hit single step here now. An ax here is 0 right. This is the first four digits are used if the number goes over, our carry flag here are set, so let’s see what the flag our carry flag is set to 1 and the other of 4 bits gets stored into D X, So it’s 2,000 as you can see here, so that’s pretty much it for this tutorial. I’ll go over it one more time from the beginning. Let’s not close this so again. We moved into ax 2008 right, so then we moved into Bx 100h so when we use the multiplication instruction with a 16-bit operands and 16-bit register, right the the number gets stored in DX. + Ax together as you can see right here. The X and X Together. If then, number is greater than 4 digits, some sum of the number gets stored in DX. All right, so I’ll give an example how that would look here, so are we? We got 200,000 right, so there’s a Pitts so 1 2 3 4 5 6 7 8 so 200,000 would be here. The 2 would be here, right, so the ax would be all zeros. Sorry from here. If this is ax portion, This is the BX or I’m sorry. The DX portion since the number is greater than 4 bits, the carry flag was set and the remainder of the number was moved into DX. So that’s how we got a DX here with a value of 20 and the ax with the value of 4 zeros. So that’s pretty much it for this tutorial. If you guys like this tutorial, please give me a like. If you want more videos like this, please subscribe to my channel, im. Wriston from Rust protector comment. Thanks for watching.