Slide 1 of 53 Ver. 1.0 Programming in C ASSEMBLY LANGUAGE LECTURE 01-05 BASIC INFORMATION By SHERY KHAN 10:00 to 11:30.

Slides:



Advertisements
Similar presentations
Registers of the 8086/ /2002 JNM.
Advertisements

Week 3. Assembly Language Programming  Difficult when starting assembly programming  Have to work at low level  Use processor instructions >Requires.
MICROPROCESSORS TWO TYPES OF MODELS ARE USED :  PROGRAMMER’S MODEL :- THIS MODEL SHOWS FEATURES, SUCH AS INTERNAL REGISTERS, ADDRESS,DATA & CONTROL BUSES.
Computer Organization and Architecture
Introduction to 8086 Microprocessor
Processor System Architecture
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#3) By Dr. Syed Noman.
Assembly Language Lecture BY SHERY KHAN
Lab6 – Debug Assembly Language Lab
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
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.
Table 1. Software Hierarchy Levels.. Essential Tools An assembler is a program that converts source-code programs into a machine language (object file).
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.
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.
CH12 CPU Structure and Function
An Introduction to 8086 Microprocessor.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 Microprocessor Architecture.
Chapter 1: Basic Concepts
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.
1 ICS 51 Introductory Computer Organization Fall 2009.
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
Chapter 2 Parts of a Computer System. 2.1 PC Hardware: Memory.
COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE Lecture 21 & 22 Processor Organization Register Organization Course Instructor: Engr. Aisha Danish.
Processor Structure and Function Chapter8:. CPU Structure  CPU must:  Fetch instructions –Read instruction from memory  Interpret instructions –Instruction.
Microprocessors used in Personal Computers. The Memory Map of a Personal Computers Transient Program Area (TPA): Holds the operating system (interrupt.
COMP 1321 Digital Infrastructure Richard Henson University of Worcester October 2015.
Computer Architecture Lecture 4 by Engineer A. Lecturer Aymen Hasan AlAwady 17/11/2013 University of Kufa - Informatics Center for Research and Rehabilitation.
INTRODUCTION TO INTEL X-86 FAMILY
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.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Internal Programming Architecture or Model
Week 6 Dr. Muhammad Ayaz Intro. to Assembly Language.
Intel 8086 MICROPROCESSOR ARCHITECTURE
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.
ΜComputer Structure μProcessor Memory Bus System I/O Ports.
1 Chapter 1: Introduction Appendix A: Binary and Hexadecimal Tutorial Assembly Language for Intel-Based Computers, 3rd edition Kip R. Irvine.
Chapter 12 Processor Structure and Function. Central Processing Unit CPU architecture, Register organization, Instruction formats and addressing modes(Intel.
Part of the Assembler Language Programmers Toolbox
Introduction to 8086 Microprocessor
Assembly Language Programming Part 3
8086 Microprocessor.
Computer Organization & Assembly Language Chapter 3
Introduction of microprocessor
Microprocessor and Assembly Language
ADDRESSING MODES.
University of Gujrat Department of Computer Science
Intel 8088 (8086) Microprocessor Structure
Microcomputer & Interfacing Lecture 1
CS-401 Assembly Language Programming
COAL Chapter 1,2,3.
Introduction to Assembly Language
Intel 8088 (8086) Microprocessor Structure
CS-401 Computer Architecture & Assembly Language Programming
COMP 1321 Digital Infrastructure
COMP 1321 Digital Infrastructure
Computer Architecture CST 250
University of Gujrat Department of Computer Science
COMP 1321 Digital Infrastructure
Computer Architecture and System Programming Laboratory
Part I Data Representation and 8086 Microprocessors
Presentation transcript:

Slide 1 of 53 Ver. 1.0 Programming in C ASSEMBLY LANGUAGE LECTURE BASIC INFORMATION By SHERY KHAN 10:00 to 11:30

Slide 2 of 53 Ver. 1.0 Programming in C In this session, you will learn to: Identify the benefits and features of Assembly language What is Assembler How to use Assembler Identify the structure of Assembly functions Binary And Hexadecimal Discussion Short History of Assembly language(iApx88 Hierarchy) Detail Registers and Categories of Register Register Functionalities Sample Program Data Declaration Sample Program …………………………. Objectives

Slide 3 of 53 Ver. 1.0 Programming in C What is Assembly Language Assembly Language is a Machine Specific Programming Language with one to one Correspondence b/w its Statement and computer native Machine Language There are many Different Types of Assembly Language each specific to processor or processor Family this is because the instruction in Assembly language are Designed to match a Computer Machine Instructions Set and Hardware Architecture IBM PC assembly Language refer to instruction recognized by num of Different micro processors in Intel family 8086,8088,80186,80386,80486, and Pentium

Slide 4 of 53 Ver. 1.0 Programming in C Assembler Assembler is a program that Convert source code program from Assemble Language into Machine Language The Assembler can optionally generate a source listing file with line number,memory addresses,source data code statement,and cross reference listing of Symbol and variable used in program Linker A companion program called linker combine individual files created bt assembler with Single Executable File: DEBUGGER: Third Program called Debugger provides away for programmer to trace execution of program and Examine the Content of memory What is Assembler ? & TOOLS ?

Slide 5 of 53 Ver. 1.0 Programming in C Steps for Understanding to develop a Context: Step 1: Write a program name with ex01.asm Save it in the Assemble folder in let example D’derive Step 2: then go to the Run write “cmd “ a Dos is Open Following command is on Dos you will See C:\document setting \window Xp > Now write the in the front of this Command “d;” SEE THE Detail with synapshots: How to use Assembler ? & TOOLS ?

Slide 6 of 53 Ver. 1.0 Programming in C First Look Simple Dos is Open How to use Assembler ? & TOOLS ?

Slide 7 of 53 Ver. 1.0 Programming in C How to use Assembler ? & TOOLS ? I can Give him a Directory Were I Save the Assembly Folder Like D drive in Second Pic I can write cd which mean Display Change in Directory and Give Him A Folder Name”

Slide 8 of 53 Ver. 1.0 Programming in C How to use Assembler ? & TOOLS ? Now write the Command “nasm ex01.asm-o ex01.com-l ex01.lst after this Execution a Lst and COM File is Generated Here Pictorial View

Slide 9 of 53 Ver. 1.0 Programming in C How to use Assembler ? & TOOLS ? Now Edit command is used to Write Some Instruction or rewrite the File So for this purpose we use “Edit ex01.asm “

Slide 10 of 53 Ver. 1.0 Programming in C How to use Assembler ? & TOOLS ? For Execution of COM file we Must Load it in the Debugger the Last Step is And Command is afd Ex01.COM Pictorial View Here

Slide 11 of 53 Ver. 1.0 Programming in C Identify the structure of Assembly functions : Why we Learn Assembly Language??? If our Software want to direct communication with the Pc OS may be Necessary or Computer Game Application might have to directly Access the Video Controller or Sound Card So in Assembly Language a routine is Written for Speedy Communication with Hardware.like Utility Softwares Why It is Called Low level Language ?? Because it is Close to Machine Language. Weakness that its programs are not recompiled & Executed on different Computer.

Slide 12 of 53 Ver. 1.0 Programming in C Number System Disscussion SystemBasePossible Digits Binary20,1 octal80,1,2,3,4,5,6,7 Decimal100-9 Hexa Decimal A,B,C,D,E,F

Slide 13 of 53 Ver. 1.0 Programming in C Number System Disscussion Assembly Debugger work with Hexadecimal System which take 4 bits Decimal To Binary to Hexdecimal Here Example Decimal Binary Hexa Decimal

Slide 14 of 53 Ver. 1.0 Programming in C Number System Disscussion Convert 3BA4 to Decimal 3*16 pow 3 + B*16 pow 2 + A*16 pow 1 + 4*16 pow 0 + Decimal Result is Above A=10 B=11

Slide 15 of 53 Ver. 1.0 Programming in C Signed Number: A Signed Byte Used Only 7 Bits were 0 indicate +ve and 1 indicate –ve Unsigned Number: A Unsigned Byte used 8 bits largest value is 255 Bit: Each Digit in a Binary Num System Is Bit Byte: Eight Bits together Make A byte Word: 16 Bits Are called Word which is 2 byte long Double Word: 32 bits are called DW Quad Word : 64 bits Are called QW Calculation Formula: (2 pow b -1) b indicate bits. Number System Disscussion

Slide 16 of 53 Ver. 1.0 Programming in C CPU DESIGN SIMPLIFIED VIEW Data BUS Address Register Address BUS Data Register Memory Cpu ALU CPU: FETCH DECODE Execute

Slide 17 of 53 Ver. 1.0 Programming in C Adress,Data And Control Bus: Adress Bus:is a Uni directional Bus and Adress Always travel from Processor to Memory because memory cannot predict which element processor at a particular time need. Processor Memory Data Bus: Data Moves from processor to memory and Memory to Processor So Data Bus is Bi directional Memory To Processor (Read operation) Processor to Memory (Write operation) Control Bus :Also Bi directional

Slide 18 of 53 Ver. 1.0 Programming in C REGISTERs: Register: with in A CPU A high Speed Storage area is Called Register which are directly linked to a control unit Basic Purpose is to store operand in Arthematic Calculations They are Like a Scratch pad Ram inside a Processor like Ram. They Are Named as A,B,C,D. USED: When we need more than one data element inside the processor at one time. ……..

Slide 19 of 53 Ver. 1.0 Programming in C REGISTER CATEGORIES iApx88 REGISTERS/ IApx88 General Purpose Index Registers Status Control Flag RegisterSegment

Slide 20 of 53 Ver. 1.0 Programming in C REGISTER CATEGORIES iApx88 / General Register GENERAL REGISTER AXBXCXDX

Slide 21 of 53 Ver. 1.0 Programming in C INDEX REGISTER INDEX REGISTER BPSPSIDI

Slide 22 of 53 Ver. 1.0 Programming in C Status Control Register Status Control REGISTER IP

Slide 23 of 53 Ver. 1.0 Programming in C FLAG REGISTER Flag REGISTER DFIFTFCFOFSFZF Status Flag Control FLag

Slide 24 of 53 Ver. 1.0 Programming in C SEGMENT REGISTER SEGMENT REGISTER CSDSSSES

Slide 25 of 53 Ver. 1.0 Programming in C Accumulator Register: Central Register All Mathematical And Logical operation are Performed on it. Word size of processor is defined by Accumulator. Index Register : Hold Address not Data. Flag Register: it is Meaning Less As Whole.Individual Bit carry different Meaning it is of 8 bit,16,32bit like Accumulator But as unit it is Meaning Less commonly Carry Flag is Used 16 bit num + 16 bit Accumulator=17 the 17 bit is placed as carry without this No Meaning REGISTER: MAIN POINTS

Slide 26 of 53 Ver. 1.0 Programming in C REGISTER: MAIN POINTS Program Counter or Instruction Pointer: Every thing Must be Translated into Binary for our Processor to understand & order of Instruction is controlled by this Register. INSTRUCTION GROUP: Data Movement Instruction Mov ax,bx Lad

Slide 27 of 53 Ver. 1.0 Programming in C Instruction Group Continue ALU INSTRUCTION: Logical OR Logical And Logical XOR and ax,1345 and bx,0534 Add bx,[1200] Data placed at 1200

Slide 28 of 53 Ver. 1.0 Programming in C Instruction Group Continue Program Control Instruction Instruction pointer points to next instruction and instruction run one after other with the help of this register I.E Flow Control Cmp ax,0 Jne SPECIAL INSTRUCTION: Change the behaviour of Processor Cli sti Changing the Flow of instructions Clear the intrupt flag & SET IT

Slide 29 of 53 Ver. 1.0 Programming in C GENERAL REGISTER: AX,BX,CX and DX are General Purpose Register “X” in there name Stand For Extended meaning 16 bit. AX mean we are referring to 16 bit “A “ Register. UPPER & LOWER BYTE: are Separately Available as AH( A high Byte) AL(A low BYTE) All General Purpose Register can be Accessed as 16 bit register or as two 8 bit register AX::: ACCUMULATOR BX::: BASE (role in Memory Addressing) CX::: Counter (work with automatic Count) DX::DESTINATION ( act as destination in I/O)

Slide 30 of 53 Ver. 1.0 Programming in C INDEX REGISTER: SI are Stand for Source INDEX DI stand for Destination INDEX INDEX REGISTER HOLD ADDRESS Intel Allow MATHEMATICAL & LOGICAL OPERATIONS STRING INSTRUCTION: A SPECIAL CLASS of Instruction is Called String instruction SI and DI are 16bit and cannot be used as 8 bit register pair IP:(Instruction Pointer):contain the Adress of Next Instruction to be Executed NO Memory Access or Mathematic is Done SP(Stack pointer)::Memory pointer and is Used indirectly by set of instructions BP(base pointer):: Memory pointer contain the adress in the Special Area of memory called STack

Slide 31 of 53 Ver. 1.0 Programming in C FLAG REGISTER is Not Meaning Full As a Whole But it was Bitwise significant. CARRY FLAG: when two 16 bit num are added the answer is 17 bit long the extra bit which could not Fit in the target register is placed in the carry flag PARITY FLAG::odd or even one bit only: this flag is used to verify the integrity of data. Auxiliary Carry : during operation if a carry goes from one nibble to another is called Auxiliary FLAG Zero FLAG: if the last logical instruction or mathematical instruction produced zero the zero flag is set: Sign Flag: -ve number is represented as 1 +ve num it is zero Trap Flag:special role in debugging Intrupt Flag: interruption of processor is disable or enable by making this bit zero or one Direction Flag: specially related, this flag tells wheather the current operation has to be done FLAG REGISTER:

Slide 32 of 53 Ver. 1.0 Programming in C SEGMENT REGISTER: The CS (code segment register) DS(Data Segment Register) SS(Stack Segment) ES(Extra Segment Register) …………………

Slide 33 of 53 Ver. 1.0 Programming in C SAMPLE PROGRAM Org[0x0100] mov ax,5 add ax,bx mov bx,15 add ax,bx mov ax,0x4c00 Int 0x21