8086 Assembly Language INT 21h Dos Interrupt Edit
Int 21h is a dos interrupt. It is one of the most commonly used interrupt while writing code in 8086 assembly language.
To use the dos interrupt 21h load ah with the desired sub-function. load other required parameters in other registers. and make a call to int 21h.
Int 21h functions
Function Number | Description |
AH=01h | READ CHARACTER FROM STANDARD INPUT, WITH ECHO |
AH=02h | WRITE CHARACTER TO STANDARD OUTPUT |
AH=05h | WRITE CHARACTER TO PRINTER |
AH=06h | DIRECT CONSOLE OUTPUT |
AH=07h | DIRECT CHARACTER INPUT, WITHOUT ECHO |
AH=08h | CHARACTER INPUT WITHOUT ECHO |
AH=09h | WRITE STRING TO STANDARD OUTPUT |
AH=0Ah | BUFFERED INPUT |
AH=0Bh | GET STDIN STATUS |
AH=0Ch | FLUSH BUFFER AND READ STANDARD INPUT |
AH=0Dh | DISK RESET |
AH=0Eh | SELECT DEFAULT DRIVE |
AH=19h | GET CURRENT DEFAULT DRIVE |
AH=25h | SET INTERRUPT VECTOR |
AH=2Ah | GET SYSTEM DATE |
AH=2Bh | SET SYSTEM DATE |
AH=2Ch | GET SYSTEM TIME |
AH=2Dh | SET SYSTEM TIME |
AH=2Eh | SET VERIFY FLAG |
AH=30h | GET DOS VERSION |
AH=35h | GET INTERRUPT VECTOR |
AH=36h | GET FREE DISK SPACE |
AH=39h | "MKDIR" - CREATE SUBDIRECTORY |
AH=3Ah | "RMDIR" - REMOVE SUBDIRECTORY |
AH=3Bh | "CHDIR" - SET CURRENT DIRECTORY |
AH=3Ch | CREATE OR TRUNCATE FILE |
AH=3Dh | "OPEN" - OPEN EXISTING FILE |
AH=3Eh | "CLOSE" - CLOSE FILE |
AH=3Fh | "READ" - READ FROM FILE OR DEVICE |
AH=40h | "WRITE" - WRITE TO FILE OR DEVICE |
AH=41h | "UNLINK" - DELETE FILE |
AH=42h | "LSEEK" - SET CURRENT FILE POSITION |
AH=43h | GET FILE ATTRIBUTES |
AH=47h | "CWD" - GET CURRENT DIRECTORY |
AH=4Ch | "EXIT" - TERMINATE WITH RETURN CODE |
AH=4Dh | GET RETURN CODE (ERRORLEVEL) |
AH=54h | GET VERIFY FLAG |
AH=56h | "RENAME" - RENAME FILE |
AH=57h | GET/SET FILE'S DATE AND TIME, GET EXTENDED ATTRIBUTES FOR FILE |