Hardware and Software Interrupts:
Hardware interrupts:
 The nonmaskable interrupt is generated by en external device, trough a rising edge on
    the NMI pin
 An external device, trough a high logic level on the INTR pin (the external device has to
    specify the interrupt number).
Software interrupts: Software interrupts (exceptions) using the INT instruction (followed by
the interrupt number (type)).
Interrupt Vector Table:
An "interrupt vector table" (IVT) is a data structure that associates a list of interrupt
handlers with a list of interrupt requests in a table of interrupt vectors. An entry in the
interrupt vector is the address of the interrupt handler. While the concept is common across
processor architectures, each IVT may be implemented in an architecture-specific fashion.
For example, a dispatch table is one method of implementing an interrupt vector table.
The first 1Kbyte of memory of 8086 (00000 to003FF) is set aside as a table for storing the
starting addresses of Interrupt Service Procedures (ISP). Since 4-bytes are required for
storing starting addresses of ISPs, the table can hold 256 Interrupt procedures. The starting
address of an ISP is often called the Interrupt Vector or Interrupt Pointer. Therefore the table
is referred as Interrupt Vector Table. In this table, IP value is put in as low word of the vector
& CS is put in high vector.
Dedicated interrupts of 8086:
The        following       are        the      various       types       of       interrupts:
- Type 0 interrupts: This interrupt is also known as the divide by zero interrupt. For cases
where the quotient becomes particularly large to be placed / adjusted an error might occur.
- Type 1 interrupts: This is also known as the single step interrupt. This type of interrupt is
primarily      used      for      debugging     purposes       in     assembly       language.
- Type 2 interrupts: also known as the non-maskable NMI interrupts. These type of
interrupts are used for emergency scenarios such as power failure.
- Type 3 interrupts: These type of interrupts are also known as breakpoint interrupts. When
this interrupt occurs a program would execute up to its break point.
-Type 4 interrupts: Also known as overflow interrupts is generally existent after an arithmetic
operation was performed.
 Interrupt Priority Structure
Bios interrupts:
        BIOS interrupt calls are a facility that operating systems and application programs use
to invoke the facilities of the Basic Input/Output System on IBM PC compatible computers.
Traditionally, BIOS calls are mainly used by MS-DOS programs and some other software such
as boot loaders (including, mostly historically, relatively simple application software that
boots directly and runs without an operating system—especially game software.) BIOS only
runs in the real address mode (Real Mode) of the x86 CPU, so programs that call BIOS either
must also run in real mode or must switch from protected mode to real mode before calling
BIOS and then switch back again. For this reason, modern operating systems that use the
CPU in Protected Mode generally do not use the BIOS to support system functions, although
some of them use the BIOS to probe and initialize hardware resources during their early
stages of booting.
       In all computers, software instructions control the physical hardware (screen, disk,
keyboard, etc.) from the moment the power is switched on. In a PC, the BIOS, preloaded in
ROM on the main board, takes control immediately after the processor is reset, including
during power-up or when a hardware reset button is pressed. The BIOS initializes the
hardware, finds, loads and runs the boot program (usually, but not necessarily, an OS
loader), and provides basic hardware control to the operating system running on the
machine, which is usually an operating system but may be a directly booting single software
application.
        For IBM's part, they provided all the information needed to use their BIOS fully or to
directly utilize the hardware and avoid BIOS completely, when programming the early IBM
PC models (prior to the PS/2). From the beginning, programmers had the choice of using
BIOS or not, on a per-hardware-peripheral basis. Today, the BIOS in a new PC still supports
most, if not all, of the BIOS interrupt function calls defined by IBM for the IBM
AT (introduced in 1984), along with many more newer ones, plus extensions to some of the
originals (e.g. expanded parameter ranges). This, combined with a similar degree of
hardware compatibility, means that most programs written for an IBM AT can still run
correctly on a new PC today, assuming that the faster speed of execution is acceptable
(which it typically is for all but games that use CPU-based timing). Despite the considerable
limitations of the services accessed through the BIOS interrupts, they have proven extremely
useful and durable to technological change.
Interrupt
            Description
vector
            Executed when Shift-Print screen is pressed,              as   well    as   when
05h
            the BOUND instruction detects a bound failure.
10h         Video Services
                AH    Description
                00h Set Video Mode
                01h Set Cursor Shape
                02h Set Cursor Position
                03h Get Cursor Position And Shape
                04h Get Light Pen Position
                05h Set Display Page
                06h Clear/Scroll Screen Up
                07h Clear/Scroll Screen Down
                08h Read Character and Attribute at Cursor
                09h Write Character and Attribute at Cursor
         0Ah Write Character at Cursor
         0Bh Set Border Color
         0Ch Write Graphics Pixel
         0D
               Read Graphics Pixel
         h
         0Eh Write Character in TTY Mode
         0Fh Get Video Mode
         10h Set Palette Registers (EGA, VGA, SVGA)
         11h Character Generator (EGA, VGA, SVGA)
         12h Alternate Select Functions (EGA, VGA, SVGA)
         13h Write String
         1Ah Get or Set Display Combination Code (VGA, SVGA)
         1Bh Get Functionality Information (VGA, SVGA)
         1Ch Save or Restore Video State (VGA, SVGA)
         4Fh VESA BIOS Extension Functions (SVGA)
