R28 Coding Instructions Coding Instructions - Reading
R28 Coding Instructions Coding Instructions - Reading
R28 Coding Instructions Coding Instructions - Reading
R 28
In Maths we show calculations like this: 5 + 4 = 9
0010101101001010
First Operand (register D)
MOV D, [74]
Move the
he contents of memory address 74 to register D
The program counter is now incremented (1 is added to it) so that it points to the location for the
next instruction in memory.
An instruction set is a list of all the instructions that can be given to a particular CPU. This is specific
to each type of CPU. This is why a program that has been compiled for one processor (e.g. a PC with
a 64 bit processor) wont work on a computer with a different processor (e.g. a PC with a 32 bit
processor).
An example instruction set is given below
Instruction
Assembly code Meaning
example
00000 XXX YYYYYYYY SUB A, 73
SUBtract value in YYYYYYYY from register XXX
00001 XXX YYYYYYYY ADD A, 125
ADD value in YYYYYYYY to register XXX
00010 XXX YYYYYYYY MOV B, 6
MOVe value YYYYYYYY into register B
00011 XXX
DEC C
DECrement (subtract 1) from the value in register XXX
00100 XXX
INC D
INCrement (add 1) to the value in register XXX
00101 XXX YYYYYYYY MOV A, [5]
MOVe value in memory address YYYYYYYY
YYYY to register XXX
Question: What would the following machine code do?
Machine code
00001 001 10110110
00001 000 01001001
00011 000
00100 001
00001 000 00100101
Assembly code
MOV B, 182
MOV A, 73
DEC A
INC B
ADD A, 37
55