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

Chemistry, application problems on electrochemical series

application problems on electrochemical series

Advantages of e-commerce, One of the resources we used was Ajeet Khurana's ...

One of the resources we used was Ajeet Khurana's article that talks about the advantages of e-commerce. It was helpful to gain some background on the variety of benefits the electr

Image matching using cross correlation, I am confuse how i start my coding ...

I am confuse how i start my coding in this topic please help me to start my coding.

Returns and procedures definitions in 8086, Q. Returns and Procedures defin...

Q. Returns and Procedures definitions in 8086? 8086 microprocessor supports RET and CALL instructions for procedure call. CALL instruction not only branches to indicate address

Order in which filters get implemented, If we have multiple filters implet...

If we have multiple filters impleted, what is the order in which these filters get implemented?   Ans) 1. Authorization filters 2. Response filters 3. Action filters

Write a ''c'' functions to arrange the elements of an integer , Write a 'C'...

Write a 'C' functions to arrange the elements of an integer array in such a way that all the negative elements are before the positive elements. The array is passed to it as an arg

What is delegation, What is delegation? Delegation gives a proper mecha...

What is delegation? Delegation gives a proper mechanism to achieve the desired code reuse. The method is caught in the desired class and forwarded to another class for actual i

Low on the data-input line, For the 8-bit bidirectional register in Figure ...

For the 8-bit bidirectional register in Figure 3, verify the status of the register after every clock pulse for the LEFT RIGHT /control waveform given. A HIGH on this input permits

Nix commands, reate a directory "Unix" under your home directory. Command(...

reate a directory "Unix" under your home directory. Command(s): ………………………………………….

Describe about analysis, Analysis describes about the logical and statistic...

Analysis describes about the logical and statistical analysis needed for an efficient output. This involves writing of code and performing calculations, but most part of these lang

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