Stack, Computer Engineering

Assignment Help:

The Stack

A procedure call is supported by a stack. So let's discuss stack in assembly. Stacks are 'Last In First Out' data structures and are used for storing return addresses of procedures and for parameter passing and saving the return value.

In 8086 microprocessor a stack is made in the stack segment. SS register stores the offset of stack segment whereas SP register stores the top of stack. A value is pushed in top of the stack or taken out (poped) from top of the stack. The stack segment may be initialized as below:   

STACK_ SEG SEGMENT STACK

            DW 100   DUP (0)

            TOS LABEL   WORD

STACK_SEG ENDS

 

CODE SEGMENT

ASSUME CS: CODE, SS: STACK_SEG

MOV   AX, STACK_SEG

MOV   SS, AX      ; initialise stack segment

LEA   SP, TOP      ; initialise stack pointer

CODE ENDS

END

The directive STACK_SEG SEGMENT STACK declares logical segment for stack segment. DW 100 DUP (0) assigns actual size of stack to 100 words. All locations of this stack are initialized to zero. Stacks are recognized by the stack top and so the Label Top of Stack (TOS) has been selected. Please consider that stack in 8086 is a WORD stack. Stack facilities include the use of indirect addressing by a special register, the stack pointer (SP). SP is decremented by itself as items are put on the stack and incremented as they are retrieved. Putting something on to stack is known as a PUSH and taking it off is known as a POP. The address of last element pushed on to stack is termed as the top of stack (TOS).

874_Stack.png


Related Discussions:- Stack

Define electronic data interchange, Define Electronic Data Interchange. ...

Define Electronic Data Interchange. An EDI stand for Electronic Data Interchange is used by organizations for transactions which occur on regular basis to a pre-determined for

Communication of request/response - procedural interaction, Explain the Com...

Explain the Communications of Request/Response Communications requirements for message or procedural- based interaction are very similar. Application interaction (client-server

Where signalling transfer point exist, Signalling transfer point (STP) exis...

Signalling transfer point (STP) exist in (A) Strowger exchange                  (B)  SS7 (C)  Local area network                 (D)  PABX Ans: STP that is stand f

Input output techniques - computer architecture, Input Output Techniques: ...

Input Output Techniques: o   Interrupt driven o   Direct Memory Access (DMA) o   Programmed Programmed I/O   CPU has control over I/O directly   Read/write

Illustrate the purchase consummation activity, Illustrate the Purchase Cons...

Illustrate the Purchase Consummation activity? Purchase Consummation: This model lists three activities in the purchase consummation phase: • Receipt of product. • Pl

What is XML DTD (Document Type Definition), What is XML DTD (Document Type ...

What is XML DTD (Document Type Definition)? DTD is a document which defines legal building blocks of a particular XML document. This defines the document structure along with

Digital electronics, what is Asynchronous Finite State Machines?

what is Asynchronous Finite State Machines?

Significance of xml in edi and electronic commerce, What is the significanc...

What is the significance of XML in EDI and electronic commerce?   XML has been defined as lightweight SGML XML shows great promise for its inherent ability to permit a " doc

Explain about indirect addressing, Q. Explain about Indirect Addressing? ...

Q. Explain about Indirect Addressing? In this technique the operand field of instruction specifies the address of address of intended operand for example if instruction LOAD

Logic-based expert systems - artificial intelligence, Logic-based Expert Sy...

Logic-based Expert Systems - Artificial intelligence: Expert systems are agents which are programmed to make decisions about real world situations. They are put together by uti

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd