Skip to content
The Computer Science
TheCScience
  • Engineering Subjects
    • Human Values
    • Computer System Architecture
    • Microprocessor
    • Digital Communication
    • Internet of Things
  • NCERT Solutions
    • Class 12
    • Class 11
  • Solutions
    • HackerRank
      • C Solutions
      • C++ Solutions
      • Java Solutions
      • Python Solutions
      • Algorithms Solutions
      • Data Structures Solutions
    • HackerEarth Solutions
    • Leetcode Solutions
  • JEE 2027
The Computer Science
TheCScience

Stack in 8085 Microprocessor

YASH PAL, March 23, 2026April 25, 2026

Stack in 8085 Microprocessor – The stack is a portion of R/W memory that is used for temporary storage during the execution of a program. For the application programs, the internal memory of the microprocessor (registers) is not sufficient to store the intermediate results. These intermediate results can be stored temporarily on the stack and can be used again when required. The data is put last will be taken first. This type of input/output manner is called Last In First Out (LIFO).

Table of Contents

  • Microprocessor Stack
    • Stack Related Instructions

Microprocessor Stack

The 8085 Microprocessor stack follows the LIFO concept. When the data is written on the stack, the operation is called PUSH. Similarly, when the data is read from the stack, the operation is called POP. The stack is generally initialized at the highest available memory location. The beginning of the stack is defined by loading the address into the stack pointer (SP). The stack pointer is a 16-bit register that indicates the top of the stack. Top of the stack means the data that is recently stored can be retrieved first. A new register pair, Program Status Word (PSW)) is also used with stack-related operations. The program status word is a 16-bit register pair. It is the combination of the accumulator and the flag register.

Program status word
Figure 1: Program status word

Stack Related Instructions

PUSH RpStore the contents of register pair on the stack.
OperationSP ← SP – 1
[SP] ← Rp (Higher)
SP ← SP -1
[SP] ← Rp (Lower)
Length1 Byte
Addressing modeIndirect addressing mode
FlagsFlags are not affected.
PUSH Rp stack instructions
PUSH PSWStore the contents of the program status word on the stack.
OperationSP ← SP – 1
[SP] ← A
SP ← SP -1
[SP] ← Flag register
Length1 Byte
Addressing modeIndirect addressing mode
FlagsFlags are not affected.
PUSH PSW stack operation

Execution of PUSH Rp/PSW – In the PUSH operation, 16-bit data from register pair Rp/PSW is stored on the stack. This is completed with two internal operations. In the first operation, the stack pointer is decremented by one, and the higher data byte (D8 – D15) of the 16-bit data is stored at the memory location pointed by the stack pointer. In the second operation, the stack pointer is again decremented by one, and the lower data byte (D0 – D7) of the 16-bit data is stored at the memory location pointed by the stack pointer. Figure 2 shows the steps involved in the PUSH operation.

Stack Push operation
Figure 2: Stack Push Operation

The instruction cycle of any instruction has two parts: the Read cycle and the execution cycle. The read cycle of the PUSH Rp instruction has only one machine cycle, i.e., opcode fetch. The execution cycle of this instruction requires two additional machine cycles to write the two bytes to memory. Hence, execution has two memory write machine cycles.

Instruction = Read cycle + Execution cycle
= (Opcode fetch) + (Memory Write + Memory Write)

Total T-states required
= 6T + (3T + 3T)
= 12T

The timing diagram of the instruction PUSH Rp is shown in Figure 3.

Timing diagram for instruction PUSH Rp PSW
Figure 3: Timing diagram for instruction PUSH Rp PSW

Note: The opcode fetch machine cycle of instruction PUSH Rp/PSW requires 6 T-states instead of 4 T-states.

POP RpLoad the register pair Rp with the 16-bit data from the stack.
OperationRp(Lower) ← [SP]
SP ← SP + 1
Rp(Higher) ← [SP]
SP ← SP + 1
Length1 Byte
Addressing modeIndirect addressing mode
FlagsFlags are not affected.
POP Rp Stack operation
POP PSWLoad the program status word with the 16-bit data from the stack.
OperationA ← [SP]
SP ← SP + 1
Flag register ← [SP]
SP ← SP + 1
Length1 Byte
Addressing modeIndirect addressing mode
FlagsFlags are not affected.
POP PSW Stack Operation

Execution of POP Rp/PSW – In the POP operation, 16-bit data is retrieved from the stack to the register pair Rp/PSW. This stack also includes two internal operations. In the first operation, the lower data byte (D0-D7) is retrieved from the stack memory location pointed by the stack pointer and loaded into the lower byte of the register pair. Then the stack pointer is incremented. In the second operation, a higher data byte (D8 – D15) is retrieved from the stack memory location pointed by the stack pointer and loaded to the higher byte of the register pair. Then the stack pointer is incremented as shown in Figure 4, which shows the steps involved in POP operations.

