SlideShare a Scribd company logo
Presentation Topic :
PUSH, PUSHF, POP, POPF
Presented By :
Contents :
 The Stack
 Push
 Pop
 PushF
 PopF
A stack in one-dimensional data structure. Items are added and
removed from one end of the structure; that is, it is processed
in a “Last-in, first out” manner. The most recent addition to the
stack is called the top of the stack.
A program must set aside a block of memory to hold the stack.
We have been dong this by declaring a stack segment ;
For example :
.STACK 100H
THE STACK
To add a new word to the stack we PUSH it on. The syntax is
PUSH source
Where source is a 16-bit register or memory word.
For example,
PUSH AX
Execution of PUSH causes the following to happen :
1. SP is decreased by 2.
2. A copy of the source content is moved to the address specified
by SS:SP. The source is unchanged.
PUSH AND PUSHF
The instruction PUSHF, which has no operands, pushes
the contents of the FLAGS register onto the stack.
Initially SP contains the offset address of the memory
location immediately following the stack segment; the
first PUSH decreases SP by 2, making it point to the last
word in the stack segment. Because each PUSH
decreases SP, the stack grows toward the beginning of
memory
PUSH AND PUSHF
FIGURE : EMPTY STACK
offset
00F0
00F2
00FA
00F4
00F6
00F8
00FC
00FE
0100
1234
SP
5678
0100
AX
BX
STACK(empty)
SP
FIGURE : AFTER PUSH AX
offset
00F0
00F2
00FA
00F4
00F6
00F8
00FC
00FE
0100
1234
1234
SP
5678
00FE
AX
BX
STACK
SP
FIGURE : AFTER PUSH BX
offset
00F0
00F2
00FA
00F4
00F6
00F8
00FC
00FE
0100
5678
1234
1234
SP
5678
00FC
AX
BX
STACK
SP
To remove the top item from the stack we POP it. The Syntax is
POP destination
Where destination is a 16-bit register (except IP) or memory word. For example,
POP BX
Executing POP causes this to happen:
1. The content of SS:SP (the top the stack) is moved to the destination
2. SP is increased by 2.
POP AND POPF
The instruction POPF pops the top of the stack into the FLAGS
Register. There is no effect of PUSH, PUSHF, POP, POPF on the flags.
Such as
Illegal : PUSH DL
Is illegal. So is a push of immediate data, such as
Illegal : PUSH 2
FIGURE : BEFORE POP
offset
00F0
00F2
00FA
00F4
00F6
00F8
00FC
00FE
0100
5678
1234
FFFF
SP
0001
00FC
CX
DX
STACk
SP
FIGURE : AFTER POP CX
offset
00F0
00F2
00FA
00F4
00F6
00F8
00FC
00FE
0100
5678
1234
5678
SP
0001
00FE
CX
BX
STACK
SP
FIGURE : AFTER POP DX
offset
00F0
00F2
00FA
00F4
00F6
00F8
00FC
00FE
0100
5678
1234
5678
SP
1234
0100
CX
DX
STACK(empty)
SP
THANK YOU
END

More Related Content

Viewers also liked

Cpu speed, wordlength.8
Cpu speed, wordlength.8Cpu speed, wordlength.8
Cpu speed, wordlength.8
myrajendra
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051
Jay Patel
 
Microprocessor
MicroprocessorMicroprocessor
Microprocessor
Tarun Nayak
 
Lect 5
Lect 5Lect 5
itft-Clock generator
itft-Clock generatoritft-Clock generator
itft-Clock generator
Shifali Sharma
 
Central processor amd memory
Central processor amd memoryCentral processor amd memory
Central processor amd memory
Oscar Becwarika
 
clock synchronization in Distributed System
clock synchronization in Distributed System clock synchronization in Distributed System
clock synchronization in Distributed System
Harshita Ved
 
Computer Fundamentals
Computer FundamentalsComputer Fundamentals
Computer Fundamentals
archikabhatia
 
8085 microprocessor architecture ppt
8085 microprocessor architecture ppt8085 microprocessor architecture ppt
8085 microprocessor architecture ppt
Parvesh Gautam
 
Computer Concepts PPT
Computer Concepts PPTComputer Concepts PPT
Computer Concepts PPT
okmomwalking
 

Viewers also liked (10)

Cpu speed, wordlength.8
Cpu speed, wordlength.8Cpu speed, wordlength.8
Cpu speed, wordlength.8
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051
 
Microprocessor
MicroprocessorMicroprocessor
Microprocessor
 
Lect 5
Lect 5Lect 5
Lect 5
 
itft-Clock generator
itft-Clock generatoritft-Clock generator
itft-Clock generator
 
Central processor amd memory
Central processor amd memoryCentral processor amd memory
Central processor amd memory
 
clock synchronization in Distributed System
clock synchronization in Distributed System clock synchronization in Distributed System
clock synchronization in Distributed System
 
Computer Fundamentals
Computer FundamentalsComputer Fundamentals
Computer Fundamentals
 
8085 microprocessor architecture ppt
8085 microprocessor architecture ppt8085 microprocessor architecture ppt
8085 microprocessor architecture ppt
 
Computer Concepts PPT
Computer Concepts PPTComputer Concepts PPT
Computer Concepts PPT
 

Similar to Microprocessor & assembly language

