WEBVTT

1
00:01.600 --> 00:03.100
Hello and welcome.

2
00:03.100 --> 00:07.570
In this practical, we are going to take a look at the AND operations.

3
00:07.570 --> 00:12.880
And the AND operations have got this syntax: source, destination.

4
00:13.570 --> 00:17.590
So the result of the AND will be stored in the destination.

5
00:18.130 --> 00:20.110
And there are few variations here.

6
00:20.110 --> 00:24.490
You can AND register immediate and register register.

7
00:24.490 --> 00:26.260
So let's try them one by one.

8
00:26.980 --> 00:36.490
And for the purpose of this exercise, we are going to make use of these values from the slides over here.

9
00:37.210 --> 00:40.000
So the first value will be this,

10
00:40.000 --> 00:41.290
and the second value will be this,

11
00:41.290 --> 00:42.790
and the result should be this.

12
00:43.240 --> 00:49.870
We are going to store the first value here into the register.

13
00:50.590 --> 00:57.400
And then we are going to use the immediate value over here as the second parameter.

14
00:57.970 --> 01:01.750
So now we're going to store this value in the register.

15
01:01.750 --> 01:04.030
So we are going to use - as an example.

16
01:04.300 --> 01:06.310
You could also use other registers.

17
01:06.790 --> 01:09.550
Let's move this value into -.

18
01:10.870 --> 01:18.640
So the value that we are going to move into - is this value: 00100000.

19
01:18.640 --> 01:19.900
So let's do that now.

20
01:23.970 --> 01:26.430
Move -.

21
01:26.580 --> 01:31.230
And then for the prefix, instead of 0x, which means hex,

22
01:31.410 --> 01:33.930
now we put 0b, which means binary.

23
01:34.200 --> 01:36.210
Now we can type our binary number.

24
01:42.590 --> 01:43.550
Okay, okay.

25
01:45.380 --> 01:47.600
So in hex it is 20.

26
01:48.320 --> 01:49.550
So we step over this.

27
01:49.550 --> 01:53.210
Now we run to this breakpoint first.

28
01:53.210 --> 01:55.220
Before that, make sure you put the breakpoint.

29
01:55.970 --> 01:57.650
This is your template 2x.

30
02:00.640 --> 02:04.120
Step over until you come to this line.

31
02:05.530 --> 02:06.400
Step over that,

32
02:06.400 --> 02:08.170
and now you see the value.

33
02:08.200 --> 02:10.450
20 is already in -.

34
02:10.840 --> 02:13.330
Next, we are going to AND with this value here.

35
02:16.010 --> 02:20.030
AND -, 0b

36
02:22.640 --> 02:26.750
01100111.

37
02:35.740 --> 02:38.110
So let's step over and see the result.

38
02:40.320 --> 02:41.910
Right, and you go back to 20.

39
02:42.540 --> 02:48.420
So 20 is the original value that we input here. To confirm this,

40
02:48.450 --> 02:51.570
you can use your programmer's calculator.

41
02:52.020 --> 02:55.950
So let's search for calculator and then...

42
02:59.790 --> 03:01.260
Make sure you use the programmer one.

43
03:01.260 --> 03:03.570
You can change the calculator here.

44
03:04.350 --> 03:09.270
Standard or scientific or programmer.

45
03:10.170 --> 03:12.990
And here, set it to byte.

46
03:13.920 --> 03:16.860
And here, the input, change it to binary.

47
03:17.370 --> 03:19.230
So let's put in the first value.

48
03:20.100 --> 03:21.210
So type it in.

49
03:27.670 --> 03:28.990
This is the first value.

50
03:29.020 --> 03:33.010
Now the second one, we are going to perform a bitwise AND operation.

51
03:33.010 --> 03:39.430
So let's tap on that and AND, enter the second value here.

52
03:47.720 --> 03:54.020
You close, and you get 00100000, which is 0x20, which we are seeing here.

53
03:54.380 --> 03:55.580
So this works.

54
03:55.580 --> 03:57.890
That means this proves that the result is correct.

55
03:57.890 --> 03:58.670
The result.

56
03:59.330 --> 04:07.760
Next, we are going to try the second variation, which is register to register, AND register,

57
04:07.760 --> 04:08.210
register.

58
04:08.210 --> 04:12.080
So we are going to use the - here and - here.

59
04:12.410 --> 04:14.630
So - already got 20.

60
04:14.630 --> 04:18.620
So now we're going to move the second value into -.

61
04:18.620 --> 04:19.760
This value here.

62
04:20.990 --> 04:24.320
So we type: move -.

63
04:34.920 --> 04:35.850
Hit okay.

64
04:36.870 --> 04:37.650
In hex it's 67.

65
04:40.990 --> 04:46.450
And now the 67 is in the, is in, is in -.

66
04:46.510 --> 04:50.890
So let's confirm the 67 is indeed this number, this value here.

67
04:51.040 --> 04:54.340
So we clear all this and we key in this:

68
04:54.340 --> 05:01.960
01100111.

69
05:01.960 --> 05:04.180
And we see, indeed, it is hex 67.

70
05:06.070 --> 05:07.510
So this is this number.

71
05:07.540 --> 05:11.020
So now we are going to AND -, -.

72
05:16.460 --> 05:17.270
Hit okay.

73
05:18.530 --> 05:19.760
And now step over it.

74
05:20.660 --> 05:22.670
And you see the result is still 20.

75
05:22.670 --> 05:23.930
So it is correct.

76
05:26.120 --> 05:26.600
Okay.

77
05:26.600 --> 05:31.130
So this is how we perform AND operations using the AND operator.

78
05:31.160 --> 05:32.720
That's all for this video.

79
05:32.720 --> 05:34.130
Thank you for watching.