Search code examples
assemblyx86nasm

INT vs CALL on Asm instructions


i searched over web but i could not found any difference between int and call on asm. Whats the difference between call and int asm instructions?

They both call some functions "int" calls system functions "call" calls user functions.

But in real mode they same? I can't understand the difference much.

And , does int calls ivt ( interrupt vector table ) that has defined on bios ? But call can do same operation also ? why needed call or divided both ?


Solution

  • Superficially, the difference is:

    CALL takes the procedure address, which can be either near or far, and provided either as a constant or in a register. Meanwhile, INT takes an interrupt number, which is used as an index in the interrupt vector table at 0000:0000 (in real mode) to look up the address. CALL pushes the return address (either near or far) to the stack; INT pushes the flags register and the return address (always far).

    In protected mode, INT is rather different. It involves a user to kernel mode switch.

    INT is used to consume services of BIOS and DOS. CALL is for invoking your own procedures. You can make an interrupt vector point at one of your procedures, but what would be the point?

    Some real mode DOS programs that have services intended for consumption by other programs also used to hook interrupt vectors. For example, the Microsoft mouse driver (a regular program, not a part of DOS proper) would hook the INT 33h vector, and programs would use that to interact with the mouse. For the vector to remain valid, those programs would have to stay resident in memory.