1 Chapter 1: Basic Concepts Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine 9/6/2003.

Slides:



Advertisements
Similar presentations
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and.
Advertisements

ICS312 Set 2 Representation of Numbers and Characters.
HEXADECIMAL NUMBERS Code
Data Representation COE 205
Chapter 3 Data Representation.
Assembly Language for Intel-Based Computers, 4th Edition
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
Chapter 3 Data Representation. Chapter goals Describe numbering systems and their use in data representation Compare and contrast various data representation.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.
1 Introduction Chapter 1 n What is Assembly Language? n Data Representation.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#1) By Dr. Syed Noman.
Number Systems Computer Science 210 Computer Organization.
Assembly Language for Intel-Based Computers, 5th Edition
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and copy this slide show for your personal use, or for.
Computers Organization & Assembly Language
CSU0014 Assembly Languages Homepage: Textbook: Kip R. Irvine, Assembly Language for Intel-Based Computers,
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
ACOE2511 ACOE251/AEEC335 -Assembly Language for the 80X86/Pentium Intel Microprocessors Lecturer: Dr. Konstantinos Tatas.
Binary Arithmetic & Data representation
Chapter 1: Basic Concepts
ICS312 Set 1 Representation of Numbers and Characters.
Assembly Language for x86 Processors 7 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and copy this.
Data Representation Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
CPU Internal memory I/O interface circuit System bus
CPS120: Introduction to Computer Science Computer Math: Converting to Decimal.
Chapter 19 Number Systems. Irvine, Kip R. Assembly Language for Intel-Based Computers, Translating Languages English: Display the sum of A times.
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
ACOE2511 Assembly Language for the 80X86/Pentium Intel Microprocessors Lecturer: Dr. Konstantinos Tatas.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Computer Organization and Assembly Languages 2007/11/10
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
1 Chapter 1: Introduction Appendix A: Binary and Hexadecimal Tutorial Assembly Language for Intel-Based Computers, 3rd edition Kip R. Irvine.
A LECTURE NOTE. Introduction to Programming languages.
CS2100 Computer Organisation
Data Representation COE 308 Computer Architecture
Chapter 3 Data Representation
Computer Science 210 Computer Organization
Data Representation ICS 233
Lec 3: Data Representation
Assembly Language for x86 Processors 6th Edition
Assembly Language (CSW 353)
Data Representation Binary Numbers Binary Addition
Integer Real Numbers Character Boolean Memory Address CPU Data Types
Microprocessor Systems Design I
Computer Science 210 Computer Organization
Microprocessor Systems Design I
EPSII 59:006 Spring 2004.
CSE 102 Introduction to Computer Engineering
Number Systems.
University of Gujrat Department of Computer Science
CS1010 Programming Methodology
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 6
Assembly Language for x86 Processors 6th Edition
Computer Science 210 Computer Organization
Data Representation COE 301 Computer Organization
Topic 3 Number Representations and Computer Arithmetics
Computer Science 210 Computer Organization
Topic 3 Number Representations and Computer Arithmetics
Number Systems Lecture 2.
C1 Number systems.
Computer Organization and Assembly Language
Data Representation ICS 233
Networks & I/O Devices.
Data Representation COE 308 Computer Architecture
Dr. Clincy Professor of CS
Presentation transcript:

1 Chapter 1: Basic Concepts Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine 9/6/2003

2 Introduction u 1.1 Welcome to Assembly Language (Important: Read this section!) u 1.2 Virtual Machine Concept u 1.3 Data Representation u 1.4 Boolean Operations

3 1.1 Welcome to Assembly Language: Why study assembly language? u Learn about computers –Computer architecture –Operating systems –Data representation –Hardware devices u Learn about assembly languages u Learn about compiling u Learn how to write embedded programs u Learn the assemble language for Intel 80x86

4 1.1 Welcome to Assembly Language: Uses of assembly language u Communicating with the operating system u Optimize critical areas of applications –Minimize size –Maximize speed u Avoid restrictions of high level languages u Access to hardware (drivers)

5 1.1 Welcome to Assembly Language: Definitions u Assembly language: machine-specific language with a one-to-one correspondence with the machine language for that computer u Machine language: The language a particular processor understands u Assembler: converts programs from assembly language to machine language

6 1.1 Welcome to Assembly Language: Example u u u u Assembly Language: High-Level Language: Machine language: x = a + b; MOV AX, a ADD AX, b MOV x, AX A A3 0000

7 1.1 Welcome to Assembly Language: Problems with assembly language u Provides no structure u Is not portable u Applications can be very long u “Hard” to read and understand u Lots of detail required

8 1.3 Data representation: Binary Numbers u Digital computers store information in binary u Binary allows two states –On yes true 1 –Off no false 0 u All information on digital computers is ultimately 0’s and 1’s

9 1.3 Data representation: Data types u byte: 8 bits: u word: 16 bits or __ bytes: u double word: __ bits or __ bytes : u quad word: __ bits or __ bytes:

Data representation: Range of a unsigned byte u Question: What is the range of numbers that can be represented with u 1 bit? u 2 bits? u 3 bits? u 4 bits? u 6 bits?

Data representation: Range of the data types u byte: 0 to = 255 u word: 0 to = 64K - 1 = 65,535 u double word: 0 to 4G - 1 = _____ u quad word: 0 to 18x10 18 Unsigned integers:

Data representation: Different bases u System Digits u Binary __ u Octal u Decimal _______________ u Hexadecimal A B C D E F

Data representation: Number systems (bases) u Number systems used –Binary: The internal representation inside the computer. They may be represented in binary, decimal, or hexadecimal. –Decimal: The system people use. u ASCII representations of numbers used for I/O: –ASCII binary –ASCII octal –ASCII decimal –ASCII hexadecimal

Data representation: Binary Addition & Multiplication u Binary addition table u Binary multiplicaton *

Data representation: Binary Addition & Multiplication u Examples: b 1010b b * 1101b u b b b * 1011b

Data representation: Hex Addition & Multiplication u Hex addition and multiplication tables are large u We can still do simple calculations by hand B852h 23Ah + 5A65h * 100h u ABCh 2B3h + E F 0 h * 102h

Data representation: Converting to decimal u = 1 * * * * *10 0 u (Human) conversions: hex to decimal ABCh = 10* * *16 0 = 10* * *1 = = 2748

Data representation: Converting to decimal u (Human) conversions to decimal ABCDh = (((10*16+11)*16+12)*16+13 = (easier on calculator)

Data representation: Conversion problems u b = ________ 10 u 1234 base 5 or (1234) 5 =_________ 10

Data representation: Conversion from decimal u (Human) conversions from decimal = ??? In hex u 2748 = 171 * u 171 = 10 * = 0 * so value is ABCh 2748 = 171 * = (10* ) * = 10 * * * 16 0 = ABCh How do we know this is the Hex representation?

Data representation: Conversion problems u Write decimal 58 in binary. u Write decimal 194 in base 5

Data representation: Conversions: hex and binary u Conversion between base 10 and base 1000 = 10 3 u 1,234,567 = 1* * * u Conversion between base 2 and base 16 = b = = 3Ah u 3Ah = b u Note: we often write binary numbers in hex because: –binary numbers can be very long –it is easy to convert back and forth

Data representation: Conversion problems u Write ABCh in binary. u Write b in hex. u Write b in octal

Data representation: Comments u It is EXTREMELY important to get good at hex and binary –conversion –addition.

Data representation: Signed numbers u Signed numbers: The number of bits must be fixed. In every case, the left hand bit is the sign bit. u 0 means + u 1 means -

Data representation: Signed numbers u We will look at 3 representations in 6 bits. u sign and magnitude 10d = b -10d = b u one’s complement 10d = b -10d = b (one’s complement)

Data representation: Two’s complement u two’s complement 10d = b (one’s complement) d = b (two’s complement) u (one’s complement) d = b (two’s complement) u Two’s complement is used for signed integers on most computers

Data representation: Practice problems u Find the 8 bit two’s complement representation of -2Ch u Find the 8 bit two’s complement representation of 2Ch u What is decimal representation of the two’s complement number ?

Data representation: Signed numbers - Comments u The representation of positive numbers is the same in all three systems u The representation of negative numbers differs between the 3 systems u There are two ways to write 0 in sign and magnitude representations and in one’s complement

Data representation: Signed numbers - Comments u Two's complement: Sizes Signed byte: -128 to +127 = Signed word: -32,768 to +32,767 = Singed double word: -2,147,483,648 to +2,147,483,647 = u Observe there is one more negative than positive value u There are (about) half as many positive signed values as unsigned values

Data representation: Signed numbers - Comments u Vocabulary: “Find the two’s complement of” vs. “Find the two’s complement representation of”

Data representation: Signed numbers - Comments u Why is two’s complement the most popular way of representing signed integers?

Data representation: Signed numbers - Comments u Algorithm to add in signed decimal (sign and magnitude) If both numbers have the same sign Add the two magnitudes Prefix with the common sign else Subtract the number with smaller magnitude from the number with the larger magnitude Prefix with the sign of the number with the larger magnitude.

Data representation: Signed numbers - Comments u Two's complement: Just add numbers even if one or both are negative u (Assume 6 bit two’s complement) = = = = = = -5 u To subtract, take the two’s complement of the number being subtracted and add

Data representation: Character Storage u Characters are stored as numbers u Coding schemes –ASCII (7 or 8 bit) –EBCDIC (8 bit) –Unicode (16 bit) u ASCII Examples: “A” = 65d = 41h “a” = 97d = 61h “B” = 66d = 42h “b” = 98d = 62h “0” = 48d = 30h “1” = 49d = 31h “ “ = 32d = 20h “*” = 42d = 2Ah

Data representation: What does a number represent? u What is CD21h ( b)? u Unsigned integer: u Signed integer (two’s complement): u (one’s complement): u (sign and magnitude): u Instruction: INT 21h u MS-DOS characters: ! u Windows characters: Í! u Two 1 byte numbers: CDh, 21h Line drawing character

Boolean Operations Boolean Algebra u Values: true and false u Invented by George Boole u Boolean operations NOT AND OR

Boolean Operations Boolean Algebra u X Not X false true true false X Y X and Y X or Y false false false false false true false true true false true true true true true true

Boolean Operations Boolean Algebra Example: X and not Y X Y Not Y X and not Y false false true false false true false false true false true true true true false false

Boolean Operations Boolean Algebra u Problem: not (X and Y) or Z

41 u CSCE 380 u Department of Computer Science and Computer Engineering u Pacific Lutheran University u 9/6/2003