Advanced Features of Screen Processing

Download Report

Transcript Advanced Features of Screen Processing

Advanced Features of Screen Processing
Suthida Chaichomchuen
[email protected]
1
BIOS INT 10H
•
•
•
•
•
•
•
•
•
•
•
00H : Set video mode
01H : Set cursor size
02H : Set cursor position
03H : Read cursor position
04H : Read light pen position
05H : Select active page
06H : Scroll up screen
07H : Scroll down screen
08H : Read attribute/character
09H : Display attribute/character
0AH : Display character
2
BIOS INT 10H
•
•
•
•
•
•
•
•
•
•
0BH : Set color palette
0CH : Write pixel dot
0DH : Read pixel dot
0EH : Write teletype
0FH : Get current video mode
11H : Character generator
12H : Select alternative routine
13H : Display character string
1BH : Return state information
1CH : Save/restore video status
3
Video Adapters
•
•
•
•
•
MDA : Monochrome display adapter
CGA : Color graphics adapter
EGA : Enhanced graphics adapter
MCGA : Multicolor graphics array
VGA : Video graphics array
4
Video Display
• Video controller
– generate the monitor’s scan signals
• Video BIOS
– Interface to the video adapter
– setting cursor
– displaying characters
• Video display area
– contain the information for display
5
Attribute Byte
• Bit 7 (BL)
– set blinking
• Bits 6-4
– determine the screen background
• Bit 3 (I)
– set high intensity
• Bit 2-0
– determine the foreground
6
Screen Pages
• Text mode
– Page 0 - 3
• Begin address
–
–
–
–
B800[0] : Page 0
B900[0] : Page 1
BA00[0] : Page 2
BB00[0] : Page 3
• Amount memory for each page
– 80 x 25 x 2 = 4000 bytes (4K)
7
INT 10H Function 00H
• Set video mode
• AH = 00H
• AL = video mode value
–
–
–
–
–
00 : 25 x 40 mono
01 : 25 x 40 color
02 : 25 x 80 mono
03 : 25 x 80 color
07 : 25 x 80 mono
8
INT 10H Function 00H
• Example
– MOV
– MOV
– INT
AH,00H
AL,03H
10H
9
INT 10H Function 01H
•
•
•
•
•
Set cursor size
AH = 01H
CH (bit 4-0) = top of cursor
CL (bit 4-0) = bottom of cursor
Cursor size
– 0:14 - VGA
– 0:13 - EGA
– 0:7 - CGA
10
INT 10H Function 01H
• Example
–
–
–
–
MOV
MOV
MOV
INT
AH,01H
CH,00
CL,14
10H
11
INT 10H Function 02H
• Set cursor position
• AH = 02H
• BH = page number (0-3)
– 0 : default
• DH = row
• DL = column
12
INT 10H Function 02H
• Example
–
–
–
–
–
MOV
MOV
MOV
MOV
INT
AH,02H
BH,00
DH,12
DL,30
10H
13
INT 10H Function 03H
•
•
•
•
•
Read cursor position
Determine the Row, Column, cursor Size
AH = 02H
BH = page number
Values return of operation
–
–
–
–
–
AX, BX : unchanged
CH : starting scan line
CL : ending scan line
DH : row
DL : column
14
INT 10H Function 03H
• Example
–
–
–
–
–
–
MOV
MOV
INT
MOV
INC
INT
AH,03H
BH,00
10H
AH,02H
DL
10H
15
INT 10H Function 05H
•
•
•
•
Select active page
AH = 05H
AL = page number
Example
– MOV
– MOV
– INT
AH,05H
AL,page#
10H
16
INT 10H Function 06H
•
•
•
•
•
•
Scroll up screen
AH = 06H
AL = number of rows (00 for full screen)
BH = attribute
CX = starting row : column
DX = ending row : column
17
INT 10H Function 06H
• Example
–
–
–
–
–
MOV
MOV
MOV
MOV
INT
AH,06H
BH,61H
CX,0000H
DX,184FH
10H
18
INT 10H Function 07H
•
•
•
•
•
•
Scroll down screen
AH = 07H
AL = number of rows (00 for full screen)
BH = attribute
CX = starting row : column
DX = ending row : column
19
INT 10H Function 08H
•
•
•
•
Read attribute/character at cursor position
AH = 08H
BH = page number
Values return
– AL = character
– AH = attribute of character
• Example
– MOV
– MOV
– INT
AH,08H
BH,00
10H
20
INT 10H Function 09H
•
•
•
•
•
•
Display attribute/character at cursor position
AH = 09H
AL = ASCII character to be displayed
BH = page number
BL = attribute
CX = count
21
INT 10H Function 09H
• Example
–
–
–
–
–
–
MOV
MOV
MOV
MOV
MOV
INT
AH,09H
AL,01H
BH,00
BL,16H
CX,60
10H
22
INT 10H Function 0AH
•
•
•
•
•
Display character at cursor position
AH = 0AH
AL = ASCII character to displayed
BH = page number
CX = count
23
INT 10H Function 0AH
• Example
–
–
–
–
–
MOV
MOV
MOV
MOV
INT
AH,0AH
AL,char
BH,page#
CX,repetition
10H
24
INT 10H Function 0EH
• Write teletype
• AH = 0EH
• AL = ASCII character to displayed
–
–
–
–
08H : backspace
07H : bell
0DH : carriage return
0AH : line feed
• BH = page number
• BL = foreground color
25
INT 10H Function 0EH
• Example
–
–
–
–
–
MOV
MOV
MOV
MOV
INT
AH,0EH
AL,char
BH,page#
BL,color
10H
26
INT 10H Function 0FH
• Get current video mode
• AH = 0FH
• Values return
– AL = current video mode
– AH = characters per line (20, 40 or 80)
– BH = current page number
• Example
– MOV
– INT
AH,0FH
10H
27
INT 10H Function 12H
• Select alternative screen routine
• AH = 12H
• Values return
– BH = 00H for color, 01H for monochrome
– BL = 00H for 64K, 01H for 128K, 02H for 192K,
03H for 256K
– CH = adapter bits
– CL = switch setting
• Example
– MOV
– INT
AH,12H
10H
28
INT 10H Function 13H
•
•
•
•
•
•
•
•
Display character string
AH = 13H
AL = subfunctions (00, 01, 02 or 03)
BH = page number
BL = screen attribute
BP = address of string in ES:BP
CX = length of string
DX = starting location on screen
29
INT 10H Function 13H
• Four subfunctions in AL
– 00 : display attribute and string; do not advance
cursor
– 01 : display attribute and string; advance cursor,
– 02 : display character and then attribute; do not
advance cursor
– 03 : display character and then attribute; advance
cursor
30
INT 10H Function 13H
• Example
–
–
–
–
–
–
–
–
MOV
MOV
MOV
MOV
LEA
MOV
MOV
INT
AH,13H
AL,subfunction
BH,page#
BL,attribute
BP,address
CX,length
DX,screen
10H
31
Using Graphics Mode
• Set graphic mode by use function 00H
• Mode number in AL
– 04H - 06H
– 0DH - 13H
• used Pixels to generate color patterns
• Example
– MOV
– MOV
– INT
AH,00H
AL,12H
10H
32
INT 10H Function 04H
• Read light pen position
• AH = 04H
• Values return
–
–
–
–
AH = 0 - not triggered, 1 - triggered
DH = row
DL = column
CH:BX = pixel location
33
INT 10H Function 0BH
• Set color palette
• AH = 0BH
• BH = 00 or 01
– determine the purpose of BL
34
INT 10H Function 0BH
• BH = 00
– select the background color
• BL = color value in bit 0-3
• Example
–
–
–
–
MOV
MOV
MOV
INT
AH,0BH
BH,00
BL,04
10H
35
INT 10H Function 0BH
• BH = 01
– select the palette for graphics
• BL = the palette 0 or 1
• Example
–
–
–
–
MOV
MOV
MOV
INT
AH,0BH
BH,01
BL,00
10H
36
INT 10H Function 0CH
•
•
•
•
•
•
Write pixel dot
AH = 0CH
AL = color of the pixel
BX = page number (VGA/EGA)
CX = column
DX = row
37
INT 10H Function 0CH
• Example
–
–
–
–
–
–
MOV
MOV
MOV
MOV
MOV
INT
AH,0CH
AL,03
BH,00
CX,200
DX,50
10H
38
INT 10H Function 0DH
•
•
•
•
•
•
Read pixel dot
AH = 0DH
BX = page number (VGA/EGA)
CX = column
DX = row
Value return
– AL = pixel color
39
INT 10H Function 10H
• Set palette registers
• AH = 10H
• AL = subfunction code (00-03)
40
INT 10H Function 10H
• Subfunction code in AL
– 00 : set a palette register
• BH = the value to set
• BL = the register to set
– 01 : set the overscan register
• BH = the value to set
– 02 : set all palette registers and overscan
• bytes 0-15 = palette values
• byte 16 = overscan value
– 03 : Toggle the intensity/blinking bit
• BL = 00 enables intensity
• BL = 01 enables blinking
41