1 screen and keyboard operations suthida chaichomchuen [email protected]
TRANSCRIPT
![Page 2: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/2.jpg)
2
Objectives
To introduce the requirements for... Displaying information on a screen. Accepting input from a keyboard.
![Page 3: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/3.jpg)
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
![Page 4: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/4.jpg)
4
INT 10H Functions
02H : Set cursor 06H : Scroll screen
![Page 5: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/5.jpg)
5
FFFFFFFFF21
02H : Display character on screen 09H : Display string on screen 0AH : Input from keyboard 3FH : Input from keyboard 40H : Display on screen
![Page 6: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/6.jpg)
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
![Page 7: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/7.jpg)
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
![Page 8: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/8.jpg)
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
![Page 9: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/9.jpg)
9
Setting the cursor
For text mode INT 10H function 02H AH = 02H BH = page number (normally 0) F FFF= DL = column
![Page 10: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/10.jpg)
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
![Page 11: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/11.jpg)
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
![Page 12: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/12.jpg)
12
FFFFFFFF FFF FFFFFF
Example :
MOV AX,0600HMOV BH,71HMOV CX,0000HMOV DX,1 8 4 FHINT 1 0 H
![Page 13: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/13.jpg)
13
Screen display : string
INT 21H function 09H AH = 09H DX = address of display string F FFFFFFFFFF FFF FFF FF FFFF=
![Page 14: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/14.jpg)
14
Screen display : string
Example :
MSG DB ‘ Cust omer name?’ , ’ $’
. . .MOV AH,0 9 HLEA DX,MSGINT 21H
![Page 15: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/15.jpg)
15
FFFFFFFF FFFFF
INT 21H function 0AH AH = 0AH DX = address of parameter list
![Page 16: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/16.jpg)
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
![Page 17: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/17.jpg)
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
![Page 18: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/18.jpg)
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
![Page 19: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/19.jpg)
19
Screen display : character
INT 21H function 02H AH = 02H DL = character to display
![Page 20: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/20.jpg)
20
Screen display : character
Format Instruction :
F F F AH,0 2 HMOV DL,charINT 21H
![Page 21: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/21.jpg)
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
![Page 22: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/22.jpg)
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
![Page 23: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/23.jpg)
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.
![Page 24: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/24.jpg)
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
![Page 25: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/25.jpg)
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
![Page 26: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/26.jpg)
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.
![Page 27: 1 Screen and Keyboard Operations Suthida Chaichomchuen std@kmitnb.ac.th](https://reader035.vdocument.in/reader035/viewer/2022062718/56649ebf5503460f94bc9e7b/html5/thumbnails/27.jpg)
27
Keyboard input : uses file handles Example :
KBINPUT DB 20 DUP( ‘ ‘ )
. . .MOV AH,3FHMOV BX,0 0MOV CX,2 0LEA DX,KBINPUTINT 21H