Microprocessor and Assembly Language

Slides:



Advertisements
Similar presentations
Computer Architecture
Advertisements

10-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL Subroutine and Interrupt.
University of Tehran 1 Microprocessor System Design Interrupt Omid Fatemi
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#3) By Dr. Syed Noman.
Unit 4 Chapter-1 Multitasking. The Task State Segment.
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.
LOGO Chapter 1 Interrupt handling. hardware interrupt Under x86, hardware interrupts are called IRQ's. When the CPU receives an interrupt, it stops whatever.
CS2422 Assembly Language & System Programming November 2, 2006.
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.
Introduction to Interrupts
Introduction to Computer Engineering by Richard E. Haskell Interrupts Module M17.3 Sections 11.3, 14.1.
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.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Chapter 2: Computer-System Structures 2.1 Computer System Operation 2.5 Hardware Protection 2.6 Network Structure.
Microprocessors 1 MCS-51 Interrupts.
CHAPTER 6 INTERRUPTS AND THE 8259 CHIP. What happens on interrupt? Micro automatically saves (on stack) the FR (flag register), IP (instruction pointer),
CSNB374: Microprocessor Systems Chapter 5: Procedures and Interrupts.
Functions/Methods in Assembly
EEL 3801 Part IV The Assembler. OFFSET Operator Returns address of variable used as operand. Actually, it represents the offset from the beginning of.
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
BIOS and DOS Interrupts Basic Input /Outpu System Disk Operating System.
Assembly Language Lecture 2. Lecture Outline Program Structure Memory models Data Segment Stack Segment Code Segment Input and Output Instructions INT.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edit9on Lecture 3 Chapter 1: Introduction Provided & Updated by Sameer Akram.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
7-Nov Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Oct lecture23-24-hll-interrupts 1 High Level Language vs. Assembly.
1 Interrupts A Course in Microprocessor Electrical Engineering Dept. University of Indonesia.
OPERATING SYSTEM CONCEPT AND PRACTISE
Instruction set Architecture
1st prog! Q: Read a char – from a keyboard & display it at the beginning of the next line! ====== A.
MICROPROCESSOR BASED SYSTEM DESIGN
CS501 Advanced Computer Architecture
Microprocessor and Assembly Language
Microprocessor Systems Design I
UNIT – Microcontroller.
Anton Burtsev February, 2017
Interrupts In 8085 and 8086.
Unit - 1 Interrupts M.Brindha AP/EIE
Computer Organization & Assembly Language Chapter 3
Computer Organization And Assembly Language
Instruksi Set Prosesor 8088
Microprocessor and Assembly Language
Microprocessor and Assembly Language
Microprocessor and Assembly Language
CS-401 Compute Architecture & Assembly Language Programming
8085 Interrupts.
University of Gujrat Department of Computer Science
Microprocessor and Assembly Language
Microprocessor and Assembly Language
Microprocessor and Assembly Language
Symbolic Instruction and Addressing
The slides must be understood in Lecture 5
Microprocessor and Assembly Language
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 process.
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
Microprocessor and Assembly Language
Accessing Services Through Interrupts
Symbolic Instruction and Addressing
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Operating Systems Lecture 3.
CNET 315 Microprocessor & Assembly Language
CS-401 Assembly Language Programming
Microprocessor and Assembly Language
Chapter 6 –Symbolic Instruction and Addressing
CS501 Advanced Computer Architecture
COMP3221: Microprocessors and Embedded Systems
Part I Data Representation and 8086 Microprocessors
Presentation transcript:

Microprocessor and Assembly Language Lecture-12-Animation with Timer Interrupt Muhammad Hafeez Department of Computer Science GC University Lahore

Today’s Agenda User Interrupt Procedures Animation using Timer Interrupt

Moving Objects in a Game Game’s objects can be moved by displaying an object, erasing it and then displaying it at another new place CPU speed it fast that we cannot see the movement of object or cannot produce appropriate delays One way to approach this kind of task is to write loops Can you write one ?

User Interrupt Procedure A better approach is to write a routine for BIOS INT 1CH that is called by another BIOS INT 08h that is triggered by hardware and ticked by a timer circuit on your IBM machine every 18.2 seconds. INT 08H always executes INT 1CH instructions before it returns (IRET) Never overwrite existing ISR of 1CH with your own code, it will crash the system However, there is a way…

User Interrupt Procedure A better approach is to write a routine for BIOS INT 1CH that is called by another BIOS INT 08h that is triggered by hardware and ticked by a timer circuit on your IBM machine every 18.2 seconds. INT 08H always executes INT 1CH instructions before it returns (IRET) Never write code on existing ISR as it will crash the system However, Interrupt Procedure can be written while saving the existing ISR address from vector table and then load IVT with user interrupt procedure

User Interrupt Procedure How can we store the existing address of interrupt??

Get Interrupt Vector Obtain interrupt vector from vector table INPUT: AH = 35H AL = INTERRUPT NUMBER OUTPUT: ES:BX (INTERRUPT VECTOR)

Set Interrupt Vector Store interrupt vector into vector table INPUT: AH = 25H AL = INTERRUPT NUMBER DS:DX INTERRUPT VECTOR OUTPUT: NONE

Writing user Interrupt Procedure We can write the code for user interrupt in a separate procedure This procedure must end with IRET instead of RET instruction As this interrupt procedure will be called using IVT so it does not know the location of Data Segment (DS) Hence, if any variable needs to be used in this user interrupt procedure the DS needs to be set before using that variable

Call User Interrupt Procedure in User Program User interrupt procedure that is a function written in user current code segment needs to loaded in IVT For that we have to have IP and CS of under interrupt procedure to be replaced in IVT

Seg and Offset Pseudo-ops It has been used as to get the offset address of data segment variable, it can also be used to get offset address of procedure where the code is written SEG: This pseudo-op can be used to get segment address of user procedure

Seg and Offset Pseudo-ops It has been used as to get the offset address of data segment variable, it can also be used to get offset address of procedure where the code is written SEG: This pseudo-op can be used to get segment address of user procedure