stack in assembally language

Post on 12-Apr-2017

2 Views

Category:

Education

0 Downloads

Preview:

Click to see full reader

Transcript

Daffodil International University

WELCOME TO OUR PRESENTATION

REPRESENTED BY

“HIGH 5”

Name :Ms. Nasrin AkterDesignationLecturerDepartmentDepartment of Computer Science and EngineeringFacultyFaculty of Science and Information TechnologyE-mailnasrin.cse@diu.edu.bd

SUBMITTED TO

Arafat Rahman----152-15-5983Thofayel Ahmed Khan Shourov-----151-15-5192Nazmul Islam------152-15-5652Taijul Islam---------152-15-5613Mehedi Hassan----161-15-7667

TOPICS : STACK & INTRODUCTION TO PROCEDURES

The Stack

The stack segment of a program is used for temporary storage of data and addresses. The item are added and removed from one end of the structure, and the processed in a “last-in, first-out”.

Represent an example of a procedure that performs binary multiplication by bit shifting and adding.

The Stack

Stack instruction are PUSH,POP,PUSHF and POPF There is no effect of stack instructions on flag.

The stackThe preceding stack declaration, SP.

The stack pointer is initialized to 0100h.

It is empty stack.

When it is not empty, it contains the offset address of the top of the stack.

Stack Instruction

PUSH source.Source is 16 bit

register.PUSH AL.Sp decreased by 2.

CODE

.model small

.stack 100h

.data

main procmov ah,1int 21hpush ax

mov ah,1int 21h push ax

mov ah,1int 21hpush ax mov ah,1int 21hpush ax

mov ah,1int 21hpush ax

mov ah,1int 21hpush axmov ah,1int 21h push ax

mov ah,1int 21hpush ax

mov ah,1int 21hpush ax mov ah,1int 21hpush ax

pop bx

mov ah,2

mov dl,0dh

int 21h

mov dl,0ah

int 21h

mov dx,bx

int 21h

pop bx

mov ah,2

mov dx,bx

int 21h

pop bx

mov ah,2

mov dx,bx

int 21h

pop bx

mov ah,2

mov dx,bx

int 21h

pop bx

mov ah,2

mov dx,bx

int 21h

pop bx mov ah,2mov dx,bxint 21h

pop bx mov ah,2mov dx,bxint 21h

pop bx mov ah,2mov dx,bxint 21h

pop bx mov ah,2mov dx,bxint 21h

pop bx mov ah,2mov dx,bxint 21h

mov ah,4chint 21h

main endp

Push The operation to place a new item at the top of the stack

Pop The operation to remove the next item from the top of the stack

THANK YOU ALL

top related