Stack POP operation
Figure 4: POP operation in Stack

Similar to other instructions, the POP Rp instruction also has two parts: the Read cycle and the Execution cycle. The read cycle of instruction POP Rp has only one machine cycle, i.e., opcode fetch. The execution cycles of this instruction require two additional cycles to read (retrieve) the two bytes from memory. Hence, the execution cycle has two memory read machine cycles.

Instruction = Read cycle + Execution cycle
= (Opcode fetch) + (Memory Read + Memory Read)
Total T-states required
= 4T + (3T + 3T)
= 10T

The timing diagram of the instruction POP Rp is shown in Figure 5.

Timing diagram of Instruction PUSH
Figure 5: Timing diagram of Instruction PUSH

Microprocessor Subject Tutorials & Notes | Beginners Guide
engineering subjects Microprocessor microprocessor

Post navigation

Previous post
Next post

Introduction to Microprocessor
Generations of Computer
Microprocessor Types
Types of Computer Systems
Types of Programming Languages
Basic Computer Structure
Interfacing Logic Devices
Number System in Computer
Number System Arithmetic – Addition & Subtraction

Microprocessor as CPU
8085 Microprocessor Architecture
Pin Configuration of 8085 Microprocessor
Demultiplexing of Address and Data Bus in 8085 Microprocessor
Basic Operations of the 8085 Microprocessor
Memory Organization in 8085 Microprocessor

Microprocessor memory structure
Memory Interfacing with 8085 Microprocessor
Memory address decoding in a microprocessor
Input/Output Interfacing in Microprocessor

8085 Microprocessor Programming Model
8085 Assembly Language Programming
8085 Microprocessor Instructions
Microprocessor Programming Steps
Flowchart Design of a Program
8085 Microprocessor Data Transfer Instructions
8085 Microprocessor Arithmetic Instructions
8085 Microprocessor Logical Instructions
8085 Microprocessor Branch Instructions
8085 Microprocessor Machine-Processor Control Instructions
Basic Structure of an Assembly Language Program
Programming Techniques for Repeated Tasks
Debugging of a Microprocessor Program

8085 Microprocessor Timing Operations
Timing Diagram of 8085 Microprocessor
Time Delay in Microprocessor
Stack in 8085 Microprocessor
Subroutine in 8085 Microprocessor
MACRO in Microprocessor

Interrupts in 8085 Microprocessor
Digital to Analog Converter (DAC) in Microprocessor
Analog to Digital Converter (ADC) in Microprocessor

Programmable Peripheral Interface
8255 (PPI) Programmable Peripheral Interface
Programmable Interval Timer (PIT) 8253/8254
Programmable Interrupt Controller (PIC) 8259
Direct Memory Access (DMA) Controller 8257

8086 Microprocessor Architecture, Instructions, and Pin Diagram
Addressing Modes of the 8086 Microprocessor
Instruction Set of 8086 Microprocessor
8088 Microprocessor Architecture with Pin Diagram
Difference between 8085, 8086, and 8088 Microprocessors
80186 Microprocessor Architecture
80286 Microprocessor Architecture & Features
80386 Microprocessor Architecture & Features
80486 Microprocessor Architecture & Features
80586 (Pentium) Microprocessor Architecture & Features

8051 Microcontroller Architecture
8051 Microcontroller Memory Organization
8051 Microcontroller Pin Configuration & Programming Model
8051 Microcontroller Timers and Counters
Serial Communication in 8051 Microcontroller
Interrupts of the 8051 Microcontroller
Addressing Modes of the 8051 Microcontroller
Intel MMX Architecture
Dual Core Processor

LED & Multiplexed Display Interfacing with Microprocessor
Liquid Crystal Display (LCD) Pin Configuration & Interfacing
Matrix Keyboard Interfacing with Microprocessor
8279 Keyboard/Display Controller
Programmable Communication Interface (USART) 8251
Serial Communication Standards in Microprocessor
Computer System Standard Buses

TheCScience

At TheCScience.com, our mission is to make quality education accessible to everyone. We provide in-depth, easy-to-understand articles covering Secondary, Senior Secondary, and Graduation-level subjects.

Pages

About US

Contact US

Privacy Policy

DMCA

Our Tools

Hosting - get 20% off

Engineering Subjects

Internet of Things

Human Values

Digital Communication

Computer System Architecture

Microprocessor

Programming Tutorials

Data Structure and Algorithm

C

Java

NCERT

Class 12th

©2026 TheCScience | WordPress Theme by SuperbThemes