Loading....
Coupon Accepted Successfully!

 

Instruction Set

Instructions have been classified into the following five functional groups.

  • Data transfer group
  • Arithmetic group
  • Logical group
  • Branch control group
  • I/O and machine control group

 

Data Transfer Group

Table :Types of data transfer

 

Types

Example

Between Registers

Copy the contents of the register B into register A

Load specific data byte to a register or a memory location

Load register B with the specific data byte FFH

Between a memory location and a register

Move data from a memory location 9000H to register B

Between an I/O device and the accumulator

Move data from an input port to the accumulator

Between Registers pairs

Exchange the content of two register pairs

 

Examples:

MOV

Move

MVI

Move immediate

LDA

Load accumulator directly from memory

STA

Store accumulator directly in memory

LHLD

Load H and L registers directly from memory

SHLD

Store H and L registers directly in memory

 

An ‘X’ in the name of a data transfer instruction means that the data transfer operation is performed with a register pair.
 

LXI

Load register pair with 16 bit immediate data

LDAX

Load accumulator from memory whose address in register pair

STAX

Store the content of accumulator in memory whose address in register pair

XCHG

Exchange H and L with D and E

XTHL

Exchange Top of Stack with H and L

Arithmetic Group

The arithmetic instructions perform arithmetic operations such as addition, subtraction, increment, and decrement data in registers or memory.
 

Addition The contents of a register or the contents of a memory location or any 8-bit number can be added to the contents of the accumulator. After addition, the sum is stored in the accumulator.

 

Subtraction An 8-bit number or the contents of a register or the contents of a memory location can be subtracted from the contents of the accumulator. After subtraction, the results will be stored in the accumulator.

 

Increment/Decrement The content of a register or a memory location, 8-bit data can be incremented or decremented by 1. In the same way, the contents of a register pair H–L or B–C or D–E (16 bit data) can be incremented or decremented by 1. The increment and decrement operations can also be performed in a memory location.

 

Examples
 

ADD  Add to accumulator
ADI  Add immediate 8-bit data to accumulator
ADC  Add to accumulator using carry flag
ACI  Add immediate data to accumulator with carry
SUB  Subtract from accumulator
SUI  Subtract immediate data from accumulator
SBB  Subtract from accumulator with borrow (carry) flag
SBI  Subtract immediate from accumulator with borrow (carry) flag
INR  Increment specified 8-bit data or byte by one
DCR  Decrement specified 8-bit data or byte by one
INX  Increment register pair by one
DCX  Decrement register pair by one
DAD  Double register addition: add content of register pair to H–L register pair

Logical Group

AND, OR, Exclusive-OR The content of a register or content of a memory location or content of any 8-bit data can be logically ANDed, Ored, or Exclusive-ORed with the contents of the accumulator. Then results must be stored in the accumulator.

 

Rotate Each bit of the accumulator can be shifted either left or right by one bit.


Compare
 An 8-bit number or the content of a register or content of a memory location be compared with the contents of the accumulator to check greater than or equal or less than.


Complement
 The contents of the accumulator can be complemented. Therefore, all 0s are replaced by 1s and all 1s are replaced by 0s.


Examples

 

ANA - Logical AND with Accumulator

ANI -  Logical AND with Accumulator using Immediate Data

ORA - Logical OR with Accumulator

OR -   Logical OR with Accumulator using Immediate Data

XRA - Exclusive Logical OR with Accumulator

XRI -  Exclusive OR using Immediate Data


The compare instructions compare the content of a register, or the content of a memory location or an 8-bit data with the contents of the accumulator.


CMP -Compare

CPI - Compare using Immediate Data

 

The rotate instructions shift the contents of the accumulator one bit to the left or right:


RLC - Rotate Accumulator Left

RRC - Rotate Accumulator Right

RAL - Rotate Left through Carry

RAR - Rotate Right through Carry

 

Complement and carry flag instructions are:

 

CMA - Complement Accumulator

CMC -Complement Carry Flag

STC - Set Carry Flag

 

Branch Control Group

Jump 
Jump instructions are generally conditional jump and unconditional jump types. Conditional jump instructions always test certain conditions such as ‘zero’ or ‘carry flag’ and then change the program execution sequence once the condition arises. On the other hand, when conditions are not used in the instruction set, the instruction is called unconditional jump.

 

Call, Return, and Restart 

 

Thus, the conditional branching instructions are specified as follows:
 

Jumps Calls Returns
JC CC RC (Carry)
JNC CNC RNC (No Carry)
JZ CZ RZ (Zero)
JNZ CNZ RNZ (Not Zero)
JP CP RP (Plus)
JM CM RM (Minus)
JPE CPE RPE (Parity Even
JPO CPO RPO (Parity Odd)

 

Stack, I/O and Machine Control Group

The following instructions are related with the Stack and/or Stack Pointer:

 

PUSH Push Two bytes of Data onto the Stack
POP Pop Two Bytes of Data off the Stack
XTHL Exchange Top of Stack with H and L
SPHL Move content of H and L to Stack Pointer

 
 
The I/O instructions are given below:
 
IN Initiate Input Operation
OUT Initiate Output Operation


The Machine Control instructions are as follows:

 

EI Enable Interrupt System
DI Disable Interrupt System
HLT Halt
NOP No Operation





Test Your Skills Now!
Take a Quiz now
Reviewer Name