CS 206D Computer Organization

Slides:



Advertisements
Similar presentations
Programming 8086 – Part IV Stacks, Macros
Advertisements

Run-time Environment for a Program different logical parts of a program during execution stack – automatically allocated variables (local variables, subdivided.
There are two types of addressing schemes:
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 2 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
MA.912.A.7.2: Solve quadratic equations by factoring and using the quadratic formula. f(x) = −x x − 21 The function below can be used to describe.
Procedures and Stacks. Outline Stack organization PUSH and POP instructions Defining and Calling procedures.
Subroutines: Passing Arguments Using the Stack. Passing Arguments via the Stack Arguments to a subroutine are pushed onto the stack. The subroutine accesses.
Fall 2008ACS-1805 Ron McFadyen1 Ch 8 Recursion Recursion occurs when a method (or function) calls itself.
Practical Session 3. The Stack The stack is an area in memory that its purpose is to provide a space for temporary storage of addresses and data items.
8-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL x86 Instructions Part.
Preorder Traversal with a Stack Push the root onto the stack. While the stack is not empty n pop the stack and visit it.
Equivalent Fractions Equivalent Fractions Using Cross-Multiplication.
Assembly Language – Lab 5
X-box Factoring. Step 1: Set up X- Box Factor ax 2 + bx + c Product a  c Sum b.
CDP ECE Spring 2000 ECE 291 Spring 2000 Lecture 7: More on Addressing Modes, Structures, and Stack Constantine D. Polychronopoulos Professor, ECE.
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 7 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Introduction to Subroutines. All the combinations in which a subroutine can be written 1. The subroutine may be: a. Internal or b. External 2. The type.
Computer Architecture EKT 422 Chapter 10 Instruction Sets: Characteristics and Functions (cont.)
Types of Registers (8086 Microprocessor Based)
Implementing function/ procedure calls (in Pascal and C)
The Quadratic Formula. What does the Quadratic Formula Do ? The Quadratic formula allows you to find the roots of a quadratic equation (if they exist)
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.
MA.912.A.4.2: Add, subtract, and multiply polynomials. Which of the following expressions is equivalent to (5x − 3) 2 ? A. 25x 2 − 30x + 9 B. 25x 2 −
“It was the night before midterm”. Midterm rule (March 16 nd, 2005) - Student ID is required. Open books, note exam - Don’t: - Leave the exam room after.
Module R3 Process Scheduling. Module R3 involves the creation of a simple “Round Robin” dispatcher. The successful completion of this module will require.
4-Oct Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept  direct mode: OK for static addresses  indirect register mode:
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#9) By Dr. Syed Noman.
Lab 6 Stack.
Subroutines: Passing Arguments Using the Stack. Passing Arguments via the Stack Arguments to a subroutine are pushed onto the stack. The subroutine accesses.
The Stack Stack, Procedures and Macros. Outline Stack organization PUSH and POP instructions Calling procedures Macros Programming guidelines.
Algebra 1 Mini-Lessons 3x2y(6y + 12xy − 9x) 3(6x2y2 + 12x3y3 − 9x3y)
Lecture 9 (The Stack and Procedures). 1 Lecture Outline Introduction The Stack The PUSH Instruction The POP Instruction Terminology of Procedures INDEC.
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.
Assembly Language Data Movement Instructions. MOV Instruction Move source operand to destination mov destination, source The source and destination are.
Khaled A. Al-Utaibi  Introduction  The MOV Instruction  The LEA Instruction  The Stack Instructions  The String Data Transfer.
Addressing Modes Instruction – Op-code – Operand Addressing mode indicates a way of locating data or operands. – Any instruction may belong to one or more.
Stack Operations Dr. Hadi AL Saadi.
Instruction set Architecture
Microprocessor Systems Design I
Solve a literal equation
COURSE OUTCOMES OF MICROPROCESSOR AND PROGRAMMING
Instruksi Set Prosesor 8088
Microprocessor and Assembly Language
Microprocessor and Assembly Language
Pushdown Automata PDAs
Information Security - 2
EE3541 Introduction to Microprocessors
Assembly Language Programming Part 2
(The Stack and Procedures)
Chapter 3 Addressing Modes
4.4 Bit Manipulation Instructions
Data Addressing Modes • MOV AX,BX; This instruction transfers the word contents of the source-register(BX) into the destination register(AX). • The source.
3.6 Data transfer Instructions
Stack and Subroutines Module M17.1 Section 11.2.
Programming 8086 – Part IV Stacks, Macros
8086 MICROPROCESSOR PROGRAMMING – INTEGER INSTRUCTIONS AND COMPUTATIONS Amar Saraswat.
8086 Registers Module M14.2 Sections 9.2, 10.1.
Practical Session 4.
(The Stack and Procedures)
Morgan Kaufmann Publishers Computer Organization and Assembly Language
3.6 Data transfer Instructions
Lecture 06 Programming language.
University of Gujrat Department of Computer Science
Problem: ! bell ! help ! ! 1 ! 2 ! ! Bal help ! ! ! !
Problem: ! bell ! help ! ! 1 ! 2 ! ! Bal help ! ! ! !
Problem: ! bell ! help ! ! 1 ! 2 ! ! Bal help ! ! ! !
CS-401 Computer Architecture & Assembly Language Programming
Process.
(The Stack and Procedures)
(The Stack and Procedures)
Presentation transcript:

CS 206D Computer Organization Lab9 CS 111

Suppose that AX=7800h BX=1234h CX=91ACh and SP=0100h Question 2 Suppose that AX=7800h BX=1234h CX=91ACh and SP=0100h Give the content of AX, BX, CX and SP after executing the following instructions: PUSH AX PUSH BX XCHG AX ,CX POP CX PUSH AX POP BX CS 111

Initial: AX=1234h BX=5678h CX=9ABCh SP=0100h Solution Initial: AX=1234h BX=5678h CX=9ABCh SP=0100h PUSH AX 1234 5678 9ABC 00FE 1234 is pushed PUSH BX 1234 5678 9ABC 00FC 5678 is pushed XCHG AX,CX 9ABC 5678 1234 00FC POP CX 9ABC 5678 5678 00FE 5678 is popped PUSH AX 9ABC 5678 5678 00FC 9ABC is pushed POP BX 9ABC 9ABC 5678 00FE 9ABC is popped CS 111

Write some code to do the following: Question 2 Write some code to do the following: Place the top of the stack into AX without changing the stack contents 2) Place the word that is below the stack top into CX, without changing the stack contents. You may use AX. 3) Exchange the top two words on the stack. You may use AX and BX. CS 111

POP AX ;place top of stack into AX PUSH AX ;restore stack contents Solution 1) Place the top of the stack into AX without changing the stack contents POP AX ;place top of stack into AX PUSH AX ;restore stack contents CS 111

POP AX ;place original stack top into AX Solution 2) Place the word that is below the stack top into CX, without changing the stack contents. You may use AX. POP AX ;place original stack top into AX POP CX ;place word that is below original stack top into CX PUSH CX ;restore word that is below original stack top PUSH AX ;restore original stack top CS 111

Solution 3) Exchange the top two words on the stack. You may use AX and BX. POP AX ;place original stack top into AX POP BX ;place word that is below original stack top into BX PUSH AX ;place original stack top back on stack PUSH BX ;place word that was originally below stack top onto stack top CS 111