Computer Architecture Lecture 13 – part 1 by Engineer A. Lecturer Aymen Hasan AlAwady 31/3/2014 University of Kufa - Information Technology Research and.

Slides:



Advertisements
Similar presentations
Week 8 Stack and Subroutines. Stack  The stack is a section of data memory (or RAM) that is reserved for storage of temporary data  The data may represent.
Advertisements

1 Procedural Programming Paradigm Stacks and Procedures.
Eng. Mohammed Timraz Electronics & Communication Engineer University of Palestine Faculty of Engineering and Urban planning Software Engineering Department.
CPU Review and Programming Models CT101 – Computing Systems.
Run-time Environment for a Program different logical parts of a program during execution stack – automatically allocated variables (local variables, subdivided.
8085 Architecture & Its Assembly language programming
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /17/2013 Lecture 12: Procedures Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE CENTRAL.
Lecture 6 Machine Code: How the CPU is programmed.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 1: Bits, bytes and a simple processor dr.ir. A.C. Verschueren.
Multiple data transfer instructions ARM also supports multiple loads and stores: ldm/ldmia/ldmfd: load multiple registers starting from [base register],
S. Barua – CPSC 240 CHAPTER 10 THE STACK Stack - A LIFO (last-in first-out) storage structure. The.
Accessing parameters from the stack and calling functions.
EECC250 - Shaaban #1 Lec # 5 Winter Stacks A stack is a First In Last Out (FILO) buffer containing a number of data items usually implemented.
Intro to Computer Architecture
TK 2633 Microprocessor & Interfacing
EECC250 - Shaaban #1 lec #7 Winter Local workspace of a subroutine: A number of temporary memory locations required by the subroutine for temporary.
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, Stack Operations Runtime Stack PUSH Operation POP.
Stacks and Subroutines ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
© 2010 Kettering University, All rights reserved..
DAT2343 Accessing Services Through Interrupts © Alan T. Pinck / Algonquin College; 2003.
Computer Architecture Lecture 13 – part 2 by Engineer A. Lecturer Aymen Hasan AlAwady 7/4/2014 University of Kufa - Information Technology Research and.
13/02/2009CA&O Lecture 04 by Engr. Umbreen Sabir Computer Architecture & Organization Instructions: Language of Computer Engr. Umbreen Sabir Computer Engineering.
Passing Parameters using Stack Calling program pushes parameters on the stack one element at a time before calling subroutine. Subroutine Call (jsr, bsr)
Computer Architecture Lecture 12 by Engineer A. Lecturer Aymen Hasan AlAwady 17/3/2014 University of Kufa - Information Technology Research and Development.
Subroutines, parameters and the stack Bryan Duggan.
Today’s Lecture Unconditional branch instruction
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson Slides4-2.ppt Modification date: March 23, Procedures Essential ingredient of high level.
Computer Architecture Lecture 11 by Engineer A. Lecturer Aymen Hasan AlAwady 10/3/2014 University of Kufa - Information Technology Research and Development.
ECE 265 – LECTURE 5 The M68HC11 Basic Instruction Set 12/8/ ECE265.
The x86 Instruction Set Lecture 16 Mon, Mar 14, 2005.
Computer Architecture Lecture 5 by Engineer A. Lecturer Aymen Hasan AlAwady 25/11/2013 University of Kufa - Informatics Center for Research and Rehabilitation.
University of Tehran 1 Microprocessor System Design Omid Fatemi Machine Language Programming
Computer Architecture Lecture 4 by Engineer A. Lecturer Aymen Hasan AlAwady 17/11/2013 University of Kufa - Informatics Center for Research and Rehabilitation.
Computer Architecture Lecture 14 by Engineer A. Lecturer Aymen Hasan AlAwady 14/4/2014 University of Kufa - Information Technology Research and Development.
Architectural Considerations A Review of Some Architectural Concepts.
CPU performs the bulk of data processing operations CPU performs the bulk of data processing operations The CPU is made up of three parts. They are Control.
MIPS Subroutines Subroutine Call – jal subname Saves RA in $31 and jumps to subroutine entry label subname Subroutine Return – jr $31 Loads PC with return.
Subroutines and Stacks. Stack The stack is a special area in memory used by the CPU to store register information or general data information during program.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
Function Calling. Mips Assembly Call and Return Steps for procedure calling –Save the return address –Jump to the procedure (function) –Execute the procedure.
CSC 221 Computer Organization and Assembly Language Lecture 15: STACK Related Instructions.
1 Stack Advanced Programming. 2 The Stack It is a special area of memory used as temporary storage A stack is a LIFO data structure Putting data into.
ICS51 Introductory Computer Organization Accessing parameters from the stack and calling functions.
Index What is an Interface Pins of 8085 used in Interfacing Memory – Microprocessor Interface I/O – Microprocessor Interface Basic RAM Cells Stack Memory.
Computer Architecture & Operations I
Storage Classes There are three places in memory where data may be placed: In Data section declared with .data in assembly language in C - Static) On the.
PROGRAMMING OF 8085 PROCESSOR
ECE 3430 – Intro to Microcomputer Systems
The Stack.
Subroutines and the Stack
Microprocessor and Assembly Language
Overview Introduction General Register Organization Stack Organization
In this lecture Global variables Local variables System stack
Stack and Subroutines Module M17.1 Section 11.2.
Programming 8086 – Part IV Stacks, Macros
Subroutines and the Stack
The University of Adelaide, School of Computer Science
Chapter 6 - Procedures and Macros
Morgan Kaufmann Publishers Computer Organization and Assembly Language
EE6502/MPMC/UNIT II/STACK AND SUBROUTINE/T.THARANKUMAR
Lecture 06 Programming language.
Program and memory layout
8051 ASSEMBLY LANGUAGE PROGRAMMING
Program and memory layout
Subroutines and the Stack
Some Assembly (Part 2) set.html.
Program and memory layout
Program and memory layout
Computer Organization and Assembly Language
(The Stack and Procedures)
Presentation transcript:

Computer Architecture Lecture 13 – part 1 by Engineer A. Lecturer Aymen Hasan AlAwady 31/3/2014 University of Kufa - Information Technology Research and Development Center 1 1

1. Stack and Subroutines The stack is an area of memory identified by the programmer for temporary storage of information. The stack is a LIFO (Last In First Out) structure. The programmer defines the bottom of the stack and the stack grows up into reducing address range. So, the stack normally grows backwards into memory. 2

1.2 The Stack Given that the stack grows backwards into memory, it is customary to place the bottom of the stack at the end of memory to keep it as far away from user programs as possible. In the 8085, the stack is defined by setting the SP (Stack Pointer) register. LXI SP, FFFFH This sets the Stack Pointer to location FFFFH (end of memory for the 8085). 3

1.3 Saving Information on the Stack Information is saved on the stack by PUSHing it on. Information is retrieved from the stack by POPing it off. The 8085 provides two instructions: PUSH and POP for storing information on the stack and retrieving it back. Both PUSH and POP work with register pairs ONLY. 4

1.3.1 The PUSH Instruction LXI SP, FFFFH ; To indicate the starting of the stack. PUSH B 1.Decrement SP. 2.Copy the contents of register B to the memory location pointed to by SP. 3.Decrement SP. 4.Copy the contents of register C to the memory location pointed to by SP. 5 12F3 FFFB FFFC FFFDF3 FFFE12 FFFF SP B C

1.3.2 The POP Instruction POP D 1.Copy the contents of the memory location pointed to by the SP to register E. 2.Increment SP. 3.Copy the contents of the memory location pointed to by the SP to register D. 4.Increment SP. 6 12F3 FFFB FFFC FFFDF3 FFFE12 FFFF SP D E

1.4 Operation of the Stack 1. During pushing, the stack operates in a “decrement then store” style. The stack pointer is decremented first, then the information is placed on the stack. 2. During poping, the stack operates in a “use then increment” style. The information is retrieved from the top of the stack and then the pointer is incremented. The SP pointer always points to “the top of the stack”. 7

1.5 LIFO (Last In First Out) order The order of PUSHs and POPs must be opposite of each other in order to retrieve information back into its original location. PUSH B PUSH D... POP D POP B 8

9 End of lecture 13 Part 1