Stack
StackStack
Lecture 05 NOP and Stack Group of Instructions
Lecture 05 NOP and Stack Group of InstructionsLecture 05 NOP and Stack Group of Instructions
Lecture 05 NOP and Stack Group of Instructions
Zeeshan Ahmed
 
Stack and its usage in assembly language
Stack and its usage in assembly language Stack and its usage in assembly language
Stack and its usage in assembly language
Usman Bin Saad
 
What is Stack? Application of Stack
What is Stack? Application of StackWhat is Stack? Application of Stack
What is Stack? Application of Stack
Shahzeb Amjad
 
Stack in 8085 microprocessor
Stack in 8085 microprocessorStack in 8085 microprocessor
Stack in 8085 microprocessor
hepzijustin
 
Stack & queue
Stack & queueStack & queue
Stack & queue
Siddique Ibrahim
 
B sc e 5.2 mp unit 2 soft ware(alp)
B sc e 5.2 mp unit 2 soft ware(alp)B sc e 5.2 mp unit 2 soft ware(alp)
B sc e 5.2 mp unit 2 soft ware(alp)
MahiboobAliMulla
 

Similar to Microprocessor & assembly language (7)

Stack
StackStack
Stack
 
Lecture 05 NOP and Stack Group of Instructions
Lecture 05 NOP and Stack Group of InstructionsLecture 05 NOP and Stack Group of Instructions
Lecture 05 NOP and Stack Group of Instructions
 
Stack and its usage in assembly language
Stack and its usage in assembly language Stack and its usage in assembly language
Stack and its usage in assembly language
 
What is Stack? Application of Stack
What is Stack? Application of StackWhat is Stack? Application of Stack
What is Stack? Application of Stack
 
Stack in 8085 microprocessor
Stack in 8085 microprocessorStack in 8085 microprocessor
Stack in 8085 microprocessor
 
Stack & queue
Stack & queueStack & queue
Stack & queue
 
B sc e 5.2 mp unit 2 soft ware(alp)
B sc e 5.2 mp unit 2 soft ware(alp)B sc e 5.2 mp unit 2 soft ware(alp)
B sc e 5.2 mp unit 2 soft ware(alp)
 

Recently uploaded

Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 

Recently uploaded (20)

Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 

Microprocessor & assembly language

  • 1.
  • 2. Presentation Topic : PUSH, PUSHF, POP, POPF Presented By :
  • 3. Contents :  The Stack  Push  Pop  PushF  PopF
  • 4. A stack in one-dimensional data structure. Items are added and removed from one end of the structure; that is, it is processed in a “Last-in, first out” manner. The most recent addition to the stack is called the top of the stack. A program must set aside a block of memory to hold the stack. We have been dong this by declaring a stack segment ; For example : .STACK 100H THE STACK
  • 5. To add a new word to the stack we PUSH it on. The syntax is PUSH source Where source is a 16-bit register or memory word. For example, PUSH AX Execution of PUSH causes the following to happen : 1. SP is decreased by 2. 2. A copy of the source content is moved to the address specified by SS:SP. The source is unchanged. PUSH AND PUSHF
  • 6. The instruction PUSHF, which has no operands, pushes the contents of the FLAGS register onto the stack. Initially SP contains the offset address of the memory location immediately following the stack segment; the first PUSH decreases SP by 2, making it point to the last word in the stack segment. Because each PUSH decreases SP, the stack grows toward the beginning of memory PUSH AND PUSHF
  • 7. FIGURE : EMPTY STACK offset 00F0 00F2 00FA 00F4 00F6 00F8 00FC 00FE 0100 1234 SP 5678 0100 AX BX STACK(empty) SP
  • 8. FIGURE : AFTER PUSH AX offset 00F0 00F2 00FA 00F4 00F6 00F8 00FC 00FE 0100 1234 1234 SP 5678 00FE AX BX STACK SP
  • 9. FIGURE : AFTER PUSH BX offset 00F0 00F2 00FA 00F4 00F6 00F8 00FC 00FE 0100 5678 1234 1234 SP 5678 00FC AX BX STACK SP
  • 10. To remove the top item from the stack we POP it. The Syntax is POP destination Where destination is a 16-bit register (except IP) or memory word. For example, POP BX Executing POP causes this to happen: 1. The content of SS:SP (the top the stack) is moved to the destination 2. SP is increased by 2. POP AND POPF
  • 11. The instruction POPF pops the top of the stack into the FLAGS Register. There is no effect of PUSH, PUSHF, POP, POPF on the flags. Such as Illegal : PUSH DL Is illegal. So is a push of immediate data, such as Illegal : PUSH 2
  • 12. FIGURE : BEFORE POP offset 00F0 00F2 00FA 00F4 00F6 00F8 00FC 00FE 0100 5678 1234 FFFF SP 0001 00FC CX DX STACk SP
  • 13. FIGURE : AFTER POP CX offset 00F0 00F2 00FA 00F4 00F6 00F8 00FC 00FE 0100 5678 1234 5678 SP 0001 00FE CX BX STACK SP
  • 14. FIGURE : AFTER POP DX offset 00F0 00F2 00FA 00F4 00F6 00F8 00FC 00FE 0100 5678 1234 5678 SP 1234 0100 CX DX STACK(empty) SP