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

Which important terminal required between dte and pstn, An important termin...

An important terminal that is required between DTE and PSTN is (A)  Server                                      (B) MODEM (C)  Relay

Assignment for statical natural language processing, Hi I study master of ...

Hi I study master of computer science I have assignment for subject statical natural language processing . I need solved due date on 6 May2014 at 11 pm Australia time I need yo

What is parallel computing, Parallel computing has been a topic of interes...

Parallel computing has been a topic of interest in computing society over the previous few decades. Ever-growing amount of databases and increasing complexity of new problems are

Operating system., what is the minimum number of page faults for an optimal...

what is the minimum number of page faults for an optimal page replacement strategy?

Anti reflection coating, expression for thickness and refractive index of c...

expression for thickness and refractive index of coating material to act as anti reflection coating

What are sections, Layout pages, can describe sections, which can then be o...

Layout pages, can describe sections, which can then be overridden by particular views making use of the layout. Major and overriding sections is optional.

Basics of caches - computer architecture, Basics of Caches: "The cache...

Basics of Caches: "The caches are situated on basis of blocks, the shortest amount of data which may be copied between 2 adjacent levels at a time. "If requested data by th

Explain about data registers, Q. Explain about data registers? The data...

Q. Explain about data registers? The data registers are used just for storing intermediate results or data and not for operand address calculation. Some dedicated address re

Logical database reads the data from the database, Is it true that the Logi...

Is it true that the Logical Database reads the data from the database tables using Select Statements. Yes. We are coding that in Database part of LDB.

Subprogram, create a stored procedure to debit a bank account user must ent...

create a stored procedure to debit a bank account user must enter account no. and amount to debited from account .the minimum balance in account should be 500. if the debited amoun

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