MP - Module 2
MP - Module 2
4.1:
2. Arithmetic group
3. Logical group
-Instructions which are used to transfer data from one point to another point
(copy data)
Ex:Mov A,B
LDA 2500
2.Arithmetic group
Ex:ADD ,SUB,INR,DAD
3.Logical group
Instructions under this gp perform logical operation such as
AND,OR,XOR;compare ,rotate
Ex: ANA,XRA,ORA,CMP,RAL
EX:JMP,JC,JZ,CALL,CZ,RST
-special instructions
Ex:IN,OUT,PUSH,POP,HLT
1 byte-8bit
-if 16 bit data are to be stored, they are stored in consecutive m/y location
1.Direct data
EX:ADD B
EX:MOV A,B
5)Data is implied
EX:CMA
RAL
RAR
8 bit of data
ADD B
Mov M
2 )2 byte instruction
First byte-opcode
2nd byte-operand
MVI A,08
ADI 05
1st byte-opcode
2nd&3rd byte-operand
STA 4600
1st byte(opcode) , 2nd byte(operand’s MSB 46), 3rd byte(operand’s LSB 00)
LXI 2500
1st byte(opcode) , 2nd byte(operand’s MSB 25), 3rd byte(operand’s LSB 00)
1. Direct Addressing
2. Register Addressing
4. Immediate Addressing
5. Implicit Addressing
1.Direct Addressing
-address of the operand(data)is given in the instruction itself
[address in instruction]
-it specifies 16 bit address of the operand within the instruction itself.
Ex:
2.Register Addressing
[data in register]
Ex:
2)ADD B, Add contents of Register A and register B and store the result in
Register A
[address in register]
Ex:
1)Mov A,M ,move the content of the memory location,whose address is in H-L
pair,to the accumulator.
2)LDAX B
1050H
4.Immediate Addressing
Ex:
5.Implicit Addressing
EX:
Summary(Addressing mode):
1)immediate..data in instruction
2)register….data in reg
3)direct…address in instruction
4)indirect…address in reg
5)implied
[r1]<-[r2]
[r]<-[[H-L]]
-The content of memory location,whose address is in H-L pair ,is moved to register
r
[[H-L]]<-[r]
-The content of register r is moved to the memory location addressed by H-L pair
-No flags affected.
EX: MOV M,C, Move the content register C to the memory location whose
address is in H-L pair.
[r]<-data
MVI M,data
[[H-L]]<-data
-The data is moved to the memory location whose address is in H-L pair.
-This instruction loads 16 bit immediate data into register pair rp.
H:25 L:00
[A]<-[addr]
-The content of the memory location ,whose address is specified in the instruction,
is loaded into the accumulator
Ex: LDA 2400H ,load the content of memory location 2400H into the accumulator.
5.STA addr (Store accumulator direct)
[addr]<-[A]
-The content of the accumulator is stored in the memory location whose address is
specified in the instruction
[A]<-[A]+[r]
-The content of register r is added to the content of the accumulator, and the sum is
placed in the accumulator.
[A]<-[A]+[[H-L]]
-The content of memory location addressed by H-L pair is added to the content of
the accumulator. The sum is placed in the accumulator.
[A]<-[A]+[r]+[CS]
-The contents of register r and carry status are added to the content of the
accumulator. The sum is placed in the accumulator.
ADC M
[A]<-[A]+[[H-L]]+[CS]
The content of memory location addressed by H-L pair and carry status are added
to the content of the accumulator. The sum is placed in the accumulator.
[A]<-[A]+data
➢ The immediate data is added to the content of the accumulator .The sum is
placed in the accumulator
➢ EX:ADI 08, add 08 to the content of accumulator and place the result in the
accumulator.
[A]<-[A]+data+[CS]
-data given in the instruction and carry status added to the content of accumulator.
The sum is placed in the accumulator.
[H-L]<-[H-L]+[rp]
-The contents of register pair rp are added to the contents of H-L pair and the result
is placed in H-L pair.
[A]<-[A]^[r]
-the content of register r is ANDed with the content of accumulator,and the result
is placed in the accumulator.
[A]<-[A]^[[H-L]]
-The content of memory location addressed by H-L pair is ANDed with the
accumulator .The result is placed in the accumulator.
Cs-0
AC-1
[A]<-[A]^data
-the data given in the instruction is ANDed with the content of accumulator .The
result is placed in accumulator.
CS:0
AC:1
[A]<-[A]v[r]
[A]<-[A]v[[H-L]]
-The content of the memory location addressed by H-L pair is ORed with the
content of accumulator.The result is placed in the accumulator.
[a]<-[A] v data
-The data given in the instruction is ORed with the content of the accumulator.The
result is placed in the accumulator.
CS & AC=0
[A]<-[A] v [r]
CS & AC=0
➢ The instructions of this group change the normal sequence of the program.
The address of the label is the address of memory location for next
instruction to be executed. The program jumps to the instruction specified by
the address(label)unconditionally.
-After the execution of a conditional jump instruction the program jumps to the
instruction specified by the address(label)if the specified condition is fulfilled.
-The program proceeds further in the normal sequence if the specified condition is
not fulfilled.
[PC]<-address(label),jump if z=1
-The program jumps to the instruction specified by the address(label)if the result is
zero(zero status Z=1).
-Here the result after the execution of preceding instruction is under consideration
-The program jumps to the instruction specified by the address (label)if the result is
non-Zero(ie Zero status Z=0)
3.JC addr(label)(jump if there is a carry)
[PC]<-address(label),jump if CS=1
-Here the carry after the execution of the preceding instruction is under
consideration
-The program jumps to the instruction specified by the address (label) if the result
is plus.
[A]<-[port]
No flags affected
[port]<-[A]
No flags affected
3.PUSH(push the content of register pair to stack)
[[sp]-1]<-[rh]
[[sp]-2]<-[rl]
[sp]<-[sp]-2
No flags affected
[[sp]-1]<-[A]
[[sp]-2<-PSW
[sp]<-[sp]-2
No flags affected
Ex:
PUSH PSW
[D014]=33H [D013]=25H
[SP]=D013H
4.POP rp(pop the content of reg pair ,which was saved,from stack)
[rl]<-[[SP]]
[rh]<-[[SP]+1]
[sp]<-[sp]+2
No flags affected
PSW<-[[sp]]
[A]<-[[SP]+1]
[sp]<-[sp]+2
No flags affected
5.HLT(halt)
********************************