Ch5b. 0000 040009 BR 0x0009 ;Branch around data 0003 FFFE.WORD 0xFFFE ;First 0005 00.BYTE 0x00 ;Second 0006 55.BYTE 'U' ;Third 0007 0470.WORD 1136 ;Fourth.

Slides:



Advertisements
Similar presentations
Operator Overloading. Introduction Operator overloading –Enabling C++’s operators to work with class objects –Using traditional operators with user-defined.
Advertisements

C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
Low-Level Programming Languages and Pseudocode Chapter 6.
PASSING PARAMETERS 1. 2 Parameter Passing (by Value) Parameters Formal Parameters – parameters listed in the header of the function Variables used within.
Assembly Language Part 3. Symbols Symbols are assembler names for memory addresses Can be used to label data or instructions Syntax rules: –start with.
Assembly Language part 2. Program example 2 BR 0x0008.ASCII "#?".ASCII "\n".BLOCK 2 CHARO 0x0003, d CHARO 0x0004, d DECI 0x0006, d CHARO 0x0005, d DECO.
CMPUT 101 Lab # 5 October 22, :00 – 17:00.
1 10/20/08CS150 Introduction to Computer Science 1 do/while and Nested Loops Section 5.5 & 5.11.
1 10/11/06CS150 Introduction to Computer Science 1 do/while and Nested Loops.
C++ Typecasting. Math Library Functions.. Operator / Operands A = x + y.
Chapter 8. 2 Objectives You should be able to describe: One-Dimensional Arrays Array Initialization Arrays as Arguments Two-Dimensional Arrays Common.
Compound Operators 03/07/11. More Operators, First Section 4.4.
How to Program in C++ CHAPTER 3: INPUT & OUTPUT INSTRUCTOR: MOHAMMAD MOJADDAM.
Programming is instructing a computer to perform a task for you with the help of a programming language.
Assembly Language Part 5. Reference parameter/global variable model C++ reference parameters are references to the actual arguments (as opposed to copies.
Assembly Language part 1.
 2003 Prentice Hall, Inc. All rights reserved. 1 Introduction to C++ Programming Outline Introduction to C++ Programming A Simple Program: Printing a.
CPS120: Introduction to Computer Science
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 4: Continuing with C++ I/O Basics.
Chapter 1 Quiz Questions (CGS-3464) Mahendra Kumar
Comp 245 Data Structures Linked Lists. An Array Based List Usually is statically allocated; may not use memory efficiently Direct access to data; faster.
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
CSE1222: Lecture 3The Ohio State University1. Assignment Operations  The C++ assignment operator is: =  Examples: x = 3 * 5; y = x – 7; y = y + 4; Do.
1 INTRODUCTION TO PROBLEM SOLVING AND PROGRAMMING.
Chapter 2: Introduction to C++. Language Elements Keywords Programmer-defined symbols (identifiers) Operators Punctuation Syntax Lines and Statements.
C++ Basics. Compilation What does compilation do? g++ hello.cpp g++ -o hello.cpp hello.
CS Class 03 Topics  Sequence statements Input Output Assignment  Expressions Read pages Read pages 40 – 49 for next time.
A First Book of C++: From Here To There, Third Edition2 Objectives You should be able to describe: One-Dimensional Arrays Array Initialization Arrays.
Quiz 2 Results. What Is Wrong? #include using namespace std int Main() { // Say Hello 4 times for(i == 0; i < 3; i++) { cout >> "Hello World!"
1 For Loops l From Chapter 9 l A shorthand way of coding count loops.
Lecture 20 Polymorphism. Introduction General meaning ; the ability to take on different forms. Programming language term: –Allows an entity to take a.
13/15/2016CS150 Introduction to Computer Science 1 Summary  Assignment due on Wednesday, October 29,  Tutor will be in the lab on Tuesday evening,
Chapter five exercises. a. false; b. true; c. false; d. true; e. true; f. true; g. true; h. false.
Objectives You should be able to describe: One-Dimensional Arrays
Constants, Data Types and Variables
A FIRST BOOK OF C++ CHAPTER 7 ARRAYS. OBJECTIVES In this chapter, you will learn about: One-Dimensional Arrays Array Initialization Arrays as Arguments.
Example 21 #include<iostream.h> int main() { char Letter = 0;
Variables Mr. Crone.
LESSON 2 Basic of C++.
Arrays An array is a grouping of elements of the same type that share a common base name Can have any number of elements in the array Individual elements.
Chapter 2 Assignment and Interactive Input
Variables A piece of memory set aside to store data
CSCI 161: Introduction to Programming
Pointer Data Type and Pointer Variables
CS 1430: Programming in C++ Turn in your Quiz1-2 No time to cover HiC.
Chapter 5 Assembly Language.
Screen output // Definition and use of variables
הרצאה 03 אבני היסוד של תוכנית ב- C
Counting Loops.
Lecture 12 Oct 16, 02.
 Student:Risvayeva Charos  Group: 220.
Variables T.Najah Al_Subaie Kingdom of Saudi Arabia
CS150 Introduction to Computer Science 1
Engineering Problem Solving with C++ An Object Based Approach
Engineering Problem Solving with C++ An Object Based Approach
CS150 Introduction to Computer Science 1
do/while Selection Structure
What Actions Do We Have Part 1
Fundamental Programming
Arrays An array is a grouping of elements of the same type that share a common base name Can have any number of elements in the array Individual elements.
CS 101 First Exam Review.
C++ Programming Basics
Pointer Data Type and Pointer Variables
Computer Systems and Assembly Language Input and output operations
The .ASCII and .END Assembler Input ;Stan Warford ;January 13, 2005
Pointer Data Type and Pointer Variables
The switch Statement When we want to compare a variable against several values to see which one it has, we can use the switch statement: switch (status)
Functions Divide and Conquer
CS150 Introduction to Computer Science 1
Presentation transcript:

Ch5b

BR 0x0009 ;Branch around data 0003 FFFE.WORD 0xFFFE ;First BYTE 0x00 ;Second BYTE 'U' ;Third WORD 1136 ;Fourth ; DECO 0x0003,d ;Interpret First as decimal 000C 50000A CHARO '\n',i 000F DECO 0x0005,d ;Interpret Second and Third as decimal A CHARO '\n',i CHARO 0x0006,d ;Interpret Third as character CHARO 0x0008,d ;Interpret Fourth as character 001B 00 STOP 001C.END Output Up Figure 5.13

Assembler Listing Object Addr code Symbol Mnemon Operand Comment D BR main ;Branch around data num:.BLOCK 2 ;Storage for one integer B20 msg:.ASCII " + 1 = \x00" 31203D 2000 ; 000D main: DECI num,d ;Get the number DECO num,d ;and output it STRO msg,d ;Output ' + 1 = ' 0016 C10003 LDA num,d ;A := the number ADDA 1,i ;Add one to it 001C E10003 STA num,d ;Store the sum 001F DECO num,d ;Output the sum STOP 0023.END Symbol table: Symbol Value Symbol Value main 000D msg 0005 num 0003 Figure 5.15

char ch; int j; int main () { cin >> ch >> j; j += 5; ch++; cout << ch << endl << j << endl; return 0; } BR main ch:.BLOCK 1 ;global variable #1c j:.BLOCK 2 ;global variable #2d ; main: CHARI ch,d ;cin >> ch DECI j,d ; >> j 000C C10004 LDA j,d ;j += 5 000F ADDA 5,i 0012 E10004 STA j,d 0015 D10003 LDBYTEA ch,d ;ch ADDA 1,i 001B F10003 STBYTEA ch,d 001E CHARO ch,d ;cout << ch A CHARO '\n',i ; << endl DECO j,d ; << j A CHARO '\n',i ; << endl 002A 00 STOP 002B.END