1
00:00:04,780 --> 00:00:11,800
Now we are going to step through the code and see the changes that go on in the register and memory.

2
00:00:12,190 --> 00:00:17,200
Before we do that let's take a look at what the various views are displaying.

3
00:00:17,200 --> 00:00:24,310
Now currently we have the logos view here showing our local variable counter showing this number 2 x

4
00:00:24,310 --> 00:00:29,970
1 0 0 0 0 6 0 and then we have here in the red just a view.

5
00:00:30,290 --> 00:00:36,580
Iris you are 1 2 and are 3 showing the same values stored in the local variable.

6
00:00:37,120 --> 00:00:43,500
Yes there's a random number we've not initialized a variable so that's a random number in it for us.

7
00:00:43,740 --> 00:00:47,300
And let's see here in the disassembly view we still have it here.

8
00:00:47,320 --> 00:00:52,840
As we mentioned the arrow is pointing to the beginning of the main function and we know the main function

9
00:00:52,840 --> 00:00:55,190
is where all problems start.

10
00:00:56,170 --> 00:01:02,650
What we see here and a code few this arrow pointing to this very line lane number four which is into

11
00:01:02,650 --> 00:01:09,460
county course you mean and we had to declare and initialize and count equals zero when the arrow was

12
00:01:09,460 --> 00:01:11,100
pointing to a line.

13
00:01:11,140 --> 00:01:17,500
It does not mean the line has executed but rather it means this is the line to be executed next.

14
00:01:17,500 --> 00:01:24,670
So now when we when we move a step when we move from this line to this line by number four to number

15
00:01:24,670 --> 00:01:34,420
five we would execute this line and logically or according to the rules of the compiler our local variable

16
00:01:34,420 --> 00:01:38,080
counter should be initialized the value 0.

17
00:01:38,110 --> 00:01:44,050
So we're going to step through the code one see line at a time and we're going to do it by clicking

18
00:01:44,050 --> 00:01:45,310
this I can hear.

19
00:01:45,310 --> 00:01:51,370
This is known as this step I can this I can show in a pair of candidate graces with umpire pointing

20
00:01:51,900 --> 00:01:54,240
and so let's click and see.

21
00:01:55,050 --> 00:01:58,000
So let's see the changes first of four in the code few.

22
00:01:58,000 --> 00:02:04,930
We see the it's dropped from line number four to line number five which means we've initialized that

23
00:02:04,960 --> 00:02:05,730
already.

24
00:02:05,760 --> 00:02:14,290
Let's see what happened in our registers we'd realized our 1 has changed to 0 x sera sera sera sera

25
00:02:14,290 --> 00:02:17,690
sera meaning the value is zero.

26
00:02:18,910 --> 00:02:26,560
And indeed in the disassembly if you realize it's dropped to this line remember this is where we started

27
00:02:26,560 --> 00:02:27,570
it's dropped here.

28
00:02:27,760 --> 00:02:35,980
And what what got executed in the disassembly view was moving the value 0 into register are 1.

29
00:02:36,040 --> 00:02:44,410
Remember we treated this in the previous chapter cortex and assembly the instruction move as are 1 0

30
00:02:44,620 --> 00:02:48,350
0 0 means put the value 0 into R1.

31
00:02:48,370 --> 00:02:56,320
That is why we have our once you are x sera sera sera sera sera sera sera sera sera sera sera.

32
00:02:56,410 --> 00:02:58,830
Are equal in value the same.

33
00:02:58,860 --> 00:03:02,250
In fact it's still equal to the decimal zero.

34
00:03:03,160 --> 00:03:09,910
If we check here in our local as you would see that the counter which is our local variable has to find

35
00:03:09,910 --> 00:03:14,400
you sue X you're serious you are zero the same value stored in Taiwan.

36
00:03:14,440 --> 00:03:20,350
So we we saw what happened in the disassembly if you will move divide value zero into our one and then

37
00:03:20,470 --> 00:03:27,640
when we check in the register or when we look into our register then we see that indeed everyone has

38
00:03:27,640 --> 00:03:30,250
zero since it's been moved to zero here.

39
00:03:30,250 --> 00:03:36,490
And when we check our variable here if we are to print it out it would print out the value 0 which we

40
00:03:36,490 --> 00:03:39,330
are doing here by using the locals view.

41
00:03:39,430 --> 00:03:45,520
In fact let's change this to display in decimal form we do it by right clicking here and on checking

42
00:03:45,530 --> 00:03:47,560
the hexadecimal display.

43
00:03:47,680 --> 00:03:56,410
Now it's here another important register I want to take note of as AR 15 which is P.S. the program counter

44
00:03:57,070 --> 00:04:05,530
when we see here in the register view we realized that the value of AR 15 has changed to 0 0 0 0 0 3

45
00:04:05,530 --> 00:04:13,360
9 see what it does is it stores the address of the next instruction to be executed.

46
00:04:13,360 --> 00:04:21,610
So let's go to the disassembly view and check whether indeed 0 0 0 0 3 9 C is the address of the next

47
00:04:21,610 --> 00:04:23,510
instruction to be executed.

48
00:04:23,590 --> 00:04:30,010
And as we know the yellow line is pointing to the next instruction to be executed and indeed the address

49
00:04:30,010 --> 00:04:32,430
is zero exterior seriously with 3 9 C..

50
00:04:33,160 --> 00:04:38,220
Let's iterate once more and see whether the rules we've just established follow through.

51
00:04:38,710 --> 00:04:39,330
Okay.

52
00:04:39,340 --> 00:04:45,250
Over here in the code for you it's dropped in line meaning we've just executed this instruction plus

53
00:04:45,250 --> 00:04:50,640
plus counter meaning counter plus one meaning in one to counter.

54
00:04:50,680 --> 00:04:53,190
So let's see what this means.

55
00:04:53,200 --> 00:05:03,220
Indeed disassembly Q which is basically the assembly code the code we executed is at 1 2 R1 This is

56
00:05:03,510 --> 00:05:07,320
it says here I want your course are one plus one.

57
00:05:07,530 --> 00:05:12,370
Meaning I'd want to R1 and then store it back into R1.

58
00:05:12,870 --> 00:05:14,370
And this is the art.

59
00:05:14,430 --> 00:05:19,080
Remember we said the art entered as art or art.

60
00:05:19,080 --> 00:05:22,210
In fact we said or did you want X or the goods.

61
00:05:22,290 --> 00:05:29,960
If you see s by the end it means updates are a register so don't worry a lot about the s.

62
00:05:29,970 --> 00:05:32,930
Just look at the art just like we had to move here.

63
00:05:33,030 --> 00:05:39,620
So we've added we've added 1 2 R1 and stored it back into our one and before we forget.

64
00:05:39,630 --> 00:05:46,500
Let's go to our low cost view and see whether indeed we have added one to the console variable which

65
00:05:46,500 --> 00:05:47,840
was 0 initially.

66
00:05:48,660 --> 00:05:49,050
Yes.

67
00:05:49,080 --> 00:05:51,360
And then we see here.

68
00:05:51,360 --> 00:05:52,410
Indeed we spotted one.

69
00:05:52,440 --> 00:05:57,590
Let's continue our iteration if I did another one I did another one.

70
00:05:58,000 --> 00:06:04,170
And P.S. It's telling us that the next instruction to be executed has the address ending with three

71
00:06:04,670 --> 00:06:07,980
a two and plus three two here.

72
00:06:08,790 --> 00:06:12,120
So basically this is how computers add.
