8.4 Instruction Execution Times - 8088 TOBIN PROC FAR SUB AX,AX MOV DX,AX MOV CX,4 NEXTD: PUSH CX SUB BP,BP MOV CX,4 GETNUM: RCL BX,1 RCL BP,1 LOOP GETNUM.

Slides:



Advertisements
Similar presentations
10-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL Subroutine and Interrupt.
Advertisements

University of Tehran 1 Microprocessor System Design Interrupt Omid Fatemi
More about procedures and Video Processing. Lesson plan Review existing concepts More about procedures and boolean expression Video processing.
Video systems (continue). Practice Modify the program to get a string from a keyboard to display the input string on the middle of the screen with reverse.
Lecture 6 Machine Code: How the CPU is programmed.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#4)
Set 20 Interrupts. INTERRUPTS The Pentium has a mechanism whereby external devices can interrupt it. Devices such as the keyboard, the monitor, hard disks.
IP high IP low IP high IP low BP high BP low IP high IP low BP high BP low FL high FL low CS high CS low IP high IP low _TEXTsegment byte public ‘CODE’
Interrupt Processing Haibo Wang ECE Department
Kip Irvine: Assembly Language for Intel-Based Computers Overview Stack Operations (PUSH and POP) Procedures Procedure Parameters Software Interrupts MS-DOS.
Kip Irvine: Assembly Language for Intel-Based Computers
8.6 Multitasking User 1 PP User 2 User 3 User 4 User 1 User 2 User 3 User 4 User 1 User 2 User 3 User 4 User 1 User 2 User 3 User 4... time the time.
Microcomputer & Interfacing Lecture 3
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#6)
ICS312 Set 4 Program Structure. Outline for a SMALL Model Program Note the quiz at the next lecture will be to reproduce this slide.MODEL SMALL.586 ;
Micro-Computer Applications: Procedures & Interrupts Dr. Eng. Amr T. Abdel-Hamid ELECT 707 Fall 2011.
Lab 5 Part C Write to the screen a character string that uses a ‘$’ to indicate the end of the string. Do not write the ‘$’ to the screen. Use DOS Interrupt.
Lecture 11 Last notes on interrupts and exam review Dr. Dimitrios S. Nikolopoulos CSL/UIUC.
Stack Operations LIFO structure (last-in,first-out) –The last value put into the stack is the first value taken out Runtime stack –A memory array that.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
BIOS and DOS Programming in DOS INT 10 and 21H. Interrupts There are some extremely useful subroutines within BIOS or DOS that are available to the user.
Multiplication and Division Instructions & the 0Ah function.
Strings, Procedures and Macros
Binary Number Output To display a number in binary format, a program looks at each bit in the number and sends the ASCII equivalent of a ‘1’ (31h) or a.
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#9) By Dr. Syed Noman.
Video systems. Lesson plan Review the code for the previous exercise Video systems Review for midterm exam.
Writing and using procedures
21/11/2005CAP2411 Input & Output Instructions CPU communicates with the peripherals through I/O registers called I/O ports. There are 2 instructions, IN.
Chapter 8 Advanced Programming Applications Objectives: Linking separate object files together Creating and using an object code library Predicting the.
Click to add Title Comunicación y Gerencia Click To add Subtitle Click to add Text Fundamentals of Assembly Language.
Assembly Language. Symbol Table Variables.DATA var DW 0 sum DD 0 array TIMES 10 DW 0 message DB ’ Welcome ’,0 char1 DB ? Symbol Table Name Offset var.
ICS 312 SET 10 Multiplication & Division & input using function 0Ah.
BIOS and DOS Interrupts Basic Input /Outpu System Disk Operating System.
Calling Procedures C calling conventions. Outline Procedures Procedure call mechanism Passing parameters Local variable storage C-Style procedures Recursion.
Assembly Language Lecture 2. Lecture Outline Program Structure Memory models Data Segment Stack Segment Code Segment Input and Output Instructions INT.
Computer and Information Sciences College / Computer Science Department CS 206 D Computer Organization and Assembly Language.
File Operations. FILE PROCESSING For the purposes of the following discussion, reading means copying all or part of an existing file into memory Writing.
Stack Operations Dr. Hadi AL Saadi.
Assembly language programming
Instruction set Architecture
Format of Assembly language
1st prog! Q: Read a char – from a keyboard & display it at the beginning of the next line! ====== A.
Microprocessor and Assembly Language
Instruksi Set Prosesor 8088
Microprocessor and Assembly Language
Lecture 4 Control Flow Structures (LOOPS)
Assembly Language Programming Part 2
(The Stack and Procedures)
Defining Types of data expression Dn [name] expression Dn [name]
Symbolic Instruction and Addressing
4.4 Bit Manipulation Instructions
Stack and Subroutines Module M17.1 Section 11.2.
8086 Registers Module M14.2 Sections 9.2, 10.1.
Microprocessor Lab CSL1543 0:0:2
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
(Array and Addressing Modes)
(The Stack and Procedures)
Symbolic Instruction and Addressing
(Array and Addressing Modes)
Morgan Kaufmann Publishers Computer Organization and Assembly Language
UNIT-II Assembly Language Programs Involving Logical
Chapter 6 –Symbolic Instruction and Addressing
(The Stack and Procedures)
By Nasser Halasa Assembly Language.
Chapter 8: Instruction Set 8086 CPU Architecture
Microprocessor and Assembly Language
(Array and Addressing Modes)
Procedures and Macros.
Presentation transcript:

