0% found this document useful (0 votes)
51 views9 pages

Slide 15 - Instructions - InT 21h Interrupts

Uploaded by

ffelif3439
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views9 pages

Slide 15 - Instructions - InT 21h Interrupts

Uploaded by

ffelif3439
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Microprocessor Systems and

Laboratory
EEE220

slide 1
INT 21h interrupts

The INT 21h interrupts are DOS system services that allow programs to perform various functions such
as input/output operations, file handling, and system management.
They are called by setting specific values in the AH register to select a particular function.

Example Usage
Input a character and display it
mov ah, 01h ; Function to read a character
int 21h ; Call DOS interrupt
mov dl, al ; Move input character to DL
mov ah, 02h ; Function to display a character
int 21h ; Call DOS interrupt
INT 21h interrupts

Input/Output Functions

1. AH = 01h: Input a single character from the keyboard (echoed to the screen).
○ Returns: ASCII character in AL.
2. AH = 02h: Output a single character to the screen.
○ Input: Character in DL.
3. AH = 09h: Display a string on the screen.
○ Input: Address of the string in DX (terminated with $).
4. AH = 0Ah: Buffered input.
○ Input: Address of buffer in DX. First byte specifies max length; second byte gets the actual length.
INT 21h interrupts

File Handling

5. AH = 3Ch: Create a file.


○ Input: Address of filename in DX.
6. AH = 3Dh: Open a file.
○ Input: Address of filename in DX.
7. AH = 3Eh: Close a file.
○ Input: File handle in BX.
8. AH = 3Fh: Read from a file.
○ Input: File handle in BX, buffer address in DX, number of bytes to read in CX.
9. AH = 40h: Write to a file.
○ Input: File handle in BX, buffer address in DX, number of bytes to write in CX.
INT 21h interrupts

Program Termination

10. AH = 4Ch: Terminate the program.


○ Input: Exit code in AL.

Memory Management

11. AH = 48h: Allocate memory block.


○ Input: Paragraphs of memory requested in BX.
12. AH = 49h: Free memory block.
○ Input: Segment address of block in ES.
INT 21h interrupts

System Functions

13. AH = 30h: Get DOS version.


○ Returns: Major version in AL, minor version in AH.
14. AH = 2Ah: Get system date.
○ Returns: Year in CX, month in DH, day in DL, day of the week in AL.
15. AH = 2Ch: Get system time.
○ Returns: Hour in CH, minute in CL, second in DH, hundredths in DL.
INT 21h interrupts

Keyboard Functions

16. AH = 0Bh: Check the keyboard buffer (input status).


○ Returns: AL = 0 if no character is ready; AL != 0 if a character is available.
17. AH = 0Ch: Clear the keyboard buffer and wait for input.
INT 21h interrupts

write a program that display 5 charaters from the user

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy