I have read about BIOS interrupts, and know that they can be accessed only in 8086 real mode.
My questions:
Are there any other interrupts also available ? I have read about DOS interrupts, but I am confused as to if they are available in real mode also, and what is the list of DOS interrupts.
Once we enter protected mode, what happens to the BIOS interrupt table stored at 0x00 ? Is it replaces, or is it present but just not accessible ?
- BIOS interrupts like 0x13 or 0x19, how are they implemented ? Is it in software or through the processor ?
In real mode, you have 256 different SOFTWARE TRIGGERED interrupts. In the early days of BIOS and DOS, they were used as not much more than a "jump address" table. For example, DOS used INT 21 mainly, so applications could be coded to use the
INT 21
processor instruction instead of aCALL 1234:5678
- the real address would change with each new version of DOS, but the INT 21 stayed. When dos booted up, it would put the address of its real handler function into that slot of the interrupt table.The
INT XX
processor instruction can use interrupt numbers from 0 to 255, so all of them are available. If there was anything useful in the corresponding interrupt table slot was another thing - there were lots of resident programs however, that used some specific interrupt (which led to collisions if you loaded more than one of these programs).Apart from this are the HARDWARE interrupts - these are not triggered by software, but by an external device like your keyboard, floppy or hard disk, when they wanted to tell the processor "i need some service". So for example, when you pressed a key on the keyboard, the keyboard controller triggers interrupt 9 (not sure about the number, it's a long time ago, but interrupts 8-15 were reserved for hardware). When booting, the BIOS would put the address of its keyboard-handling-procedure into the corresponding entry of the interrupt table. Whenever you pressed a key, the keyboard controller triggered interrupt 9, which made the processor look up the corresponding address in the interrupt table, call it - this transfers control to the bios - the bios did whatever is neccesary to get the actual key from the keyboard, then returned to the application, which had no idea what hat happened.
So to answer your first question: There are 256 interrupts. 0-7 were used for processor-internal stuff. 07-0F were triggered by hardware. 10-1F were reserved for the Bios, and DOS used 20-27. The rest of them were unused, which means, no valid procedure entry point was stored for them in the interrupt table. (This became very murky later, i'm oversimplifying here).
2nd question: Once you enter protected mode, the interrupt table is replaced by the OS that puts the processor in protected mode, because the BIOS routines were written for the 8086 which did not have a protected mode, often aren't safe to use if not in real mode, and don't handle multitasking well. Any decent OS just has to do this kind of stuff itself. And interrupts from 20-27, which were used by DOS, just have no replacement for them in others OSes. So you can't run dos executables on Linux, apart from not being able to run them, they wouldn't work if they use dos interrupts.
3rd question: The BIOS interrupts themselves are purely software, but they trigger hardware events. Interrupt 13 was for the floppy/hard disk. A program that wanted to read sectors directly from the floppy would fill the processor registers with some predefined values, call interrupt 13 (thus jump into the BIOS routine, the address of which was put into the interrupt table when the BIOS booted), and let the bios do its work. No hardware stuff yet. WITHIN the interrupt handler, of course, the bios would read and write the hardware ports of the floppy controller, but the application didn't have to know about the details.