Microprocessor and Assembly Language

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.
Representing Numbers: Integers
Data Representation Computer Organization &
Data Representation COE 205
Assembly Language and Computer Architecture Using C++ and Java
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.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
Data Representation ICS 233
1 Introduction Chapter 1 n What is Assembly Language? n Data Representation.
Basic Concepts Computer Organization and Assembly Language.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#1) By Dr. Syed Noman.
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.
Programmable Logic Controllers
Computers Organization & Assembly Language
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
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.
Chapter 1: Basic Concepts
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
1 Introduction Chapter 1 n What is Assembly Language? n Data Representation.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
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.
CPU Internal memory I/O interface circuit System bus
Chapter 19 Number Systems. Irvine, Kip R. Assembly Language for Intel-Based Computers, Translating Languages English: Display the sum of A times.
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
ACOE2511 Assembly Language for the 80X86/Pentium Intel Microprocessors Lecturer: Dr. Konstantinos Tatas.
 Lecture 2 Processor Organization  Control needs to have the  Ability to fetch instructions from memory  Logic and means to control instruction sequencing.
Computer Organization and Assembly Languages 2007/11/10
MECH1500 Chapter 3.
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
Data Representation COE 301 Computer Organization Dr. Muhamed Mudawar
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Data Representation COE 301 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum.
1 Chapter 1: Introduction Appendix A: Binary and Hexadecimal Tutorial Assembly Language for Intel-Based Computers, 3rd edition Kip R. Irvine.
3.1 Denary, Binary and Hexadecimal Number Systems We use the denary (base 10) number system in our daily life for counting and calculation. Computers use.
1 Chapter 1: Basic Concepts Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine 9/6/2003.
CS2100 Computer Organisation
Number Systems & Binary Arithmetic
Chapter 1 Digital Systems and Binary Numbers
Data Representation COE 308 Computer Architecture
NUMBER SYSTEMS.
Data Representation ICS 233
Lec 3: Data Representation
Assembly Language for x86 Processors 6th Edition
Data Representation.
Assembly Language (CSW 353)
3.1 Denary, Binary and Hexadecimal Number Systems
Digital Logic & Design Dr. Waseem Ikram Lecture 02.
Data Representation Binary Numbers Binary Addition
CHAPTER 1 : INTRODUCTION
Computer Architecture & Operations I
Number Systems.
Chapter 1 Digital Systems and Binary Numbers
University of Gujrat Department of Computer Science
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 6
Data Representation COE 301 Computer Organization
Microprocessor and Assembly Language
Numbering System TODAY AND TOMORROW 11th Edition
Digital Logic & Design Lecture 02.
Computer Organization and Assembly Language
Data Representation ICS 233
Part I Data Representation and 8086 Microprocessors
Data Representation COE 308 Computer Architecture
Presentation transcript:

Microprocessor and Assembly Language Lecture-1-Intrduction Muhammad Hafeez Department of Computer Science GC University Lahore

Today’s Agenda Introduction to Course Background-Prerequisites Number System Memory

My Introduction Office: Room-103 Course Blog: csience1234.wordpress.com Email: hafeez192@gmail.com

Course Introduction Course Title: Microprocessor and Assembly Language Course Code: CS-2207 Recommended Books: 8086 IBM-PC Assembly Language by M.A.Mazidi Intel Microprocessors Architecture, Programming and Interfacing by Bary B. Bray Assembly Language Programming and Organization of the IBM PC By Ytha Y. Yu, Charles Marut

Course Introduction Reference Material: Google It Taste It

Course Description This is a semester long course introducing fundamentals of a computer organization. Primarily the course focus on Assembly Language for the Intel x86 series of chips which is the heart of the IBM PC. Assembly Language is a link between microprocessor and High Level Language Write, Understand and Debug a Program written in Assembly Language Control I/O Devices

Course Prerequisites Digital Logic Design Minimum familiarity with IBM PC and MS-DOS

Processor Understanding Bottom-Up View Logic Gates (Transistors) Flip-Flops, Registers, Multiplexers, Decoders, Adders Memory, Processor, I/O Controllers Build Complete Computer System

Processor Understanding Top-Down View A Programmer’s View Study tasks that processor executes to execute a HLL program Learn the Set of very basic steps processor performs – Instruction Set Can be Learned at Machine Level – difficult to understand Assembly Language Level – Symbolic equivalent to machine level instructions

Processor Understanding Top-Down View Example, for the Intel Processor: MOV AL, 5 ;Assembly language 10110000 00000101 ;Machine language

