Chapter2 Microprocessor
Chapter2 Microprocessor
microprocessor
• Register consists of five flip flops, each holding the status of different states separately is known
as flag register and each flip flop are called flags.
• 8085A can set or reset one or more of the flags and are sign(S), Zero (Z), Auxiliary Carry (AC)
and Parity (P) and Carry (CY).
• The state of flags indicates the result of arithmetic and logical operations, which in turn can be
used for decision making processes.
• Carry: - If the last operation generates a carry its status will 1
otherwise 0. It can handle the carry or borrow from one word to
another.
• Zero: - If the result of last operation is zero, its status will be 1
otherwise o. It is often used in loop control and in searching for
particular data value.
• Sign: - If the most significant bit (MSB) of the result of the last
operation is 1 (negative), then its status will be 1 otherwise 0.
• Parity: - If the result of the last operation has even number of s
even parity), its status will be 1 otherwise 0.
• Auxiliary carry: - If the last operation generates a carry from the
lower half word (lower nibble), its status will be 1 otherwise 0. Used
for performing BCD arithmetic.
Example 1
MVI A 30 (load 30H in register A) 00110000
MVI B 40 (load 40H in register B). - 01000000
SUB B (A = A – B) = 11000000. with borrow 1
These set of instructions will set the sign flag to 1 as 30 – 40 is a
negative number.
Example 2
MVI A 40 (load 40H in register A)
MVI B 30 (load 30H in register B)
SUB B (A = A – B)
These set of instructions will reset the sign flag to 0 as 40 – 30 is a
positive number.
Example 3
LXI B, 9000H
LDAX B
B= 90, C= 00 A= [9000]
9) STA 16-bit address (store accumulator contents direct)
•– 3-byte instruction.
•– Stores the contents of accumulator to specified address
•– E.g. STA FA00H
[FA00] ß [A]
3) SUB R/M
• 1 byte subtract instruction.
• Subtracts the contents of specified register / m with the contents of
accumulator and stores the result in accumulator.
• SUB D ; Aß A-D
4) SUI 8 bit data
• 2 byte subtract immediate instruction.
• Subtracts the 8 bit data from the contents of accumulator stores
result in accumulator.
• No flags affected
7) ADC R/M and ACI 8-bit data ( addition with carry (1 byte))
• ACI 8-bit data= immediate (2 byte).
• Adds the contents of register or 8 bit data whatever used suitably
with the previous carry.
8) SBB B/M
• 1 byte instruction.
• Subtracts the contents of register or memory from the contents of
accumulator and stores the result in accumulator.
• SBB D
• A<-- A-D-burrow
11001110
00110001
+. 1
= 00110010
= 32H
=- 32 H ( placing negative sign infront of it)
BCD Addition:
Jump Instructions:
• The jump instructions specify the memory location explicitly.
• They are 3 byte instructions, one byte for the operation code followed
by a 16 bit (2 byte) memory address.
• Jump instructions can be categorized into unconditional and
conditional jump.
Unconditional Jump
• 8085 includes unconditional jump instruction to enable the
programmer to set up continuous loops without depending only type
of conditions.
• E.g. JMP 16 bit address: loads the program counter by 16 bit address
and jumps to specified memory location.
JMP 4000H
• Here, 40H is higher order address and 00H is lower order address. The
lower order byte enters first and then higher order.
• The jump location can also be specified using a label or name.
E.g.
Address. Label. Mnemonics. Hexcode
2000H. MVI A, 80H
2002H. OUT 43H
2004H. MVI A, 00H
2006H. L1: OUT 40H
2008H. INR A
2009H. JMP L1
200CH HLT
Conditional Jump