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

Explain the memory transfer process, Q. Explain the Memory Transfer process...

Q. Explain the Memory Transfer process? Memory Transfer Transfer of information from memory to outside world which implies I/O Interface is known as a read operation. Tra

Define dma controller, Define DMA controller. The I/O device interface ...

Define DMA controller. The I/O device interface control circuit that is used for direct memory access is called as DMA controller.

First-order models -artificial intelligence, First-Order Models - Artificia...

First-Order Models - Artificial intelligence: We proposed first-order logic like good knowledge representation language rather than propositional logic because it is more expre

What is the need of interrupt controller, What is the need of interrupt con...

What is the need of interrupt controller?  The interrupt controller is employed to expand the interrupt inputs. It can handle the interrupt requests from several devices and pe

Invoke on the dataadapter control, Which method do you invoke on the DataAd...

Which method do you invoke on the DataAdapter control to load  your generated dataset with data? DataAdapter.Fill(ds). The beauty of this method is it automatically implicitly

Code Solution, Dear sir, I want to read Excel file and display it in grid v...

Dear sir, I want to read Excel file and display it in grid view(the headings in excel file should be grid view column heading).This should be coded in C# Windows forms Application

How can i pass parameters to my simulation, How can I pass parameters to my...

How can I pass parameters to my simulation? A  test  bench  and  simulation  would likely  need  many  different  parameters  and  settings  for  various sorts of tests and con

Define html, HTML is a Hyper text Markup Language and it is  Scripting La...

HTML is a Hyper text Markup Language and it is  Scripting Language

What is state and state diagram, What is state and state diagram? A sta...

What is state and state diagram? A state is an abstraction of values and links of an object. Set of values and links are grouped together into a state according to the group be

How to clear computer motherboard cmos password, As CMOS is a special chip ...

As CMOS is a special chip with its own battery, the best way to clear out a CMOS chip is to cut off it from its power supply. To clear the CMOS password you just take away the

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