11
Most read
14
Most read
15
Most read
1
CONTENTS
 Interrupt
 Interrupts in 8086
 CPU’s ‘Fetch-Execute’ cycle
 The operation of an interrupt sequence on 8086
 Mouse features
      Pixel
      Mouse pointer
      Mickey
 Interrupt Vector Table(IVT)
 IVT Format
 Mouse functions

                                                   2
INTERRUPT
 In computing an interrupt is an asynchronous signal indicating the
  need for attention.

 Interrupts are a commonly used technique for computer multitasking,
  Such a system is said to be interrupt driven.

 An act of interrupting is referred to as an interrupt request (IRQ).

 The part of a program that deals with the interrupt is referred to as an
  service routine (ISR) or interrupt handler.




                                                                             3
Interrupts in 8086
An 8086 Interrupt can come from any of three sources.

Hardware Interrupt

• External interrupt applied to non-maskable interrupt NMI.
        Interrupt response cannot be disabled ( masked) by
        any program instruction.

• External interrupt applied to maskable interrupt INTR.

Software Interrupt

• Execution of INT instruction.




                                                              4
CPU’s ‘Fetch-Execute’ Cycle
           Fetch instruction at IP


       Decode the fetched instruction          Save context

                                               Get INTR ID
       Execute the decoded instruction
                                               Lookup ISR
       Advance IP to next instruction
                                               Execute ISR


                 Interrupt?              yes        IRET

                  no
                                                              5
The Operation of an Interrupt sequence on
the 8086 Microprocessor:
1. External interface sends an interrupt signal, to the Interrupt Request
   (INTR) pin, or an internal interrupt occurs.

2. The CPU finishes the present instruction (for a hardware interrupt) and

  sends Interrupt Acknowledge (INTA) to hardware interface.

3. The interrupt type N is sent to the Central Processor Unit (CPU) via the

   Data bus from the hardware interface.

4. The contents of the flag registers are pushed onto the stack.

5. Both the interrupt (IF) and (TF) flags are cleared. This disables the INTR
  pin and the trap or single-step feature.


                                                                              6
Interrupt sequence contd…
6. The contents of the code segment register (CS) are pushed onto the

    Stack.

7. The contents of the instruction pointer (IP) are pushed onto the Stack.

8. The interrupt vector contents are fetched, from (4 x N) and then placed

   into the IP and from (4 x N +2) into the CS so that the next instruction

   executes at the interrupt service procedure addressed by the interrupt

   vector.

9. While returning from the interrupt-service routine by the Interrupt
  Return(IRET) instruction, the IP, CS and Flag registers are popped from
  the Stack and return to their state prior to the interrupt.

                                                                             7
Interfacing with mouse
 Second primary input devices used is the mouse.

 It has a greater flexibility and movement.

 Mouse system consist of the mouse and the mouse driver.

 Mouse driver is the memory resident program that provides
  communication between the mouse and the computer.

 Mouse driver maintains the cursor position of the mouse and the status
  of the mouse buttons.




                                                                           8
Mouse Features
Pixel:
 A pixel or pel (picture element) is a single point in a raster image, or
  the smallest addressable screen element in a display device.

 It is the smallest unit of picture that can be represented or controlled.

 Each pixel has its own address.

 The address of a pixel corresponds to its coordinates.

 Pixels are normally arranged in a two-dimensional grid and are often
  represented using dots or squares.

 Each pixel is a sample of an original image. More samples typically
  provide more accurate representations of the original image.

                                                                              9
Mouse Features
Mouse pointer:
 A mouse pointer, or a cursor, is a visible indicator displayed on a
  computer screen.

 By moving the mouse, the computer's user can move the mouse
  pointer around the screen.

 The mouse pointer located on the screen can determine how and
  where the user can press a button on the mouse to input text or execute
  a command.




                                                                            10
Mouse Features
Mickey:

 A unit of measure for movement of the mouse, approximately 1/200 of an
  inch.

 A mickey is a unit of measurement for the speed and

  movement direction of a computer mouse.

 The speed of the mouse is the ratio between how many pixels the cursor
  moves on the screen and how many centimeters you move the mouse on
  the mouse pad.



                                                                           11