11h   Returns equipment list
12h   Return conventional memory size
      Low Level Disk Services
         AH    Description
         00h Reset Disk Drives
         01h Check Drive Status
         02h Read Sectors
         03h Write Sectors
         04h Verify Sectors
         05h Format Track
13h
         08h Get Drive Parameters
         09h Init Fixed Drive Parameters
         0Ch Seek To Specified Track
         0D
               Reset Fixed Disk Controller
         h
         15h Get Drive Type
         16h Get Floppy Drive Media Change Status
         17h Set Disk Type
         18h Set Floppy Drive Media Type
         41h Extended Disk Drive (EDD) Installation Check
         42h Extended Read Sectors
         43h Extended Write Sectors
         44h Extended Verify Sectors
         45h Lock/Unlock Drive
         46h Eject Media
         47h Extended Seek
         48h Extended Get Drive Parameters
         49h Extended Get Media Change Status
         4Eh Extended Set Hardware Configuration
14h   Serial port services
         AH    Description
         00
               Serial Port Initialization
         h
         01
               Transmit Character
         h
         02
               Receive Character
         h
         03    Status
         h
15h   Miscellaneous system services
         AH    AL   Description
         00h        Turn on cassette drive motor
         01h        Turn off cassette drive motor
         02h        Read data blocks from cassette
         03h        Write data blocks to cassette
         4Fh        Keyboard Intercept
         83h        Event Wait
         84h        Read Joystick
         85h        Sysreq Key Callout
         86h        Wait
         87h        Move Block
         88h        Get Extended Memory Size
         89h        Switch to Protected Mode
         C0h        Get System Parameters
         C1h        Get Extended BIOS Data Area Segment
         C2h        Pointing Device Functions
         C3h        Watchdog Timer Functions - PS/2 systems only
         C4h        Programmable Option Select - MCA bus PS/2 systems only
         D8
                    EISA System Functions - EISA bus systems only
         h
                    Get Extended Memory Size (Newer function, since 1994). Gives
         E8h 01h
                    results for memory size above 64 Mb.
                 Query System Address Map. The information returned
         E8h 20h from E820 supersedes   what    is    returned from the
                 older AX=E801h and AH=88hinterfaces.
      Keyboard services
         AH    Description
         00
               Read Character
         h
         01
               Read Input Status
         h
16h
         02
               Read Keyboard Shift Status
         h
         05
               Store Keystroke in Keyboard Buffer
         h
         10
               Read Character Extended
         h
         11    Read Input Status Extended
         h
         12
               Read Keyboard Shift Status Extended
         h
      Printer services
         AH    Description
         00
               Print Character to Printer
         h
17h
         01
               Initialize Printer
         h
         02
               Check Printer Status
         h
      Execute Cassette BASIC: Very early true IBM computers contain Microsoft
      Cassette BASIC in the ROM, to be started by this routine in the event of a failure
18h   to boot from disk (called by the BIOS). On virtually all clones and later models in
      the PC line from IBM, which lack BASIC in ROM, this interrupt typically displays a
      message such as "No ROM BASIC" and halts.
      After POST this interrupt is used by BIOS to load the operating system. A
      program can call this interrupt to reboot the computer (but must ensure that
19h   hardware interrupts or DMA operations will not cause the system to hang or
      crash during either the reinitialization of the system by BIOS or the boot
      process).
1Ah   Real Time Clock Services
         AH    Description
         00
               Read RTC
         h
         01
               Set RTC
         h
         02
               Read RTC Time
         h
         03
               Set RTC Time
         h
         04
               Read RTC Date
         h
         05
               Set RTC Date
         h
         06
               Set RTC Alarm
         h
         07
               Reset RTC Alarm
         h
      PCI Services - implemented by BIOSes supporting PCI 2.0 or later
         AX      Description
         B101h PCI Installation Check
1Ah      B102h Find PCI Device
         B103h Find PCI Class Code
         B106h PCI Bus-Specific Operations
         B108h Read Configuration Byte
             B109h Read Configuration Word
             B10Ah Read Configuration Dword
             B10Bh Write Configuration Byte
             B10Ch Write Configuration Word
             B10Dh Write Configuration Dword
             B10Eh Get IRQ Routine Information
             B10Fh Set PCI IRQ
1Bh       Ctrl-Break handler - called by INT 09 when Ctrl-Break has been pressed
1Ch       Timer tick handler - called by INT 08
          Not to be called; simply a pointer to the VPT (Video Parameter Table), which
1Dh
          contains data on video modes
          Not to be called; simply a pointer to the DPT (Diskette Parameter Table),
1Eh
          containing a variety of information concerning the diskette drives
          Not to be called; simply a pointer to the VGCT (Video Graphics Character Table),
1Fh
          which contains the data for ASCII characters 80h to FFh
41h       Address pointer: FDPT = Fixed Disk Parameter Table (1st hard drive)
46h       Address pointer: FDPT = Fixed Disk Parameter Table (2nd hard drive)
4Ah       Called by RTC for alarm
MEMORY AND I/O INTERFACING: