Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.

Slides:



Advertisements
Similar presentations
Low-Level Programming Languages and Pseudocode
Advertisements

Dr. Ken Hoganson, © August 2014 Programming in R COURSE NOTES 2 Hoganson Language Translation.
Week 3. Assembly Language Programming  Difficult when starting assembly programming  Have to work at low level  Use processor instructions >Requires.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
Lecture 1: Overview of Computers & Programming
Low-Level Programming Languages and Pseudocode Chapter 6.
Low-Level Programming Languages and Pseudocode Chapter 6.
Chapter 1: An Overview of Computers and Programming Languages J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program.
Chapter 3 Assembly Language: Part 1. Machine language program (in hex notation) from Chapter 2.
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Low-Level Programming Languages
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Operational Semantics.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
Chapter 16 Programming and Languages: Telling the Computer What to Do.
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
Outline Chapter 1 Hardware, Software, Programming, Web surfing, … Chapter Goals –Describe the layers of a computer system –Describe the concept.
EET 2261 Unit 2 HCS12 Architecture
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Computer Architecture
Assembly & Machine Languages
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Low-Level Programming Languages and Pseudocode
An Introduction Chapter Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram.
University of Texas Pan AmDr. John P. Abraham Information Technology Computer Architecture Dr. John P. Abraham.
Topics Introduction Hardware and Software How Computers Store Data
CPS120: Introduction to Computer Science
Quiz # 2 Chapters 4, 5, & 6.
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
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
GCSE Computing#BristolMet Session Objectives#11 MUST identify what program instructions consist of SHOULD describe how instructions are coded as bit patterns.
The CPU Central Processing Unit. 2 Reminder - how it fits together processor (CPU) memory I/O devices bus.
Chapter 4 MARIE: An Introduction to a Simple Computer.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Execution of an instruction
Computer Operations A computer is a programmable electronic device that can store, retrieve, and process data Data and instructions to manipulate the data.
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
Chapter 7 Low-Level Programming Languages. 2 Features in Pep/7 Figure 7.1 Pep/7’s architecture.
CMSC 150 PROGRAM EXECUTION CS 150: Wed 1 Feb 2012.
Chapter 7 Low-Level Programming Languages (slides modified by Erin Chambers)
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
Chapter 1 : Overview of Computer and Programming By Suraya Alias
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
8086/8088 Instruction Set, Machine Codes and Addressing Modes.
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Chapter 1 An Overview of Computers and Programming Languages.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
Software Engineering Algorithms, Compilers, & Lifecycle.
Low-Level Programming Languages, Pseudocode and Testing Chapter 6.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Introduction to computer software. Programming the computer Program, is a sequence of instructions, written to perform a specified task on a computer.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Topics Introduction Hardware and Software How Computers Store Data
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Introduction to Assembly Language
MARIE: An Introduction to a Simple Computer
Topics Introduction Hardware and Software How Computers Store Data
Low Level Programming Languages
MARIE: An Introduction to a Simple Computer
ICT Programming Lesson 1:
Computer Architecture Assembly Language
Presentation transcript:

Chapter 7 Low-Level Programming Languages

2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of abstraction and the determination of concrete algorithm steps Describe the important features of the Pep/7 virtual machine Distinguish between immediate mode addressing and direct addressing

3 Chapter Goals Convert a simple algorithm into a machine- language program Distinguish between machine language and assembly language Convert a simple algorithm into an assembly- language program Distinguish between instructions to the assembler and instruction to be translated Design and implement a test plan for a simple assemble-language program

4 Computer Operations Computer A programmable electronic device that can store, retrieve, and process data Data and instructions to manipulate the data are logically the same and can be stored in the same place What operations can a computer execute?

5 Levels of Abstraction What do we mean by the expression "levels of abstraction"? Give several examples.

6 Machine Language Machine language The language made up of binary coded instructions built into the hardware of a particular computer and used directly by the computer Why would anyone choose to use machine language? (Hint: they had no choice. Why?)

7 Machine Language Characteristics of machine language: –Every processor type has its own set of specific machine instructions –The relationship between the processor and the instructions it can carry out is completely integrated –Each machine-language instruction does only one very low-level task

8 Pep/7: A Virtual Computer Virtual computer A hypothetical machine designed to contain the important features of a real computer that we want to illustrate Pep/7 A virtual computer designed by Stanley Warford that has 32 machine-language instructions No; we are not going to cover all of them!