Interrupt Vector Table – IVT (in memory)

 x86 has 256 interrupts, specified by Type Number or Vector.

 1 byte of data must accompany each interrupt(specifies Type).

 Vector is a pointer (address) into Interrupt Vector Table (IVT).

     - IVT is stored in memory from 0000:0000 to 0000:03ffh

     - IVT contains 256 far pointer values (addresses)

     - Far pointer is CS:IP values

 Each far pointer is address of Interrupt Service Routine (ISR).

     - Also referred to as Interrupt Handler.


                                                                     12
IVT Format
0000:0000
0000:0001
             Offset
0000:0002
                        Interrupt 0                    IP LSB

0000:0003
            Segment                                    IP MSB

0000:0004                                              CS LSB

0000:0005
             Offset                                    CS MSB
                        Interrupt 1
0000:0006
0000:0007
            Segment


                                        Given a Vector, where is the
                                        ISR address stored in memory ?


                                              Offset     Type 4
0000:03fc
0000:03fd
             Offset                       Example:int 36h
0000:03fe
                        Interrupt 255
            Segment                       Offset = (54 4) = 216
0000:03ff
                                                = 00d8h
Mouse functions
 We can access the cursor position and the button status with interrupt
  33h.

 The mouse driver has several functions by specifying the function
  number in the AX register when calling interrupt 33h.

 Some of the functions are

         0- Resets the mouse and retrieves the mouse status.

         1- Displays the mouse cursor

         2- Hides the mouse cursor.

         3- Retrieves the mouse cursor positioned the status of
  the mouse buttons.

                                                                           14
Mouse functions contd…
Initializing the mouse:

 To be able to use the mouse it must be first tested whether it is present
  or not.

         int 33h
         mov ax,00
         int 33h
         mov result,ax


 Using int 33h is the necessary first step toward using the mouse.

 If this service returns a non-zero value, the mouse is initialized.

  Otherwise, the mouse cannot be used.


                                                                              15
Mouse functions contd…
Display mouse cursor:


 Initializing the mouse does not display the mouse cursor.
 A function that initialize the mouse and returns the result.

 Int 33h service 1 – display mouse cursor.



         mov ax,01h

         int 33h



   At this point ,the mouse system is active and the cursor has appeared
    on the screen.
                                                                        16
Mouse functions contd…

Hide mouse cursor:


 If the cursor is already off, it stays off (int 33h service 2).

 The very important reason for hiding the mouse cursor , as the mouse
  cursor moves over the screen,the mouse driver software reads the
  character at the preset position before it displays the mouse cursor.


         mov ax,02h
         int 33h




                                                                          17
Mouse functions contd…
Mouse buttons:
 It is also possible to read right and left button information from the mouse int
  33h service 3.

Getting mouse information:
 Int 33h service 3 set AX=3 .This will return

        BX            meaning
         0     No button down
          1        Left button down
         2      Right button down
         3      Both the buttons down
 CX = current mouse cursor column.

 DX= current mouse cursor row.

                                                                                     18
Mouse functions contd…
         Mov ax, 03h
         Int 33h
         Mov button, bx
         Mov row, dx
         Mov col, cx


 This service 3, returns information in bx, dx, and cx.

 bx indicates which button(s) are down.

 This service also returns the current row and column of the mouse
  cursor in dx and cx, respectively.




                                                                      19
THANK YOU




            20

More Related Content

PPTX
Hardwired control
PDF
Vlsi lab viva question with answers
PDF
Lecture 16 KL Transform in Image Processing
PPTX
Interfacing with peripherals: analog to digital converters and digital to ana...
PPTX
Chapter 5: Cominational Logic with MSI and LSI
PPTX
Sampling theorem
PPTX
Arduino and its hw architecture
PPT
Encoder, decoder, multiplexers and demultiplexers
Hardwired control
Vlsi lab viva question with answers
Lecture 16 KL Transform in Image Processing
Interfacing with peripherals: analog to digital converters and digital to ana...
Chapter 5: Cominational Logic with MSI and LSI
Sampling theorem
Arduino and its hw architecture
Encoder, decoder, multiplexers and demultiplexers

What's hot (20)

PPT
Time delays & counter.ppt
PPT
BCD,GRAY and EXCESS 3 codes
PPTX
ARM Exception and interrupts
PPT
decoder and encoder
PPTX
Unsigned multiplication
PDF
Arm instruction set
PDF
2.2 frequency division multiple access
PPT
Image Sensing & Acquisition
PPTX
Architecture of 16C6X
PDF
Digital Image Processing - Image Compression
PPT
PDF
8051 Timers / Counters
PPT
Multiplexers & Demultiplexers
PPTX
Image Restoration (Order Statistics Filters)
PDF
Wallace tree multiplier
PPT
Multipliers in VLSI
PPT
ISI and Pulse shaping.ppt
PPTX
Tuned amplifire
PPT
8086 microprocessor assembler directives.ppt
PPTX
quine mc cluskey method
Time delays & counter.ppt
BCD,GRAY and EXCESS 3 codes
ARM Exception and interrupts
decoder and encoder
Unsigned multiplication
Arm instruction set
2.2 frequency division multiple access
Image Sensing & Acquisition
Architecture of 16C6X
Digital Image Processing - Image Compression
8051 Timers / Counters
Multiplexers & Demultiplexers
Image Restoration (Order Statistics Filters)
Wallace tree multiplier
Multipliers in VLSI
ISI and Pulse shaping.ppt
Tuned amplifire
8086 microprocessor assembler directives.ppt
quine mc cluskey method
Ad

Viewers also liked (20)

PPTX
INTERRUPTS OF 8086 MICROPROCESSOR
PDF
Interrupt
PPS
Interrupts
PPTX
37471656 interrupts
PPTX
Interrupts on 8086 microprocessor by vijay kumar.k
DOCX
Mouse programming in c
PPT
Computer system
PDF
Instruction, interrupts & io processing
PPT
Presentation on
PPTX
Fit unit 2 interrupts
PPT
13 superscalar
PPT
63071507 interrupts-up
PDF
Handling Interrupts in Microchip MCUs
PPTX
INTEL’S MMX TECHNOLOGY FOR ENHANCED PROCESSOR
PPT
Intel processors
PPT
System quality attributes
PDF
Superscalar processors
INTERRUPTS OF 8086 MICROPROCESSOR
Interrupt
Interrupts
37471656 interrupts
Interrupts on 8086 microprocessor by vijay kumar.k
Mouse programming in c
Computer system
Instruction, interrupts & io processing
Presentation on
Fit unit 2 interrupts
13 superscalar
63071507 interrupts-up
Handling Interrupts in Microchip MCUs
INTEL’S MMX TECHNOLOGY FOR ENHANCED PROCESSOR
Intel processors
System quality attributes
Superscalar processors
Ad

Similar to Mouse interrupts (Assembly Language & C) (20)

PPTX
IVT-mpmc material used to leaern mpmc and micro
DOCX
Customizable Microprocessor design on Nexys 3 Spartan FPGA Board
DOCX
Gesture Controlled Car_Project report
PDF
How Triton can help to reverse virtual machine based software protections
PPTX
3.12_8086 microprocessor Interrupts.pptx
PPTX
Space mouse
PPTX
Interrupt in ATMEGA328P.pptx
PDF
MicroprocessorMicroprocessorMicroprocessor
PPTX
LECTURE_8 Interrupts.pptx hello and thanks for the University of
PPTX
Introduction to 8085 Microprocessor
PPT
lesson24.ppt
DOC
Linux interrupts
PPTX
Interrupts of 8085
PPTX
Interrupts programming in embedded C using 8051
PDF
Advanced Microprocessors
PDF
[Ruxcon 2011] Post Memory Corruption Memory Analysis
PPTX
Coa INTERUPT
PPTX
Interrupts
PPTX
8086 Interrupts & With DOS and BIOS by vijay
PPTX
Embedded systems and robotics by scmandota
IVT-mpmc material used to leaern mpmc and micro
Customizable Microprocessor design on Nexys 3 Spartan FPGA Board
Gesture Controlled Car_Project report
How Triton can help to reverse virtual machine based software protections
3.12_8086 microprocessor Interrupts.pptx
Space mouse
Interrupt in ATMEGA328P.pptx
MicroprocessorMicroprocessorMicroprocessor
LECTURE_8 Interrupts.pptx hello and thanks for the University of
Introduction to 8085 Microprocessor
lesson24.ppt
Linux interrupts
Interrupts of 8085
Interrupts programming in embedded C using 8051
Advanced Microprocessors
[Ruxcon 2011] Post Memory Corruption Memory Analysis
Coa INTERUPT
Interrupts
8086 Interrupts & With DOS and BIOS by vijay
Embedded systems and robotics by scmandota

