Вы находитесь на странице: 1из 7

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

Comment Like 20 Share

passive I/O Box - DINRail


Power-Distribution 24VDC - 6A 14 dig. I/Os, MINI I/O Connector

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 Load register B with the specific
a register or a memory data byte FFH
location
Between a memory Move data from a memory
location and a register location 9000H to register B
Between an I/O device Move data from an input port to
and the accumulator 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

Comment Like 20 Share


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/DecrementThe 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 HL or BC 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

Subtract immediate from accumulator with borrow (carry)


SBI
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

Double register addition: add content of register pair to


DAD
HL register pair

Comment Like 20 Share

Logical Group
AND, OR, Exclusive-ORThe 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.

RotateEach bit of the accumulator can be shifted either left or


right by one bit.

CompareAn 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.

ComplementThe 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
InstructionSet
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

Comment Like 20 Share

passive I/O Box - DINRail


Power-Distribution 24VDC - 6A 14 dig. I/Os, MINI I/O Connector

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 calledunconditional 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)



InstructionSet

Comment Like 20 Share

Stack, I/O and Machine Control Group


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

Push Two bytes of Data onto the
PUSH
Stack

Pop Two Bytes of Data off the


POP
Stack

Exchange Top of Stack with H and


XTHL
L

Move content of H and L to Stack


SPHL
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
Comment Like 20 Share

Previous Next

InstructionSet

Replay

Вам также может понравиться