0% found this document useful (0 votes)
6 views

Exp8

The document outlines an assembly language experiment focusing on using interrupts INT 21H and INT 10H for screen manipulation and user input. It includes a program that clears the screen, sets the cursor position, and displays messages based on user input, along with homework assignments for additional programming tasks. The document also provides details on various DOS and BIOS interrupt functions relevant to the experiment.

Uploaded by

mohsinsrj03
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Exp8

The document outlines an assembly language experiment focusing on using interrupts INT 21H and INT 10H for screen manipulation and user input. It includes a program that clears the screen, sets the cursor position, and displays messages based on user input, along with homework assignments for additional programming tasks. The document also provides details on various DOS and BIOS interrupt functions relevant to the experiment.

Uploaded by

mohsinsrj03
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Experiment No.

08

Objective: Students will learn how to write program using the interrupts. INT 21H
and INT 10H are used in this program.

Lab Work:
The following programme firstly it clears the screen then set cursor position (in this
example row=5 column=8). After setting cursor, it displays some message.
; ----------------------------------------------------------------------------------
CLEAR MACRO
MOV AX,0600H
MOV BH,07
MOV CX,0000
MOV DX,184FH
INT 10H
ENDM
; ---------------------------- ------------------------------------------------------
CURSOR MACRO Col, Row
MOV AH,02
MOV BH,00
MOV DL,Col
MOV DH,Row
INT 10H
ENDM
; ----------------------------------------------------------------------------------
DISP MACRO MES
MOV AH,09
MOV DX,OFFSET MES
INT 21H
ENDM
; ----------------------------------------------------------------------------------

.MODEL SMALL
.STACK 64H
.DATA
MES1 DB 'There is a message for yo u'
DB ' To read it enter R','$'
MES2 DB 'Hi! This lab is about '
DB ' BIOS and DOS Interrupts ' ,'$'
MES3 DB ' No more message for you','$'

.CODE
MAIN: MOV AX,@DATA
MOV DS, AX
CLEAR
CURSOR 05,08
DISP MES1
MOV AH, 07
INT 21H
CMP AL,'R'
JZ NEXT
CMP AL, 'r'
JZ NEXT
CURSOR 05,09
DISP MES3
JMP EXIT
NEXT: CURSOR 05,09
DISP MES2
EXIT: MOV AH, 4CH
INT 21H
END MAIN

H.W. 5
1. Write a programme that it will read some numbers from the keyboard, if we input a random number
then corresponding message should be the output from the following messages:
If the number <50 ‘fail’
If the number >50 and <60 ‘satisfactory’
If the number >60 and <70 ‘good’
If the number >70 and <80 ‘ very good’
If the number >80 and < 99 ‘ excellent’
When the input is a letter then the program must be terminated, all the messages will be Output at the
center of the screen. When a new number has been entered the screen should be cleared before
displaying the new message.
2. Develop an assembly language program to read the following test message from the data segment
‘Vertical Text Test’ and display the message from up to down. The display device is assumed to be in
the text mode with 25 x 80 resolution.
Hint: INT 10H AH=02 sets cursor location and assumes row in DH and column in DL.
INT 21H AH=02 outputs a character to the monitor. Assumes the character in DL (ASCII).

DOS INT 21h - DOS Function Codes


AH Description AH Description
01 Read character from STDIN 02 Write character to STDOUT
05 Write character to printer 06 Console Input/Output
07 Direct char read (STDIN), no echo 08 Char read from STDIN, no echo
09 Write string to STDOUT 0A Buffered input
0B Get STDIN status 0C Flush buffer for STDIN
0D Disk reset 0E Select default drive
19 Get current default drive 25 Set interrupt vector
2A Get system date 2B Set system date
2C Get system time 2D Set system time
2E Set verify flag 30 Get DOS version
35 Get Interrupt vector
36 Get free disk space 39 Create subdirectory
3A Remove subdirectory 3B Set working directory
3C Create file 3D Open file
3E Close file 3F Read file
40 Write file 41 Delete file
42 Seek file 43 Get/Set file attributes
47 Get current directory 4C Exit program
4D Get return code 54 Get verify flag
56 Rename file 57 Get/Set file date
BIOS interrupt INT10H

Function
Function Parameters Return
code

AL = video mode flag / CRT


Set video mode AH=00h AL = video mode
controller mode byte

CH = Scan Row Start, CL = Scan Row End

Normally a character cell has 8 scan lines,


0-7. So, CX=0607h is a normal underline
cursor, CX=0007h is a full-block cursor. If
bit 5 of CH is set, that often means "Hide
Set text-mode cursor cursor". So CX=2607h is an invisible
AH=01h
shape cursor.
Some video cards have 16 scan lines, 00h-
0Fh.
Some video cards don't use bit 5 of CH.
With these, make Start>End (e.g.
CX=0706h)

BH = Page Number, DH = Row, DL =


Set cursor position AH=02h
Column
AX = 0, CH = Start scan line,
Get cursor position and
AH=03h BH = Page Number CL = End scan line, DH =
shape
Row, DL = Column
AH = Status (0=not triggered,
1=triggered), BX = Pixel X,
Read light penposition
CH = Pixel Y, CX = Pixel line
(Does not work AH=04h
number for modes 0Fh-10h,
on VGAsystems)
DH = Character Y, DL =
Character X
Select active display
AH=05h AL = Page Number
page
AL = lines to scroll (0 = clear, CH, CL,
DH, DL are used),
BH = Background Color and Foreground
color. BH = 43h, means that background
Scroll up window AH=06h color is red and foreground color is cyan.
Refer the BIOS color attributes
CH = Upper row number, CL = Left
column number, DH = Lower row number,
DL = Right column number

Scroll down window AH=07h like above


Read character and
attribute at cursor AH=08h BH = Page Number AH = Color, AL = Character
position
Write character and AL = Character, BH = Page Number, BL
attribute at cursor AH=09h = Color, CX = Number of times to print
position character
Write character only at AL = Character, BH = Page Number, CX =
AH=0Ah
cursor position Number of times to print character
Set background/border AH=0Bh, BL = Background/Border color (border
color BH = 00h only in text modes)
BL = Palette ID (was only valid in CGA,
AH=0Bh,
Set palette but newer cards support it in many or all
BH = 01h
graphics modes)
AL = Color, BH = Page Number, CX = x,
Write graphics pixel AH=0Ch
DX = y
Read graphics pixel AH=0Dh BH = Page Number, CX = x, DX = y AL = Color
AL = Character, BH = Page Number, BL
Teletype output AH=0Eh
= Color (only in graphic mode)

Get current video mode AH=0Fh AL = Video Mode

Write string (EGA+, AL = Write mode, BH = Page Number, BL


meaning PC AH=13h = Color, CX = String length, DH = Row,
ATminimum) DL = Column, ES:BP = Offset of string

You might also like