0% found this document useful (0 votes)
33 views6 pages

COAL Lab 5

Assembly language

Uploaded by

f2022266330
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)
33 views6 pages

COAL Lab 5

Assembly language

Uploaded by

f2022266330
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/ 6

Computer Organization and Assembly Lan-

guage
Lab Manual (Lab 5)

Topic: BIOS INT, INT 10h –services,


Screen position, Setting the cursor position- goto (x,y), Scroll page up clrscr
window, Scroll page down loops

Course Instructor:
Lab Instructor:

Session: Fall 2021

School of Systems and Technology


UMT Lahore Pakistan
Objectives: Introduction to gotoxy(), clrscr() & Loops

Some concepts and sample code

Interrupt Handler:
A callback subroutine called when an interrupt is received. Also known as Interrupt
Service Routine.

Interrupt are of two types:


1- Hardware Interrupts: A signal from some device e.g. mouse, keyboard, etc.
2- Software Interrupts: Caused by some exceptional condition or by some special
instruction in instruction set.

x8086 Software Interrupts:

The INT instruction in x8086 instruction invokes the respective ISR to perform the task
assigned. Number of interrupts supported by instruction set are 256 but every interrupt can have
up to 256 sub interrupts. So the total number of interrupts are (256 * 256) = 65,536.

Useful DOS Interrupts


1) INT 21H, Function 04CH terminate the code properly and return to the DOS Prompt.
2) INT 21H, Function 02H Display a number or character on the screen.
3) INT 21H, Function 09H Display the string on the screen
4) INT 21H, Function 01H Get Character input with Echo.
5) INT 21h, function 08H Get Character input without Echo.

For example 21H interrupt number has 108 sub interrupts like 01H for character input, 02H for
character output etc.

Useful BIOS Interrupts


The following are the IBM PC BIOS interrupts in which we will be Interested.
INTERRUPT FUNCTION
a. 5H Print screen
b. 10H Video I/O
c. 11H Equipment check
d. 14H Serial I/O
e. 1BH Keyboard break
f. 1CH Timer tick
g. 1FH Graphics character table
INTERRUPT 10H is the most useful BIOS interrupt to the programmer. INT 10H is the 17th
Interrupt vector in an x86 based computer system. It is a real mode ISR. Interrupt 10H is used to
provide the standard character output function as well as to provide some additional control over
the video display.

How to Use
Like 21H it has many subroutines. So the steps involved in using this routine are
1- Load AH with the number of required subroutine.
2- Load other desired parameters
3- Call INT 10H
Some 80x25 screen position
Position Decimal Hex
Column Row Column Row
Upper left corner 0 0 0 0
Lower left corner 0 24 0 18
Upper right corner 79 0 4f 0
Lower right corner 79 24 4f 18
Center of the screen 39 12 27 C

INT 10h function 2 set cursor position


 Input AH = 2
 DH = new cursor row (0-24)
 DL = new cursor column 0-79 for 80x25display,0-39 for 40x25
 Output none

Example :
o Mov dh,10
o Mov dl,20
o Mov ah, 2
o Int 10h

INT 10h function 6 scroll the screen or window up


INT 10h function 7 scroll the screen or window down
 Input AH = 6/7
 AL= number of lines to scroll (0 = whole screen)
 BH = attribute for blank lines
 DL,DH =row column for lower right corner
CL,CH = row column for upper left corner of window
 Output none
 Scrolling the screen up one line means to move each display line UP one row and insert
a blank line at the bottom of the screen. The previous top row disappears from the screen.
 The whole screen or any rectangular area (window) may be scrolled. AL contains the
number of lines to scroll. If AL = 0, all the lines are scrolled and this clears the screen or
window.
 Function 7 same as function 6, but lines are scrolled down instead of up.
 Example: Clear the screen to black for the 80x25 display.

MOV AH, 6 ; scroll up function


MOV AL, 0 ; clear entire screen
MOV CX, 0 ; upper left corner is (0,0)
MOV DX, 184FH ; lower right corner is (4Fh, 18H)
MOV BH, 7 ; normal video attribute
INT 10H ; clear screen

Looping instruction

A loop is a sequence of instruction that is repeated the number of times to repeat may be known
in advance, or it may depend on condition.
Use the following lines to loop
MOV CX, Number Of iterations
Again: start loop here
; Instructions
LOOP Again

Lab Tasks
Task # 1
 Clear the command screen clrscr command (scroll up/down window)
 Prompt a user to enter an alphabet
 Go to the Screen Position to x=12 and y=40 by setting dh(row) and dl(column)
 Make a loop of 10 by initializing Cx=10
 Display the input character and the 9 upcoming characters in a loop defined above

Example
Enter a character: g

ghijklmnop
Task # 2:
 Clear the command prompt screen by using clrscr
 Prompt a user to enter an alphabet
 Go to the Screen Position to x=6 and y=20 by setting dh(row) and dl(column)
 Make a loop of 7 by initializing Cx=7
 Keeping the value of ‘y’ constant, increment in the value of ‘x’ and display the in-
put character as well as its upcoming characters in corresponding rows.

Example:

Enter a character: A

A
B
C
D
Task # 3:
 Clear the command prompt screen by using clrscr
 Prompt a user to enter an alphabet
 Go to the Screen Position to x=6 and y=20 by setting dh(row) and dl(column)
 Make a loop of 7 by initializing Cx=7
 Increment the value of ‘y’, increment in the value of ‘x’ and display the input
character as well as its upcoming characters in corresponding rows and columns.

Example:

Enter a character: A
A
B
C
D

Task # 4
1. Prompt User to Enter 1st (1-digit) number
2. Prompt User to Enter 2nd (1-digit) number
3. Add two numbers
4. Display result in the following format:

Enter First Digit: 4

Enter Second Digit: 4

+4

==========

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