Hello and welcome to the next lesson.
In this lesson, we are going to do a practical on the OR operation.
The OR operation syntax is as follows: OR destination, source, and the result will be stored back into
the destination.
So there are these two variations that we will look at.
First one is OR register and immediate.
And the second one is OR register and register.
And then for each of these two, we will be using the values from here.
So the first value will be in the first operand,
and the second value will be in the second operand.
And for the register, we can choose -, -, - and so on.
But we are just going to stick with - for this practical.
So let's get started.
I've already opened template 2x in my x64dbg, so,
and I also put a breakpoint here.
So now let's create the code that will make this happen.
So for the first example, we are going to take - as the register.
So we need to move this value into -.
So let's do that now.
And click okay.
Right, now we run to our breakpoint.
Step away until we reach this line.
And notice here, it has converted the binary number into hex.
And we can confirm by opening our calculator to check whether the 3D hex value represents this binary
number.
So we can go into here and key in our hex value as 3D.
And we will see it is converted to this binary number.
That means it is correct.
Now the next instruction is to step over this, to let it move this 3D into -.
3D is now in -.
Next, we are going to perform this OR operation.
So let's do that now.
The immediate value will be this one here.
And hit
okay.
Now we step over this to execute it.
And we have just executed it, and the result is stored in the - register.
So let's go to our calculator to confirm whether the result is correct.
Make sure you set this to byte and bitwise.
Before that, let's input by using the bin input.
Clear.
And then over here, we input the first value.
Then select bitwise OR, and then
now input the second value.
Hit equal, and we get this value.
And in hex, it is 3F.
So compare it with -.
Indeed, we get 3F.
So it's working.
So now let's do the next one, which is to OR register and register.
So we're going to put this value into binary, into the register - again.
So we can just copy this line here.
And paste it here.
Then you are going to put this value in the second register, and we will choose - for that register.
So we are going to move -, 0b.
Hit
okay.
And it has converted our binary number into 22.
We can go and confirm by using our calculator
whether or not this 22 represents this second binary number.
Click cancel.
Make sure it's bin again. Key in this number.
And indeed, you look at the hex, it is indeed
22.
So now let's step over that.
And step over this.
So we have our two values in our registers already:
- and -.
The next thing to do is to OR them.
So now we're going to OR -, -.
Hit okay.
And now we're going to step over this.
And we get 3F.
So let's open our calculator and test it out.
Clear the input first.
So the first value is 3F.
So we input as hex. It will be faster: 3F.
And then we OR it with
22.
And we should get 3F.
So it seems that our result is correct.
So that's all for this video.
Thank you for watching.