9 Features in Pep/7 Figure 7.1 Pep/7’s architecture

10 Features in Pep/7 Pep/7 Registers/Status Bits Covered –The program counter (PC) (contains the address of the next instruction to be executed) –The instruction register (IR) (contains a copy of the instruction being executed) –The accumulator (A register) –Status bit N (1 if A register is negative; 0 otherwise) –Status bit Z (1 if the A register is 0; and 0 otherwise) The memory unit is made up of 4,096 bytes

11 Instruction Format Figure 7.2 The Pep/7 instruction format

12 Instruction Format Operation code Specifies which instruction is to be carried out Register specifier Specifies which register is to be used (only use A in this chapter) Addressing-mode specifier Says how to interpret the operand part of the instruction

13 Instruction Format Figure 7.3 Difference between immediate-mode and direct-mode addressing

14 Instruction Format Is there something we are not telling you about the addressing mode specifier? How can you tell?

15 Some Sample Instructions Figure 7.3 Subset of Pep/7 instructions

16 Sample Instructions What do these instructions mean?

17 Sample Instructions What do these instructions mean?

18 Sample Instructions What do these instructions mean?

19 Sample Instructions What do these instructions mean?

20 Algorithms Write "Hello" Write "Hell" Write "H" Write "e" Write "l" Write "o" Are we concrete yet?

21 Algorithms Write "H" Write 48 (hex) Write "e" Write 65 (hex). Write "o" Write 6F (hex) Are we concrete yet?

22 A Program Example

23 Hand Simulation What is the fetch/execute cycle? How much is the PC incremented?

24 Hand Simulation What is the fetch/execute cycle here?

25 Hand Simulation What is the fetch/execute cycle here?

26 Pep/7 Simulator Pep7/Simulator A program that behaves just like the Pep/7 virtual machine behaves To run a program Enter the hexadecimal code, byte by byte with blanks between each

27 Pep/7 Simulator What are the "zz"s for?

28 Pep/7 Simulator What is a loader? What does it do? Where does execution begin?

29 Assembly Language Assembly language A language that uses mnemonic codes to represent machine-language instructions Assembler A program that reads each of the instructions in mnemonic form and translates it into the machine-language equivalent

30 Pep/7 Assembly Language Remember the difference between immediate and direct addressing? i : immediate d: direct

31 Pep/7 Assembly Language What is the difference between operations and pseudo operations?

32 Assembly Process

33 A New Program Reading and adding three numbers Set sum to 0 Read num1 Add num1 to sum Read num2 Add num2 to sum Read num3 Addnum3 to sum Write sum Are we concrete yet?

34 Our Completed Program

35 Decision Making Remember the status bits A and Z?

36 Decision Making … Add num3 to sum If sum is negative Write "Error" Else Write sum Write "Error" if sum is negative. Are we concrete yet?

37 Decision Making Add num3 to sum If status bit N is 1 Go to NegMsg Write sum Quit: STOP NegMsg: Write the message and go to Quit Are we concrete yet?

38 Decision Making Read limit Set sum to 0 While (limit is not zero) Read number Set sum to sum + number Set limit to limit - 1 Are we concrete yet?

39 Decision Making Set the accumulator to limit Subtract one from the accumulator Compare accumulator to zero If status bit Z is 1 go to Quit Else go to Read Are we concrete yet?

40 Decision Making

41 Testing Test plan A document that specifies how many times and with what data the program must be run in order to thoroughly test it Code coverage An approach that designs test cases by looking at the code Data coverage An approach that designs test cases by looking at the allowable data values

42 Testing Test plan implementation Using the test cases outlined in the test plan to verify that the program outputs the predicted results

43 Importhat Threads Programming language A set of grammar rules, symbols, and special words used to construct a program Program A sequence of instructions written to perform a specified task Syntax The formal grammar rules governing the construction of valid instructions Semantics The rules that give meaning to the instructions

44 Ethical Issues Software Piracy and Copyrighting Have you every "borrowed" software from a friend? Have you ever "lent" software to a friend? Did you know that 107,000 jobs were lost in the US one year due to such "borrowing" and "lending?"

45 Who am I? The architecture of the Pep/7 is named after me. Where was I born and from where did I escape? I consulted on which high-level language?

46 Do you know? What can Platinum Blue's software predict? How much money do software errors (bugs) cost the US economy annually? To what did the Rosetta Stone provided the key to the translation?