The MOVE Multiple: MOVEM Instruction

Slides:



Advertisements
Similar presentations
Calling sequence ESP.
Advertisements

Subroutines – parameter passing passing data to/from a subroutine can be done through the parameters and through the return value of a function subroutine.
680XX Program Examples Outline –Binary to BCD –Matrix Addition –Ones Count –String Compare –Sector Map –Raster Graphics –Subroutine Calls Goal –Understand.
Run-time Environment for a Program different logical parts of a program during execution stack – automatically allocated variables (local variables, subdivided.
Computer Science 210 Computer Organization Recursive Subroutines System Stack Management.
9/20/6Lecture 3 - Instruction Set - Al Instruction Set.
EECC250 - Shaaban #1 Lec # 6 Winter Stack-Related Instructions PEA Push Effective Address Calculates an effective address and pushes it.
5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Assembly.
Multiple data transfer instructions ARM also supports multiple loads and stores: ldm/ldmia/ldmfd: load multiple registers starting from [base register],
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.
CSCE 212 Quiz 2 – 2/2/11 1.What is the purpose of the jal instruction? 2.What are the two conditional branching (if, goto; not the slt instruction) instructions.
Subroutines and Stacks Lecture L3.1. Subroutine and Stacks The System Stack Subroutines A Data Stack.
Chapters 9 & 10 Midterm next Wednesday (11/19) Trap Routines & RET Subroutines (or Functions) & JSR & JSRR & RET The Stack SSP & USP Interrupts RTI.
28/06/2015CMPUT Functions (2)  Function calling convention  Various conventions available  One is specified by CMPUT229  Recursive functions.
EECC250 - Shaaban #1 lec #7 Winter Local workspace of a subroutine: A number of temporary memory locations required by the subroutine for temporary.
Chapter 9 Trap Routines TRAP number (go to service routine) & RET (return from service routine) Subroutines (or Functions) JSR offset or JSRR rn (go to.
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Subroutine and Stacks Chapter 2.
Stacks and Subroutines ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 7 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Subroutines and Stacks 1. Subroutines Separate, independent module of program, performs a specific task shortens code, provide reusable “tools” High-level.
The Stack Pointer and the Frame Pointer (Lecture #19) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying.
Procedure Calls and the Stack (Lectures #18) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer.
Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Chapter 7 – Subroutines These are lecture notes to accompany the book SPARC Architecture,
The Stack This is a special data structure: –The first item to be placed into the stack will be the last item taken out. Two basic operations: –Push: Places.
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 13 – part 1 by Engineer A. Lecturer Aymen Hasan AlAwady 31/3/2014 University of Kufa - Information Technology Research and.
MAL 3 - Procedures Lecture 13. MAL procedure call The use of procedures facilitates modular programming. Four steps to transfer to and return from a procedure:
MicroComputer Engineering IntroLab1 page 1 Introduction Lab1  A crash course in assembler programming  Learn how a processor works!  Decode a coded.
by Richard P. Paul, 2nd edition, 2000.
1 Stacks, Subroutines, I/O Routines Today: First Hour: Stacks, Subroutines –Section 3.9,3.10 of Huang’s Textbook –In-class Activity #1 Second Hour: I/O.
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.
Pushing the Return Address To return to the caller a subroutine must have the correct return address in $ra when the jr instruction is performed. But this.
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.
Function Calling. Mips Assembly Call and Return Steps for procedure calling –Save the return address –Jump to the procedure (function) –Execute the procedure.
1 Subroutines Advanced Programming. 2 Top-Down approach to problem solving Algorithm step by step description of how to solve a problem Divide and Conquer.
Multiple data transfer instructions ARM also supports multiple loads and stores: When the data to be copied to the stack is known to be a multiple of 4.
Computer Architecture & Operations I
Function Calls in MIPS To call a function: jal func
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.
Computer Science 210 Computer Organization
Figure 8.1 of course package
CSCI206 - Computer Organization & Programming
MIPS Procedures.
Subroutines … passing data
The Stack.
Lab 3 - Branching & Subroutines
Subroutines and the Stack
Lecture 3 - Instruction Set - Al
CS 301 Fall 2002 Control Structures
Subroutines … a 1st look procedures and functions in high level languages are modeled on subroutines typically, assembly code is very modular with.
CSCI206 - Computer Organization & Programming
Application Binary Interface (ABI)
Addressing in Jumps jump j Label go to Label op address 2 address
Subroutines and the Stack
Passing Parameters Data passed to a subroutine is called a parameter.
by Richard P. Paul, 2nd edition, 2000.
; main program ; main move Param2, -(sp) move Param1, -(sp) Call Sub1
MIPS Functions.
MIPS functions.
MIPS Procedures.
MIPS function continued
Subroutines … passing data
Problem: ! bell ! help ! ! 1 ! 2 ! ! Bal help ! ! ! !
Subroutines and the Stack
Lecture 3 - Instruction Set - Al
MIPS Functions.
ECE511: Digital System & Microprocessor
Runtime Stack Activation record for hanoi;
The Simulator project.
Lecture 3 - Instruction Set - Al
Presentation transcript:

The MOVE Multiple: MOVEM Instruction This instruction saves or restores multiple registers. Useful in subroutines to save the values of registers not used to pass parameters. MOVEM has two forms: MOVEM register_list,<ea> MOVEM <ea>,register_list No effect on CCR. Example: Saving/restoring registers to from memory SUBR1 MOVEM D0-D7/A0-A6,SAVEBLOCK SAVE D0-D7/A0-A6 . . . MOVEM SAVEBLOCK,D0-D7/A0-A6 Restore D0-D7/A0-A6 RTS Example: Saving/restoring registers using the stack (preferred method). SUBR1 MOVEM D0-D7/A0-A6,-(SP) Push D0-D7/A0-A6 onto the stack MOVEM (SP)+,D0-D7/A0-A6 Restore D0-D7/A0-A6 from the stack