BOSS
BOSS

Reputation: 1898

What does "int 21h" mean in Assembly?

I'm new to learning assembly language, and I'm wondering what the command int 21h means. For example:

 mov ah,01h
 int 21h

Which should read a key from the user.

Upvotes: 22

Views: 136034

Answers (3)

Geoffrey
Geoffrey

Reputation: 11353

int 21h means, call the interrupt handler 0x21 which is the DOS Function dispatcher. the "mov ah,01h" is setting AH with 0x01, which is the Keyboard Input with Echo handler in the interrupt. See:

https://mrszeto.net/CIT/interrupts.htm

Upvotes: 42

sunig kale
sunig kale

Reputation: 11

This simply means that you are using function 01h of the Interrupt type 21... where 01h is as you said is to read character from standard input, with echo, result is stored in AL. if there is no character in the keyboard buffer, the function waits until any key is pressed. It comes under type 21h of various interrput tables, hence the lines of code goes like these as you mentioned.

Upvotes: 1

Abraham Jacob
Abraham Jacob

Reputation: 91

INT 21H will generate the software interrupt 0x21 (33 in decimal), causing the function pointed to by the 34th vector in the interrupt table to be executed, which is typically an MS-DOS API call.

Upvotes: 9

Related Questions