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

20BCE2351 Micro Assignment-01

Assignments in btech

Uploaded by

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

20BCE2351 Micro Assignment-01

Assignments in btech

Uploaded by

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

MICROPROCESSOR AND INTERFACING

ASSIGNMENT-01

NAME: Yatheendra Nath Reddy


REG.NO: 20BCE2736

Discuss in detail about INT21H and INT10H.


Int 21H: DoS Interrupt
 Int 21H is a dos interrupt.
 It is one of the most commonly used interrupts while
writing code in 8086 assembly language.
 DOS provides various internal interrupts which are used by
the system programmer.
 The most used interrupt is INT 21H.
 It uses built-in DOS functions to carry out operations like
reading a user input character from the screen, showing
results on the screen, quitting the programme, etc.
 While calling the INT21H Dos interrupt, we must first assign
a correct value in AH register.
 The INT 21H function that the user requires is chosen by
the value in the AH register.
 The most used INT 21H functions are as shown:

Task Method Comment


How to input a Mov AH, 01H INT lifts the character
character from the 21H entered by the user off
screen the screen. gives the
character in the AL
register's ASCII value.
If AL-0, then a
control key was
pressed.
How to input a string Mov AH, OAH LEA OAH serves as the input
from the screen DX, string INT 21H string function's
parameter. The offset
address provided by DX
will be used to store the
string.
How to display a Mov AH, 02H Mov The display char
character on the screen DL, char INT 21H function's 02H argument.
The character that will
be displayed should be in
DL.
How to display a string Mov AH, 09H LEA The show string
DX, string INT 21H function's 09H parameter
is for that function. The
offset address of the
output string should be
in
DX.
How to terminate the Mov AH, 4CH Mov The terminate function's
Program AL, OOH INT 21H fourth argument, 4CH, is
used. The system stores
the return code in the AL
register. When AL is
00h, the programme
ended
successfully.

Int 21H functions:


Function Number Description
READ CHARACTER FROM STANDARD INPUT, WITH
AH=01h
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


Function Number Description
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


Function Number Description
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
GET/SET FILE'S DATE AND TIME, GET
AH=57h
EXTENDED ATTRIBUTES FOR FILE

Example:
String Cryptography writes to standard output after reading from
standard input and encrypting each byte.
TITLE Encryption Program
; This program uses MS-DOS function calls to
; read and encrypt a file. Run it from the
; command prompt, using redirection:
; Encrypt < infile.txt > outfile.txt
; Function 6 is also used for output, to avoid
; filtering ASCII control
characters. INCLUDE Irvine16.inc
XORVAL = 239; any value between 0-255
. code
main PROC
mov ax,@data
mov ds,ax
L1:
mov ah,6 ; direct console input
mov dl,0FFh ; don't wait for
character int 21h ; AL = character
jz L2 ; quit if ZF = 1
(EOF) xor al,XORVAL
mov ah,6 ; write to
output mov dl,al
int 21h
jmp L1 ; repeat the loop
L2: exit
main ENDP
END main

Int 10H: Video Interrupt


 Video service bios interrupt Int 10h.
 It provides functions like changing the video mode, producing
characters and strings, and reading and writing pixels in
graphics mode.
 It is one of the interrupts that 8086 assembly
language programmers utilise the most frequently.
 By entering a specified value in register AH, the choice is selected.
 There are 80 columns and 25 rows on the video screen while it is
in text mode.
 Each spot on the screen has a row and column number assigned
to it, with 00,00 in the top left corner and 24,79 in the bottom
right. The screen's centre is at 12,39 or (0C,27 in hex).
 Before using INT 10H, various registers must be set to
certain values.
 To use the appropriate sub-function with the bios interrupt,
load ah. Fill additional registers with the necessary parameters.
then give int 10h a call.

Function Number Description


AH=00h Set video mode
AH=01h Set text-mode cursor shape
AH=02h Set cursor position
AH=03h Get cursor position and shape
Read light pen position (Does not work on VGA
AH=04h
systems)
AH=05h Select active display page
AH=06h Scroll up window
AH=07h Scroll down window

AH=08h Read character and attribute at cursor position

AH=09h Write character and attribute at cursor position

AH=0Ah Write character only at cursor position

AH=0Bh, BH = 00h Set background/border color

AH=0Bh, BH = 01h Set palette

AH=0Ch Write graphics pixel


Function Number Description
AH=0Dh Read graphics pixel

AH=0Eh Teletype Output

AH=0Fh Get current video mode

AH=11h Change text mode character set

AH=13h Write string (EGA, meaning PC AT minimum)

set VESA-Compliant video modes, beginning at


AX=4f02h 640 by 480 and reaching 1280 by 1024 with 256
colors

 Function 0Eh Teletype output:


10 hour bios interrupt function at the current cursor location, 0Eh
prints a character and moves the pointer forward by one.
 Registers Used:
AH = 0Eh
AL = character to write
BH = page number
BL = foreground colour (graphics modes only)

 Function 06
clear the screen
AH = 06 ; function number
AL = 00 ; page number
BH = 07 ; normal attribute
CH = 00 ; row value of start points
CL = 00 ; column value of start
point DH = 24 ; row value of
ending point
DL = 79 ; column value of ending point
Function 02 – setting the cursor to a specific location
AH = 06 ; function number
DH = row ; cursor
DL = column ; position
Function 03 – get the current cursor position
AH = 03 ; function number
BH= 00 ; currently viewed page
The position is returned in DH = row and DL =
column Function 0E – output a character to the
screen
AH = 0E ; function number
AL = Character to be displayed
BH = 00 ; currently viewed
page
BL = 00 ; default foreground colour

Example: Program in 8086 to display Hi using bios interrupt.


Program:
.model tiny
.code
org 100h
main proc
near mov
ah,0eh mov
al,'H' int
10h
mov ah,0eh
mov al,'i'
int 10h
mov ah,4ch
mov al,00
int 21h
endp
end
main

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