0% found this document useful (0 votes)
32 views16 pages

Chapter - 4 (In/Out) : by Hasan Murad Cse, Uap

This document discusses input/output operations in BIOS and DOS. It summarizes 3 main functions: 1) single-key input using INT 21H with AH=1, 2) single-character output using INT 21H with AH=2 and DL containing the character code, and 3) character string output using INT 21H with AH=9 and DX containing the string address. It provides examples of calling conventions and parameter passing for each BIOS interrupt. The document also introduces BIOS routines, interrupt vectors, and instructions like MOV, LEA, and INT used to call BIOS interrupts for basic I/O operations.

Uploaded by

mash
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)
32 views16 pages

Chapter - 4 (In/Out) : by Hasan Murad Cse, Uap

This document discusses input/output operations in BIOS and DOS. It summarizes 3 main functions: 1) single-key input using INT 21H with AH=1, 2) single-character output using INT 21H with AH=2 and DL containing the character code, and 3) character string output using INT 21H with AH=9 and DX containing the string address. It provides examples of calling conventions and parameter passing for each BIOS interrupt. The document also introduces BIOS routines, interrupt vectors, and instructions like MOV, LEA, and INT used to call BIOS interrupts for basic I/O operations.

Uploaded by

mash
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/ 16

Chapter – 4(In/Out)

By
Hasan Murad
CSE,UAP
In/out Operation
• BIOS Routine
• Interrupt Vector
BIOS
• BIOS(Basic input/output system)
• Perform I/O operation for the PC
• BIOS routines are machine specific
• DOS I/O operations are done by BIOS
• In simple word BIOS is a library of input/output functions
Interrupt vector
• The addresses of the BIOS routines are called interrupt vectors
The Interrupt Instruction
• INT interrupt_number
• INT 21H
• INT 21H ->Console
Functions of INT 21H
Function Number Routine

1 Single-Key Input

2 Single-Character Output

9 Character String Output


Function 1:Single-Key Input
• INT 21H
• Input: AH = 1 (function number)
• Output: AL = ASCII code of the character key pressed
= 0 if non-character key is pressed

• MOV AH,1 ;function number


• INT 21H ;execute
• Output will be stored in AL in ASCII value
Function 2:Single-Character Output
• INT 21H
• Input: AH = 2 (function number)
DL = ASCII code of the display character
• Output: AL = ASCII code of the display character

• MOV AH,2 ; function number


• MOV DL, ‘?’ ; character is ‘?’
• INT 21H ;execute
• Output will be stored in AL in ASCII value
Function 2:Single-Character Output
• INT 21H
• Input: AH = 2 (function number)
DL = ASCII code of the display character or Control Function
• Output: AL = ASCII code of the display character or Control Function
ASCII code(Hex) Symbol Function
7 BEL Beep(sounds a tone)
8 BS backspace
9 HT tab
A LF Line feed (new line)
D CR Carriage return(start of
current line)
Function 2:Single-Character Output
• INT 21H
• Input: AH = 2 (function number)
DL = ASCII code of the display character or Control Function
• Output: AL = ASCII code of the display character or Control Function

• MOV AH,2 ;function number


• MOV DL, 7H ; Beep a tone
• INT 21H ;execute
• Output will be stored in AL in ASCII value
New line
• INT 21H
• Input: AH = 2 (function number)
DL = ASCII code of the display character or Control Function
• Output: AL = ASCII code of the display character or Control Function

• MOV AH,2 ;function number


• MOV DL, 0DH ; carriage return
• INT 21H ; execute carriage return
• MOV DL, 0AH ; line feed
• INT 21H ; execute line feed
Function 9:Character String Output
• INT 21H
• Input: AH = 9 (function number)
DX =offset address of string
The LEA Instruction
• LEA -> Load Effective Address
• LEA destination, source
• It copy the source offset address into the destination
• LEA DX,MSG
• In data segment -> MSG DB ‘Hello world!$’
• In code segment -> LEA DX, MSG
Function 9:Character String Output
• INT 21H
• Input: AH = 9 (function number)
DX =offset address of string
The string must end with a ‘$’ character

• MOV AH,9 ;function number


• LEA DX,MSG ; copy the offset address of source into DX register
• INT 21H ;execute
Instruction Set In this Chapter
• MOV
• XCHG
• ADD
• SUB
• NEG
• INC
• DEC
• LEA
• INT

You might also like