NOP(No operation): - No operation is performed. The instruction is fetched and decoded. However no operation is executed.
Eg: - NOP
HLT(Halt): - The CPU finishes executing the current instruction and halts any further
execution. An interrupt or reset is necessary to exit from the halt state.
Eg: - HLT
DI(Disable Interrupt): - The interrupt enable flip-flop is reset and all the interrupts except the TRAP are disabled. No flags are affected.
Eg: - DI
EI(Enable Interrupt): - The
interrupt enable flip-flop is set and all interrupts are enabled. No
flags are affected. After a system reset or the acknowledgement of an
interrupt, the interrupt enable flipflop is reset, thus disabling the
interrupts. This instruction is necessary to reenable the interrupts
(except TRAP).
Eg: - EI
RIM(Read interrupt mas): -
This is a multipurpose instruction used to read the status of interrupts
7.5, 6.5, 5.5 and read serial data input bit. The instruction loads
eight bits in the accumulator with the following interpretations.
Eg: - RIM
PCHL: - Load program counter
with HL contents. The contents of registers H and L are copied into the
program counter. The contents of H are placed as the high-order byte and
the contents of L as the low order byte.
RST: - The RST instruction is equivalent to a 1- byte call instruction to one of eight memory
locations depending
upon the number. The instructions are generally used in conjunction with
interrupts and inserted using external hardware. However these can be
used as software instructions in a program to transfer program execution
to one of the eight locations.
The addresses are:
RST 0 0000H RST1 0008H RST 2 0010H RST 3 0018H RST 4 0020H RST 5 0028H RST 6 0030H RST 7 0038H
RST 0 0000H RST1 0008H RST 2 0010H RST 3 0018H RST 4 0020H RST 5 0028H RST 6 0030H RST 7 0038H
Eg: - RLC
RRC: - Each binary bit of the
accumulator is rotated right by one position. Bit D0 is placed in the
position of D7 as well as in the Carry flag. CY is modified according to
bit D0. Any other bit is not affected.
Eg: - RRC
RAL: - Each binary bit of the
accumulator is rotated left by one position through the Carry flag. Bit
D7 is placed in the Carry flag, and the Carry flag is placed in the
least significant position D0. CY is modified according to bit D7.
Eg: - RAL
RAR: - Each binary bit of the
accumulator is rotated right by one position through the Carry flag. Bit
D0 is placed in the Carry flag, and the Carry flag is placed in the
most significant position D7. CY is modified according to bit D0.
Eg: - RAR
CMA: - The content of accumulator is complemented.
Eg: - CMA
CMC: - The carry flag is complemented.
Eg: - CMC
STC: - This instruction sets the carry flag.
Eg: - STC
CMP: - (compare register or
memory with accumulator) The contents of the operand register or memory
are M compared with the contents of the accumulator. Both contents are
preserved . The result of the comparison is shown by setting the flags
of the PSW as follows:
if (A) < reg/mem: carry flag is set.
if (A) = reg/mem:
zero flag is set.
if (A) > reg/mem: carry and zero flags are reset.
Eg: - CMP B
CMP M
CPI: - (compare immediate
with accumulator) The second byte (8-bit data) is compared with the
contents of the accumulator. The values being compared remain unchanged.
The result of the comparison is shown by setting the flags of the PSW
as follows:
if (A) < data: carry flag is set if (A) = data: zero flag is set if (A) > data: carry and zero flags are reset
Eg: - CPI 89H
ANA: - logical AND operation is performed with the specified register or memory with accumulator.
Eg: - ANA B
ANA M
Eg: - ANI 30H
Eg: - XRA B
XRA M
Eg: - XRI 30H
ORA: - Logical OR operation is performed between accumulator and specified register and memory location.
MOV: - This instruction is used to copy the data from one place to another.
LDA: - Load accumulator. (this instruction copies the data from a given 16 bit address to the accumulator)
LDAX(Load accumulator indirect): -
The contents of the designated register pair point to a memory
location. This instruction copies the contents of that memory location
into the accumulator. The contents of either the register pair or the
memory location are not altered.
OUT: - Output data from
accumulator to a port with 8-bit addresses. The contents of the
accumulator are copied into the I/O port specified by the operand.
IN: - Input data to
accumulator from a port with 8-bit address. The contents of the input
port designated in the operand are read and loaded into the accumulator.
Return Instruction, RC, RNC, RP, RM, RZ, RNZ,RPE, RPO, RET
Eg: - ORA B
ORA M
ORI: - Logical OR operation is performed between accumulator and immediate data.
Eg: - ORI 30H
Eg: - MOV Rd, Rs (This instruction copies the content of Rs to Rd)
MOV M,Rs (This instruction copies the content of register Rs to memory location pointed by HL Register)
MOV Rd, M (This instruction copies the content of memory location pointed by the HL
register to the register Rd.)
MVI: - move immediate date to a register or memory location.
Eg: - MVI Rd, #30H (30h is stored in register Rd)
MVI M, #30H(30h is stored in memory location pointed by HL Reg)
Eg: - LDA 3000H (content of memory location 3000h is coppied in accumulator)
Eg: - LDAX B
LXI(Load register pair immediate): - The instruction loads 16-bit data in the register pair designated in the operand.
Eg: - LXI H, 2034H (2034H is stored in HL pair so that it act as memory pointer)
LXI H, XYZ (address of level XYZ is copied in HL pair)
LHLD(Load H and L register direct): - this instruction loads the contents of the 16- bit memory location into the HL register pair.
Eg: - LHLD 3000H (the content of location 3000h is copied into the HL reg pair)
STA: - the content of accumulator are copied into the memory location.
Eg: - STA 3000H (the content of accumulator is stored into the memory location 3000h)
STAX(Store accumulator indirect): -
The contents of the accumulator are copied into the memory location
specified by the contents of the operand (register pair). The contents
of the accumulator are not altered.
Eg: - STAX B (the content of accumulator is stored into the memory location specified by the BC register pair.)
SHLD(store H and L register direct): -
The contents of register L are stored into the memory location
specified by the 16-bit address in the operand and the contents of H
register are stored into the next memory location by incrementing the
operand. The contents of registers HL are not altered. This is a 3-byte
instruction, the second byte specifies the low-order address and the
third byte specifies the high-order address.
Eg: - SHLD 3000H
XCHG: - Exchange H and L with
D and E. The contents of register H are exchanged with the contents of
register D, and the contents of register L are exchanged with the
contents of register E.
Eg: - XCHG
SPHL: - This instruction copies H and L register to the stack pointer. The instruction loads
the contents of the H
and L registers into the stack pointer register, the contents of the H
register provide the highorder address and the contents of the L
register provide the low-order address. The contents of the H and L
registers are not altered.
Eg: - SPHL
XTHL: - This instruction exchanges H and L with top of stack. The
contents of the L register are exchanged with the stack location
pointed out by the contents of the stack pointer register. The contents
of the H register are exchanged with the next stack location (SP+1);
however, the contents of the stack pointer register are not altered.
Eg: - XTHL
PUSH: - This instruction
pushes the register pair onto stack. The contents of the register pair
designated in the operand are copied onto the stack in the following
sequence. The stack pointer register is decremented and the contents of
the highorder register (B, D, H, A) are copied into that location. The
stack pointer register is decremented again and the contents of the
low-order register (C, E, L, flags) are copied to that location.
Eg: - PUSH B
PUSH A
POP: - This instruction pop
off stack to register pair. The contents of the memory location pointed
out by the stack pointer register are copied to the low-order register
(C, E, L, status flags) of the operand. The stack pointer is incremented
by 1 and the contents of that memory location are copied to the
high-order register (B, D, H, A) of the operand. The stack pointer
register is again incremented by 1.
Eg: - POP H
POP A
Eg: OUT F8H
Eg: - IN 8CH
ADD: - The content of operand are added to the content of the accumulator and the result is stored in Accumulator.
Eg- ADD B (it adds the content of accumulator to the content of the register B)
ADD M (if content is stored in memory location the it is added with the content stored in accumulator)
ADC: -
ACI: - Add immediate to accumulator with carry.
addition with carry
Eg:- ADC B , ADC M
ADI: - Add immediate means add an immediate value withe the content of accumulator and it is stored in accumulator.
Eg: - ADI 30H
Eg: - ACI 40H
LXI: Load register Pair immediate
Eg:- LXI H, 2030H (This instruction loads the memory address in HL register, here it works as memory pointer)
DAD: - Add register pair to HL register. The 16-bit contents of the specified register pair are
added
to the contents of the HL register and the sum is stored in the HL
register. The contents of the source register pair are not altered. If
the result is larger than 16 bits, the CY flag is set. No other flags
are affected.
SUB: - substract
the content of a register or a memory location form the content of
accumulator and the result is stored in the accumulator.
Eg: - SUB B( it substracts the content of B register from the content of the accumulator.
SUB M( it substracts the content of memory location pointed by HL pair from the content of accumulator.
SBB: - substract with borrow. Eg: - SBB B
SBB M
SUI: - Substract immediate from accumulator. this instruction subtract the immediate data from the content of accumulator and the result is store in accumulator. Eg: - SUI 45H
SBI: - Substract immediate from the content of the accumulator and the result is stored in accumulator.
SUB M( it substracts the content of memory location pointed by HL pair from the content of accumulator.
SBB: - substract with borrow. Eg: - SBB B
SBB M
SUI: - Substract immediate from accumulator. this instruction subtract the immediate data from the content of accumulator and the result is store in accumulator. Eg: - SUI 45H
SBI: - Substract immediate from the content of the accumulator and the result is stored in accumulator.
INR: - The contents of the
designated register or memory) are incremented by 1 and the result is
stored in the same place. If the operand is a memory location, its
location is specified by the contents of the HL registers.
DCR: - The contents of the designated register or memory are M decremented by 1 and the
DAA: - Decimal adjust accumulator.
Eg: -INR B( the content of register B is incremented by 1.
INR M( the content of memory location pointed by HL pair in incremented by 1)
INX: - Increment register pair by 1.
Eg: INX H (It means the location pointed by the HL pair is incremented by 1)
result is stored in
the same place. If the operand is a memory location, its location is
specified by the contents of the HL registers.
Eg: - DCR B(content of register B is decremented by 1)
DCR M(the content of memory location pointed by the HL pointer is decremented by 1.)
DCX: - decrement the register pair by 1.
Eg: DCX H( it decreases the memory location pointed by HL pair by 1.
The contents of the accumulator are
changed from a binary value to two 4-bit binary coded decimal (BCD)
digits. This is the only instruction that uses the auxiliary flag to
perform the binary to BCD conversion, and the
conversion procedure is described below. S, Z, AC, P, CY flags are altered to reflect the results of the operation.
If the value of the low-order 4-bits in
the accumulator is greater than 9 or if AC flag is set, the instruction
adds 6 to the low-order four bits. If the value of the high-order 4-bits
in the accumulator is greater than 9 or if the Carry flag is set, the
instruction adds 6 to the high-order four bits.
The
program sequence is transferred from the subroutine to the calling
program based on the specified flag of the PSW as described below. The
two bytes from the top of the stack are copied into the program counter,
and program execution begins at the new address.
1. RC: - (conditional call) The program sequence is transferred to a particular level or a 16-bit address if C=1 (or carry is 1)
Eg: - RC ABC (jump to the level abc if C=1)
2. RNC: - (conditional call) The program sequence is transferred to a particular level or a 16-bit
address if C=0 (or carry is 0)
Eg: - RNC ABC (jump to the level abc if C=0)
3. RP: - (conditional call) The program sequence is transferred to a particular level or a 16-bit address if S=0 (or sign is 0)
Eg: - RP ABC (jump to the level abc if S=0)
4. RM: - (conditional call) The program sequence is transferred to a particular level or a 16-bit address if S=1 (or sign is 1)
Eg: - RM ABC (jump to the level abc if S=1)
5. RZ: - (conditional call) The program sequence is transferred to a particular level or a 16-bit address if Z=1 (or zero flag is 1)
Eg: - RZ ABC (jump to the level abc if Z=1)
6. RNZ: - (conditional call) The program sequence is transferred to a particular level or a 16-bit address if Z=0 (or zero flag is 0)
Eg: - RNZ ABC (jump to the level abc if Z=0)
7. RPE: - (conditional call) The program sequence is transferred to a particular level or a 16-bit address if P=1 (or parity is 1)
Eg: - RPE ABC (jump to the level abc if P=1)
8. RPO: - (conditional call) The program sequence is transferred to a particular level or a 16-bit address if P=0 (or parity is 0)
2. JC: - (conditional jump) The program sequence is transferred to a particular level or a 16-bit address if C=1 (or carry is 1)
Eg: - RPO ABC (jump to the level abc if P=0)
9.RET: - Return from subroutine unconditionally
Call Instruction, CC, CNC, CP, CM, CZ, CNZ, CPE, CPO
1. CC: - (conditional call) The program sequence is transferred to a particular level or a 16-bit address if C=1 (or carry is 1)
Eg: - CC ABC (jump to the level abc if C=1)
2. CNC: - (conditional call) The program sequence is transferred to a particular level or a 16-bit address if C=0 (or carry is 0)
Eg: - CNC ABC (jump to the level abc if C=0)
3. CP: - (conditional call) The program sequence is transferred to a particular level or a 16-bit
address if S=0 (or sign is 0)
Eg: - CP ABC (jump to the level abc if S=0)
4. CM: - (conditional call) The program sequence is transferred to a particular level or a 16-bit address if S=1 (or sign is 1)
Eg: - CM ABC (jump to the level abc if S=1)
5. CZ: - (conditional call) The program sequence is transferred to a particular level or a 16-bit address if Z=1 (or zero flag is 1)
Eg: - CZ ABC (jump to the level abc if Z=1)
6. CNZ: - (conditional call) The program sequence is transferred to a particular level or a 16-bit address if Z=0 (or zero flag is 0)
Eg: - CNZ ABC (jump to the level abc if Z=0)
7. CPE: - (conditional call) The program sequence is transferred to a particular level or a 16-bit address if P=1 (or parity is 1)
Eg: - CPE ABC (jump to the level abc if P=1)
8. CPO: - (conditional call) The program sequence is transferred to a particular level or a 16-bit address if P=0 (or parity is 0)
Eg: - CPO ABC (jump to the level abc if P=0)
Jump Instruction, JMP, JC, JNC, JP, JM, JZ, JNZ, JPE, JPO
1. JMP: - (unconditionally jump)
The program sequence is transferred to the memory location specified by
the16-bit address given in the operand.
Eg: - JMP 2034H ( jump to location 2034H) there is no condition to jump.
JMP ABC (jump to abc level)
2. JC: - (conditional jump) The program sequence is transferred to a particular level or a 16-bit address if C=1 (or carry is 1)
3. JNC:- (conditional jump) The program sequence is transferred to a particular level or a 16-bit address if C=0 (or carry is 0)
Eg: JNC ABC (jump to the level abc if C=0)
4. JP: - (conditional jump) The program sequence is transferred to a particular level or a 16-bit address if S=0 (or sign is 0)
Eg: - JP ABC (jump to the level abc if S=0)
5. JM: - (conditional jump) The program sequence is transferred to a particular level or a 16-bit address if S=1 (or sign is 1)
Eg: - JM ABC (jump to the level abc if S=1)
6. JZ: - (conditional jump) The program sequence is transferred to a particular level or a 16-bit address if Z=1 (or zero flag is 0)
Eg: - JZ ABC (jump to the level abc if Z=1)
7. JNZ: - (conditional jump) The program sequence is transferred to a particular level or a 16-bit address if Z=0 (or zero flag is 0)
Eg: - JNZ ABC (jump to the level abc if Z=0)
8.JPE: - (conditional jump) The program sequence is transferred to a particular level or a 16-bit address if P=1 (or parity flag is 1)
Eg: - JPE ABC (jump to the level abc if P=1)
9. JPO: - (conditional jump) The program sequence is transferred to a particular level or a 16-bit address if P=0 (or parity flag is 0)
Eg: - JPO ABC (jump to the level abc if P=0)
No comments:
Post a Comment