0:00
Hello.
00:02
So in this problem, we need to write a short program that execute a certain request.
00:10
So let's start by the first one.
00:14
And the first one is asking us to move the value of, like to move the value of the memory cell d8 to be.
00:30
So writing this in a form of instructions or a code, the first thing we need to do is first to copy or to keep the value of d8 in a register.
00:45
So we will start by implementing the load upcode and let's keep this value in register 0.
00:54
So 1 .0 .d8.
00:57
Load register 0 with the value of the memory.
01:00
Cell d8 and the upcoming one is to store this value or the content of register zero to the memory address b3 and finally we hold so this code actually executes exactly this we copy the value of the 8 to our register zero and then we store the content of register there zero to b3 if we're interested to write this as in form of memory cells, then we started from zero, zero, as said in the problem.
01:40
So these are the memory cells we're going to use because each instruction requires two memory cells to be stored.
01:50
So 1 .0d8 and then 30b3 and then we have like the c0 double zero.
02:04
And no need for this cell here.
02:08
So that's the first thing to be implemented.
02:14
Now let's move to the next question.
02:17
The next question or activity that we need to do is to interchange the value, like interchange the value of memory cell d8 and b3.
02:35
So in that case, we all, need to store the content of d8, let's say in register 0, and also to keep the value of b3 in register 1, for example, and afterwards we need to store whatever is in register 0, which is d8, in b3.
03:00
So store the content of 0, which is the content of the 8, in b3, and also store whatever in register 1.
03:10
1 which is the value b3 in d8 and finally the machine comes to a halt again if we need to write this in form of memory cells we need 10 memory cells for this because each instruction is stored in two consecutive memory cells so now it will be 1 .0 the 811b3 3 -0 -b -3 -3 -1 -d8 and c0 -00 so that's the the code that interchanges the 8 and b and b3 now let's move to the third one the third one is a little bit complicated and the target here is a little bit conditional so the target here is a little bit conditional so the target here here it says if the value of the memory cell is equal to zero zero then we place zero one in 46 so 46 we place zero one if not then we place the value f f in 46 as well so here there is a condition and we expect from the very first look at this that we are going to use the b operation, which is the jump.
04:58
So let's first start by recalling the value of the memory cell 44 so that we can actually compare it.
05:08
So i'm going to load my register.
05:14
Let's choose like any empty register.
05:17
Let's start by register 1 because register 0.
05:21
Will be reserved for comparison.
05:24
So load register one with the memory cell 44.
05:28
Afterwards, we need also to load our register zero with the value zero, so that we can compare.
05:38
We are like here assuming that we don't know the content of 44 actually, and that's true in that case.
05:46
And afterwards, we need the compare option and compare and jump.
05:53
So here we need the b and we are comparing 1 to 0.
05:57
So here it's b 1...