ACOE2511 Assembly Language for the 80X86/Pentium Intel Microprocessors Lecturer: Dr. Konstantinos Tatas.

Slides:



Advertisements
Similar presentations
Week 3. Assembly Language Programming  Difficult when starting assembly programming  Have to work at low level  Use processor instructions >Requires.
Advertisements

Assembly Language for Intel-Based Computers, 4 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and.
ICS312 Set 2 Representation of Numbers and Characters.
Representing Numbers: Integers
HEXADECIMAL NUMBERS Code
Lecture - 2 Number systems and computer data formats
Chapter 2 : Number System
Data Representation Computer Organization &
Data Representation COE 205
Agenda Shortcuts converting among numbering systems –Binary to Hex / Hex to Binary –Binary to Octal / Octal to Binary Signed and unsigned binary numbers.
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.
Number Representation (1) Fall 2005 Lecture 12: Number Representation Integers and Computer Arithmetic.
1 Introduction Chapter 1 n What is Assembly Language? n Data Representation.
EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office 1.
Basic Concepts Computer Organization and Assembly Language.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#1) By Dr. Syed Noman.
COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
Data Representation in Computers. Data Representation in Computers/Session 3 / 2 of 33 Number systems  The additive approach – Number earlier consisted.
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.
Data Representation in Computers
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Computers Organization & Assembly Language
The 8051 Microcontroller and Embedded Systems
CMPE 325 Computer Architecture II Cem Ergün Eastern Mediterranean University Integer Representation and the ALU.
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.
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
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.
Number Systems. Today Decimal Hexadecimal Binary –Unsigned Binary –1’s Complement Binary –2’s Complement Binary.
Number Systems ELEC 311 Digital Logic and Circuits Dr. Ron Hayne Images Courtesy of Cengage Learning.
CPU Internal memory I/O interface circuit System bus
CSC 221 Computer Organization and Assembly Language
Introduction to Computing Dr. Nadeem A Khan. Lecture 10.
Chapter 19 Number Systems. Irvine, Kip R. Assembly Language for Intel-Based Computers, Translating Languages English: Display the sum of A times.
CSNB374: Microprocessor Systems Chapter 1: Introduction to Microprocessor.
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.
Kavita Bala CS 3410, Spring 2014 Computer Science Cornell University.
SAK Chapter 21 Chapter 2 : Number System 2.1 Decimal, Binary, Octal and Hexadecimal Numbers 2.2 Relation between binary number system with other.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Number Systems by Dr. Amin Danial Asham. References  Programmable Controllers- Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan.
Computer Organization and Assembly Languages 2007/11/10
Monday, January 14 Homework #1 is posted on the website Homework #1 is posted on the website Due before class, Jan. 16 Due before class, Jan. 16.
CHAPTER 3 BINARY NUMBER SYSTEM. Computers are electronic machines which operate using binary logic. These devices use two different values to represent.
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.
1 Chapter 1: Introduction Appendix A: Binary and Hexadecimal Tutorial Assembly Language for Intel-Based Computers, 3rd edition Kip R. Irvine.
1 Chapter 1: Basic Concepts Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine 9/6/2003.
Lec 3: Data Representation
Assembly Language for x86 Processors 6th Edition
Assembly Language (CSW 353)
Data Representation Binary Numbers Binary Addition
Microprocessor Systems Design I
ACOE301: Computer Architecture II Labs
Microprocessor and Assembly Language
Number Systems.
University of Gujrat Department of Computer Science
Microprocessor and Assembly Language
C1 Number systems.
Computer Architecture CST 250
Part I Data Representation and 8086 Microprocessors
Presentation transcript:

ACOE2511 Assembly Language for the 80X86/Pentium Intel Microprocessors Lecturer: Dr. Konstantinos Tatas

ACOE2512 ASSEMBLY LANGUAGE One-to-one relationship with machine language unlike high-level languages –Many lines of code even for simple programmes Requires at least some knowledge of the microprocessor architecture, memory structure and operating system Not portable (source files will not run on a different architecture microprocessor)

ACOE2513 Course pre-requisites Digital Logic, Computer Programming Gates, flip-flops, truth tables, timing diagrams, etc. –Computer number systems decimal, hexadecimal, binary, octal conversions, logical operations, computer arithmetic –Computer data formats ASCII, BCD

ACOE2514 Why Learn/Use Assembly Language Efficient use of the main memory –Less memory required –Programs execute faster Avoid redundant instructions inserted by compilers. Direct access to the hardware of the computer, –Usually not supported by compilers. Access to the microprocessor’s internal control registers. For some processors such as DSP and micro-controllers there is no (or limited) support by high level languages Embedded systems have tight constraints on performance, memory size and power consumption

ACOE2515 Revision on Basic Computer Architecture

ACOE2516 Revision on Numbering Systems Decimal - Binary - Hex conversion Signed Numbers –Signed Magnitude – One’s Complement –Two’s Complement –Hex signed numbers: 15’s and 16’s Complement Arithmetic Operations –Binary: Addition – Subtraction – Multiplication – Division –Hex: Addition – Subtraction – Multiplication – Division Logic Operations on bit vectors –AND, OR, XOR, NOT Ranges: –Unsigned byte: 0 to 255Signed byte: -128 to +127 –Unsigned word: 0 to 65,536Signed word: -32,768 to +32,767 –Unsigned doubleword: 0 to 4,294,967,295 –Unsigned quadword: 0 to 18,446,744,073,709,551,615

ACOE2517 Conversion between number systems A.Binary to Decimal B.Decimal to Binary C.Hexadecimal to Decimal D.Decimal to Hexadecimal E.Binary to Hex F.Hex to Binary

ACOE2518 Number Conversion Decimal to Binary 25 to binary: Quotient | Remainder

ACOE2519 Number Conversion II Binary to Decimal

ACOE25110 Hexadecimal System Hexadecimal System – Base 16 Used for representing binary numbers Example: in hex is 896H The hex system has 16 digits: 0 – 9, A, B, C, D, E and F.

ACOE25111 Decimal, Binary and Hex DecimalBinaryHEX DecimalBinaryHEX A B C D E F

ACOE25112 Number Conversion III Binary to Hex: –Start from the right and group 4 bits at a time. –Replace each 4-bit binary number with its hex equivalent. Example: to hex –Group bits: –Replace hex: 9 F 5 Therefore: = 9F5 in hex.

ACOE25113 Number Conversion IV Hex to Binary: –Each hex digit is replaced with its 4-bit equivalent. –Leading zeros are dropped. Example: 29B to binary –2 9 B – B = (dropping leading zeroes)

ACOE25114

ACOE25115 Representing Positive and Negative Numbers in Hex Positive numbers - straight conversion to hex Negative numbers are stored in two's complement form To get the two's complement form of a number in hex: –First:Represent the number as if it were positive –Second:Subtract it from FF(byte) or FFFF(word) –Third: Add 1 Examples: -97 as a word is FFFF FF9E + 1 FF9F = as a byte is FF -61 9E + 1 9F = - 97

ACOE25116 Interpreting Signed and Unsigned Bytes and Words in Memory as Decimal Numbers Unsigned –Straight translation from binary or hex to decimal Signed numbers –First determine the sign of the number by looking at its MSB. If its 0, its positive and you can do a straight translation from binary or hex to decimal –If its MSB is a 1, its negative and you must Re-complement it! –Since everything you see in memory will be expressed in hexadecimal, you won't "see" the MSB. Instead, you will see a hex digit. Therefore, if the first hex digit of a signed word or a byte is 0 to 7, the number is positive. If the first hex digit of a signed word or a byte is 8 to F, the number is negative. Why?

ACOE25117 Homework - Number System Review Conversion: 1. Convert from decimal to binary a. 43b Convert from binary to decimal a bb b 3. Convert from decimal to hexadecimal a. 6242b Convert from hexadecimal to decimal a. 4BFhb. A2F7h 5. Convert from binary to hexadecimal a bb b 6. Convert from hexadecimal to binary a. FADhb. 265Chc. BE98h

ACOE25118 Character Representation Code chosen for IBM PC is the ASCII code –7 bit code –2 7 or 128 possible values –stored in a byte 95 ASCII codes are printable (32 to 126) 0 to 31 and 127 are used for control purposes IBM PC uses an extended character set using an 8 bit code thus in can represent 2 8 or 256 possible values ASCII keyboard –Each key pressed is stored in ASCII code –Today on IBM PC, each key is assigned a unique number called a scan code to handle the many control and function keys in addition to the ASCII character keys

ACOE25119 ASCII Codes - Printable Characters 20 Space 21 ! 22 ” 23 # 24 $ 25 % 26 & 27 ’ 28 ( 29 ) 2A * 2B + 2C, 2D - 2E. 2F / A : 3B ; 3C < 3D = 3E > 3F ? 41 A 42 B 43 C 44 D 45 E 46 F 47 G 48 H 49 I 4A J 4B K 4C L 4D M 4E N 4F O 60 ` 61 a 62 b 63 c 64 d 65 e 66 f 67 g 68 h 69 i 6A j 6B k 6C l 6D m 6E n 6F o 70 p 71 q 72 r 73 s 74 t 75 u 76 v 77 w 78 x 79 y 7A z 7B { 7C | 7D } 7E ~ 7F Del 50 P 51 Q 52 R 53 S 54 T 55 U 56 V 57 W 58 X 59 Y 5A Z 5B [ 5C \ 5D ] 5E ^ 5F _

ACOE25120 Examples How many bytes are required to represent the following data: –Unsigned number 92d –Unsigned number 313d –Signed number +212d –Unsigned number b –72H –2A4H –HAVE A NICE DAY Represent the above data in hexadecimal form

ACOE25121 Homework: Data Representations Set 1 Problems Note: Express all answers to problems 1-9 in HEXADECIMAL 1. How do you represent 221 as an unsigned byte? ___________ 2. How do you represent 110 as a signed byte? ___________ 3. How do you represent -92 as a signed byte? ___________ 4. How do you represent as an unsigned word? _______ 5. How do you represent 1600 as a signed word? ___________ 6. How do you represent -160 as a signed word? _________ 7. How do you represent as a character string?_________ 8. How do you represent -612 as a character string? _______ 9. How do you represent OOPS! as a character string? _______