WEBVTT

1
00:01.520 --> 00:04.100
Hello and welcome to the next lesson.

2
00:04.280 --> 00:09.650
In this lesson, we are going to do a practical on the OR operation.

3
00:10.490 --> 00:19.160
The OR operation syntax is as follows: OR destination, source, and the result will be stored back into

4
00:19.160 --> 00:20.150
the destination.

5
00:21.080 --> 00:25.340
So there are these two variations that we will look at.

6
00:25.370 --> 00:28.850
First one is OR register and immediate.

7
00:29.030 --> 00:33.080
And the second one is OR register and register.

8
00:33.890 --> 00:38.450
And then for each of these two, we will be using the values from here.

9
00:38.870 --> 00:43.040
So the first value will be in the first operand,

10
00:43.040 --> 00:46.040
and the second value will be in the second operand.

11
00:46.400 --> 00:51.560
And for the register, we can choose -, -, - and so on.

12
00:51.920 --> 00:56.150
But we are just going to stick with - for this practical.

13
00:56.690 --> 00:58.160
So let's get started.

14
00:58.550 --> 01:04.010
I've already opened template 2x in my x64dbg, so,

15
01:04.010 --> 01:05.990
and I also put a breakpoint here.

16
01:06.410 --> 01:09.710
So now let's create the code that will make this happen.

17
01:10.760 --> 01:16.580
So for the first example, we are going to take - as the register.

18
01:16.730 --> 01:20.270
So we need to move this value into -.

19
01:21.080 --> 01:22.550
So let's do that now.

20
01:26.280 --> 01:27.540
And click okay.

21
01:34.240 --> 01:36.400
Right, now we run to our breakpoint.

22
01:38.810 --> 01:42.620
Step away until we reach this line.

23
01:43.250 --> 01:48.770
And notice here, it has converted the binary number into hex.

24
01:48.920 --> 01:57.170
And we can confirm by opening our calculator to check whether the 3D hex value represents this binary

25
01:57.170 --> 01:57.770
number.

26
01:58.610 --> 02:03.950
So we can go into here and key in our hex value as 3D.

27
02:05.780 --> 02:09.140
And we will see it is converted to this binary number.

28
02:11.030 --> 02:12.470
That means it is correct.

29
02:13.880 --> 02:21.200
Now the next instruction is to step over this, to let it move this 3D into -.

30
02:22.850 --> 02:24.680
3D is now in -.

31
02:25.550 --> 02:28.610
Next, we are going to perform this OR operation.

32
02:28.610 --> 02:30.080
So let's do that now.

33
02:33.500 --> 02:35.840
The immediate value will be this one here.

34
02:41.490 --> 02:42.000
And hit

35
02:42.000 --> 02:42.690
okay.

36
02:44.880 --> 02:47.430
Now we step over this to execute it.

37
02:52.260 --> 02:56.580
And we have just executed it, and the result is stored in the - register.

38
02:57.000 --> 03:04.020
So let's go to our calculator to confirm whether the result is correct.

39
03:06.780 --> 03:10.860
Make sure you set this to byte and bitwise.

40
03:11.670 --> 03:17.400
Before that, let's input by using the bin input.

41
03:18.600 --> 03:19.230
Clear.

42
03:20.580 --> 03:23.610
And then over here, we input the first value.

43
03:32.980 --> 03:37.150
Then select bitwise OR, and then

44
03:37.150 --> 03:39.130
now input the second value.

45
03:48.000 --> 03:51.780
Hit equal, and we get this value.

46
03:51.960 --> 03:53.700
And in hex, it is 3F.

47
03:54.090 --> 03:55.650
So compare it with -.

48
03:56.070 --> 03:57.990
Indeed, we get 3F.

49
03:57.990 --> 04:00.120
So it's working.

50
04:01.440 --> 04:07.350
So now let's do the next one, which is to OR register and register.

51
04:08.520 --> 04:14.400
So we're going to put this value into binary, into the register - again.

52
04:15.630 --> 04:19.020
So we can just copy this line here.

53
04:31.440 --> 04:32.730
And paste it here.

54
04:36.660 --> 04:46.770
Then you are going to put this value in the second register, and we will choose - for that register.

55
04:49.260 --> 04:53.430
So we are going to move -, 0b.

56
05:03.790 --> 05:04.150
Hit

57
05:04.150 --> 05:04.930
okay.

58
05:08.190 --> 05:11.670
And it has converted our binary number into 22.

59
05:12.660 --> 05:17.040
We can go and confirm by using our calculator

60
05:19.390 --> 05:23.620
whether or not this 22 represents this second binary number.

61
05:24.520 --> 05:25.600
Click cancel.

62
05:27.310 --> 05:30.550
Make sure it's bin again. Key in this number.

63
05:41.230 --> 05:45.070
And indeed, you look at the hex, it is indeed

64
05:45.100 --> 05:45.490
22.

65
05:47.800 --> 05:52.810
So now let's step over that.

66
05:57.600 --> 05:58.920
And step over this.

67
05:59.280 --> 06:03.120
So we have our two values in our registers already:

68
06:03.150 --> 06:04.470
- and -.

69
06:04.920 --> 06:06.870
The next thing to do is to OR them.

70
06:08.490 --> 06:13.260
So now we're going to OR -, -.

71
06:14.280 --> 06:15.150
Hit okay.

72
06:17.950 --> 06:19.900
And now we're going to step over this.

73
06:22.280 --> 06:23.330
And we get 3F.

74
06:23.870 --> 06:26.960
So let's open our calculator and test it out.

75
06:31.410 --> 06:33.300
Clear the input first.

76
06:35.190 --> 06:37.590
So the first value is 3F.

77
06:37.980 --> 06:42.810
So we input as hex. It will be faster: 3F.

78
06:43.590 --> 06:46.290
And then we OR it with

79
06:47.960 --> 06:48.950
22.

80
06:51.250 --> 06:54.040
And we should get 3F.

81
06:54.280 --> 06:57.220
So it seems that our result is correct.

82
06:57.760 --> 07:00.520
So that's all for this video.

83
07:00.550 --> 07:02.200
Thank you for watching.