how to write the interrupt instruction in assembly language and what the diferrent between subroutine and interrupt in assembly language??
anybody can help me??
Interrupts occur due to events, e.g. a timer overflow, or a change of state of a hardware input to the microprocessor. Typically through your software code, interrupts can be enabled or disabled, i.e. when a specific event occurs the running code will be "interrupted" and the interrupt code will execute. One typically doe NOT call an interrupt routine. When done, the interrupt returns further processing (e.g. through a RETR statement which re-enables the interrupt) to the main program from where it went off.
Subroutines are pieces of code that perform a certain function, and which are called by the main program whenever that function is required. So you have to CALL the subroutine. E.g. a subroutine to count the number of occurences of a string in a file.
When done, the subroutine returns processing (e.g. through a RET statement) to the main program.
In 32-bit protected mode, interrupts are used as exception handlers, like what Athelas said. They are essentially handled exclusively by the operating system and the hardware. And in 32-bit pmode, you can't call an interrupt from your program (unless your program is the kernel or a driver.)
In 16-bit real mode, interrupts can be called by any program and in older operating systems (like DOS) they were used when a program wanted to communicate with the kernel. For example, int 21h was often used for I/O in DOS.