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

State about the three-dimensional digitizers, State about the Three-dimensi...

State about the Three-dimensional digitizers Three-dimensional digitizers use sonic or electromagnetic transmissions to record positions. One electromagnet transmission method

Explain chaining method, Chaining: In this method, instead of hashing func...

Chaining: In this method, instead of hashing function value as location we use it as an index into an array of pointers. Every pointer access a chain that holds the element having

Explain about api s of olap, Microsoft in the late 1997 introduced a standa...

Microsoft in the late 1997 introduced a standard API called as OLE DB. After which XML was used for analysis specification and this specification was largely used by a lot of vendo

Performance of computer system, Performance of computer system: Comput...

Performance of computer system: Computer performance is frequently described in terms of clock speed (usually in MHz or GHz). It refers to the cycles per second of the main cl

Logic-based expert systems - , Logic-based Expert Systems - Artificial inte...

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

Features of an expert system, The heart of an experts systems is the ...

The heart of an experts systems is the powerful corups of knowledge that accumulates during system building. The knowledge is explicit and organized to simplify decisio

Struct and class, https://dl.dropbox.com/u/41918180/Images/Pro%202/2.png ...

https://dl.dropbox.com/u/41918180/Images/Pro%202/2.png https://dl.dropbox.com/u/41918180/Images/Pro%202/3.png https://dl.dropbox.com/u/41918180/Images/Pro%202/4.png">https://dl.d

How is recursion handled internally, How is recursion handled internally? ...

How is recursion handled internally? Internally, every recursive call to a function requires storing the intermediate values of the parameters and local variables in a run time

Define pipeline speedup, Define pipeline speedup. S(m)=T(l)/T(m) Whe...

Define pipeline speedup. S(m)=T(l)/T(m) Where T(m) is the execution time for some target workload on an m-stage pipeline. T(l) is the execution time for some workload an

Project, give sample prepaired software?

give sample prepaired software?

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