8.4 Instruction Execution Times TOBIN PROC FAR SUB AX,AX MOV DX,AX MOV CX,4 NEXTD: PUSH CX SUB BP,BP MOV CX,4 GETNUM: RCL BX,1 RCL BP,1 LOOP GETNUM MOV CX,10 MUL CX ADD AX,BP POP CX LOOP NEXTD RET TOBIN ENDP /5 2 17/5 Overhead cycles: instructions performed once. Outer-loop cycles: instructions performed four times. Inner-loop cycles: instructions performed sixteen times. Clock cycles needed for the instruction itself. Four additional clock cycles needed for each memory access. Variable execution time: depends on operands’ value. Cannot be precisely known at assembling time. Variable execution time: depends on jump condition: Greater time corresponds to performing the jump. Lower time when jump is not performed (next instruction is already in instruction queue) first three times last time (loop not performed) 21 first three times 9 last time (loop not performed) Worse case total time = 35+4*(183+4*(21)-12)-12 = 1043 clock cycles.

8.4 Instruction Execution Times - Pentium TOBIN PROC FAR SUB AX,AX MOV DX,AX MOC CX,4 NEXTD: PUSH CX SUB BP,BP MOV CX,4 GETNUM: RCL BX,1 RCL BP,1 LOOP GETNUM MOV CX,10 MUL CX ADD AX,BP POP CX LOOP NEXTD RET TOBIN ENDP /6 1 5/6 Overhead cycles: instructions performed once. Outer-loop cycles: instructions performed four times. Inner-loop cycles: instructions performed sixteen times. Clock cycles needed for the instruction itself (most instructions 1 cycle). No additional clock cycles needed for each memory access. MUL is performed in a constant time Variable execution time: depends on jump condition: Lower time corresponds to performing the jump. (usually a backward jump at a location in queue) Higher time when jump is not performed 5 22 first three times 23 last time (loop not performed) 7 first three times 8 last time (loop not performed) Total time = 5+4*(22+4*(7)+1)+1 = 210 clock cycles.

8.5 Working with Interrupt Vectors DOS INT 21, function 35H: Get interrupt vector Specification: returns the ISR’s (Interrupt Service Routine) address for a given interrupt. Input: AH = 35 (function code), AL = the interrupt number (type) DOS INT 21, function 25H: Set interrupt vector Specification: replaces the ISR’s (Interrupt Service Routine) address for a given interrupt. Warning: modifying an ISR’s address in the Interrupt Pointer Table, sends the program execution to this new address every time the corresponding interrupt is acknowledged (hardware or software). This could modify the response of your computer to external or internal events. If the “routine” found at the new address is not able to perform the desired job and to return properly to the interrupted program, (releasing a correct number of stack locations and performing an IRET), the system could crash. You cannot know exactly when the “modified” interrupt is acknowledged. Restarting (resetting) your computer will restore the original interrupt pointer table. Output: BX = interrupt handler IP address, ES = interrupt handler CS address Input: AH = 25 (function code), AL = the interrupt number (type) DX = new interrupt handler IP address, DS = new interrupt handler CS address

8.5 Working with Interrupt Vectors ;Program VECTORS.ASM: View entire IPT..MODEL SMALL.DATA WMSG DB 0DH,0AH,'Hit any key to continue...’ DB 0DH,0AH,0DH,0AH,'$'.CODE.STARTUP SUB AL,AL ;begin with vector 0 NEWV: PUSH AX ;save vector number CALL DISPHEX ;display it MOV DL,' ' ;load blank character MOV AH,2 ;display character function INT 21H ;DOS call MOV DL,'=' ;load equal sign INT 21H ;and output MOV DL,' ' ;load another blank INT 21H ;and output POP AX ;get vector number back PUSH AX ;and save it again MOV AH,35H ;get interrupt vector function INT 21H ;DOS call MOV AX,ES ;get interrupt segment CALL DISPHEX_16 ;display it MOV DL,':' ;load colon character MOV AH,2 ;display character function INT 21H ;DOS call MOV AX,BX ;get interrupt offset CALL DISPHEX_16 ;display it MOV DL,' ' ;load blank character MOV AH,2 ;display character function INT 21H ;DOS call INT 21H ;output a second blank POP AX ;get vector number back MOV DL,AL ;make a copy of it AND DL,3 ;should we output a new line? CMP DL,3 JNZ NNL PUSH AX ;save vector number MOV DL,0DH ;load carriage return MOV AH,2 ;display character function INT 21H ;DOS call MOV DL,0AH ;also output a line feed INT 21H POP AX ;get vector number back NNL: MOV DL,AL ;make copy of vector number CMP DL,255 ;finished? JZ NNP AND DL,63 ;should we pause here? CMP DL,63 JNZ NNP PUSH AX ;save vector number LEA DX,WMSG ;set up pointer to pause message MOV AH,9 ;display string function INT 21H ;DOS call MOV AH,8 ;character input function INT 21H ;DOS call POP AX ;get vector number back NNP: INC AL ;advance to next vector CMP AL,0 ;did we wrap from 255 to 0? JNZ NEWV.EXIT

DISPHEX_16 PROC NEAR PUSH AX ;save number MOV AL,AH ;load upper byte CALL DISPHEX ;go display in hex POP AX ;get number back CALL DISPHEX ;go display lower byte RET DISPHEX_16 ENDP DISPHEX PROC NEAR PUSH AX ;save number SHR AL,1 ;get upper nybble SHR AL,1 CALL HEXOUT ;display hex character POP AX ;get number back AND AL,0FH ;preserve lower nybble CALL HEXOUT ;display hex character RET DISPHEX ENDP HEXOUT PROC NEAR CMP AL,10 ;is AL greater than 10? JC NHA1 ;yes ADD AL,7 ;no, add alpha bias NHA1: ADD AL,30H ;add ASCII bias MOV DL,AL ;load output character MOV AH,2 ;display character function INT 21H ;DOS call RET HEXOUT ENDP END 8.5 Working with Interrupt Vectors