CPS120: Introduction to Computer Science

Slides:



Advertisements
Similar presentations
Low-Level Programming Languages and Pseudocode
Advertisements

Assembly Language for Intel-Based Computers, 4 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and.
Low-Level Programming Languages and Pseudocode Chapter 6.
Low-Level Programming Languages and Pseudocode Chapter 6.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
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
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 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.
Introduction to a Programming Environment
EET 2261 Unit 2 HCS12 Architecture
Computer Architecture
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#1) By Dr. Syed Noman.
ECE 265 – LECTURE 9 PROGRAM DESIGN 8/12/ ECE265.
Assembly & Machine Languages
Low-Level Programming Languages and Pseudocode
Computers Organization & Assembly Language
Topics Introduction Hardware and Software How Computers Store Data
The CPU The Central Presentation Unit Main Memory and Addresses Address bus and Address Space Data Bus Control Bus The Instructions set Mnemonics Opcodes.
Summer 2014 Chapter 1: Basic Concepts. Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Chapter Overview Welcome to Assembly Language.
Instruction Set Architecture
CPS120: Introduction to Computer Science Midterm Exam Review.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Bits & Bytes Created by Chris McAbee For AAMU AGB199 Extra Credit Created from information copied and pasted from
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 2.
Chapter 4 MARIE: An Introduction to a Simple Computer.
Assembly Language A Brief Introduction. Unit Learning Goals CPU architecture. Basic Assembler Commands High level Programming  Assembler  Machine Language.
Computer Operations A computer is a programmable electronic device that can store, retrieve, and process data Data and instructions to manipulate the data.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
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 (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.
1.4 Representation of data in computer systems Instructions.
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
Computer Organization Instructions Language of The Computer (MIPS) 2.
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.
Chapter 7: Low-Level Programming Languages Chapter 7 Low-Level Programming Languages Page 66 In order to execute instructions on a CPU, those instructions.
A LECTURE NOTE. Introduction to Programming languages.
Binary Representation in Text
Binary Representation in Text
Topics Introduction Hardware and Software How Computers Store Data
Microprocessor Systems Design I
System Programming and administration
Microprocessor Systems Design I
Computer Organization and Assembly Language (COAL)
The Processor and Machine Language
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
A Simple Two-Pass Assembler
MARIE: An Introduction to a Simple Computer
CPU has 6 special locations called registers
Chapter 4: Computer Architecture
The Von Neumann Machine
Chapter 6 Programming the basic computer
The .ASCII and .END Assembler Input ;Stan Warford ;January 13, 2005
Dr. Clincy Professor of CS
Presentation transcript:

CPS120: Introduction to Computer Science Low-Level Programming Languages Nell Dale • John Lewis

Bits, Bytes and Characters Bytes are frequently used to hold individual characters in a text document. In the ASCII character set, each binary value between 0 and 127 is given a specific character. Most computers extend the ASCII character set to use the full range of 256 characters available in a byte. The upper 128 characters handle special things like accented characters from common foreign languages

ASCII Each byte contains not a letter but a number -- the number is the ASCII code corresponding to the character (see below). So on disk, the numbers for the file look like this: F o u r a n d s e v e n 70 111 117 114 32 97 110 100 32 115 101 118 101 110 By looking in the ASCII table, you can see a one-to-one correspondence between each character and the ASCII code used. Note the use of 32 for a space -- 32 is the ASCII code for a space. We could expand these decimal numbers out to binary numbers (so 32 = 00100000) if we wanted to be technically correct -- that is how the computer really deals with things.

What the Computer Can Do Store, retrieve and process are actions that the computer can take on data

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

Machine Language Machine language: the instructions built into the hardware of a particular computer Machine specific

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

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 We are only going to examine a few of these instructions

Features in Pep/7 Pep/7 has 32 machine-language instructions The memory unit is made up of 4,096 bytes of storage (0-4095 decimal) The word length in Pep/7 is 16 bits Pep/7 has seven registers, four 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 index register (X register) – holds data The accumulator (A register) – holds data Can be downloaded from http://csilluminated.jbpub.com/

Features in Pep/7 Pep/7’s architecture

Instruction Format There are two parts to an instruction The 8-bit instruction specifier (1rst byte) Indicates the operation to be carried out And optionally, the 16-bit operand specifier (2nd and 3rd bytes) Holds the operand itself or an address The Pep/7 instruction format

Instruction Format The instruction specifier is made up of several sections The operation code The register specifier 0 for A; 1 for X The addressing-mode specifier 00 immediate mode – last two bytes have operand 01 direct mode – last two bytes contain an address

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 The 2-bit addressing-mode specifier says how to interpret the operand part of the instruction

Instruction Format Difference between immediate-mode and direct-mode addressing

Some Sample Instructions Subset of Pep/7 instructions

A Program Example Let’s write "Hello" on the screen

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

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

Hello -- Assembly CHARO C#H/ J; Output 'H' CHARO C#e/ J; Output 'e' CHARO C#l/ J; Output 'l' CHARO C#o/ J; Output 'o' STOP END

Pep/7 Assembly Language

Figure 7.5 Assembly Process

A New Program

Our Completed Program

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 Data-coverage testing is another approach; it designs test cases to ensure that the limits of the allowable data are covered