Upload
daniela-cooper
View
216
Download
3
Tags:
Embed Size (px)
Citation preview
2
Objectives
To introduce the requirements for... Displaying information on a screen. Accepting input from a keyboard.
3
INT (interrupt) Instruction Handles 10INT H functions : BIOS
– Screen handling INT 21H functions : DOS
– Displaying screen output– Accepting keyboard input
AH register– Insert a function value
4
INT 10H Functions
02H : Set cursor 06H : Scroll screen
5
FFFFFFFFF21
02H : Display character on screen 09H : Display string on screen 0AH : Input from keyboard 3FH : Input from keyboard 40H : Display on screen
6
The Screen
-25 024rows ( ) -80 (0 79)columns
Screen Location Decimal Format Hex FormatRow Column Row Column
Upper left corner 00 00 00H00H Upper right corner 00 79 00H4FH Center of screen 12 3940/ 0CH 2728
Lower left corner 24 00 18H00H Lower right corner 24 79 18H4FH
7
FFF FFFFFF F video display area
Monochrome display area– 000 0Begin BIOS location : B [ ]H– Support 4K bytes of memory
• 2K : available for characters•2K : attribute for each character
– reverse video–blinking– high intensity–underlining
8
The Screen : video display area
FFFFF-FFFFFFFF FFFFF FFFFFFF FFea– Begin BIOS location : B800[0]H– FFFFF FF F FF FFF1 6– Text mode– Gr aphi cs mode
9
Setting the cursor
For text mode INT 10H function 02H AH = 02H BH = page number (normally 0) F FFF= DL = column
10
Setting the cursor
FF FFF F F F FFF. 0 8 , umn 15
F F F AH,0 2 HMOV BH,0 0MOV DH,0 8MOV DL,15INT 1 0 H
11
FFFFFFFF FFF FFFFFF
INT 10H function 06H AH = 06H AL = number of lines to scroll
(00H for full screen) BH = attribute value
(color, reverse video, blinking) CX = starting row:column DX = ending row:column
12
FFFFFFFF FFF FFFFFF
Example :
MOV AX,0600HMOV BH,71HMOV CX,0000HMOV DX,1 8 4 FHINT 1 0 H
13
Screen display : string
INT 21H function 09H AH = 09H DX = address of display string F FFFFFFFFFF FFF FFF FF FFFF=
14
Screen display : string
Example :
MSG DB ‘ Cust omer name?’ , ’ $’
. . .MOV AH,0 9 HLEA DX,MSGINT 21H
15
FFFFFFFF FFFFF
INT 21H function 0AH AH = 0AH DX = address of parameter list
16
Keyboard Input : parameter list
Use LABEL directive 1 : provide the name of parameter list 2 : fi r st byt e =maxi mumnumber of
characters– 0 255min = , max =
3: second byte = actual number of chFFFFFFFF
FFFF F FFFFF FF FFFFF FFFFFFF4 : =FFF
17
Keyboard Input : parameter list
Exampl e defi nes a par amet er l i st
PARALSTLABEL BYTEMAXLEN DB 20
ACTLEN DB ?KBDATA DB 20 DUP(‘ ‘)
. . .MOV AH,0 AHLEA DX,PARALSTINT 21H
18
Usi ng cont r ol char act er s i n a scr e en display
Carriage return (13 : 0DH)
– resets to left position of screen Line feed (10 : 0AH)
– advanced to next line Tab (09 : 09H)
– advanced to next tab stop
19
Screen display : character
INT 21H function 02H AH = 02H DL = character to display
20
Screen display : character
Format Instruction :
F F F AH,0 2 HMOV DL,charINT 21H
21
File handles
Number that refers to a specific device
00 : Input, normally keyboard, but m ay be redirected
01 : Out put , nor mal l y di spl ay, but may be r edi r ect ed
F FFFFF FFFFFFF FFFFFFFF F FF FFF 02
be r edi r ect ed 03 : Auxiliary device 04 : Printer
22
Screen display : uses file handles
INT 21H function 40H AH = 40H BX = file handle 01 CX = number of characters to displ
FF DX = address of the display area
23
FFFFFF FF FFF FFFFFFFFF Successful
– Delivers the number of bytes writ ten to the AX.
– Clears the carry flag. Unsuccessful
– Delivers the error code to the AX.• 05H = access denied• 06H = invalid handle
– Sets the carry flag.
24
Screen display : uses file handles
Example :
DISPMSG DB ‘Assembly Lang. ’, 0DH, 0AH . . .
MOV 40
MOV 01BX,MOV 16CX,FFF DX,DISPMSGINT 2 1 H
25
Keyboard Input : uses file handles
INT 21H function 3FH AH = 3FH BX = file handle 00 CX = maximum number of characte
rs to accept DX = address of area for entering c
haracters
26
FFFFFF FF FFF FFFFFFFFF Successful
– Sets the AX with the number of ch aracters entered.
– Clears the carry flag. Unsuccessful
– Inserts the error code in the AX.• 05H = access denied• 06H = invalid handle
– Sets the carry flag.
27
Keyboard input : uses file handles Example :
KBINPUT DB 20 DUP( ‘ ‘ )
. . .MOV AH,3FHMOV BX,0 0MOV CX,2 0LEA DX,KBINPUTINT 21H