You are on page 1of 13

CHAPTER EIGHT

ADVANCED TOPICS
Compiled by: Seble N.
Outlines

 Video and Keyboard Processing

 String Data Processing

 Facilities for Using the Mouse

 INT 21H Functions for supporting Disks and Files


Video and Keyboard Processing
 The two interrupts covered in this chapter are
 INT 10h
 Isa low level BIOS interrupt that transfers control directly to
BIOS
 INT 21h
 Provides an interrupt service that first transfers control to the
operating system, which handles additional high level
processing and then transfers control to BIOS
INT 10H
02h - Set Cursor & 06h - Scroll Screen
 Screen Features
 A typical video monitor has 25 rows and 80 columns

 Rows and columns provide a grid of addressable locations, where the cursor can
be set

 Some examples of cursor locations:

Decimal Hexadecimal
Screen Location Row Column Row Column
Upper left corner 00 00 00H 00H
Upper right corner 00 79 00H 4FH
Center 12 39 0CH 27H
Lower left corner 24 00 18H 00H
Lower right corner 24 79 18H 4FH
Displaying Data on the Screen
 The interrupts that handle screen displays, transfer data directly to
the Video Display Area OR programs may transfer data directly to
the Video Display Area

 The location of the Video Display Area varies based on the mode
the system is operating

 In text mode, the video display area requires 4K byte of memory


 2K of which available for characters

 2K for an attribute for each character


 Ex. Blinking, high intensity, underlining…
INT 10H
02h - Set Cursor

MOV AH, 02H ; request to set cursor

MOV BH, 00 ;page number 0

MOV DH, 08 ;row 8

MOV DL, 15 ;column 15

INT 10H ;call interrupt service


06h, INT 10H
Screen Cleaning or Screen Scrolling
 You can clear all or part of a screen beginning at any screen location
and ending at any higher numbered location

 AH - function code 06h  Example


MOV Ah, 06H
 AL - number of lines to scroll, or MOV BH, 71h
00H for the full screen White background (7)
Blue foreground (1)
 BH - attribute value (color ..)
MOV CX, 0000H
 CX - starting row:col MOV DX, 2479
 DX - ending row:col INT 10H
INT 21H Functions

 02h – display character

 01h – accept character

 09h – display string

 0Ah – accept character

 3Fh – accept string

 40 – display string
INT 21h, 3FH
Accept string
NAME db 20 DUP(‘ ‘)
 AH- function code 3fh

 BX – file handle 00 MOV AH, 3FH
MOV BX, 00
 CX – maximum input length
MOV CX, 20
 DX- address of the area that is LEA DX, NAME
INT 21H
going to hold input

 Does not check whether the number of characters exceeds the limit
 The input characters are followed by 0DH and 0AH
 Stores the actual input length in AX
File Handles
 A file handle is a number that refers to a specific
device.
Handle Device
00 Keyboard
01 Screen
04 Printer
INT 21h, 0AH
Accept string
 Define parameter list in the .DATA
form label byte PARA_LIST LABEL BYTE
 NameOfTheParameter LABEL BYTE max_len DB 20
 In the first byte of the parameter act_len DB ?
list define the maximum length of input DB 20 Dup(‘ ‘)
the input (0 -255)
 The second byte is reserved for the
operation to store the actual length .CODE
of the input string MOV AH, 0Ah
 The third byte begins a field that is LEA DX, PARA_LIST
to contain the typed characters
INT 21H
 Checks input characters does not exceed the maximum value
 Stores the enter character 0DH, but its not counted on the actual length
 MOV name[act_len + 1], ‘$’ ;to set a delimiter
Using control characters
Control character ASCII Hex Effect on Cursor
Carriage Return 13 0Dh Resets to left position
Line feed 10 0Ah Advances to next line
Tab 09 09h Advances to next tab stop

 Example
 Msg db “Hello”, 13,10,’$’
 Msg db 13,10,”Hello”,’$’
 Example
 CR equ 13
 Lf equ 10

 Msg CR, LF, “Abebe”, 09,”Kebede”


40H, INT 21H
Display String
Name db “Abebe kebede”, 13, 10
 AH – function code 40H

 BX – file handle Mov AH, 40H
MOV BX, 01
 CX – number of characters to MOV CX, 14
display LEA DX, Name
INT 21H
 DX – address of the string to be
displayed

 Don’t need a delimiter


 Successful INT operation- delivers the number of bytes written on AX
 Unsuccessful INT operation returns
 Sets the carry flag and
 Stores error codes in AX
 Ax =05H access denied (invalid or disconnect device)
 AX= 06H, invalid handle

You might also like