Prof. Muhammad Saeed II. 1/27/2015 Computer Architecture & Assembly Language 2.

Slides:



Advertisements
Similar presentations
CPU Structure and Function
Advertisements

Computer Architecture
Chapter 2 (cont.) An Introduction to the 80x86 Microprocessor Family Objectives: The different addressing modes and instruction types available The usefulness.
Chapter 10 And, Finally.... Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display A Final Collection of ISA-related.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 2: Data types and addressing modes dr.ir. A.C. Verschueren.
INSTRUCTION SET ARCHITECTURES
Computer Organization And Assembly Language
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
Chapter 12: Interrupts. Copyright ©2009 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved. The Intel Microprocessors:
Instruction Set Architecture
SOFTWARE ARCHITECTURE OF THE 8088 AND 8086 MICROPROCESSORS
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
By Tien Phung CS 147 Dr. Sin-Min Lee. High-level Languages Assembly Languages Machine Languages.
Interrupt Processing Haibo Wang ECE Department
1 Computer System Overview OS-1 Course AA
1 CSIT431 Introduction to Operating Systems Welcome to CSIT431 Introduction to Operating Systems In this course we learn about the design and structure.
Computer System Overview
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Introduction to Interrupts
EET 2261 Unit 2 HCS12 Architecture
Unit-1 PREPARED BY: PROF. HARISH I RATHOD COMPUTER ENGINEERING DEPARTMENT GUJARAT POWER ENGINEERING & RESEARCH INSTITUTE Advance Processor.
Interrupts – (Chapter 12)
Interrupts  Interrupt is a process where an external device can get the attention of the microprocessor.  The process starts from the I/O device  The.
Micro-Computer Applications: Procedures & Interrupts Dr. Eng. Amr T. Abdel-Hamid ELECT 707 Fall 2011.
CEG 320/520: Computer Organization and Assembly Language ProgrammingIntel Assembly 1 Intel IA-32 vs Motorola
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.
Machine Instruction Characteristics
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
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.
Microprocessors Monday, Apr. 13 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
CSNB374: Microprocessor Systems Chapter 5: Procedures and Interrupts.
Computer Architecture and Organization
Virtual 8086 Mode  The supports execution of one or more 8086, 8088, 80186, or programs in an protected-mode environment.  An 8086.
Dec Hex Bin 14 E ORG ; FOURTEEN Interrupts In x86 PC.
Lecture 1: Review of Computer Organization
What is a program? A sequence of steps
MICROPROCESSOR DETAILS 1 Updated April 2011 ©Paul R. Godin prgodin gmail.com.
BIOS and DOS Interrupts Basic Input /Outpu System Disk Operating System.
Internal Programming Architecture or Model
Microprocessor & Assembly Language
GUIDED BY PROFFESOR NILESH DESAI GROUP NO:-8 CHANDRASHIKHA SINGH( ) KURUP SHUBHAM VALSALAN( ) SAURAV SHUBHAM( )
SOFTWARE ARCHITECTURE OF THE 8088 AND 8086 MICROPROCESSORS
7-Nov Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Oct lecture23-24-hll-interrupts 1 High Level Language vs. Assembly.
1 Computer System Overview Chapter 1. 2 Operating System Exploits the hardware resources of one or more processors Provides a set of services to system.
An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal) OR A Software-generated CALL (internally derived from.
MICROPROCESSOR BASED SYSTEM DESIGN
CS501 Advanced Computer Architecture
Microprocessor and Assembly Language
Microprocessor Systems Design I
Interrupts In 8085 and 8086.
Interrupts – (Chapter 12)
Computer Organization And Assembly Language
Basic Microprocessor Architecture
Intel 8088 (8086) Microprocessor Structure
Computer Organization and Assembly Language (COAL)
Computer System Overview
Intel 8088 (8086) Microprocessor Structure
CS 301 Fall 2002 Computer Organization
Interrupts.
8051 ASSEMBLY LANGUAGE PROGRAMMING
Computer Organization and Assembly Language
Part I Data Representation and 8086 Microprocessors
Presentation transcript:

Prof. Muhammad Saeed II

1/27/2015 Computer Architecture & Assembly Language 2

1/27/2015 Computer Architecture & Assembly Language 3  Number System  Binary  Octal  Hexa  Conversion into one another  Binary Operations  Addition, Subtraction and Multiplication  AND, OR, XOR  COMPLEMENT, TWO’s COMPLEMENT  Set and Reset Bits Fundamentals (recap)

1/27/2015 Computer Architecture & Assembly Language 4 Interrupts a signal to the processor emitted by hardware or software indicating an event that needs immediate attention state interrupt handlerISR An interrupt is a signal to the processor emitted by hardware or software indicating an event that needs immediate attention. An interrupt alerts the processor to a high-priority condition requiring the interruption of the current code the processor is executing. The processor responds by suspending its current activities, saving its state, and executing a function called an interrupt handler (or an interrupt service routine, ISR) to deal with the event. This interruption is temporary, and, after the interrupt handler finishes, the processor resumes normal activities.

1/27/2015 Computer Architecture & Assembly Language 5 Interrupt

Interrupts 1/27/2015 Computer Architecture & Assembly Language 6 TYPES Hardware interrupts Hardware interrupts are used by internal or external devices to communicate that they require attention from the operating system. Pressing a key on the keyboard or moving the mouse triggers hardware interrupts that cause the processor to read the keystroke or mouse position. Unlike the software type hardware interrupts are asynchronous and can occur in the middle of instruction execution. A software interrupt trap or exception divide-by-zero exception A software interrupt is caused either by an exceptional condition in the processor itself, or a special instruction in the instruction set which causes an interrupt when it is executed. The former is often called a trap or exception and is used for errors or events occurring during program. For example, if the processor's arithmetic logic unit is commanded to divide a number by zero, this impossible demand will cause a divide-by-zero exception. Computers often use software interrupt instructions to communicate with the device drivers.

1/27/2015 Computer Architecture & Assembly Language 7 Interrupts  Interrupt Service Routine (ISR) or Interrupt handler  Interrupt Service Routine (ISR) or Interrupt handler : Code used for handling a specific interrupt.  Interrupt priority: In systems with more than one interrupt inputs, some interrupts have a higher priority than other. They are serviced first if multiple interrupts are triggered simultaneously.  Interrupt vector: Code loaded on the bus by the interrupting device that contains the Address (segment and offset) of specific interrupt service routine.  Interrupt Masking  Interrupt Masking : Ignoring (disabling) an interrupt  Non-Maskable Interrupt (NMI)  Non-Maskable Interrupt (NMI) : Interrupt that cannot be ignored (power-down)

1/27/2015 Computer Architecture & Assembly Language 8 The Intel x86 Vector Interrupts  The processor uses the interrupt vector to determine the address of the ISR of the interrupting device.  The interrupt vector is a pointer to the Interrupt Vector Table.  The Interrupt Vector Table occupies the address range from 00000H to 003FFH (the first 1024 bytes in the memory map).  Each entry in the Interrupt Vector Table is 4 bytes long:  The first two represent the offset address and the last two the segment address of the ISR.  The first 5 vectors are reserved by Intel to be used by the processor.  The vectors 5 to 255 are free to be used by the user. 8088/8086 processor as well as 80386/80486/ Pentium etc. processors operating in Real Mode (16-bit operation)

1/27/2015 Computer Architecture & Assembly Language 9 Type-0 Type-1 Type-255 IP CS 003FFH The Intel x86 Vector Interrupts Interrupt Vector Table 8088/8086 processor as well as 80386/80486/ Pentium etc. processors operating in Real Mode (16-bit operation)

1/27/2015 Computer Architecture & Assembly Language 10 Interrupt Vector Table – Real Mode  Using the Interrupt Vector Table shown below, determine the address of the ISR of a device with interrupt vector 42H.  Answer: Address in table = 4 X 42H = 108H  Offset Low = [108] = 2A, Offset High = [109] = 33  Segment Low = [10A] = 3C,Segment High = [10B] = 4A  Address = 4A3C:332A = 4A3C A = 4D6EAH

1/27/2015 Computer Architecture & Assembly Language 11 The Intel x86 Vector Interrupts  The interrupt vector is a pointer to the Interrupt Descriptor Table.  The Interrupt Descriptor Table can be located anywhere in the memory.  Its starting address is pointed by the Interrupt Descriptor Table Register (IDTR).  Each entry in the Interrupt Vector Table is 8 bytes long:  Four bytes represent the 32-bit offset address, two the segment selector and the rest information such as the privilege level.  The first 32 vectors are reserved by Intel to be used by the processor.  The vectors 33 to 255 are free to be used by the user /80486/Pentium processors operating in Protected Mode (32-bit operation)

1/27/2015 Computer Architecture & Assembly Language 12 The Intel x86 Vector Interrupts

Access Levels 1/27/2015 Computer Architecture & Assembly Language 13

Language Fundamentals 1/27/2015 Computer Architecture & Assembly Language 14 †Identifiers An identifier is a programmer-chosen name. It might identify a variable, a constant, a procedure, or a code label. There are a few rules on how they can be formed: They may contain between 1 and 247 characters. They are not case sensitive. The first character must be a letter (A..Z, a..z), underscore ?, or $. Subsequent characters may also be digits. An identifier cannot be the same as an assembler reserved word.

1/27/2015 Computer Architecture & Assembly Language 15 Language Fundamentals † Data Types

1/27/2015 Computer Architecture & Assembly Language 16 Language Fundamentals †8088 Data Type Directives

1/27/2015 Computer Architecture & Assembly Language 17 †Label Language Fundamentals A label is an identifier that acts as a place marker for instructions and data. A label placed just before an instruction implies the instruction’s address. Similarly, a label placed just before a variable implies the variable’s address. There are two types of labels: Data labels and Code labels. A data label identifies the location of a variable, providing a convenient way to reference the variable in code. Data Label:a1 BYTE86 ( a1 is Data Label) Code Label:again: mov eax, 100h (again is Code Label)

1/27/2015 Computer Architecture & Assembly Language 18 Language Fundamentals †Directive And Instruction Directive instructs assembler how to assemble a program, in other word it is an instruction for the assembler whereas assembly Instruction is for the processor and it is converted to machine code. Directive is not converted to machine code. Directives do not execute at runtime, but they let you define variables, macros, and procedures. They can assign names to memory segments and perform many other housekeeping tasks related to the assembler. Directives: INCLUDE (INCLUDE windows.inc, INCLUDELIB windows.lib),.MODEL,.DATA,.CODE, WORD, etc.

1/27/2015 Computer Architecture & Assembly Language 19 Language Fundamentals †Defining Data a1BYTE86 a2BYTE‘K’ a3BYTE“Welcome to Dept. of Comp. Sc. & IT”,0 a4BYTE255 a5BYTE? a6SBYTE-128 a7SBYTE127 a8SBYTE 0, 20, 50, -25, 100 quoteBYTE“There are no tales” BYTE“ finer than those”, 0dh, 0ah BYTE“created by life itself”,0dh, oah,0

1/27/2015 Computer Architecture & Assembly Language 20 Language Fundamentals †Defining Data (ARRAYS) Array1 BYTE10 DUP(?) Array2WORD20DUP(0) Array3 BYTE10DUP(‘COMPUTER’)  Stack (.stack 1024)  Data(.data)  Code(.code) †Segments †Comments single line comment starts with “;” and the block comment is used as, COMMENT ! …….. ………………….. ! (! Character can be replaced by & etc.)

Language Fundamentals Stack is a memory array managed directly by the CPU, using the ESP register, known as the stack pointer register. In 32-bit mode, ESP register holds a 32-bit offset into some location on the stack. We rarely manipulate ESP directly; instead, it is indirectly modified by instructions such as CALL, RET, PUSH, and POP. †Stack Stack, after pushing and BeforeAfter

1/27/2015 Computer Architecture & Assembly Language 22 Fundamentals x86 processors x86 processors store and retrieve data from memory using little-endian order(low to high). The least significant byte is stored at the first memory address allocated for the data. The remaining bytes are stored in the next consecutive memory positions. The doubleword h is stored as given in the opposite figure. †Little-Endians †Big-Endians Some other computer systems use big-endian order (high to low). Figure on the right shows the same example of h stored in big-endian order

Memory Addressing 1/27/2015 Computer Architecture & Assembly Language 23

Language Fundamentals Data-Related Operators and Directives  The OFFSET operator returns the distance of a variable from the beginning of its enclosing segment.  The PTR operator lets you override an operand’s default size.  The TYPE operator returns the size (in bytes) of an operand or of each element in an array.  The LENGTHOF operator returns the number of elements in an array.  The SIZEOF operator returns the number of bytes used by an array initializer.  The LABEL directive provides a way to redefine the same variable with different size attributes.

1/27/2015 Computer Architecture & Assembly Language 25 Language Fundamentals The Carry flag indicates unsigned integer overflow. For example, if an instruction has an 8-bit destination operand but the instruction generates a result larger than binary, the Carry flag is set. The Overflow flag indicates signed integer overflow. For example, if an instruction has a 16-bit destination operand but it generates a negative result smaller than 32,768 decimal, the Overflow flag is set. The Zero flag indicates that an operation produced zero. For example, if an operand is subtracted from another of equal value, the Zero flag is set. The Sign flag indicates that an operation produced a negative result. If the most significant bit (MSB) of the destination operand is set, the Sign flag is set. The Parity flag indicates whether or not an even number of 1 bits occurs in the least significant byte of the destination operand, immediately after an arithmetic or boolean instruction has executed. The Auxiliary Carry flag is set when a 1 bit carries out of position 3 in the least significant byte of the destination operand. †FLAGS

END