Download presentation
Presentation is loading. Please wait.
Published byDaniela Cooper Modified over 9 years ago
1
1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th
2
2 Objectives n To introduce the requirements for... n Displaying information on a screen. n Accepting input from a keyboard.
3
3 INT (interrupt) Instruction Handles n INT 10H functions : BIOS –Screen handling n INT 21H functions : DOS –Displaying screen output –Accepting keyboard input n AH register –Insert a function value
4
4 INT 10H Functions n 02H : Set cursor n 06H : Scroll screen
5
5 INT 21H Functions n 02H : Display character on screen n 09H : Display string on screen n 0AH : Input from keyboard n 3FH : Input from keyboard n 40H : Display on screen
6
6 The Screen n 25 rows (0-24) n 80 columns (0-79) Screen LocationDecimal Format Hex Format RowColumnRowColumn Upper left corner000000H00H Upper right corner007900H4FH Center of screen1239/400CH27H/28H Lower left corner240018H00H Lower right corner247918H4FH
7
7 The Screen : video display area n Monochrome display area –Begin BIOS location : B000[0]H –Support 4K bytes of memory 2K : available for characters 2K : attribute for each character –reverse video –blinking –high intensity –underlining
8
8 The Screen : video display area n Color-graphics video display area –Begin BIOS location : B800[0]H –Support 16K bytes of memory –Text mode –Graphics mode
9
9 Setting the cursor n For text mode n INT 10H function 02H n AH = 02H n BH = page number (normally 0) n DH = row n DL = column
10
10 Setting the cursor n Ex. Sets the cursor to row 08, column 15 MOVAH,02H MOVBH,00 MOVDH,08 MOVDL,15 INT10H
11
11 Clearing the screen n INT 10H function 06H n AH = 06H n AL = number of lines to scroll (00H for full screen) n BH = attribute value (color, reverse video, blinking) n CX = starting row:column n DX = ending row:column
12
12 Clearing the screen n Example : MOVAX,0600H MOVBH,71H MOVCX,0000H MOVDX,184FH INT10H
13
13 Screen display : string n INT 21H function 09H n AH = 09H n DX = address of display string n $ = recognizes the end of data
14
14 Screen display : string n Example : MSGDB‘Customer name?’,’$’... MOVAH,09H LEADX,MSG INT21H
15
15 Keyboard Input n INT 21H function 0AH n AH = 0AH n DX = address of parameter list
16
16 Keyboard Input : parameter list n Use LABEL directive n 1 : provide the name of parameter list n 2 : first byte = maximum number of characters –min = 0, max = 255 n 3 : second byte = actual number of characters n 4 : third byte = begin of typed characters
17
17 Keyboard Input : parameter list n Example defines a parameter list PARALSTLABELBYTE MAXLENDB20 ACTLENDB? KBDATADB20 DUP(‘ ‘)... MOVAH,0AH LEADX,PARALST INT21H
18
18 Using control characters in a screen display n Carriage return (13 : 0DH) –resets to left position of screen n Line feed (10 : 0AH) –advanced to next line n Tab (09 : 09H) –advanced to next tab stop
19
19 Screen display : character n INT 21H function 02H n AH = 02H n DL = character to display
20
20 Screen display : character n Format Instruction : MOVAH,02H MOVDL,char INT21H
21
21 File handles n Number that refers to a specific device n 00 : Input, normally keyboard, but may be redirected n 01 : Output, normally display, but may be redirected n 02 : Error output, display, may not be redirected n 03 : Auxiliary device n 04 : Printer
22
22 Screen display : uses file handles n INT 21H function 40H n AH = 40H n BX = file handle 01 n CX = number of characters to display n DX = address of the display area
23
23 Result of INT operation n Successful –Delivers the number of bytes written to the AX. –Clears the carry flag. n Unsuccessful –Delivers the error code to the AX. 05H = access denied 06H = invalid handle –Sets the carry flag.
24
24 Screen display : uses file handles n Example : DISPMSGDB‘Assembly Lang.’, 0DH, 0AH... MOVAH,40H MOVBX,01 MOVCX,16 LEADX,DISPMSG INT21H
25
25 Keyboard Input : uses file handles n INT 21H function 3FH n AH = 3FH n BX = file handle 00 n CX = maximum number of characters to accept n DX = address of area for entering characters
26
26 Result of INT operation n Successful –Sets the AX with the number of characters entered. –Clears the carry flag. n Unsuccessful –Inserts the error code in the AX. 05H = access denied 06H = invalid handle –Sets the carry flag.
27
27 Keyboard input : uses file handles n Example : KBINPUTDB20 DUP(‘ ‘)... MOVAH,3FH MOVBX,00 MOVCX,20 LEADX,KBINPUT INT21H
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.