More from Tech_MX (20)

PPTX
Virtual base class
PPTX
Uid
PPTX
Theory of estimation
PPTX
Templates in C++
PPT
String & its application
PPTX
Statistical quality__control_2
PPTX
Stack data structure
PPT
Stack Data Structure & It's Application
PPTX
Spss
PPTX
Spanning trees & applications
PPTX
Set data structure 2
PPTX
Set data structure
PPTX
Real time Operating System
PPTX
Parsing
PPT
Motherboard of a pc
PPTX
More on Lex
PPTX
MultiMedia dbms
PPTX
Merging files (Data Structure)
PPTX
Memory dbms
PPTX
Linkers
Virtual base class
Uid
Theory of estimation
Templates in C++
String & its application
Statistical quality__control_2
Stack data structure
Stack Data Structure & It's Application
Spss
Spanning trees & applications
Set data structure 2
Set data structure
Real time Operating System
Parsing
Motherboard of a pc
More on Lex
MultiMedia dbms
Merging files (Data Structure)
Memory dbms
Linkers

Recently uploaded (20)

PPTX
Ppt obs emergecy.pptxydirnbduejguxjjdjidjdbuc
PPTX
GW4 BioMed Candidate Support Webinar 2025
PDF
English 2nd semesteNotesh biology biopsy results from the other day and I jus...
PDF
LATAM’s Top EdTech Innovators Transforming Learning in 2025.pdf
PDF
GIÁO ÁN TIẾNG ANH 7 GLOBAL SUCCESS (CẢ NĂM) THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌ...
PDF
Horaris_Grups_25-26_Definitiu_15_07_25.pdf
PDF
HSE 2022-2023.pdf الصحه والسلامه هندسه نفط
PPTX
UCSP Section A - Human Cultural Variations,Social Differences,social ChangeCo...
PDF
Chevening Scholarship Application and Interview Preparation Guide
PDF
BSc-Zoology-02Sem-DrVijay-Comparative anatomy of vertebrates.pdf
PPTX
ENGlishGrade8_Quarter2_WEEK1_LESSON1.pptx
PPTX
INTRODUCTION TO PHILOSOPHY FULL SEM - COMPLETE.pptxINTRODUCTION TO PHILOSOPHY...
PPTX
PAIN PATHWAY & MANAGEMENT OF ACUTE AND CHRONIC PAIN SPEAKER: Dr. Rajasekhar ...
PDF
IS1343_2012...........................pdf
PPTX
Chapter-4-Rizal-Higher-Education-1-2_081545.pptx
PPSX
namma_kalvi_12th_botany_chapter_9_ppt.ppsx
PPTX
climate change of delhi impacts on climate and there effects
PDF
GSA-Past-Papers-2010-2024-2.pdf CSS examination
PPT
hsl powerpoint resource goyloveh feb 07.ppt
PDF
FAMILY PLANNING (preventative and social medicine pdf)
Ppt obs emergecy.pptxydirnbduejguxjjdjidjdbuc
GW4 BioMed Candidate Support Webinar 2025
English 2nd semesteNotesh biology biopsy results from the other day and I jus...
LATAM’s Top EdTech Innovators Transforming Learning in 2025.pdf
GIÁO ÁN TIẾNG ANH 7 GLOBAL SUCCESS (CẢ NĂM) THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌ...
Horaris_Grups_25-26_Definitiu_15_07_25.pdf
HSE 2022-2023.pdf الصحه والسلامه هندسه نفط
UCSP Section A - Human Cultural Variations,Social Differences,social ChangeCo...
Chevening Scholarship Application and Interview Preparation Guide
BSc-Zoology-02Sem-DrVijay-Comparative anatomy of vertebrates.pdf
ENGlishGrade8_Quarter2_WEEK1_LESSON1.pptx
INTRODUCTION TO PHILOSOPHY FULL SEM - COMPLETE.pptxINTRODUCTION TO PHILOSOPHY...
PAIN PATHWAY & MANAGEMENT OF ACUTE AND CHRONIC PAIN SPEAKER: Dr. Rajasekhar ...
IS1343_2012...........................pdf
Chapter-4-Rizal-Higher-Education-1-2_081545.pptx
namma_kalvi_12th_botany_chapter_9_ppt.ppsx
climate change of delhi impacts on climate and there effects
GSA-Past-Papers-2010-2024-2.pdf CSS examination
hsl powerpoint resource goyloveh feb 07.ppt
FAMILY PLANNING (preventative and social medicine pdf)

