Week 6 Dr. Muhammad Ayaz Intro. to Assembly Language.

Slides:



Advertisements
Similar presentations
Register In computer architecture, a processor register is a small amount of storage available on the CPU whose contents can be accessed more quickly than.
Advertisements

Registers of the 8086/ /2002 JNM.
There are two types of addressing schemes:
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 2 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
MICROPROCESSORS TWO TYPES OF MODELS ARE USED :  PROGRAMMER’S MODEL :- THIS MODEL SHOWS FEATURES, SUCH AS INTERNAL REGISTERS, ADDRESS,DATA & CONTROL BUSES.
Introduction to 8086 Microprocessor
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#3) By Dr. Syed Noman.
Intel MP.
Azir ALIU 1 What is an assembly language?. Azir ALIU 2 Inside the CPU.
Princess Sumaya University
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
Assembly Language for Intel-Based Computers Chapter 2: IA-32 Processor Architecture Kip Irvine.
ICS312 Set 3 Pentium Registers. Intel 8086 Family of Microprocessors All of the Intel chips from the 8086 to the latest pentium, have similar architectures.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2013 Lecture 4: 80386DX memory, addressing.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
Gursharan Singh Tatla Block Diagram of Intel 8086 Gursharan Singh Tatla 19-Apr-17.
Unit-1 PREPARED BY: PROF. HARISH I RATHOD COMPUTER ENGINEERING DEPARTMENT GUJARAT POWER ENGINEERING & RESEARCH INSTITUTE Advance Processor.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
The 8086 Microprocessor The 8086, announced in 1978, was the first 16-bit microprocessor introduced by Intel Corporation 8086 is 16-bit MPU. Externally.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#1) By Dr. Syed Noman.
An Introduction to 8086 Microprocessor.
Natawut NupairojAssembly Language1 Introduction to Assembly Programming.
1 Fundamental of Computer Suthida Chaichomchuen : SCC
Types of Registers (8086 Microprocessor Based)
Fall 2012 Chapter 2: x86 Processor Architecture. Irvine, Kip R. Assembly Language for x86 Processors 6/e, Chapter Overview General Concepts IA-32.
INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
1 ICS 51 Introductory Computer Organization Fall 2009.
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
Microprocessor Microprocessor (cont..) It is a 16 bit μp has a 20 bit address bus can access upto 220 memory locations ( 1 MB). It can support.
Chapter 2 Parts of a Computer System. 2.1 PC Hardware: Memory.
Intel 8086 (8088) Microprocessor Structure
X86 Assembly Language We will be using the nasm assembler (other assemblers: MASM, as, gas)
University of Sargodha, Lahore Campus Prepared by Ali Saeed.
MODULE 5 INTEL TODAY WE ARE GOING TO DISCUSS ABOUT, FEATURES OF 8086 LOGICAL PIN DIAGRAM INTERNAL ARCHITECTURE REGISTERS AND FLAGS OPERATING MODES.
Internal Programming Architecture or Model
1 x86 Programming Model Microprocessor Computer Architectures Lab Components of any Computer System Control – logic that controls fetching/execution of.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
BITS Pilani Pilani Campus Pawan Sharma Lecture / ES C263 INSTR/CS/EEE F241 Microprocessor Programming and Interfacing.
I NTEL 8086 M icroprocessor بسم الله الرحمن الرحيم 1.
Assembly language.
Format of Assembly language
x86 Processor Architecture
UNIT Architecture M.Brindha AP/EIE
Introduction to 8086 Microprocessor
8086 Microprocessor.
Computer Organization & Assembly Language Chapter 3
Basic Microprocessor Architecture
University of Gujrat Department of Computer Science
Intel 8088 (8086) Microprocessor Structure
Homework Reading Continue work on mp1
Microcomputer & Interfacing Lecture 1
COAL Chapter 1,2,3.
Symbolic Instruction and Addressing
Introduction to Assembly Language
BIC 10503: COMPUTER ARCHITECTURE
Intel 8088 (8086) Microprocessor Structure
8086 Registers Module M14.2 Sections 9.2, 10.1.
CS-401 Computer Architecture & Assembly Language Programming
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
CS 301 Fall 2002 Computer Organization
The Microprocessor & Its Architecture
Symbolic Instruction and Addressing
Computer Architecture CST 250
Unit-I 80386DX Architecture
Chapter 6 –Symbolic Instruction and Addressing
Process.
Part I Data Representation and 8086 Microprocessors
Presentation transcript:

Week 6 Dr. Muhammad Ayaz Intro. to Assembly Language

Levels of Programming n Machine Language n Assembly Language n High level Language

Computer Languages Applications High Level Language Low Level language Hardware Assembly Language C, JAVA Word, Excel HLL  Complier Assembly Language  Assembler Machine Language

Machine Language (Low level) n A computer can directly understand only its own machine language. n Machine languages generally consist of streams of numbers (ultimately reduced to binary 1s and 0s). n Machine-language programming proved u Longer Codes u Difficult to understand. u Error prone (very easy to make mistakes). u Very hard to find these mistakes n Not Portable: must be rewritten on another computer architecture

Machine Language Characteristics n Direct memory management n Little-to-no abstraction from the hardware Register access n Statements usually have an obvious correspondence with clock cycles n Superb performance

Assembly Language n To overcome the problems of speed and errors, assembly language is used. n English-like abbreviations form the basis of assembly languages. n Computers cannot understand assembly-language code until it is translated into machine language. n Normally, designed for a family of processors.

High level Language n The main advantage of high-level languages over low- level language is that they are easier to read, write, and maintain. n These are modern programming languages. u C/C++, VB, JAVA, C#, Pascal, FORTRAN …. n Much more simpler to understand and remember. n High-level languages are closer to the human language. n The early high-level programming languages were designed in the 1950s.

Comparing Low & High-level Languages (1) Advantages of high-level language

Comparing Low & High-level Languages (2) Advantages of low-level language

Why learn Assembly Language? n To learn how high-level language code gets translated into machine language u ie: to learn the details hidden in HLL code n To learn the computer’s hardware u by direct access to memory, video controller, sound card, keyboard… n To speed up applications u Direct access to hardware (ex: writing directly to I/O ports instead of doing a system call) u Good ASM code is faster and smaller: rewrite in ASM the critical areas of code

When to Use Assembly n When speed and size matter ! u Equipment that must response very quickly. u Device driver. u When the resource is limited. n When we use the specialized instructions: u 3D graphic library n When there is no compiler ! n When you want to understand internal architecture of a CPU !

Assembly Language Translation Process n Assembler: u translate Assembly to a Binary Code. u check Syntax. u produce an object file (not executable). n Linker: u combine one or more object files. u resolve references to other object files / libraries. u produce an executable program.

Natawut NupairojAssembly Language Translation Process (Cont’) Assembly Program Assembler Object File Object File Object File Libraries Linker Executable File

Assembly Language Statements n Three types of statements in assembly language u Typically, one statement should appear on a line 1. Executable Instructions u Generate machine code for the processor to execute at runtime u Instructions tell the processor what to do 2. Assembler Directives u Provide information to the assembler while translating a program u Used to define data, select memory model, etc. 3. Macros u Shorthand notation for a group of statements u Sequence of instructions, directives, or other macros

32-bit registers n Upper (first) halves do not have names

Registers n The advantage of registers over computer memory is that they are extremely fast. n The CPU has four general purpose programming registers, u EAX, u EBX, u ECX and u EDX. n Each of the four general purpose programming registers is 32 bits wide

Registers … n Among these 32 bits, we can access the lower 16 bits of EAX (called AX) if we want to. n Further, the lower 16 bits of EBX is called BX, etc. n Moreover, we can access both the upper and lower 8 bits of AX (called AH and AL respectively), too, and similarly for BX, CX and DX.

16-bit Registers

General-Purpose Registers n These are Data Registers where the upper and lower half can be accessed separately n AX = Accumulator (used in arithmetic) n BX = Base (arithmetic, data movement…) n CX = Counter (for looping instructions) n DX = Data (multiplication & division)

Index Registers n SP (stack pointer) contains the offset of the top of the stack n BP (base pointer) often contains the offset of a data/variable in the stack n SI (source index) and n DI (destination index) are used in string movement instructions u SI points to the source string u DI points to the destination string

Segment Registers n CS (code segment) holds the base location of all executable instructions in a program n DS (data segment) the default base location for memory variables n ES (extra segment) additional base location for memory variables n SS (stack segment) base location for stack

Status and Control Registers n IP (instruction pointer) always contains the offset of the instruction to be executed next within the current code segment n The FLAGS register consist of individual bits indicating either u the mode of operation of the CPU (control flag) u the outcome of an arithmetic operation (status)