Skip to content
The Computer Science
TheCScience
  • Engineering Subjects
    • Human Values
    • Computer System Architecture
    • Digital Communication
    • Internet of Things
  • NCERT Solutions
    • Class 12
    • Class 11
  • HackerRank solutions
    • HackerRank Algorithms Problems Solutions
    • HackerRank C solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
The Computer Science
TheCScience

Stack in 8085 Microprocessor

YASH PAL, March 23, 2026March 23, 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).

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
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. The figure below shows the steps involved in the PUSH operation.

Stack Push operation
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 the figure below.

Timing diagram for instruction PUSH Rp PSW
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 the figure below, which shows the steps involved in POP operations.

Stack POP operation
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 the figure below.

Timing diagram of Instruction PUSH
Timing diagram of Instruction PUSH
engineering subjects Microprocessor microprocessor

Post navigation

Previous post

TheCScience

We at TheCScience.com are working towards the goal to give free education to every person by publishing in dept article about 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

Programming Tutorials

Data Structure and Algorithm

C

Java

NCERT

Class 12th

©2026 TheCScience | WordPress Theme by SuperbThemes