Motivation Link between High Level Language and Assembly Assembler is developed for particular processor Reasons to Learns Assembly: In-depth understanding of assembly is required to understand device drivers Compiler Development and Code Optimization Helpful in working with Operating System and embedded systems A conceptual bridge between Abstraction of real world in (compiler) and microprocessor

Course Work and Grading Quiz-05% Assignment-05% Term Project-10% Mid Term-20% Final Term-60% This is tentative distribution and liable to change under certain circumstances.

Attendance & Assignment Submission 80% attendance mandatory to qualify for final examination Assignments should be submitted on due date and time, no further extension shall be given. Assignments should be submitted in hard-copy on A4 paper with proper binding and titled in the format StudentFirstName-RollNo-CourseCode-Section-AssignmentNo e.g. kaleem-001BSCS14-CS2207-A-01

Number System Data Represented in Computer is in the form of digital signals (on-off) Best represented by Binary Number System (1-0) One binary digit is not enough to represent real world information Need at least 08 bits called a ‘Byte’; that is smallest addressable unit in modern computers For x86 following units are used 01 Byte = 08 Bits 01 Word = 02 Bytes 01 Double Word = 02 Words

Number System The contents of 1 bytes stored in computer memory needs ‘Interpretation’ For Example, the memory content 0100 0001, can be represented as Number 65 or Letter ‘A’ It is upto the programmer to provide interpretation

Number System A written number is only meaningful when we define its Base Hexadecimal 25 is written as 25h Binary 1010 is written as 1010b Decimal 1010 is written as 1010 or 1010d Significance of Bases to demonstrate quantity Larger base represent large quantities in fewer digits

Binary Number System Digits are 1 and 0 MSB – Most Significant Bit 1 = true 0 = false MSB – Most Significant Bit LSB – Least Significant Bit Bit Numbering:

Binary Number System Each digit (bit) is either 1 or 0 Each bit represents a power of 2: Every binary number is a sum of powers of 2

Converting Binary To Decimal Weighted positional notation shows how to calculate the decimal value of each binary bit: Decimal Number = (Dn-1  2n-1) + (Dn-2  2n-2) + ... + (D1  21) + (D0  20) D = Binary Digit (1010)2 =1x23+0x22+1x21+0x20 =8+0+2+0= (10)10

Converting Unsigned Decimal To Binary Repeatedly divide the decimal integer by 2. Each remainder is a binary digit in the translated value:

Binary Arithmetic Binary Addition Binary Subtraction Binary Multiplication Binary Division

Unsigned Integer Number Storage Size In Memory Standard Sizes What is the Largest Number stored in 20 Bits

Hexadecimal Number System Binary, Decimal and Hexadecimal Numbers

Hexadecimal Number System Binary, Decimal and Hexadecimal Numbers

Converting Hexadecimal to Binary Each Hexadecimal digit is equivalent to 4 Binary Digits Prove the same with repeated division method by 2

Converting Hexadecimal to Decimal Multiply each digit by its corresponding power of 16: Decimal = (Dn-1  16n-1)+…+(D3  163) + (D2  162) + (D1  161) + (D0  160) Hex 1234 equals (1  163) + (2  162) + (3  161) + (4  160)= decimal 4,660. Hex 3BA4 equals (3  163) + (11 * 162) + (10  161) + (4  160)= decimal 15,268. Another way

Converting Hexadecimal values upto 8 digits

Converting Decimal to Hexadecimal decimal 422 = 1A6 hexadecimal

Hexadecimal Addition Starting from LSB if sum of each two digits is greater than or equal to 16, divide it with 16, the quotient become carry digit and remainder become sum digit Carry will be 1 Important skill to do arithmetic in Hexadecimal for Assembly Language 36 28 28 6A 42 45 58 4B 78 6D 80 B5 21 / 16 = 1, rem 5

Hexadecimal Addition

Hexadecimal Subtraction When a Borrow is required from the digit on left hand side, add sixteen (16) to the digit on right hand side Borrow will be 16 The address of var1 is 00400020. The address of the next variable after var1 is 0040006A. How many bytes are used by var1? C6 75 A2 47 24 2E -1 16 + 5 = 21

Two Representations for Integers The unsigned representation: in that case all the bits are used to represent a magnitude Can be positive number or Zero Signed Representation For What purpose signed number could be used? Can you recognize a number for even or odd by looking at bit pattern?

