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

Estimate the size of the state space, 1. The missionaries and cannibals pro...

1. The missionaries and cannibals problem. Three missionaries and three cannibals are on the left river bank, with a boat that can hold one or two people. If on either side of the

Give the difference between register and counter, Q. Give the difference be...

Q. Give the difference between Register and Counter. Q. Give the difference between Flip-flop and Latch. Q. Draw a set of waveforms for following signal on out-put line.

excitation diagram indicating , a.  Sketch the excitation diagram indicati...

a.  Sketch the excitation diagram indicating the last states and next states. b. Build the circuit using a Synchronous Counter with JK FF and NAND gates only. Replicate the circ

Write a program to input an address, Write a program to input an address i....

Write a program to input an address i.e. 20 Hex and read the byte (char) contents of that address   Answer   include void main() { char prompt; Date: 26th August 2012

Describe collective communications, Q. Collective Communications? A num...

Q. Collective Communications? A number of message-passing systems allow communication involving more than two processors. Such type of communication can be known as collective

CPE, WHAT IS CPE

WHAT IS CPE

Difference between visual basic, Visual basic is useful if you are planning...

Visual basic is useful if you are planning to make the programs from scratch. This language helps you in producing Active x controls, exe files, etc. Visual script is a powerful t

SWOT ANALYSIS, OPPORTUNITIES AND THREATS IN COMPUTER FEILD

OPPORTUNITIES AND THREATS IN COMPUTER FEILD

Illustrate the following list of consideration of Laptop, Illustrate the fo...

Illustrate the following list of consideration of laptop computers The following is a list for consideration: -  The processor must consume as little power as possible thus

Explain the term instruction cycle, Instruction Cycle The instruction c...

Instruction Cycle The instruction cycle consists of a series of steps required for the execution of an Instruction in a program. A distinctive instruction in a program is compo

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