Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.

Slides:



Advertisements
Similar presentations
Low-Level Programming Languages and Pseudocode
Advertisements

The 8051 Microcontroller and Embedded Systems
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
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.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
Low-Level Programming Languages
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.
Table 1. Software Hierarchy Levels.. Essential Tools An assembler is a program that converts source-code programs into a machine language (object file).
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
Dale & Lewis Chapter 5 Computing components. Let’s design a computer Generic CPU with registers −Program counter (PC) – 5 bits (size of addresses) −Instruction.
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 1 An Overview of Computers and Programming Languages.
Low-Level Programming Languages and Pseudocode
Topics Introduction Hardware and Software How Computers Store Data
CPS120: Introduction to Computer Science
How Computers Work Dr. John P. Abraham Professor UTPA.
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
4-1 Chapter 4 - The Instruction Set Architecture Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
CPS120: Introduction to Computer Science Midterm Exam Review.
Computer Systems Organization CS 1428 Foundations of Computer Science.
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.
Assembly Language A Brief Introduction. Unit Learning Goals CPU architecture. Basic Assembler Commands High level Programming  Assembler  Machine Language.
Module : Algorithmic state machines. Machine language Machine language is built up from discrete statements or instructions. On the processing architecture,
Computer Operations A computer is a programmable electronic device that can store, retrieve, and process data Data and instructions to manipulate the data.
1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization.
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 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.
Chapter 7 Low-Level Programming Languages (slides modified by Erin Chambers)
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.
Dale & Lewis Chapter 5 Computing components
Logic Design / Processor and Control Units Tony Diep.
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
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.
Computer Operation. Binary Codes CPU operates in binary codes Representation of values in binary codes Instructions to CPU in binary codes Addresses in.
Hello world !!! ASCII representation of hello.c.
Operating Systems A Biswas, Dept. of Information Technology.
CPS4200 System Programming Spring 1 Systems Programming Chapter 1 Background I.
Low-Level Programming Languages, Pseudocode and Testing Chapter 6.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Microprocessor Systems Design I
Microprocessor Systems Design I
The 8051 Microcontroller and Embedded Systems
THE sic mACHINE CSCI/CMPE 3334 David Egle.
Introduction to Assembly Language
Chapter One: Introduction
Topics Introduction Hardware and Software How Computers Store Data
Low Level Programming Languages
Computer Architecture
MARIE: An Introduction to a Simple Computer
CPU has 6 special locations called registers
Chapter 4: Computer Architecture
Dr. Clincy Professor of CS
Presentation transcript:

Chapter 7 Low-Level Programming Languages Nell Dale John Lewis

7-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 Convert a simple algorithm into a machine-language program

7-3 Chapter Goals (cont.) Distinguish between machine language and assembly language Describe the steps in creating and running an assembly- language program Convert a simple algorithm into an assembly-language program Distinguish between instructions to the assembler and instructions to be translated Describe two approaches to testing Design and implement a test plan for a simple assembly- language program

7-4 Computer Operations A computer is 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 Store, retrieve, and process are actions that the computer can perform on data

7-5 Machine Language Machine language: the instructions built into the hardware of a particular computer Initially, humans had no choice but to write programs in machine language because other programming languages had not yet been invented

7-6 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

7-7 Pep/7: A Virtual Computer A virtual computer is a hypothetical machine designed to contain the important features of real computers that we want to illustrated Pep/7 –designed by Stanley Warford –has 32 machine-language instructions We are only going to examine a few of these instructions

7-8 Features in Pep/7 The memory unit is made up of 4,096 bytes of storage Pep/7 has seven registers, three of which we focus on at this point –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) Pep/7 has four status bits, of which we examine two: –N: 1 if the A register is negative, 0 otherwise –Z: 1 if the A register is zero, 0 otherwise

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

7-10 Instruction Format There are two parts to an instruction –The 8-bit instruction specifier –And optionally, the 16-bit operand specifier Figure 7.2 The Pep/7 instruction format

7-11 Instruction Format The instruction specifier is made up of several sections –The operation code –The register specifier –The addressing-mode specifier

7-12 Instruction Format The operation code specifies which instruction is to be carried out The 1-bit register specifier is 0 if register A (the accumulator) is involved in the operation and 1 if register X (the index register) is involved. In the examples discussed in the textbook, The register specifier is always 0. The 2-bit addressing-mode specifier says how to interpret the operand part of the instruction

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

7-14 Some Sample Instructions Figure 7.3 Subset of Pep/7 instructions unary instruction

7-15 Example Instructions LOAD – (08) (00 07) – (09) (00 1F) STORE – (11) (00 0A)

7-16 Example Instructions ADD – (18) (02 0A) – (19) (02 0A) Character Input to operand – (D9) (00 0A) Character Output from operand – (E0) (00 41) – (E1) (00 0A) (65) 10, 參考 第 3 章, A one byte

7-17 A Program Example Let’s write "Hello" on the screen Page 211, 程式 Ch05/Pr0504.odc

7-18 Pep/7 Simulator A program that behaves just like the Pep/7 virtual machine behaves To run a program, we enter the hexadecimal code, byte by byte with blanks between each Page 202

7-19 Assembly Language Assembly languages: assign mnemonic letter codes to each machine-language instruction –The programmer uses these letter codes in place of binary digits –A program called an assembler reads each of the instructions in mnemonic form and translates it into the machine-language equivalent

7-20 Pep/7 Assembly Language Page 216

7-21 Pseudo-Operations Pseudo-OpOperandMeaning.ASCII/…/Store the characters between the / / into memory.BLOCKd#3Generate three bytes of storage and set each byte to zero.WORDd#5Generate a word with the decimal value 5 stored in it.WORDh#0105Generate a word with the hexadecimal value 0105 stored in it.ENDSignals the end of the assembly- language program

7-22 Figure 7.5 Assembly Process

7-23 A New Program Page 219 類似程式 Ch05/Pr0512.odc

Our Completed Program Page 221

7-25 Status Bits Status bits allow a program to make a choice –BRLT: if N is 1, then set the Program Counter (PC) to the operand (N is 1 means A register is less than 0) –BREQ: if Z is 1, then set the Program Counter (PC) to the operand (Z is 1 means A register is equal to 0) –Example program Ch06/Pr0602.odc Ch06/Pr0604.odc

7-26 Testing Test plan: a document that specifies how many times and with what data the program must be run in order to thoroughly test the program A code-coverage approach designs test cases to ensure that each statement in the program is executed. This is also called clear-box testing. Data-coverage testing is another approach; it designs test cases to ensure that the limits of the allowable data are covered. This is also called black-box testing.

7-27 Ethical Issues: Software Piracy, Copyrighting Research indicated that, globally, 11.5 billion dollars were lost in the year 2000 to pirated software Advocates of open-source code believe that a program’s original source code should be in the public domain Respecting the copyrights of software, if it is not open code, is important from a number of perspectives