21

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.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
BOSS
  • 1,828
  • 11
  • 34
  • 60

3 Answers3

39

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:

http://spike.scu.edu.au/~barry/interrupts.html

Philip Kirkbride
  • 21,381
  • 38
  • 125
  • 225
Geoffrey
  • 10,843
  • 3
  • 33
  • 46
8

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.

Abraham Jacob
  • 81
  • 1
  • 1
0

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.