Now we are going to step through the code and see the changes that go on in the register and memory.
Before we do that let's take a look at what the various views are displaying.
Now currently we have the logos view here showing our local variable counter showing this number 2 x
1 0 0 0 0 6 0 and then we have here in the red just a view.
Iris you are 1 2 and are 3 showing the same values stored in the local variable.
Yes there's a random number we've not initialized a variable so that's a random number in it for us.
And let's see here in the disassembly view we still have it here.
As we mentioned the arrow is pointing to the beginning of the main function and we know the main function
is where all problems start.
What we see here and a code few this arrow pointing to this very line lane number four which is into
county course you mean and we had to declare and initialize and count equals zero when the arrow was
pointing to a line.
It does not mean the line has executed but rather it means this is the line to be executed next.
So now when we when we move a step when we move from this line to this line by number four to number
five we would execute this line and logically or according to the rules of the compiler our local variable
counter should be initialized the value 0.
So we're going to step through the code one see line at a time and we're going to do it by clicking
this I can hear.
This is known as this step I can this I can show in a pair of candidate graces with umpire pointing
and so let's click and see.
So let's see the changes first of four in the code few.
We see the it's dropped from line number four to line number five which means we've initialized that
already.
Let's see what happened in our registers we'd realized our 1 has changed to 0 x sera sera sera sera
sera meaning the value is zero.
And indeed in the disassembly if you realize it's dropped to this line remember this is where we started
it's dropped here.
And what what got executed in the disassembly view was moving the value 0 into register are 1.
Remember we treated this in the previous chapter cortex and assembly the instruction move as are 1 0
0 0 means put the value 0 into R1.
That is why we have our once you are x sera sera sera sera sera sera sera sera sera sera sera.
Are equal in value the same.
In fact it's still equal to the decimal zero.
If we check here in our local as you would see that the counter which is our local variable has to find
you sue X you're serious you are zero the same value stored in Taiwan.
So we we saw what happened in the disassembly if you will move divide value zero into our one and then
when we check in the register or when we look into our register then we see that indeed everyone has
zero since it's been moved to zero here.
And when we check our variable here if we are to print it out it would print out the value 0 which we
are doing here by using the locals view.
In fact let's change this to display in decimal form we do it by right clicking here and on checking
the hexadecimal display.
Now it's here another important register I want to take note of as AR 15 which is P.S. the program counter
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
9 see what it does is it stores the address of the next instruction to be executed.
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
instruction to be executed.
And as we know the yellow line is pointing to the next instruction to be executed and indeed the address
is zero exterior seriously with 3 9 C..
Let's iterate once more and see whether the rules we've just established follow through.
Okay.
Over here in the code for you it's dropped in line meaning we've just executed this instruction plus
plus counter meaning counter plus one meaning in one to counter.
So let's see what this means.
Indeed disassembly Q which is basically the assembly code the code we executed is at 1 2 R1 This is
it says here I want your course are one plus one.
Meaning I'd want to R1 and then store it back into R1.
And this is the art.
Remember we said the art entered as art or art.
In fact we said or did you want X or the goods.
If you see s by the end it means updates are a register so don't worry a lot about the s.
Just look at the art just like we had to move here.
So we've added we've added 1 2 R1 and stored it back into our one and before we forget.
Let's go to our low cost view and see whether indeed we have added one to the console variable which
was 0 initially.
Yes.
And then we see here.
Indeed we spotted one.
Let's continue our iteration if I did another one I did another one.
And P.S. It's telling us that the next instruction to be executed has the address ending with three
a two and plus three two here.
So basically this is how computers add.