Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2014. 1 What's Next Linking to an External Library The Book's Link Library Stack Operations Defining.

Slides:



Advertisements
Similar presentations
Assembly Language for x86 Processors 6th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy this slide.
Advertisements

Sample Theoretical Question What’s printed on the screen when the following programs are run? printing.c change_val.c And what does this function do? secret.c.
Assembly Programming Notes for Practical2 Munaf Sheikh
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy.
PSEUDOCODE & FLOW CHART
Important Irvine Library Procedures Randomize Randomize –Initializes the seed of the random-number formula by both the Random32 and the RandomRange procedures.
Assembly Language Procedures.
Assembly Language for Intel-Based Computers Chapter 5: Procedures Kip R. Irvine.
Runtime Stack Managed by the CPU, using two registers
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy.
1 Lecture 5: Procedures Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy.
CS2422 Assembly Language and System Programming Procedures Department of Computer Science National Tsing Hua University.
Conditional Processing
Assembly Language for Intel-Based Computers Chapter 2: IA-32 Processor Architecture Kip Irvine.
Kip Irvine: Assembly Language for Intel-Based Computers
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy.
CS2422 Assembly Language & System Programming October 24, 2006.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
Irvine, Kip R. Assembly Language For Intel-Based Computers XADD Instruction.code mov ax,1000h mov bx,2000h ; AX = 1000h, BX = 2000h xadd ax,bx ; AX = 3000h,
Program Design Divide and Conquer –Divide the program into separate tasks Functional Decomposition Top-Down Design –Divide an overall problem into discrete.
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, Defining and Using Procedures Creating Procedures.
Moving To Code 3 More on the Problem-Solving Process §The final step in the problem-solving process is to evaluate and modify (if necessary) the program.
Some material taken from Assembly Language for x86 Processors by Kip Irvine © Pearson Education, 2010 Slides revised 2/2/2014 by Patrick Kelley.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy.
Summer 2014 Chapter 1: Basic Concepts. Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Chapter Overview Welcome to Assembly Language.
Assembly Language for x86 Processors 7th Edition
Chapter 1: Basic Concepts
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Assembly Language for x86 Processors 6th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy this slide.
Array Cs212: DataStructures Lab 2. Array Group of contiguous memory locations Each memory location has same name Each memory location has same type a.
Functions available for Writing to the Video Display Three different ways to write to the display –Irvine library functions –DOS Video Functions (Interrupt.
Course Title: Introduction to C++ Course Instructor: ADEEL ANJUM Chapter No: 01 1 BY ADEEL ANJUM (MCS, CCNA,WEB DEVELOPER)
Chapter 19 Number Systems. Irvine, Kip R. Assembly Language for Intel-Based Computers, Translating Languages English: Display the sum of A times.
Assembly Language for Intel-Based Computers, 6th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy.
Assembly Language for x86 Processors 7th Edition
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
Sahar Mosleh California State University San MarcosPage 1 Nested Procedure calls and Flowcharts.
Binary Number Output To display a number in binary format, a program looks at each bit in the number and sends the ASCII equivalent of a ‘1’ (31h) or a.
Stack and Procedures Dr Adnan Gutub aagutub ‘at’ uqu.edu.sa
ASSEMBLY LANGUAGE FOR INTEL-BASED COMPUTERS, PROCEDURES.
Graphical User Interface You will be used to using programs that have a graphical user interface (GUI). So far you have been writing programs that have.
Chapter 4 Practice cont.. Practice with nested loops 1.What will be the output of the following program segment: 1.for (int i = 1; i
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
An Example Architecture. A Paper Computer - Woody Woody's characteristics Word size – 8 bits One word.
Computer Organization and Assembly Languages Yung-Yu Chuang 2006/11/13
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 10: Structures and Macros (c) Pearson Education, All rights reserved. You.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy.
CHAPTER 5: PROCEDURES ASSEMBLY LANGUAGE FOR INTEL- BASED COMPUTERS, 5 TH EDITION (c) Pearson Education, All rights reserved. You may modify and copy.
Arrays. The array data structure Array is a collection of elements, that have the same data type Integers (int) Floating point numbers (float, double)
LAB SESSION ONE DIMENSIONAL ARRAY.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 5: Procedures Lecture 18 Linking to External Library The Book’s Link Library Stack Operations.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 5: Procedures Lecture 19: Procedures Procedure’s parameters (c) Pearson Education, 2002.
Procedure Computer Organization and Assembly Languages Yung-Yu Chuang 2005/10/27 with slides by Kip Irvine.
CSC 221 Computer Organization and Assembly Language Lecture 16: Procedures.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy.
CSE 110: Programming Language I Matin Saad Abdullah UB 404.
Lecture 15 Advanced Procedures Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine.
Assembly Language for x86 Processors 6th Edition
Assembly Language for x86 Processors 7th Edition
Chapter 5: Procedures.
Assembly Language for x86 Processors 6th Edition
Assembly Language for Intel-Based Computers, 4th Edition
VB.Net Programming Console Application
Suppose I want to add all the even integers from 1 to 100 (inclusive)
The Stack and Procedures
Some problems for your consideration.
Presentation transcript:

Irvine, Kip R. Assembly Language for x86 Processors 7/e, What's Next Linking to an External Library The Book's Link Library Stack Operations Defining and Using Procedures Program Design Using Procedures

Irvine, Kip R. Assembly Language for x86 Processors 7/e, Program Design Using Procedures Top-Down Design (functional decomposition) involves the following: – design your program before starting to code – break large tasks into smaller ones – use a hierarchical structure based on procedure calls – test individual procedures separately

Irvine, Kip R. Assembly Language for x86 Processors 7/e, Integer Summation Program (1 of 4) Main steps: Prompt user for multiple integers Calculate the sum of the array Display the sum Description: Write a program that prompts the user for multiple 32-bit integers, stores them in an array, calculates the sum of the array, and displays the sum on the screen.

Irvine, Kip R. Assembly Language for x86 Processors 7/e, Procedure Design (2 of 4) Main Clrscr; clear screen PromptForIntegers WriteString; display string ReadInt ; input integer ArraySum ; sum the integers DisplaySum WriteString; display string WriteInt; display integer

Irvine, Kip R. Assembly Language for x86 Processors 7/e, Structure Chart (3 of 4) gray indicates library procedure View the stub programstub program View the final programfinal program

Irvine, Kip R. Assembly Language for x86 Processors 7/e, Sample Output (4 of 4) Enter a signed integer: 550 Enter a signed integer: -23 Enter a signed integer: -96 The sum of the integers is: +431