What is INT 21h?

前端 未结 9 1737
[愿得一人]
[愿得一人] 2020-12-09 22:51

Inspired by this question

How can I force GDB to disassemble?

I wondered about the INT 21h as a concept. Now, I have some very rusty knowledge of the interna

相关标签:
9条回答
  • 2020-12-09 23:43

    This is from the great The Art of Assembly Language Programming about interrupts:

    On the 80x86, there are three types of events commonly known as interrupts: traps, exceptions, and interrupts (hardware interrupts). This chapter will describe each of these forms and discuss their support on the 80x86 CPUs and PC compatible machines.

    Although the terms trap and exception are often used synonymously, we will use the term trap to denote a programmer initiated and expected transfer of control to a special handler routine. In many respects, a trap is nothing more than a specialized subroutine call. Many texts refer to traps as software interrupts. The 80x86 int instruction is the main vehicle for executing a trap. Note that traps are usually unconditional; that is, when you execute an int instruction, control always transfers to the procedure associated with the trap. Since traps execute via an explicit instruction, it is easy to determine exactly which instructions in a program will invoke a trap handling routine.

    Chapter 17 - Interrupt Structure and Interrupt Service Routines

    0 讨论(0)
  • 2020-12-09 23:48

    (Almost) the whole DOS interface was made available as INT21h commands, with parameters in the various registers. It's a little trick, using a built-in-hardware table to jump to the right code. Also INT 33h was for the mouse.

    0 讨论(0)
  • 2020-12-09 23:54

    It's a "software interrupt"; so not a hardware interrupt at all.

    When an application invokes a software interrupt, that's essentially the same as its making a subroutine call, except that (unlike a subroutine call) the doesn't need to know the exact memory address of the code it's invoking.

    System software (e.g. DOS and the BIOS) expose their APIs to the application as software interrupts.

    The software interrupt is therefore a kind of dynamic-linking.

    0 讨论(0)
提交回复
热议问题