SlideShare a Scribd company logo
1 of 14
SUBMITTED BY
S.Nandhin
N.S COLLEGE OF ARTS & SCIENC
STACK INTRODUCTION
 What is stack ?
 Stack with example
 Push and Pop
 Difference Push and Pop
 Stack register
STACK
 The stack is a temporary store data and address
 The CPU may PUSH important data on to the stack
 While it is processing other data
What is Stack?
 The stack is a LIFO->LAST IN FIRST OUT
TOP
BOTTOM
5
4
3
2
1
STACK Pointer
STACK
 These are important instructions that store and retrieve
data the LIFO stack memory
 They Two main functions:
PUSH
POP
PUSH: Add item to top
POP: Remove item from top
STACK EXAMPLE
STACK IS
EMPTY
7
PUSH 7 PUSH 8
7
8
STACK Example
EMPTY
STACK
7
POP 8 POP 7
STACK INSTRUCTION
NAME
MNEMONICS AND
FORMAT DESCRIPTION
Push onto the stack PUSH SRC (SP) (SP)-2
((SP)+1: (sp))
(SRC)
Pop from the stack POP DST (DST) ((SP)+1:
(SP))
(SP) (SP)+2
Push the flags PUSHF (SP) (SP)-2
((SP)+1 : (SP))
(PSW)
Pop the flags POPF (PSW) ((SP)+1 :
(SP))
(SP) (SP)+2
PUSH & POP Definition
 These are important instruction that store and retrieve data the
LIFO Stack memory
 There are SIX Frames of the PUSH and POP
 Instruction,register,memory,immediate,segment register ,flags and all
register
 PUSH: Push op code copies data from the source address to stack.
 POP: Pop op code copies data from the stack to the destination address.
PUSH and POP example
Difference between PUSH &
POP Key Difference push is when an Entry is“PUSHED “ on to the Stack
 Pop is when the last pushed Entry is “Popped off” the stack
 PUSH & POP FOR EXAMPLE:
 PUSH CX
 PUSH DX
 POP DX
 POP CX
STACK REGISTER
o In 8086 main stack register is called Stack pointer (SP)
o The Stack segment register (SS) is usually used to store
information about memory segment
o That stores the call stack of currently Executed
program SP points to current Stack Top.
Setting up a Stack by Loading the SS and
Sp register
STACK_SEG EGMENT
DW 30 DUP(?)
TOS LABEL WORD
STACK_SEG ENDS
CODE_SEG SEGMENT
ASSUME CS:CODE SEG, SS:STACK SEG
START : MOV AX,STACK_SEG
MOV SS,AX ;INITIALIZES SS
MOV SP,OFFSET TOS ;INITIALIZES SP
:
:
CODE_SEG ENDS
Stack

More Related Content

What's hot

Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
aviban
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly language
Mir Majid
 
Logic, shift and rotate instruction
Logic, shift and rotate instructionLogic, shift and rotate instruction
Logic, shift and rotate instruction
kashif Shafqat
 

What's hot (20)

8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 
Programmers model of 8086
Programmers model of 8086Programmers model of 8086
Programmers model of 8086
 
Register introduction
Register introductionRegister introduction
Register introduction
 
Register organization, stack
Register organization, stackRegister organization, stack
Register organization, stack
 
Interrupts on 8086 microprocessor by vijay kumar.k
Interrupts on 8086 microprocessor by vijay kumar.kInterrupts on 8086 microprocessor by vijay kumar.k
Interrupts on 8086 microprocessor by vijay kumar.k
 
Stack organization
Stack organizationStack organization
Stack organization
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
Byte and string manipulation 8086
Byte and string manipulation 8086Byte and string manipulation 8086
Byte and string manipulation 8086
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
8086 micro processor
8086 micro processor8086 micro processor
8086 micro processor
 
8086
80868086
8086
 
Stack Operations
Stack Operations Stack Operations
Stack Operations
 
Interleaved memory
Interleaved memoryInterleaved memory
Interleaved memory
 
system software 16 marks
system software 16 markssystem software 16 marks
system software 16 marks
 
Logical, Shift, and Rotate Instruction
Logical, Shift, and Rotate InstructionLogical, Shift, and Rotate Instruction
Logical, Shift, and Rotate Instruction
 
Microprocessor 8086
Microprocessor 8086Microprocessor 8086
Microprocessor 8086
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazard
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly language
 
Logic, shift and rotate instruction
Logic, shift and rotate instructionLogic, shift and rotate instruction
Logic, shift and rotate instruction
 
Instruction Formats
Instruction FormatsInstruction Formats
Instruction Formats
 

Similar to Stack