Signed Representations for Integers The Singed Representation forms: Sign Magnitude Form Uses most significant bit of the word to represent the sign. 0 - Positive 1 - Negative. Rest of the number is encoded in magnitude part 37 = 00000000 00100101 -37 = 10000000 00100101 6712 = 00011010 00111000 -6712 = 10011010 00111000 Can represent numbers from -32,767 to 32,767. -215+1 .. 215-1 But, two representations for zero: 0 = 00000000 00000000 -0 = 10000000 00000000 Arithmetic can be cumbersome.

Signed Representations for Integers Sign Magnitude Form Uses most significant bit of the word to represent the sign. 0 - Positive 1 - Negative. Rest of the number is encoded in magnitude part 37 = 00000000 00100101 -37 = 10000000 00100101 6712 = 00011010 00111000 -6712 = 10011010 00111000 Can represent numbers from -32,767 to 32,767. -215+1 .. 215-1 But, two representations for zero: 0 = 00000000 00000000 -0 = 10000000 00000000 Arithmetic can be cumbersome.

Signed Representations for Integers 1’s Compliment Form Negative number is stored as bit-wise complement of corresponding positive number. Leftmost bit of positive number is 0. That of negative number is 1. 196 = 00000000 11000100 -196 = 11111111 00111011 Can represent numbers from -32,767 to 32,767. -215+1 .. 215-1 Arithmetic is easier than sign-magnitude. But, still have two representations for zero: 0 = 00000000 00000000 -0 = 11111111 11111111 Add 5 and -5 using 1’s Complement and see the result?

Signed Representations for Integers 2’s Compliment Form Modern Method Positive number represented in same way as other two methods Negative number obtained by taking 1's Complement of positive number and adding 1. 6713 = 00011000 00011101 1's Comp = 11100111 11100010 2's Comp = 11100111 11100011 Word integer can represent numbers from -32,768 to 32,767. -215 .. 215-1 Byte integer can represent numbers from -128 to 127. -27 .. 27-1 One version of zero: 00000000 00000000 Find 2’s complement of 2’s complement of 6

Signed Representations for Integers Represent -97d in 2’s Complement Form using 8 bits and 16 bits? Sol: Represent 97 in Hex Convert hex representation into binary Take 2’s complement of binary Convert into Hex … this how it is represented 5ABAH – 2A91H Use 2’s complement to solve it

Range of Signed Integers MSB is reserved for Sign; this factor limits the range For Signed Representation; what largest value can be stored in 20 bits

Signed and Unsigned in Computer Memory to Decimal To use a number in computer memory; we need to provide it either signed or unsigned interpretation How can we do that? Unsigned: Just convert binary to decimal, better to convert to hex and then to decimal Signed: If msb=0, convert like unsigned numbers, if msb=1, call the N number as –N, take 2’s complement and then convert to decimal, place – sign in front 1111 1111 can be interpreted as 255 (unsigned) Or -1 (minus one) as signed Its upto the programmer to provide memory contents suitable interpretation for program

Signed and Unsigned in Computer Memory to Decimal

Signed and Unsigned in Computer Memory to Decimal

Signed and Unsigned in Computer Memory to Decimal Any Observation in previous two slides? Computer memory contents are FE0CH, give it signed and unsigned representation?

Signed and Unsigned in Computer Memory to Decimal Another Observation: From 0000H-7FFFH  Signed Number = Unsigned Numbers From 8000H-FFFFHSigned Number = Unsigned Number-65536 Can you Observe the same for Byte? Give FE0CH a singed and unsigned representation through this method?

Minimum and Maximum Values for Signed Numbers MSB used to represent sign, fever bits left for magnitude representation For Example, a signed byte have Smallest Positive 0000 0000 (0 in decimal) Largest Positive 0111 1111 (127 in decimal) Smallest Negative 1000 0000 (-128) Largest Negative 1111 1111 (-1) First low byte is stored memory then high byte [Little Endian]

Character Representation Through Memory Contents Each Character is represented with 7 bit Code called ASCII Character ASCII Code from 00H to 07FH Codes from 20H to 7EH are printable, rest of them are control code An extended character set is obtained by setting the most significant bit (MSB) to 1 (codes 80h to FFh) so that each character is stored in 1 byte

ASCII Character Set CR = Carriage Return LF = Line Feed (Cursor Moved one line below) SPC = Blank Space

Text Files Using ASCII Character Set Text Files contain printable and non-printable ASCII Characters Different OS represent non-printable characters (control characters) i.e. moving to cursor to start of line through different ways, Windows: <CR>+<LF> UNIX: <LF> MAC: <CR> Origin of problem when we move text files from one OS to other

Character Storage ASCII (0-127) Extended ASCII (0-255) Uni-Code (0-65,535)

Questions ????????????????????????