The int command (not to be confused with Integers in C++ and other languages) marks an interrupt. Interrupts are the ASM way of telling the computer to do something for them. Each interrupt has various subfunctions, chosen by moving the subfunction ID into the AH register. The DOS interrupt is probably the most used and/or useful interrupt in DOS or Windows programming, since it contains functionality for exiting a program.

The three ways to call the DOS Interrupt:

int 21h
int 33
int 100001b

Note that all the numbers above are the same, but are in different bases. 21h = hexidecimal, 33 = decimal, 100001b = binary.

the Exit interruptEdit

The most useful subfunction of Int 21h is 4Ch. 4Ch is the code for exiting a program, and is called with the following code:

mov ah, 4Ch
int 21h

If you want to return a code, set the AL register to the code you want to return. Most programs set it to 0, since AL might have been used before and could cause the program to return the wrong value.

mov ah, 4Ch
mov al, 00h
int 21h

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.