Microprocessor & assembly language
Microprocessor & assembly languageMicroprocessor & assembly language
Microprocessor & assembly language
James Absalem Lintu
 
Data structure lecture7
Data structure lecture7Data structure lecture7
Data structure lecture7
Kumar
 
Stack and subroutine
Stack and subroutineStack and subroutine
Stack and subroutine
Ashim Saha
 

Similar to Stack (20)

Microprocessor & assembly language
Microprocessor & assembly languageMicroprocessor & assembly language
Microprocessor & assembly language
 
Lecture_5_Stack.pptx
Lecture_5_Stack.pptxLecture_5_Stack.pptx
Lecture_5_Stack.pptx
 
Exploiting Memory Overflows
Exploiting Memory OverflowsExploiting Memory Overflows
Exploiting Memory Overflows
 
Stack & queue
Stack & queueStack & queue
Stack & queue
 
Stack
StackStack
Stack
 
Lecture5
Lecture5Lecture5
Lecture5
 
Lecture5(1)
Lecture5(1)Lecture5(1)
Lecture5(1)
 
lec15_x86procedure_4up.pdf
lec15_x86procedure_4up.pdflec15_x86procedure_4up.pdf
lec15_x86procedure_4up.pdf
 
Data structure lecture7
Data structure lecture7Data structure lecture7
Data structure lecture7
 
Stack in 8085 microprocessor
Stack in 8085 microprocessorStack in 8085 microprocessor
Stack in 8085 microprocessor
 
What is Stack? Application of Stack
What is Stack? Application of StackWhat is Stack? Application of Stack
What is Stack? Application of Stack
 
Stack and subroutine
Stack and subroutineStack and subroutine
Stack and subroutine
 
04 stacks
04 stacks04 stacks
04 stacks
 
Chapter 3 programming concepts-ii
Chapter 3  programming concepts-iiChapter 3  programming concepts-ii
Chapter 3 programming concepts-ii
 
Applicationofstack by Ali F.RAshid
Applicationofstack  by Ali F.RAshid Applicationofstack  by Ali F.RAshid
Applicationofstack by Ali F.RAshid
 
Application of Stack - Yadraj Meena
Application of Stack - Yadraj MeenaApplication of Stack - Yadraj Meena
Application of Stack - Yadraj Meena
 
STACK REALIZATION IN ARM
STACK REALIZATION IN ARMSTACK REALIZATION IN ARM
STACK REALIZATION IN ARM
 
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)
 
Stack
StackStack
Stack
 
Stack - Data Structure - Notes
Stack - Data Structure - NotesStack - Data Structure - Notes
Stack - Data Structure - Notes
 

More from lalithambiga kamaraj

More from lalithambiga kamaraj (20)

Firewall in Network Security
Firewall in Network SecurityFirewall in Network Security
Firewall in Network Security
 
Data Compression in Multimedia
Data Compression in MultimediaData Compression in Multimedia
Data Compression in Multimedia
 
Data CompressionMultimedia
Data CompressionMultimediaData CompressionMultimedia
Data CompressionMultimedia
 
Digital Audio in Multimedia
Digital Audio in MultimediaDigital Audio in Multimedia
Digital Audio in Multimedia
 
Network Security: Physical security
Network Security: Physical security Network Security: Physical security
Network Security: Physical security
 
Graphs in Data Structure
Graphs in Data StructureGraphs in Data Structure
Graphs in Data Structure
 
Package in Java
Package in JavaPackage in Java
Package in Java
 
Exception Handling in Java
Exception Handling in JavaException Handling in Java
Exception Handling in Java
 
Data structure
Data structureData structure
Data structure
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Estimating Software Maintenance Costs
Estimating Software Maintenance CostsEstimating Software Maintenance Costs
Estimating Software Maintenance Costs
 
Datamining
DataminingDatamining
Datamining
 
Digital Components
Digital ComponentsDigital Components
Digital Components
 
Deadlocks in operating system
Deadlocks in operating systemDeadlocks in operating system
Deadlocks in operating system
 
Io management disk scheduling algorithm
Io management disk scheduling algorithmIo management disk scheduling algorithm
Io management disk scheduling algorithm
 
Recovery system
Recovery systemRecovery system
Recovery system
 
File management
File managementFile management
File management
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
 
Inheritance
InheritanceInheritance
Inheritance
 

Recently uploaded

Baghajatin $ Russian Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Paymen...
Baghajatin $ Russian Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Paymen...Baghajatin $ Russian Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Paymen...
Baghajatin $ Russian Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Paymen...
HyderabadDolls
 
一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理
一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理
一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理
uodye
 
£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))
£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))
£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))
Obat Cytotec
 
怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证
怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证
怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证
tufbav
 
一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证
一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证
一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证
wpkuukw
 
Abortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Jeddah |+966572737505 | Get CytotecAbortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
一比一原版(Otago毕业证书)奥塔哥理工学院毕业证成绩单学位证靠谱定制
一比一原版(Otago毕业证书)奥塔哥理工学院毕业证成绩单学位证靠谱定制一比一原版(Otago毕业证书)奥塔哥理工学院毕业证成绩单学位证靠谱定制
一比一原版(Otago毕业证书)奥塔哥理工学院毕业证成绩单学位证靠谱定制
uodye
 
Buy Abortion pills in Riyadh |+966572737505 | Get Cytotec
Buy Abortion pills in Riyadh |+966572737505 | Get CytotecBuy Abortion pills in Riyadh |+966572737505 | Get Cytotec
Buy Abortion pills in Riyadh |+966572737505 | Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
gajnagarg
 
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
ehyxf
 

Recently uploaded (20)

Baghajatin $ Russian Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Paymen...
Baghajatin $ Russian Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Paymen...Baghajatin $ Russian Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Paymen...
Baghajatin $ Russian Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Paymen...
 
一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理
一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理
一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理
 
🌹Patia⬅️ Vip Call Girls Bhubaneswar 📱9777949614 Book Well Trand Call Girls In...
🌹Patia⬅️ Vip Call Girls Bhubaneswar 📱9777949614 Book Well Trand Call Girls In...🌹Patia⬅️ Vip Call Girls Bhubaneswar 📱9777949614 Book Well Trand Call Girls In...
🌹Patia⬅️ Vip Call Girls Bhubaneswar 📱9777949614 Book Well Trand Call Girls In...
 
£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))
£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))
£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))
 
怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证
怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证
怎样办理维多利亚大学毕业证(UVic毕业证书)成绩单留信认证
 
🌹Bhubaneswar🌹Odisha❤CALL GIRL 9777949614 ❤CALL GIRLS IN Bhubaneswar ESCORT SE...
🌹Bhubaneswar🌹Odisha❤CALL GIRL 9777949614 ❤CALL GIRLS IN Bhubaneswar ESCORT SE...🌹Bhubaneswar🌹Odisha❤CALL GIRL 9777949614 ❤CALL GIRLS IN Bhubaneswar ESCORT SE...
🌹Bhubaneswar🌹Odisha❤CALL GIRL 9777949614 ❤CALL GIRLS IN Bhubaneswar ESCORT SE...
 
Lucknow Call Girls U.P 👉👉 0000000000 Top Class Call Girl Service Available
Lucknow Call Girls U.P 👉👉 0000000000 Top Class Call Girl Service AvailableLucknow Call Girls U.P 👉👉 0000000000 Top Class Call Girl Service Available
Lucknow Call Girls U.P 👉👉 0000000000 Top Class Call Girl Service Available
 
Call Girls in Bhubaneswar Patia Escort Service(🔝))/WhatsApp 97779⇛49614
Call Girls in Bhubaneswar Patia Escort Service(🔝))/WhatsApp 97779⇛49614Call Girls in Bhubaneswar Patia Escort Service(🔝))/WhatsApp 97779⇛49614
Call Girls in Bhubaneswar Patia Escort Service(🔝))/WhatsApp 97779⇛49614
 
Best CPU for gaming Intel Core i9-14900K 14th Gen Desktop CPU
Best CPU for gaming  Intel Core i9-14900K 14th Gen Desktop CPUBest CPU for gaming  Intel Core i9-14900K 14th Gen Desktop CPU
Best CPU for gaming Intel Core i9-14900K 14th Gen Desktop CPU
 
一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证
一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证
一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证
 
Abortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Jeddah |+966572737505 | Get CytotecAbortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Jeddah |+966572737505 | Get Cytotec
 
一比一原版(Otago毕业证书)奥塔哥理工学院毕业证成绩单学位证靠谱定制
一比一原版(Otago毕业证书)奥塔哥理工学院毕业证成绩单学位证靠谱定制一比一原版(Otago毕业证书)奥塔哥理工学院毕业证成绩单学位证靠谱定制
一比一原版(Otago毕业证书)奥塔哥理工学院毕业证成绩单学位证靠谱定制
 
Genuine Call Girls in Buldhana { 9332606886 } VVIP NISHA Call Girls Near 5 St...
Genuine Call Girls in Buldhana { 9332606886 } VVIP NISHA Call Girls Near 5 St...Genuine Call Girls in Buldhana { 9332606886 } VVIP NISHA Call Girls Near 5 St...
Genuine Call Girls in Buldhana { 9332606886 } VVIP NISHA Call Girls Near 5 St...
 
Dell Inspiron 15 5567 BAL20 LA-D801P Rev 1.0 (A00) Schematics.pdf
Dell Inspiron 15 5567 BAL20 LA-D801P Rev 1.0 (A00) Schematics.pdfDell Inspiron 15 5567 BAL20 LA-D801P Rev 1.0 (A00) Schematics.pdf
Dell Inspiron 15 5567 BAL20 LA-D801P Rev 1.0 (A00) Schematics.pdf
 
Buy Abortion pills in Riyadh |+966572737505 | Get Cytotec
Buy Abortion pills in Riyadh |+966572737505 | Get CytotecBuy Abortion pills in Riyadh |+966572737505 | Get Cytotec
Buy Abortion pills in Riyadh |+966572737505 | Get Cytotec
 
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
 
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
 
Call Girls Amethi 9332606886 HOT & SEXY Models beautiful and charming call g...
Call Girls Amethi  9332606886 HOT & SEXY Models beautiful and charming call g...Call Girls Amethi  9332606886 HOT & SEXY Models beautiful and charming call g...
Call Girls Amethi 9332606886 HOT & SEXY Models beautiful and charming call g...
 
Call Girls in Bhubaneswar (Odisha) call me [🔝 9777949614 🔝] escort service 24X7
Call Girls in Bhubaneswar (Odisha) call me [🔝 9777949614 🔝] escort service 24X7Call Girls in Bhubaneswar (Odisha) call me [🔝 9777949614 🔝] escort service 24X7
Call Girls in Bhubaneswar (Odisha) call me [🔝 9777949614 🔝] escort service 24X7
 
Bhubaneswar🌹Vip Call Girls Odisha❤Heer 9777949614 💟 Full Trusted CALL GIRLS I...
Bhubaneswar🌹Vip Call Girls Odisha❤Heer 9777949614 💟 Full Trusted CALL GIRLS I...Bhubaneswar🌹Vip Call Girls Odisha❤Heer 9777949614 💟 Full Trusted CALL GIRLS I...
Bhubaneswar🌹Vip Call Girls Odisha❤Heer 9777949614 💟 Full Trusted CALL GIRLS I...
 

Stack

  • 2. STACK INTRODUCTION  What is stack ?  Stack with example  Push and Pop  Difference Push and Pop  Stack register
  • 3. STACK  The stack is a temporary store data and address  The CPU may PUSH important data on to the stack  While it is processing other data
  • 4. What is Stack?  The stack is a LIFO->LAST IN FIRST OUT TOP BOTTOM 5 4 3 2 1 STACK Pointer
  • 5. STACK  These are important instructions that store and retrieve data the LIFO stack memory  They Two main functions: PUSH POP PUSH: Add item to top POP: Remove item from top
  • 8. STACK INSTRUCTION NAME MNEMONICS AND FORMAT DESCRIPTION Push onto the stack PUSH SRC (SP) (SP)-2 ((SP)+1: (sp)) (SRC) Pop from the stack POP DST (DST) ((SP)+1: (SP)) (SP) (SP)+2 Push the flags PUSHF (SP) (SP)-2 ((SP)+1 : (SP)) (PSW) Pop the flags POPF (PSW) ((SP)+1 : (SP)) (SP) (SP)+2
  • 9. PUSH & POP Definition  These are important instruction that store and retrieve data the LIFO Stack memory  There are SIX Frames of the PUSH and POP  Instruction,register,memory,immediate,segment register ,flags and all register  PUSH: Push op code copies data from the source address to stack.  POP: Pop op code copies data from the stack to the destination address.
  • 10. PUSH and POP example
  • 11. Difference between PUSH & POP Key Difference push is when an Entry is“PUSHED “ on to the Stack  Pop is when the last pushed Entry is “Popped off” the stack  PUSH & POP FOR EXAMPLE:  PUSH CX  PUSH DX  POP DX  POP CX
  • 12. STACK REGISTER o In 8086 main stack register is called Stack pointer (SP) o The Stack segment register (SS) is usually used to store information about memory segment o That stores the call stack of currently Executed program SP points to current Stack Top.
  • 13. Setting up a Stack by Loading the SS and Sp register STACK_SEG EGMENT DW 30 DUP(?) TOS LABEL WORD STACK_SEG ENDS CODE_SEG SEGMENT ASSUME CS:CODE SEG, SS:STACK SEG START : MOV AX,STACK_SEG MOV SS,AX ;INITIALIZES SS MOV SP,OFFSET TOS ;INITIALIZES SP : : CODE_SEG ENDS