Mouse interrupts (Assembly Language & C)

  • 1. 1
  • 2. CONTENTS  Interrupt  Interrupts in 8086  CPU’s ‘Fetch-Execute’ cycle  The operation of an interrupt sequence on 8086  Mouse features  Pixel  Mouse pointer  Mickey  Interrupt Vector Table(IVT)  IVT Format  Mouse functions 2
  • 3. INTERRUPT  In computing an interrupt is an asynchronous signal indicating the need for attention.  Interrupts are a commonly used technique for computer multitasking, Such a system is said to be interrupt driven.  An act of interrupting is referred to as an interrupt request (IRQ).  The part of a program that deals with the interrupt is referred to as an service routine (ISR) or interrupt handler. 3
  • 4. Interrupts in 8086 An 8086 Interrupt can come from any of three sources. Hardware Interrupt • External interrupt applied to non-maskable interrupt NMI. Interrupt response cannot be disabled ( masked) by any program instruction. • External interrupt applied to maskable interrupt INTR. Software Interrupt • Execution of INT instruction. 4
  • 5. CPU’s ‘Fetch-Execute’ Cycle Fetch instruction at IP Decode the fetched instruction Save context Get INTR ID Execute the decoded instruction Lookup ISR Advance IP to next instruction Execute ISR Interrupt? yes IRET no 5
  • 6. The Operation of an Interrupt sequence on the 8086 Microprocessor: 1. External interface sends an interrupt signal, to the Interrupt Request (INTR) pin, or an internal interrupt occurs. 2. The CPU finishes the present instruction (for a hardware interrupt) and sends Interrupt Acknowledge (INTA) to hardware interface. 3. The interrupt type N is sent to the Central Processor Unit (CPU) via the Data bus from the hardware interface. 4. The contents of the flag registers are pushed onto the stack. 5. Both the interrupt (IF) and (TF) flags are cleared. This disables the INTR pin and the trap or single-step feature. 6
  • 7. Interrupt sequence contd… 6. The contents of the code segment register (CS) are pushed onto the Stack. 7. The contents of the instruction pointer (IP) are pushed onto the Stack. 8. The interrupt vector contents are fetched, from (4 x N) and then placed into the IP and from (4 x N +2) into the CS so that the next instruction executes at the interrupt service procedure addressed by the interrupt vector. 9. While returning from the interrupt-service routine by the Interrupt Return(IRET) instruction, the IP, CS and Flag registers are popped from the Stack and return to their state prior to the interrupt. 7
  • 8. Interfacing with mouse  Second primary input devices used is the mouse.  It has a greater flexibility and movement.  Mouse system consist of the mouse and the mouse driver.  Mouse driver is the memory resident program that provides communication between the mouse and the computer.  Mouse driver maintains the cursor position of the mouse and the status of the mouse buttons. 8
  • 9. Mouse Features Pixel:  A pixel or pel (picture element) is a single point in a raster image, or the smallest addressable screen element in a display device.  It is the smallest unit of picture that can be represented or controlled.  Each pixel has its own address.  The address of a pixel corresponds to its coordinates.  Pixels are normally arranged in a two-dimensional grid and are often represented using dots or squares.  Each pixel is a sample of an original image. More samples typically provide more accurate representations of the original image. 9
  • 10. Mouse Features Mouse pointer:  A mouse pointer, or a cursor, is a visible indicator displayed on a computer screen.  By moving the mouse, the computer's user can move the mouse pointer around the screen.  The mouse pointer located on the screen can determine how and where the user can press a button on the mouse to input text or execute a command. 10
  • 11. Mouse Features Mickey:  A unit of measure for movement of the mouse, approximately 1/200 of an inch.  A mickey is a unit of measurement for the speed and movement direction of a computer mouse.  The speed of the mouse is the ratio between how many pixels the cursor moves on the screen and how many centimeters you move the mouse on the mouse pad. 11
  • 12. Interrupt Vector Table – IVT (in memory)  x86 has 256 interrupts, specified by Type Number or Vector.  1 byte of data must accompany each interrupt(specifies Type).  Vector is a pointer (address) into Interrupt Vector Table (IVT). - IVT is stored in memory from 0000:0000 to 0000:03ffh - IVT contains 256 far pointer values (addresses) - Far pointer is CS:IP values  Each far pointer is address of Interrupt Service Routine (ISR). - Also referred to as Interrupt Handler. 12
  • 13. IVT Format 0000:0000 0000:0001 Offset 0000:0002 Interrupt 0 IP LSB 0000:0003 Segment IP MSB 0000:0004 CS LSB 0000:0005 Offset CS MSB Interrupt 1 0000:0006 0000:0007 Segment Given a Vector, where is the ISR address stored in memory ? Offset Type 4 0000:03fc 0000:03fd Offset Example:int 36h 0000:03fe Interrupt 255 Segment Offset = (54 4) = 216 0000:03ff = 00d8h
  • 14. Mouse functions  We can access the cursor position and the button status with interrupt 33h.  The mouse driver has several functions by specifying the function number in the AX register when calling interrupt 33h.  Some of the functions are 0- Resets the mouse and retrieves the mouse status. 1- Displays the mouse cursor 2- Hides the mouse cursor. 3- Retrieves the mouse cursor positioned the status of the mouse buttons. 14
  • 15. Mouse functions contd… Initializing the mouse:  To be able to use the mouse it must be first tested whether it is present or not. int 33h mov ax,00 int 33h mov result,ax  Using int 33h is the necessary first step toward using the mouse.  If this service returns a non-zero value, the mouse is initialized. Otherwise, the mouse cannot be used. 15
  • 16. Mouse functions contd… Display mouse cursor:  Initializing the mouse does not display the mouse cursor.  A function that initialize the mouse and returns the result.  Int 33h service 1 – display mouse cursor. mov ax,01h int 33h  At this point ,the mouse system is active and the cursor has appeared on the screen. 16
  • 17. Mouse functions contd… Hide mouse cursor:  If the cursor is already off, it stays off (int 33h service 2).  The very important reason for hiding the mouse cursor , as the mouse cursor moves over the screen,the mouse driver software reads the character at the preset position before it displays the mouse cursor. mov ax,02h int 33h 17
  • 18. Mouse functions contd… Mouse buttons:  It is also possible to read right and left button information from the mouse int 33h service 3. Getting mouse information:  Int 33h service 3 set AX=3 .This will return BX meaning 0 No button down 1 Left button down 2 Right button down 3 Both the buttons down  CX = current mouse cursor column.  DX= current mouse cursor row. 18
  • 19. Mouse functions contd… Mov ax, 03h Int 33h Mov button, bx Mov row, dx Mov col, cx  This service 3, returns information in bx, dx, and cx.  bx indicates which button(s) are down.  This service also returns the current row and column of the mouse cursor in dx and cx, respectively. 19
  • 20. THANK YOU 20