Professional Documents
Culture Documents
com
1
byjusexamprep.com
1. MACHINE INSTRUCTIONS
● Machine instructions are commands or machine code programs . In other words, commands
written in the machine code language of a computer that it can recognize and subsequently
execute.
● A machine instruction consists of several bytes in memory that tells the processor to
perform one machine operation.
● The processor looks at machine instructions in main memory one after another and
performs one machine operation for each machine instruction.
● The collection of machine instructions in main memory is called a machine language
program.
There are 3 type of machine instructions:
a. Data Transfer Instructions:
The data transfer instructions are defined as instructions which are used to transfer the data
from one location to another. This data transmission can be either from register to memory,
register to register or memory to register.
The MOV instruction copies the data from the source register
Copy from the source
MOV to the destination register without any alteration.
to the destination
Example − MOV K, L
2
byjusexamprep.com
3
byjusexamprep.com
Example − POPK
Output the data with The content of the accumulator is copied to the I/O port
OUT 8bit address from the specified by the operand.
accumulator to a port. Example − OUT K9L
Input data with 8-bit The content of the input port designated in the operand is
IN address to an read and loaded into the accumulator.
accumulator from a port Example − IN5KL
INCREMENT INC
DECREMENT DEC
ADD ADD
SUBTRACT SUB
MULTIPLY MUL
DIVIDE DIV
NEGATIVE NEG
4
byjusexamprep.com
Logical and Bit Manipulation Instructions
Name Mnemonic
CLEAR CLR
COMPLEMENT COM
AND AND
OR OR
EXCLUSIVE OR XOR
ENABLE INTERRUPT EI
DISABLE INTERRUPT DI
Shift Instructions
Name Mnemonic
Name Mnemonic
BRANCH BR
JUMP JMP
SKIP SKP
CALL CALL
RETTURN RET
COMPARE CMP
TEST TST
5
byjusexamprep.com
1.1. Instruction Format:
Instructions in a computer are a set of machine language instructions that are
understanded and executed by the processor. A computer performs tasks based on the
instruction provided.
An instruction comprises groups called fields. These fields include:
Mode Opcode Operand/address of Operand
a. Three Address Instruction: This has three address fields to specify a register or a
memory location.
b. Two Address Instruction: In this format, two addresses and an operation field are
present, and in this format the result can be stored at different memory locations not in
just the accumulator but it requires a greater number of bits to represent address.
c. One Address Instruction: One operand is in register or memory location. The result
and the second operand are stored in a CPU register known as Accumulator Register. One
operand is in accumulator and other is in register or memory location
6
byjusexamprep.com
e. RISC: RISC processors only use simple instructions that can be executed within one
clock cycle. It is composed of a few basic steps for loading, evaluating and storing
operations just like a load command will load data, store command will store the data. In
RISC(Reduced Instruction Set Computer) processors, all operations are done within the
CPU registers
7
byjusexamprep.com
In this mode the data is present in the memory, the corresponding address of memory
will be maintained in an address field of the instruction as an effective address.
(b) Memory Indirect Addressing Mode: Here, the EA is present in the memory, that
memory address is available in the address field of the instruction.
EA = [Address field value] ⇒ [Memory address]
Data = [EA] = [[Memory address]]
8
byjusexamprep.com
e. Indexed Addressing Mode:
Effective address of the operand is obtained by adding the content of the index register
with the address part of the instruction.
In indirect indexed addressing mode the base address is present in the memory, that
memory address is present in the address field of the instruction.
9
byjusexamprep.com
• PC ← PC + IR [Address Field]
• Position dependent.
• Relocation at run time.
b. Base Register Addressing Mode (Position independent):
• Base Addressing Mode is used to access the instruction between segments. Therefore,
base address as well as offset are required.
• Base address is maintained in the base register and offset address is maintained in the
address field of the instruction.
• EA = [Base Register] + IR [Address Field]
• PC ← [Base Register] + IR [Address Field]
****
10