1
00:00:03,630 --> 00:00:10,830
So before we write our first program there are some instructions we need to take a look at and we would

2
00:00:10,830 --> 00:00:16,620
look at the op codes we would use in our program for this first program.

3
00:00:16,620 --> 00:00:21,810
We need to be familiar with seven up codes and we're going to take a look at them now.

4
00:00:21,810 --> 00:00:26,070
The first one is to move up code the move operation.

5
00:00:26,070 --> 00:00:31,050
What it does is that it moves data within the process or without access in memory.

6
00:00:31,590 --> 00:00:37,620
And I say in fairness you should know about the move operation not all data can be moved by this particular

7
00:00:37,680 --> 00:00:38,850
operation.

8
00:00:39,030 --> 00:00:42,400
The move cannot move more than eight feet to follow you.

9
00:00:42,400 --> 00:00:47,350
Also the move cannot move to high registers.

10
00:00:47,370 --> 00:00:53,730
Remember when we created registers we demarcated them into lower registers and higher registers to move

11
00:00:53,760 --> 00:00:55,590
cannot move to higher registers.

12
00:00:55,590 --> 00:00:57,580
Let's see an example of this.

13
00:00:57,780 --> 00:01:01,940
Let's say you have this instruction move our 0 1 50.

14
00:01:01,950 --> 00:01:09,040
What this does is that it puts the value 150 in the register are zero.

15
00:01:09,180 --> 00:01:11,300
And this immediate value.

16
00:01:11,430 --> 00:01:16,500
And as we know 150 is within the 8 bit barrier.

17
00:01:16,530 --> 00:01:19,590
Let's take another look at this example.

18
00:01:19,680 --> 00:01:25,170
This another example also you can move one register into another.

19
00:01:25,170 --> 00:01:32,400
And what this does is that it moves the value of one register into the other and makes them equal in

20
00:01:32,400 --> 00:01:43,150
a sense move our one hour two gives us our 1 course are two copies the value of our R2 into our.

21
00:01:43,650 --> 00:01:46,210
This an incorrect example.

22
00:01:46,680 --> 00:01:54,090
Look at this for instance move our 0 2 5 6 and we know immediate value is out of range the largest number

23
00:01:54,090 --> 00:02:00,970
of 8 bits is 2 5 5 2 something like this would cause an era wouldn't work.

24
00:02:01,140 --> 00:02:06,480
Another incorrect example is move R eight.

25
00:02:06,540 --> 00:02:07,980
Number three.

26
00:02:08,100 --> 00:02:12,040
And as you can guess are eight is a high register.

27
00:02:12,240 --> 00:02:19,500
So we cannot use this instruction on a higher register and we cannot use this instruction with values

28
00:02:19,530 --> 00:02:20,910
greater than 8.

29
00:02:21,510 --> 00:02:31,200
The next instruction or OB code we're going to look at the LTE are and what this means is called register

30
00:02:31,680 --> 00:02:41,370
and what this does is it's loads register with either a 32 bit constant value or another register it

31
00:02:41,370 --> 00:02:50,460
reads a 32 bit volume from memory to register remember the move the one we just saw just moves in in

32
00:02:50,460 --> 00:02:58,230
the register it cannot access memory load on the other hand can access memory and it can access other

33
00:02:58,230 --> 00:03:01,810
values in the register as well.

34
00:03:02,520 --> 00:03:05,040
Let's take a look at this example.

35
00:03:05,280 --> 00:03:11,500
We have lowered our sero 0 x f f f this hexadecimal value.

36
00:03:11,520 --> 00:03:19,020
What this does is that it loads this value into our zero and this another example.

37
00:03:19,020 --> 00:03:21,000
It's a bit different from the first one.

38
00:03:21,060 --> 00:03:25,140
Load our icon square brackets are two.

39
00:03:25,210 --> 00:03:27,050
We've not treated pointers.

40
00:03:27,060 --> 00:03:28,580
I know.

41
00:03:28,920 --> 00:03:35,730
We'll talk about them when we start typing in stuff like I always say yes but this is to give you an

42
00:03:35,760 --> 00:03:42,170
overview so that when we type you just remember we did this and oh this is how it works.

43
00:03:42,180 --> 00:03:52,620
So what this means is the R1 is the value pointed to by our team the instruction load are 1 square brackets

44
00:03:52,700 --> 00:04:02,490
are two meaning point R1 to the value in which are to the value contained in R2 let's say R2 let's say

45
00:04:02,490 --> 00:04:09,810
R2 contains the value to 5 6 then our 1 starts point into 2 5 6.

46
00:04:09,950 --> 00:04:14,150
And yes I know I said 2 5 6.

47
00:04:14,160 --> 00:04:21,330
Remember we are using to load up code not move so to 5 6 would work with load but it wouldn't work would

48
00:04:21,330 --> 00:04:22,130
move.

49
00:04:22,170 --> 00:04:26,700
Remember this white 32 bit values whilst we move

50
00:04:35,920 --> 00:04:38,000
8 8 base values.

51
00:04:38,860 --> 00:04:40,980
Let's look at this other one.

52
00:04:41,350 --> 00:04:43,500
This is the store up code.

53
00:04:44,020 --> 00:04:48,760
And what this does is that it stores a register of value into memory.

54
00:04:48,760 --> 00:04:56,700
An example of this is to store our 0 1 stores the value of our 0 into our 1.

