Name: Umar Ali Roll#: 522 Class#: 5 Semester Submitted To: Sir Farhatullah Week: 07 Subject: Microprocessor and Assembly Language
Name: Umar Ali Roll#: 522 Class#: 5 Semester Submitted To: Sir Farhatullah Week: 07 Subject: Microprocessor and Assembly Language
Roll# : 522
• The address of the memory location, I/O port or I/O device, where data
• Some instructions specify two registers. The contents of the registers are the
required data.
Due to different ways of specifying data for instructions, the machine codes
of all instructions are not of the same length. It may 1-byte, 2-byte or 3-
byte instruction.
Addressing Modes:
Each instruction requires some data on which it has to operate. There
are different techniques to specify data for instructions. These
techniques are called addressing modes. Intel 8085 uses the
following addressing modes:
• Direct Addressing
In this addressing mode, the address of the operand (data) is given in the
instruction itself.
Example
STA 2400H: It stores the content of the accumulator in the memory
location 2400H.
32, 00, 24: The above instruction in the code form.
In this instruction, 2400H is the memory address where data is to be stored.
It is given in the instruction itself. The 2nd and 3rd bytes of the instruction
specify the address of the memory location. Here, it is understood that the
source of the data is accumulator.
• Register Addressing
• MOV A, M - Move the content of the memory location, whose address is in
• HLT - Halt.
In this addressing mode, the operand is specified within the instruction itself.
Example
LXI H, 2500 is an example of immediate addressing. 2500 is 16-bit data
which is given in the instruction itself. It is to be loaded into H-L pair.
• Implicit Addressing
Status Flags:
There is a set of five flip-flops which indicate status (condition) arising after
the execution of arithmetic and logic instructions. These are:
• Carry Flag (CS)
memory location.
C, D, E, H or L
A, B, C, D, H, L 8-bit register
A Accumulator
in H-L pair
specifies hexadecimal,
e.g. 2500H
a register pair
a register pair
of register PC.
CS Carry Status
bracket
^ AND operation
∨ OR operation
⊕ or ∀ Exclusive OR
direction of arrow
⇔ Exchange contents
r2 content of e A, B
[r2] register to
another
M content of e Indirect B, M
[r]←[[H memory to
-L]] register
r content of e Indirect M, C
[[H- register to
L]]←[r] memory
[r] data to
←data register
[rp] pair H
←data immediate
16 bits,
[rh] ←8
MSBs,
[rl] ←8
LSBs of
data
[A] r direct H
←[addr]
[addr] r direct H
←[A]
LHLD Load H-L 16 Non Direct 5 LHLD
[L] H
←[addr]
, [H] ←
[addr +
1]
[addr] H
←[L],
[addr
+1] ←
[H]
←[[rp]] r indirect
←[A] r indirect
[H-L] contents of e
E pair
Arithmetic Group
The instructions of this group perform arithmetic operations such as
addition, subtraction, increment or decrement of the content of a register or
a memory.
Instructio Explanation State Flags Addre-ssing Machin Exampl
n Set s e Cycles e
ADD r Add 4 All Register 1 ADD
[A] register to K
←[A]+ accumulat
[r] or
[A] + accumulat
[[H-L]] or
[A] ← register K
[r] + to
[CS] accumulat
or
[[H-L]] to
[CS] accumulat
or
[A] ← data to
[A] + accumulat
data or
ACI Add with 7 All Immediat 2 ACI
[A] ← immediate
[A] + data to
data + accumulat
[CS] or
[H-L] register K
+ [rp] pair
[A] register K
←[A]- from
[r] accumulat
or
[A] - from
[[H-L]] accumulat
or
←[A]- from
[H-L]] - accumulat
[CS] or with
borrow
←[A]- accumulat
data or
data immediate e
←[A]- accumulat
data- or with
[CS] borrow
+1 content t
carry
flag
←[[H- content t
L]]+1 carry
flag
-1 content t
carry
flag
L]]-1 carry
flag
[rp] memory
←[rp] content
+1
[rp] register K
←[rp]-1 pair
adjust
accumulat
or
Logical Group
The instructions in this group perform logical operation such as AND, OR,
compare, rotate, etc.
Instruction Explanation States Flags Addressing Machine
Set Cycles
ANA r AND 4 All Register 1
←[A]∧[r] accumulator
←[A]∧[[H- with
]] accumulator
accumulator
[A] with
←[A]∨[r] accumulator
←[A]∨[[H- accumulator
L]]
accumulator
accumulator
[[H-L]] with
accumulator
accumulator
←[A] the
accumulator
CMC Complement 4 CS 1
←[CS] status
[CS] ← 1 status
accumulator
L]] with
accumulator
data with
accumulator
[An+1] accumulator
←[An], left
[A0]
←[A7],
[CS]
←[A7]
[A7] accumulator
←[A0], right
[CS]
←[A0],
[An]
←[An+1]
[An+1] accumulator
[CS] carry
←[A7],
[A0]
←[CS]
[An] accumulator
←[An+1], right
[CS] through
←[A0], carry
[A7]
←[CS]
) to the
[PC] ← instruction
specified by
Label the address
Conditional Jump
Instruction Explanation States Machine
Set Cycles
Jump addr Conditional 10, 3, if
specified by 7, if true
if the true
specified
condition is
fulfilled
address
(label)
[PC] ← zero
address
(label)
[PC] ← carry =1
address
(label)
addr there is if CS 0 e e
(label) no carry =0
[PC] ←
address
(label)
(label) result is if 0 e e
address
(label)
(label) result is if 0 e e
address
(label)
address s P
(label) =1
address s P
(label) =0
Unconditional CALL
Instruction Explanation States Flags Addressing Machine
Set Cycles
CALL addr Unconditional 18 None Immediate 5
[SP]-1] ← the
[PCH] , subroutine
[[SP-2] ← identified by
[SP] ←
[SP]-2,
[PC] ←
addr(label
Conditional CALL
Instruction Explanation States Machine
Set Cycles
CALL addr Unconditional 18, 5, if
(label),
[SP] ←
[SP]-2
addr(label subroutin =1 8 e e
) e if carry /register
status
CS=1
(label) subroutin =0 8 e e
e if carry /register
status
CS=0
result is
zero
result is
not zero
result is
plus
e if the S= 1 /register
result is
minus
parity
) e if odd s P= /register
parity 0
Unconditional Return
Instruction Explanation States Flags Addressin Machine
Set g Cycles
RET Unconditional 10 None Indirect 3
[[SP]], from
[PCH] ← subroutine
[[SP] +
1], [SP]
← [SP]
+2
Conditional Return
Instruction Explanation States Machine
Set Cycles
RET Conditional 12, if 3, if true
[PCH] ← subroutine 6, if
[[SP] + not
1], true
[SP] ←
[SP] + 2
from 2 indirect
subroutine
if carry
status is
zero.
from 0 2 indirect
subroutine
if carry
status is
not zero.
from status
subroutine Z=1 2 indirect
if result is
zero.
subroutine Z= 0
if result is
not zero.
subroutine S= 0
if result is
not plus.
subroutine S= 0
if result is
not
minus.
subroutine P= 1
if even
parity.
subroutine P= 1
if odd
parity.
Restart
Instruction Explanation States Flags Addressin Machine
Set g Cycles
RST Restart is 12 None Register 3
← CALL
[PCH], instruction.
[[SP]-2]
[PCL],
[SP] ←
[SP] -
2,
[PC] ←
8 times
RST 1 CF 0008
RST 2 D7 0010
RST 3 DF 0018
RST 4 E7 0020
RST 5 EF 0028
RST 6 F7 0030
RST 7 FF 0038
PCHL
Instruction Set Explanation States Flags Addressin Machine
g Cycles
PCHL Jump 6 None Register 1
L], specified
[PCH] by H-L
←[H], [PCL] pair
←[L]
address accumulat e
[A] ← or from
port- from e
address accumulat
[Port] ← or to I/O
[A] port
1] ← register Indirect(destination)
[rh], pair to
[[SP] - stack
2] ←
[rh],
[SP] ←
[SP] - 2
← [A],
[[SP] -2]
← PSW,
[SP] ←
[SP] - 2
SP ] ], register Indirect(destination)
[rh] ← pair,
+1], saved,
[SP] + 2 stack
[[SP] +
1]
[H-L] → contents e
to stack
pointer
EI Enable 4 Non 1
Interrupts e
Interrupts e
Masks
Interrupts e
Masks
NOP No 4 Non 1
Operation e