8085 Microprocessor
8085 Microprocessor
CHAPTER 2
3160914 : M&M
BY : H V HIRVANIYA
Intel 8085 Microprocessor
The 8085A is an 8- bit microprocessor suitable for a wide range of application.
It is a 40-pin DIP (Dual in package) chip, based on NMOS technology.
It contains approximately 6200 transistors on a 164 x 222 mil chip.
It requires a single +5V supply between Vcc at pin no. 40 and Vss at pin no. 20.
Intel 8085 Microprocessor
Pin Configuration of Intel 8085A
The microprocessor, being a logic circuit, shall move from one state to the other state
during it operation.
There are ten (10) different possible states for the processor and the processor will be
in one of these states as long as the power is ON.
States for the Processor
1. RESET STATE:
Whenever microprocessor is reset, it enters in reset state.
The microprocessor can be in RESET state for an integral multiple of clock cycle.
2. WAIT STATE:
It can be in this state for an integral number of clock cycles, the duration being
determined by an external content signal input marked READY.
States for the Processor
3. HOLD STATE:
As long as HOLD signal is active, microprocessor is in HOLD state.
4. HALT STATE:
Microprocessor enters in this state when an HALT instruction is executed by the
processor.
It remains in this state till such time when an external signal dictated by the user
asked the microprocessor to perform further duties.
States for the Processor
5. The other states the microprocessor can be in are marked T1, T2, T3, T4, T5 & T6
state.
Each of these states is of one clock period duration.
During each of these predetermined timing slots microprocessor performs very well
defined activities.
Pin Configuration of Intel 8085A
Pin no.19 to pin no.12 are used by the microprocessor to send lower order 8-bits of
the memory address during T1 timing plot of a machine cycle.
Therefore, the same 8-pins are utilized as bi-directional data bus for data transfer
operation in the subsequent timing plots T2 & T3.
Hence, these pins are designated as AD7 – AD0.
Pin Configuration of Intel 8085A
These 8 lines are also tri-state lines. They will be tri-stated during T4, T5 & T6 states.
They will also be restated during DMA operation, during RESET operation & when a
HALT instruction is executed.
These lines will also be tri-stated for a very short duration of time (few neon seconds)
between T1 &T2 states.
Pin Configuration of Intel 8085A
Summary
A15 – A8
AD7–AD0
States for the Processor: RESET, WAIT, HOLD, HALT, T1, T2, T3, T4, T5 & T6
ALE
RD & WR
IO/M
Pin Configuration of Intel 8085A Microprocessor
https://www.youtube.com/watch?v=I78iyzXQrP4
Pin Configuration of Intel 8085A
4. What is interrupt? What are the interrupts available in 8085 microprocessor? Write interrupt vector
table for vectored interrupts. Explain SIM and RIM instructions.
Internal Architecture of Intel 8085A
The functional block diagram of 8085A
It consists of five essential blocks.
(1) Arithmetic Logic Section
(2) Register Section
(3) The Interrupt Control Section
(4) Serial I/O Section
(5) The Timing And Control Unit
Internal Architecture of Intel 8085A
Address buffer and address/data buffers isolate the internal data bus from the external
address bus and address/data bus and drive the external address bus and address/data
bus.
The CPU can send the address of desired memory locations and I/O chip through
these buffers.
Internal Architecture of Intel 8085A
a. Accumulator (A)
Arithmetic and/or logic operations on one or two operations are the basic data
transformations implemented in a μρ, one of these two operands is always in the
accumulator.
Accumulator is an 8-bit register accessible to the user is connected to the 8-bit
internal data bus.
The content of the accumulator is always available at this two state output as one
of the operands for the ALU.
Internal Architecture of Intel 8085A
a. Accumulator (A)
The contents of the accumulator can be manipulated through instructions.
Its content can be incremented and decremented.
The content of the memory location can be transferred to the accumulator and
vice-versa.
The result of arithmetic/ logical operations carried out by ALU is also stored back
in the accumulator.
In other words, it accumulates the result of the operation, hence, the name
accumulator.
Internal Architecture of Intel 8085A
d. Flags register:
The three crossed bit are redundant bits and not used.
They can be either ‘0’ or ‘1’ but normally they are forced to be zero.
The other five bits are affected as a result of execution of an instruction.
All instructions do not affect these flags e.g. data transfer operation do not affect
these flags.
Internal Architecture of Intel 8085A
Assignment:
What are the flags after these operations:
9B h + A5 h.
9B h - A5 h
Internal Architecture of Intel 8085A
2. Register Section:
Internal Architecture of Intel 8085A
2. Register Section:
Internal Architecture of Intel 8085A
2. Register Section:
General Purpose Registers
There are six 8-bit general purpose registers designated as B, C, D, E, H and L.
All these registers are accessible to the user. It means their contents can be read without destroying it
or some new data can be written into it through instructions.
These registers constitute a register array like a small on-chip RAM with addressable memory
location.
Internal Architecture of Intel 8085A
2. Register Section:
Program Counter:
This is a 16-bit register accessible to the user.
It is a special purpose register and it always contains the address of the next instruction to be fetched
from the program memory and executed by the CPU in a program sequence.
Thus the program counter keeps the track of the program execution in which instructions are to be
executed next.
When the microprocessor is RESET, the CPU initializes the PC to 0000 H. Therefore, the first
instruction of the program should be at 0000 H in the memory address space of the CPU.
Internal Architecture of Intel 8085A
2. Register Section:
Stack Pointer Register:
The stack is a storage area of the processor.
It consists of number of sequential and RWM locations in which microprocessor saves the internal
register contents during subroutine calls and interrupts so that they will not be changed or destroyed
by a subroutine.
8085A μ𝑝 can address directly 64K memory locations. This is known as directly addressable memory
space starting from the address 0000H to FFFFH.
This entire memory area is usually divided by the user into program area, data area and stack area.
It is for the user to see that program area and data area do not overlap with that of stack memory area.
The size of the stack memory area depends upon the application.
Internal Architecture of Intel 8085A
2. Register Section:
Stack Pointer Register:
Internal Architecture of Intel 8085A
2. Register Section:
Stack Pointer Register:
Since the stack pointer always holds the address of the last byte of data pushed onto the stack,
therefore, when PUSH B instruction is executed, the stack pointer is decremented by 1 and the
contents of the (B) register are copied onto the stack at that address.
The stack pointer is decremented again, and the contents of the (C) register are copied to that address.
Just after the execution of the PUSH B instruction, the situation is shown in fig.
Internal Architecture of Intel 8085A
2. Register Section:
Stack Pointer Register:
Internal Architecture of Intel 8085A
2. Register Section:
Stack Pointer Register:
Similarly, to store the contents of (D,E) register pair PUSH D instruction is used.
The meaning of this instruction is push the contents of the (D,E) pair onto the stack to save them
there as shown in figure just after the execution.
Internal Architecture of Intel 8085A
2. Register Section:
Stack Pointer Register:
Internal Architecture of Intel 8085A
2. Register Section:
Stack Pointer Register:
Since the contents of (B,C) & (D,E) register pairs are stored at the top of the stack, these registers are
now available for further computation in the subroutine.
At a later stage of execution of the program after utilizing B, C, D, E registers, there may be a need to
restore the original contents to the respective registers. E.g. at the end of the subroutine, the data is
restored to the proper register.
Internal Architecture of Intel 8085A
2. Register Section:
Stack Pointer Register:
The restoration of the contents is a READ operation from the stack and is known as POP operation. A
POP register instruction copies the stored data from the stack back into the indicated register pair.
Just before the execution of POP instruction, let us say the situation is as shown below:
Internal Architecture of Intel 8085A
2. Register Section:
Stack Pointer Register:
Internal Architecture of Intel 8085A
2. Register Section:
Stack Pointer Register:
Note that registers (B), (C), (D) and (E) have some different contents because these registers are used
in the subroutine.
To restore the contents of (B,C) register pair, POP B instruction is used. Whenever this instruction is
executed, the contents from the top of the stack are read and written into the (B,C) register pair.
To restore the contents (D,E) register pair POP D instruction is used. The question is in which
sequence these instructions are to be executed so that the contents are restored properly.
The obvious sequence in POP D first & then POP B i.e., the data must be poppedoff in the reverse
order from which it was pushed.
This type of stack is called Last-in-First-out (LIFO) memory.
Internal Architecture of Intel 8085A
2. Register Section:
Stack Pointer Register:
Just after the execution of POP D & POP B instructions,
the situation is as shown in figure:
Internal Architecture of Intel 8085A
2. Register Section:
Stack Pointer Register:
From the above discussion, following points emerge:
1. The stack pointer always points to the top of the stack up to which it is full with relevant data.
2. Storing or saving the data from the registers on stack is known as PUSH operation.
3. The restoring or reading data from the stack onto certain internal registers is known as POP
operation.
4. The stack operates on Last-in-first-out (LIFO) basis.
5. The stack pointer can be initialized to the bottom of the stack but bottom of the stack cannot be
utilized to store any useful data.
6. It is for the user to see that the program area does not overlap with stack area.
Internal Architecture of Intel 8085A
2. Register Section:
W-Z:
(W) and (Z) are two 8-bit temporary registers not accessible to the user.
They are exclusively used for the internal operation by the microprocessor.
These registers are used either to store 8-bit of information in each (W) and (Z) registers or a 16-bit
data in (W,Z) register pair with lower order 8-bits in (Z) and higher-order 8-bits in (W) register.
Internal Architecture of Intel 8085A
2. Register Section:
W-Z:
When a 3-byte instruction containing 2-byte address is to be executed by the μ 𝑝, the first byte is the
(op-code byte) which is fetched and then decoded by the decoder.
Then two memories read machine cycles are executed one by one to read the two-byte address, one
in each machine cycle and placed in (W,Z) register pair.
During instruction execution, in next machine cycle, the address in (W,Z) register pair is transferred
to the address latch to address memory or I/O for data transfer.
Internal Architecture of Intel 8085A
2. Register Section:
Increment-Decrement Address Latch:
It is another 16-bit internal register latch available in the register section for internal operations and is
not accessible to the user.
The address latch serves two functions.
First, it selects an address to be sent out from the program counter, from the stack pointer, or from
one of the 16-bit register pairs.
Second, it latches this address onto the address lines for the required time.
The 16-bit addresses from 8085A allow the microprocessor up to 216 memory locations through
A15-A8 and AD7-AD0 lines.
An increment/decrement register allows the contents of any of the 16-bit registers to be incremented
or decremented.
Internal Architecture of Intel 8085A
2. Register Section:
Instruction Register & Instruction Decoder:
The first word of an instruction is the operation code, i.e., binary code for that instruction. Therefore, in the first
machine cycle of any instruction μ𝑝 fetches the instruction from the memory .
The op-code representing the instruction to be executed is fetched from the (program) memory location pointed to by
(PC) and loaded into the instruction register (IR).
The IR passes this op-code to the instruction decoder which interprets this op-code appropriately in order to decide
what operation needs to be done for executing this instruction.
The instruction decoder tells the control unit the type of instruction to be executed; the number of machine cycles
necessary to execute the instruction etc.
In response, the control unit generates all the necessary control signals which go into the different internal block of the
microprocessor.
These different control signals are generated by what is known as Micro-programming technique. Micro-
programming means the microprocessor instruction decoding operated like a small version of a μ 𝑝 itself.
As the μ𝑝 goes through the fetch and execute cycles, the microprogramming logic goes through a series of fetch and
executes cycles.
Internal Architecture of Intel 8085A
2. Register Section:
Instruction Register & Instruction Decoder:
E.g. if the instruction is ADI 04H, then the first binary code read by the μ𝑝 is C6H into the
(IR).
After decoding this, the decoder will recognize that another memory read cycle is required to
read 04H to be added to the number in the accumulator.
The decoder will direct the control circuit to send out another memory read pulse and
transfers the data coming on the data bus into the temporary register (Temp), so that it can be
added to the accumulator.
When the addition is completed the control circuit directs the result back to the accumulator.
The program counter is then incremented to point the next memory address and send out
another memory read pulse to read the μ 𝑝 code of next instruction from memory.
Internal Architecture of Intel 8085A
r1 r2
Instruction and assembly language Program
r M(H,L)
Instruction and assembly language Program
M(H,L) r
Instruction and assembly language Program
Data Transfer Group:
4. MVI r, DATA:
DATA is the symbolic name given to 8-bit data which is immediately available as
second byte of the instruction. Therefore, the source of data is the 2nd byte of the
instruction itself.
The meaning of the instruction is “Move 8-bit data immediately available as a 2nd
byte of the instruction itself into the destination register r”.
r
DATA
Instruction and assembly language Program
M(H,L)
DATA
Instruction and assembly language Program
Data Transfer Group:
6. LXI rp, DDATA:
DDATA stands for double-data, a symbolic name given to 16-bit data available
immediately as the 2nd & 3rd bytes of the instruction.
”rp”stands for register pair.
The meaning of the instruction is “Load the 16 bit data immediate available as the
2nd & 3rd bytes of the instruction into register pair rp”.
rpl
DATA1
rph
Instruction and assembly language Program
Data Transfer Group:
7. LDA ADDR:
ADDR is the symbolic name given to the 16 bit address directly available in the
instruction.
LDA is the mnemonic for LOAD ACCUMULATOR DIRECT.
The meaning of the instruction is “Load the content of the memory location whose
address is directly available in the instruction as 2 nd and 3rd bytes into the
accumulator”.
A (ADDR)
Instruction and assembly language Program
(ADDR) A
Instruction and assembly language Program
Data Transfer Group:
9. LHLD ADDR:
LHLD is the mnemonic for LOAD (H,L) REGISTER PAIR DIRECT.
The meaning of the instruction is “Load the content of the memory location whose
address is directly available as 2nd & 3rd byte of the instruction to register L and the
content of the memory location at next higher address to the register H”.
This is a 3-byte instruction.
L (ADDR)
H
Instruction and assembly language Program
Data Transfer Group:
10. SHLD ADDR:
SHLD is the mnemonic for STORE (H, L) REGISTER PAIR DIRECT.
The meaning of the instruction is the “Store the content of (L) register into the
memory location whose address is available as 2nd & 3rd byte of the instruction
itself and store the content of (H) register into the memory location whose address is
next higher address”.
This is a 3-byte instruction.
(ADDR)
L
(ADDR+1)
Instruction and assembly language Program
Data Transfer Group:
11. LDAX rp:
LDAX is the mnemonic for LOAD ACCUMULATOR INDIRECTLY.
The meaning of the instruction is “Load the accumulator from the memory location
whose address is available in a register pair specified in the instruction”.
A (H, L)
A (B, C)
A (D, E)
Instruction and assembly language Program
Data Transfer Group:
12. STAX rp:
STAX is the mnemonic for store accumulator indirectly using register indirect
addressing mode.
The meaning of the instruction is “Store the content of accumulator in the memory
location whose address is available in register pair specified in the instruction”.
(H, L) A
(B, C) A
(D, E) A
Instruction and assembly language Program
Data Transfer Group:
13. IN PORT:
PORT is the symbolic name given to 8-bit address of the input device available as a
2nd byte of the instruction.
IN is the mnemonic for INPUT.
The meaning of the instruction is “Input an 8-bit data from the input device whose
address is available as a 2nd byte of the instruction and load it into accumulator”.
A I/O
(ADDR)
Instruction and assembly language Program
Data Transfer Group:
14. OUT PORT:
PORT is the symbolic name given to the 8-bit address of the output device available
as the 2nd byte of instruction.
OUT is the mnemonic for OUTPUT.
The meaning of the instruction is “Output the content of accumulator to an output
device whose address is available in the instruction As the 2nd byte of the
instruction”.
I/O (ADDR)
Instruction and assembly language Program
(D, E) (H,
L)
Instruction and assembly language Program
ARITHMETIC GROUP:
The instructions of this group perform the arithmetic operations on the operands.
Normally two operands are necessary for any arithmetic operation.
One of the operand is always assumed to be available in accumulator. The other
operand can be made available in one of the three locations:
a. In an internal general purpose register (r).
b. In a memory location pointed by M-pointer i.e., (H, L) pair.
c. Immediately in the instruction itself as a 2nd byte.
All the flags of Flag register are affected as per standard rule.
There are 20 basic instructions in this group.
Instruction and assembly language Program
ARITHMETIC GROUP:
1. ADD r:
This is a single byte instruction.
The meaning of the instruction is “Add the content of register (r) to the content of
accumulator and store the result back into the accumulator”.
A A+r
Instruction and assembly language Program
ARITHMETIC GROUP:
2. ADD M:
This is a single byte instruction.
The meaning of the instruction is “Add the content of memory location whose
address is in (H,L) pair to the content of accumulator and store the result back into
the accumulator”.
A A+
M(H, L)
Instruction and assembly language Program
ARITHMETIC GROUP:
3. ADI DATA:
It is a two byte instruction.
The meaning of the instruction is “Add the content available as the second byte of
the instruction to the content of accumulation and store the result back into the
accumulator”.
A A+
DATA
Instruction and assembly language Program
ARITHMETIC GROUP:
4. ADC r:
It is a single byte instruction.
The meaning of the instruction is “Add the content of register (r) to the content of
accumulator with carry and store the result back into accumulator”.
A A+r+
CY
Instruction and assembly language Program
ARITHMETIC GROUP:
5. ADC M:
It is a single byte instruction.
The meaning of the instruction is “Add the contents of memory location whose
address is available in (H, L) pair to the contents of accumulator with carry and store
the result back into accumulator”.
A A + (H, L) +
CY
Instruction and assembly language Program
ARITHMETIC GROUP:
6. ACI DATA:
It is a two byte instruction.
The meaning of the instruction is “Add the content available as the second byte of
instruction itself to the content to accumulator with carry and store the result back
into the accumulator”.
A A + DATA +
CY
Instruction and assembly language Program
ARITHMETIC GROUP:
7. SUB r:
This is a single byte instruction.
The meaning of the instruction is “Subtract the content of register (r) from the
content of accumulator and store the result back into the accumulator”.
A A-r
Instruction and assembly language Program
ARITHMETIC GROUP:
8. SUB M:
This is a single byte instruction.
The meaning of the instruction is “Subtract the content of memory location whose
address is in (H,L) pair from the content of accumulator and store the result back
into the accumulator”.
A A – M(H, L)
Instruction and assembly language Program
ARITHMETIC GROUP:
9. SUI DATA:
It is a two byte instruction.
The meaning of the instruction is “Subtract the content available as the second byte
of the instruction from the content of accumulation and store the result back into the
accumulator”.
A A – DATA
Instruction and assembly language Program
ARITHMETIC GROUP:
10. SBB r:
It is a single byte instruction.
The meaning of the instruction is “Subtract the content of register (r) from the
content of accumulator with borrow and store the result back into accumulator”.
A A – r – CY
Instruction and assembly language Program
ARITHMETIC GROUP:
11. SBB M:
It is a single byte instruction.
The meaning of the instruction is “Subtract the content of memory location whose
address is available in (H, L) pair from the content of accumulator with borrow and
store the result back into accumulator”.
A A – M(H, L)
– CY
Instruction and assembly language Program
ARITHMETIC GROUP:
12. SBI DATA:
It is a two byte instruction.
The meaning of the instruction is “Subtract the content available as the second byte
of instruction itself from the content to accumulator with borrow and store the result
back into the accumulator”.
A A – DATA –
CY
Instruction and assembly language Program
ARITHMETIC GROUP:
13. INR r:
It is a single byte instruction.
The meaning of the instruction is “Increment the content of register (r) by 1 and
store the result back to the register (r)”.
r r+1
Instruction and assembly language Program
ARITHMETIC GROUP:
14. INR M:
It is a single byte instruction.
The meaning of the instruction is “Increment the content of memory location by 1
whose address is available in (H, L) pair and stores the result back in the same
location”.
M(H, L) M(H,
L) + 1
Instruction and assembly language Program
ARITHMETIC GROUP:
15. DCR r:
It is a single byte instruction.
The meaning of the instruction is “Decrement the content of register (r) by 1 and
store the result back to the register (r)”.
r r-1
Instruction and assembly language Program
ARITHMETIC GROUP:
16. DCR M:
It is a single byte instruction.
The meaning of the instruction is “Decrement the content of memory location by 1
whose address is available in (H, L) pair and stores the result back in the same
location”.
M(H, L) M(H,
L) – 1
Instruction and assembly language Program
ARITHMETIC GROUP:
17. INX rp:
It is a single byte instruction.
The meaning of the instruction is “Increment the content of register pair (rp) by 1
and store it in same register pair”.
(H, L) (H, L) +
1
(B, C) (B, C) +
1
Instruction and assembly language Program
ARITHMETIC GROUP:
18. DCX rp:
It is a single byte instruction.
The meaning of the instruction is “Decrement the content of register pair (rp) by 1
and store it in same register pair.
(H, L) (H, L) –
1
(B, C) (B, C) –
1
Instruction and assembly language Program
ARITHMETIC GROUP:
19. DAD rp:
It is a single byte instruction.
The meaning of the instruction is double precision addition, i.e., “Add the contents
of (H,L) register pair with the contents of register pair (rp) and store the result back
into (H,L) register pair”.
(H, L) (H, L) +
rp
Instruction and assembly language Program
ARITHMETIC GROUP:
20. DAA:
It is a single byte instruction. The meaning of the instruction is decimal adjust
accumulator.
It is specifically used for BCD addition operation. It adjusts the content of
accumulator to two digit BCD.
Instruction and assembly language Program
ARITHMETIC GROUP:
20. DAA:
This instruction is used just after the addition operation. Whenever DAA is executed
the following checks and corrections are made:
1. If the lower order 4-bits A3A2A1A0 is an illegal BCD code or if AC is SET then 06H is
added to accumulator.
2. Thereafter, if the higher order 4-bits A7A6A5A4 is an illegal BCD code or if CY is SET
then 60 H is added to accumulator else no action.
Instruction and assembly language Program
LOGICAL GROUP:
It consists of 19 basic instructions.
There are three basic logic operation AND, OR & XOR.
Logical operation takes place bit by bit.
If two operands are involved in the instruction, the first operand is assumed to be in the
accumulator.
The second 8-bit operand is available in:
a. the internal general purpose register
b. in the memory location pointed to by the M-pointer
c. the 2nd byte of the instruction itself.
The result of the logical operation is stored back in the accumulator.
Instruction and assembly language Program
LOGICAL GROUP:
1. ANA r:
This is a single byte instruction.
The meaning of the instruction is “AND bit by bit the content of register (r) to the
content of accumulator and store the result back in the accumulator”.
𝑨 𝑨∩𝒓
Instruction and assembly language Program
LOGICAL GROUP:
2. ANA M:
This is a single byte instruction.
The meaning of the instruction is “AND bit by bit the content of memory location
pointed by (H, L) register pair to the content of accumulator and store the result back
in the accumulator”.
𝑨 𝑨 ∩ 𝑴 ( 𝑯 , 𝑳)
Instruction and assembly language Program
LOGICAL GROUP:
3. ANI DATA:
It is a two byte instruction.
The meaning of the instruction is “AND bit by bit the content available as a second
byte of instruction to the content of the accumulator and store the result back in the
accumulator”.
𝑨 𝑨 ∩ 𝑫𝑨𝑻𝑨
Instruction and assembly language Program
LOGICAL GROUP:
4. XRA r:
It is a single byte instruction.
The meaning of the instruction is “Exclusively ORed bit by bit the content of register
(r) with the content of accumulator and store the result back into accumulator”.
𝑨 𝑨 ⨁𝒓
Instruction and assembly language Program
LOGICAL GROUP:
5. XRA M:
This is a single byte instruction.
The meaning of the instruction is “Exclusively ORed bit by bit the content of memory
location pointed by (H, L) register pair to the content of accumulator and store the
result back in the accumulator”.
𝑨 𝑨 ⨁ 𝑴 ( 𝑯 , 𝑳)
Instruction and assembly language Program
LOGICAL GROUP:
6. XRI DATA:
It is a two byte instruction.
The meaning of the instruction is “Exclusively ORed bit by bit the content of second
byte of the instruction with the content of accumulator and store the result back into
accumulator”.
𝑨 𝑨 ⨁ 𝑫𝑨𝑻𝑨
Instruction and assembly language Program
LOGICAL GROUP:
7. ORA r:
It is a single byte instruction.
The meaning of the instruction is “ORed bit by bit the content of register (r) with the
content of accumulator and store the result back into accumulator”.
𝑨 𝑨⋃ 𝒓
Instruction and assembly language Program
LOGICAL GROUP:
8. ORA M:
This is a single byte instruction.
The meaning of the instruction is “ORed bit by bit the content of memory location
pointed by (H, L) register pair to the content of accumulator and store the result back
in the accumulator”.
𝑨 𝑨 ⋃ 𝑴 ( 𝑯 , 𝑳)
Instruction and assembly language Program
LOGICAL GROUP:
9. ORI DATA:
It is a two byte instruction.
The meaning of the instruction is “ORed bit by bit the content of second byte of the
instruction with the content of accumulator and store the result back into accumulator”.
𝑨 𝑨 ⋃ 𝑫𝑨𝑻𝑨
Instruction and assembly language Program
LOGICAL GROUP:
10. CMP r:
It is a single byte instruction.
The meaning of the instruction “Compare the content of accumulator with the content of
register (r)”.
Thus the contents of Acc & register (r) are not destroyed but as result of this operation
the flags are affected as per standard rule as given below:
If
(A) > (r) CY = 0, Z = 0
(A) = (r) CY = 0, Z = 1
(A) < (r) CY = 1, Z = 0
Instruction and assembly language Program
LOGICAL GROUP:
11. CMP M:
It is a single byte instruction.
The meaning of the instruction is “Compare the content of accumulator with the
content of memory location whose address is available in (H, L) register pair”.
If
(A) > M(H, L) CY = 0, Z = 0
(A) = M(H, L) CY = 0, Z = 1
(A) < M(H, L) CY = 1, Z = 0
Instruction and assembly language Program
LOGICAL GROUP:
12. CPI data:
The meaning of the instruction is “Compare the content of accumulator with the 8-bit
data available in the instruction as immediate data byte”.
If
(A) > DATA CY = 0, Z = 0
(A) = DATA CY = 0, Z = 1
(A) < DATA CY = 1, Z = 0
Instruction and assembly language Program
LOGICAL GROUP:
13. RLC:
The meaning of the instruction is “Rotate left the content of the accumulator by one bit
without carry flag. The lower order bit & the CY flag are both set to the value shifted
out the high order bit position”.
Instruction and assembly language Program
LOGICAL GROUP:
14. RRC:
The meaning of the instruction is “Rotate right the content of the accumulator by one
bit without carry flag. The higher order bit & the CY flag are both set to the value
shifted out the lower order bit position”.
Instruction and assembly language Program
LOGICAL GROUP:
15. RAL:
The meaning of the instruction is “Rotate left the content of the accumulator by one bit
through the carry flag. The lower order bit set equal to the CY flag and CY flag is set
to the value shifted out of the A7 bit”.
Instruction and assembly language Program
LOGICAL GROUP:
16. RAR:
The meaning of the instruction is “Rotate right the content of the accumulator by one
bit through carry flag. The higher order bit is set equal to the CY flag and the CY flag
is set to the value shifted out the lower order bit position”.
Instruction and assembly language Program
LOGICAL GROUP:
17. CMA:
The meaning of the instruction is “Complement the content of accumulator bit by bit
and store the result back into the accumulator”.
Instruction and assembly language Program
LOGICAL GROUP:
18. CMC:
The meaning of the instruction is “Complement CY flag and store it back into the same
CY flag position”.
Instruction and assembly language Program
LOGICAL GROUP:
19. STC:
The meaning of the instruction is “Set the CY flag to “1””.
1
Instruction and assembly language Program
BRANCH GROUP:
This group of instructions is used to alter the normal sequential program flow and force the
program to proceed from a different point.
Condition flags are not affected by any instruction in this group only program counter (PC)
is affected; sometimes stack is also affected.
Branch instructions can be of two types: conditional & unconditional.
Unconditional branch instructions simply cause the program to branch to the indicated instruction
whenever these instructions are encountered, i.e., (PC) is loaded with a new address.
Conditional branch instructions examine the status of one of the four processor flags (Z, CY, P, S)
to determine if the specified branch instruction is to be executed. If the condition tested is TRUE,
it causes a branching to occur otherwise not. AC is not used for specifying condition.
Instruction and assembly language Program
BRANCH GROUP:
The 8 conditions that are tested are given below:
Instruction and assembly language Program
BRANCH GROUP:
1. JMP ADDR:
ADDR is the symbolic name given to the 16- bit address data available as the 2nd and
3rd bytes of the instruction. JMP is the mnemonic for jump.
The meaning of the instruction is “Load the PC with the 16- bit data available in the
instruction itself as the 2nd and 3rd bytes of instruction so that the next instruction is
fetched from this address in the succeeding instruction cycle”.
PCL ADDR(L)
PCH ADDR(H)
Instruction and assembly language Program
BRANCH GROUP:
2. Jcond ADDR:
This is a 3-byte conditional jump instruction.
There are 8 conditions that can be checked. Accordingly, there are 8-variations for this
instruction depending upon the conditions to be tested. They are JNZ, JZ, JNC, JC,
JPO, JPE, JP, and JM.
BRANCH GROUP:
3. CALL ADDR:
This instruction is used for unconditional subroutine CALL.
The starting address of the subroutine is Y3Y2Y1Y0, available immediately in the
instruction itself as 2nd and 3rd bytes of the instruction.
The stack is made use of to store the return address before jumping to the subroutine.
The meaning of the instruction is
“Save the return address on the top of the stack and thereafter, load the (PC) with the
16-bit address immediately available in the instruction as 2nd and 3rd bytes”.
Instruction and assembly language Program
BRANCH GROUP:
3. CALL ADDR:
This instruction is used for unconditional subroutine CALL.
The starting address of the subroutine is Y3Y2Y1Y0, available immediately in the
instruction itself as 2nd and 3rd bytes of the instruction.
The stack is made use of to store the return address before jumping to the subroutine.
The meaning of the instruction is
“Save the return address on the top of the stack and thereafter, load the (PC) with the
16-bit address immediately available in the instruction as 2nd and 3rd bytes”.
Instruction and assembly language Program
BRANCH GROUP:
3. CALL ADDR:
M(SP – 1) PCH
M(SP – 2) PCL
SP SP – 2
PCL ADDR(L)
PCH ADDR(H)
Instruction and assembly language Program
BRANCH GROUP:
4. Ccond ADDR:
This is also 3-byte instruction.
2nd and 3rd bytes give the address of the subroutine. When this instruction is executed,
the 𝑝jump to the subroutine if the condition tested is TRUE.
If the condition is not TRUE then 𝑝goes to execute the next instruction.
The corresponding instructions are CNZ, CZ, CNC, CC, CPO, CPE, CP and CM.
Instruction and assembly language Program
BRANCH GROUP:
4. Ccond ADDR:
If condition is true
M(SP – 1) PCH
M(SP – 2) PCL
SP SP – 2
PCL ADDR(L)
PCH ADDR(H)
Instruction and assembly language Program
BRANCH GROUP:
5. RET (Unconditional Return):
The meaning of the instruction is “Return to the main program from the subroutine
unconditionally”.
Obviously RET instruction should be a part of the subroutine program.
PCL M(SP)
PCH M(SP + 1)
SP SP + 2
Instruction and assembly language Program
BRANCH GROUP:
6. Rcond:
Whenever this instruction is executed, 𝑝checks the conditional flags.
If the condition is found true then the 𝑝returns to the main program by loading the
(PC) with the return address stored at the top of the stack. If the condition is found not
true then the next instruction of the subroutine will be executed.
There are 8 variations in this statement depending upon CCC. They are RNZ, RZ,
If the condition is true
RNC, RC, RPO, RPE, RP and RM.
PCL M(SP)
PCH M(SP + 1)
SP SP + 2
Instruction and assembly language Program
BRANCH GROUP:
7. RST n:
This is a single byte unconditional subroutine call instruction. The address of the
subroutine is fixed depending upon the decimal number “n” in the instruction.
The decimal number “n” can change from 0 to 7.
M(SP – 1) PCH
M(SP – 2) PCL
SP SP – 2
PC 8xn
Instruction and assembly language Program
BRANCH GROUP:
8. PCHL:
The meaning of the instruction is “Move the content of register (H) to the higher byte
of program counter (PCH) and move the content of register (L) to lower byte of
program counter (PCL)”.
In this way the control is transferred to the memory location whose address is available
in (H, L) register pair.
PCH H
PCL L
Instruction and assembly language Program
STACK GROUP:
This group of instructions manipulates the stack.
Unless otherwise specified, condition flags are not affected by any instruction of this
group.
It is the user responsibility to define stack area and to initialize the stack pointer (SP)
with the bottom address before these instructions are used.
Instruction and assembly language Program
STACK GROUP :
1. PUSH rp :
The meaning of the instruction is “Push or save the contents of register pair (rpH, rpL)
on top of the stack”.
M(SP – 1) rpH
M(SP – 2) rpL
SP SP – 2
Instruction and assembly language Program
STACK GROUP :
2. PUSH PSW (Push Processor Status Word):
The meaning of the instruction is “Save or push the processor status word, comprising
of (A) and (F) register, on the top of the stack”.
The accumulator & flag register together form a 16- bit word known as the processor
status word (PSW), ACC occupies the higher order 8-bits and flag register occupies the
lower order 8-bits in PSW.
M(SP – 1) A
M(SP – 2) F
SP SP – 2
Instruction and assembly language Program
STACK GROUP :
3. POP rp:
The meaning of the instruction is “Pop or load the content form the top of the stack
into register pair (rp)”.
rpL M(SP)
rpH M(SP + 1)
SP SP + 2
Instruction and assembly language Program
STACK GROUP :
4. POP PSW (Push Processor Status Word):
The meaning of the instruction is “Save or push the processor status word, comprising
of (A) and (F) register, on the top of the stack”.
The accumulator & flag register together form a 16- bit word known as the processor
status word (PSW), ACC occupies the higher order 8-bits and flag register occupies the
lower order 8-bits in PSW.
F M(SP)
A M(SP + 1)
SP SP + 2
Instruction and assembly language Program
STACK GROUP :
5. XTHL:
The meaning of the instruction is “Exchange the contents from the top of the stack
with the contents of (H, L) register pair”.
L M(SP)
H M(SP + 1)
Instruction and assembly language Program
STACK GROUP :
6. SPHL:
The meaning of the instruction is “Move the contents of register pair (H, L) to 16-bit
register stack pointer (SP)”.
SPH H
SPL L
Instruction and assembly language Program
The 8085 microprocessor has 5 (seven) basic machine cycles. They are
MOV instruction:
MACHINE CYCLES OF 8085
Addressing Modes:
Most of the instruction execution requires two operands e.g. transfer of data between
two registers of a microprocessor system.
How the 𝑝knows the positions of these operands? The method of identifying the
operands position by the instruction format is known as the addressing mode.
Whenever two operands are involved in an instruction, the first operand is assumed to
be in any register of the 𝑝itself.
ADDRESSING MODES
Addressing Modes:
1. Register Addressing Mode
2. Direct Addressing Mode
3. Register Indirect Addressing Mode
4. Immediate Addressing Mode
5. Implied Addressing Mode
ADDRESSING MODES