55
00:04:56,770 --> 00:04:58,670
Can you tell the difference.

56
00:04:58,870 --> 00:05:00,320
There is a bit of difference.

57
00:05:00,340 --> 00:05:03,500
It looks quite similar to the load.

58
00:05:03,600 --> 00:05:11,000
However if you look carefully at the comments here this one stores the value of our 1 into R2 and 2

59
00:05:11,530 --> 00:05:21,370
Sorry stores the value of our 0 into R1 the value of R1 into our 0 would to store the first register

60
00:05:21,730 --> 00:05:28,540
or the first operant is the source and the second operant is the destination register.

61
00:05:28,540 --> 00:05:33,910
This is the opposite for to load up code.

62
00:05:34,240 --> 00:05:41,770
So our one sorry our zero into R1 is towards the value of Irish you go into R1.

63
00:05:42,160 --> 00:05:50,710
If we replace this with load of the r zero our 1 0 0 is going to be the destination and our is going

64
00:05:50,710 --> 00:05:51,750
to be the source.

65
00:05:51,790 --> 00:05:53,210
So please do remember this.

66
00:05:53,230 --> 00:05:56,260
A lot of people get confused by this.

67
00:05:57,780 --> 00:06:02,350
And the next one instruction number for is to be instruction.

68
00:06:02,410 --> 00:06:05,840
What this means is branch to a location.

69
00:06:05,830 --> 00:06:12,340
An example of this is B loop and you should know this word loop is not a reserved word is a word that

70
00:06:12,400 --> 00:06:24,530
we give it could have been B turn on or b go b stop this one branches it branches two or jumps to loop.

71
00:06:24,750 --> 00:06:32,470
It's like there is a label in our program called Loop remember we said we put labels by our instructions

72
00:06:32,510 --> 00:06:34,970
so that we can access them easily.

73
00:06:34,990 --> 00:06:36,850
So there's a label somewhere called loop.

74
00:06:37,090 --> 00:06:39,880
If we invoke B loop we count the.

75
00:06:40,420 --> 00:06:44,230
And we would see an example of this when we stop right in the code.

76
00:06:44,300 --> 00:06:55,060
Now we have no five B L and this one is primes to a subroutine B L turn on cost to turn on and turn

77
00:06:55,060 --> 00:07:04,300
on this a subroutine that is different from the B and the says the the B jumps to 1 9 instructions.

78
00:07:04,430 --> 00:07:04,680
Yeah.

79
00:07:04,690 --> 00:07:11,130
To put it in simple terms it comes to an instruction location whereas this one comes to a subroutine

80
00:07:11,140 --> 00:07:17,540
you can think of a subroutine as a block of code perhaps like a function in a high level language.

81
00:07:17,710 --> 00:07:26,140
It goes to a series of operations not just one instruction it goes to series and then goes back so detail

82
00:07:26,200 --> 00:07:32,620
jumps to a subroutine and B comes to an instruction the location of an instruction.

83
00:07:32,620 --> 00:07:42,010
So we have the number six this is P x l ah yes get just abbreviations No we start typing them to start

84
00:07:42,010 --> 00:07:43,080
making more sense.

85
00:07:43,100 --> 00:07:43,370
Yeah.

86
00:07:43,390 --> 00:07:44,680
Just bear with me.

87
00:07:44,680 --> 00:07:52,060
This one returns the value from a subroutine core an example of this is let's say we have the subroutine

88
00:07:52,060 --> 00:07:54,290
called Blue on.

89
00:07:54,670 --> 00:08:04,480
So we move the value 0 x 0 1 which is the value one would move it into R2 and then be X L R meaning

90
00:08:04,570 --> 00:08:12,040
it returns the value to the function that was run in before jump into this subroutine its returns to

91
00:08:12,040 --> 00:08:13,300
value after its run.

92
00:08:13,300 --> 00:08:13,950
This code.

93
00:08:13,990 --> 00:08:19,210
It keeps the value of R2 when it goes back to where it's come from.

94
00:08:19,750 --> 00:08:20,750
Yes.

95
00:08:20,920 --> 00:08:27,730
So this one as you can tell would be used in conjunction with a b l mean and when you entered a subroutine

96
00:08:27,730 --> 00:08:34,100
and a subroutine does its processes and it gets a value you might want to take it back and then use

97
00:08:34,100 --> 00:08:41,770
that value and what you invoke is to be X L R returns from separate subroutine blue on.

98
00:08:41,950 --> 00:08:42,600
Yes.

99
00:08:42,700 --> 00:08:47,630
And this the last one this the N O P and it stands for no operation.

100
00:08:47,770 --> 00:08:57,220
Our do nothing assessors here for example Star 1 A.P. A.P. stores the value of r 0 into our 1 do nothing

101
00:08:57,220 --> 00:09:00,930
for 2 psychos 1 annual P of course one cycle.

102
00:09:00,940 --> 00:09:07,420
This is usually used for padding if you want to give perhaps you want to give time to some operation

103
00:09:07,420 --> 00:09:14,680
to perform in a jump to the next operation you can put it where a series of No operation no operations

104
00:09:14,710 --> 00:09:18,380
we would use it if we'll use this when we start.

105
00:09:18,500 --> 00:09:23,920
So these are the first seven up codes that we going to be using.

106
00:09:24,100 --> 00:09:28,480
The first of an instructions would have this in our program.
