38
1 PC Peripherals PC Peripherals for Technicians for Technicians Chapter 3.2 - Video Chapter 3.2 - Video Text Mode Operation Text Mode Operation Systems Manufacturing Systems Manufacturing Training and Employee Training and Employee Development Development Copyright © 1998 Intel Copyright © 1998 Intel Corp. Corp.

1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

Embed Size (px)

Citation preview

Page 1: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

1

PC PeripheralsPC Peripherals for for TechniciansTechnicians

Chapter 3.2 - Video Chapter 3.2 - Video Text Mode Operation Text Mode Operation

Systems Manufacturing Training Systems Manufacturing Training and Employee Developmentand Employee Development

Copyright © 1998 Intel Corp.Copyright © 1998 Intel Corp.

Page 2: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

2

Text Mode Text Mode OperationOperation

OBJECTIVES: At the end of this section, the student will be able to do the following:

Discuss Video Display Modes in a Graphics System. Discuss the ASCII standard. Explain the Text Mode Video Buffer data format. Discuss Text Mode character fonts. Describe the attribute byte & the palette registers. Discuss color generation using the Video DAC.

Page 3: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

3

Display Modes Video subsystems operate in multiple display modes which

control certain aspects of the video operation.Text OR Graphics; Screen Resolution; Number of colors.

Numerous control registers put the video adapter hardware in a state that will allow it to produce the indicated mode.This is almost always accomplished with BIOS calls.

» Video modes are changed using BIOS software interrupt INT 10h, or through a high-level construct such as the int86() function in Microsoft C.

Default Mode is Text Mode 03hDefault Mode is Text Mode 03hThe initial video mode is an 80-column alphanumeric

mode (03h) set by the ROM BIOS during POST.Text modes display alphanumeric characters only.

Page 4: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

4

Modes supported BIOS (Partial list)

CGAEGAVGACGAEGAVGACGACGAMDAVGAEGAEGAEGAEGAVGAVGAVGA

TextGraphicsGraphicsTextTextGraphicsGraphicsGraphicsGraphicsGraphicsGraphicsGraphics

Mode Emul. Res. TypeMaxColors Scheme

Char.Box

Max.Pages

Buff.Start

0,10,10,12,32,32,3!4,5677!DEF10111213

320x200320x350360x400640x200640x350720x400320x200640x200720x350720x400320x200640x200640x350640x350640x480640x480320x200

TextTextTextTextText

88888811888422111

16/256k16/256k16/256k16/256k16/256k16/256k4/256k2/256kMDA MonoVGA Mono16/256k16/256kMono16/356k2/256k16/256k256/256k

40x2540x2540x2580x2580x2580x2540x2580x2580x2580x2540x2580x2580x2580x2580x3080x3040x25

8x88x149x168x88x149x168x88x89x149x168x88x88x148x148x168x168x8

B8000hB8000hB8000hB8000hB8000hB8000hB8000hB8000hB0000hB0000hA0000hA0000hA0000hA0000hA0000hA0000hA0000h

! - Indicates power-on default mode 3! - Color monitor is attached3! - Color monitor is attached 7! - Monochrome monitor is attached

Page 5: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

5

Characteristics of VGA Mode 03h Characteristics of VGA Mode 03h:

Video Buffer @ B800080 Characters/line; 25 text lines frame4000 bytes of Memory used (4000t = FA0h)

» 80 x 25 = 2000 characters

» 2000 chars * 2 bytes/char = 4000 bytes.

Character size = 9 x 16Resolution = 720 pixels x 400 raster lines

» 720 pixels per horizontal line> 720 / 9 pixels/char -> 80 char/line

» 400 vertical lines> 400 / 16 lines/char -> 25 text lines

15

7 6 5 4 3 2 1 0

2

4

5

9

01

3

6

7

8

10

1112

13

14

Page 6: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

6

Characteristics of VGA Mode 03h Characteristics of VGA Mode 03h

Horizontal Freq. = 31.5 KHz (lines/sec)Vertical Freq = 70 Hz (frames/sec)

» 31.5 KHz / 70 Hz ~ 449 lines per frame> Only 400 displayed due to overscan

Dot Clock = 28.322 MHz (28,322,000 dots per second)» 28.322 MHz / 31.5 KHz = 900 dots/line

> 100 chars/ line * 9 dots / char = 900 dots/line> Only 80 chars/line displayed due to overscan

Number of colors = 16 (2 4 = 16)» Attribute Byte is two 4-bit fields:

> Foreground Color: Bits 0-3 > Background Color: Bits 4-7

Displayed Video Buffer area

720 pixels x 400 lines

Page 7: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

7

Mode 3: Display Memory Map

Page 0

Page 1

Page 2

Page 6

Page 7

B8000

B8F9F

B9000

B9F9F

BA000

BAF9F

BE000

BEF9F

BF000

BFF9F

Bit Planes 0, 1

DisplayData

Unused

4000Bytes

0000

96 Bytes

399940004095

Typical Page: 80x25 = 4000 Bytes A Display Page is one screen of text.Int 10h Function 5 sets the active page.

0000

0F9Fh0FA0h0FFFh

Bit Planes 0, 1

THE 32K BETWEEN B8000 - BFFFFCAN HOLD UP TO 8 DISPLAY PAGES(8 * 4096 = 32K)

NOTE: The memory between A0000h & B7FFFh is not used for display in this mode.

Page 8: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

8

ASCII StandardAmerican Standard Code for Information Interchange

ASCII (pronounced “askey”) is a 7 bit code used to achieve compatibility between data services.

The ASCII standard ensures that each of the common characters are assigned a unique code that is the same, regardless of keyboard, computer or monitor.Common characters include:

» Alphabet: Upper & lower case (A,a,B,b, ... Z,z)

» Numbers: (0,1,2...8,9)

» Symbols: (@, $, [, ~, etc)

» Non printable characters: Control chars (^G, ^H), etc.

» Extended ASCII characters includes codes for multiple keys (e.g. - CTL-ALT-DEL).

Page 9: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

9

Decimal To Hex to ASCII ConversionDec Hex ASCII

0 12345678910111213141516171819202122

23 15 NAK232425262728293031

NUL SOHSTXETXEOTENQACKBELBSHTLFVTFFCRSOSIDLEDC1-XONDC2 DC3-XOFFDC4NAKSYN

23

ETBCANEMSUBESCFSGSRSUS

000102030405060708090A0B0C0D0E0F10111213141516

23 15 NAK1718191A1B1C1D1E1F

3233343536373839404142434445464748495051525354555657585960616263

202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F

SP!“#$%&‘()*+,-./0123456789:;<=>?

Dec Hex ASCII6465666768697071727374757677787980818283848586878889909192939495

404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F

@ABCDEFGHIJKLMNOPQRSTUVWXYZ{\}^_

Dec Hex ASCII96979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127

606162636465666768596A6B6C6D6E6F707172737475767778797A7B7C7D7E7F

‘abcdefghijklmnopqrstuvwxyz{|}~DEL

Dec Hex ASCII

Page 10: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

10

Putting a character on the screenO/S or Application Software Write “A” on

Screen - Call INT 10h AH=09 AL=41

BIOS ( INT 10h)

Dot Stream To Monitor

A

41 07

Video RAM

ASCIICharCode

41h 07h

ATTRInfo

(colors)

Video Controller

Video Signal Generator

CRT Controller

AlphanumericCharacter Generator

AttributeDecoder

Color &Intensity

Dot Pattern

Horiz & Vert Timing

BUSInterface

Microprocessor

Page 11: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

11

Putting a character on the screenIn Text Mode each character is represented in the Video

Buffer by a pair of bytes:» The first byte represents the character’s ASCII value.

» The second byte represents the character’s attribute > (i.e. color of foreground/background, blinking, intensity)

The Video Controller reads out the character codes and attributes simultaneously from the video buffer.

Each location in the video hardware’s display buffer maps to a location on the display screen.

» The first byte of the display buffer maps to the top, leftmost point on the screen.

» As memory addresses increase, the screen location moves from left to right & top to bottom.

Page 12: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

12

Putting a character on the screenExamining the contents of the video buffer shows how the

data corresponds to the characters on the screen

AMIBIOS (C) 1992 American Megatrends, IncBIOS Version 1.00.02.CA3C

0008192 KB

Please Wait...

Image on screen

>byte 0b8000p length 40 (ITP cmd to display memory)0x0000000b8000P 41 07 4d 07 49 07 42 07 'A.M.I.B.'0x0000000b8008P 49 07 4f 07 53 07 20 07 'I.O.S. .'0x0000000b8010P 28 07 43 07 29 07 31 07 '(.C.).1.'0x0000000b8018P 39 07 39 07 32 07 20 07 '9.9.2. .'0x0000000b8020P 41 07 6d 07 65 07 72 07 'A.m.e.r.'0x0000000b8028P 69 07 63 07 61 07 6e 07 'i.c.a.n.'0x0000000b8030P 20 07 4d 07 65 07 67 07 ' .M.e.g.'0x0000000b8038P 61 07 74 07 72 07 65 07 'a.t.r.e.'

Video Buffer

Each Character Code is followed by it’s Attribute Byte

Page 13: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

13

Putting a character on the screen

Bit Plane 1

2000 bytes (7D0h)

Bit Plane 0

C.0 B8000

C.1B8002

C.79 B809E

C.80 B80A0

C.81B80A1

C.159

CHARACTER ATTRIBUTE

A.0 B8001

A.1 B8003

A.79 B809FC.0. = Character position

zero @ B8000

A.0. = Attribute position zero @ B8001

2000 bytes (7D0h)

Viewing the Video Buffer as Bit Planes

Page 14: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

14

Text Mode Character Generation

The number of text lines displayed depends on the vertical resolution: e.g. - The default text mode 03h (720 x 400) has 400 raster lines.

» The 9x16 FONT with a character matrix height of 16 pixels, produces 25 lines of text in mode 03h.

> 400 / 16 = 25 text lines> and - 720 / 9 = 80 characters / line

» Other modes such as the 132x43 VGA text mode 54h (1056 x 350) use different character sets such as the 8 x 8 character matrix displaying 43 lines of text.

> e.g. - 350 / 8 = 43 text lines (Mode 54h: 1056 x 350)> e.g. - 1056 / 8 = 132 characters (Mode 54h: 1056 x 350)

First we’ll describe Font Generation from the Character Byte, then color generation using the Palette & the Attribute Byte.

Page 15: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

15

Text Mode Character Generation

Note: The 9th pixel is usually blank except for ASCII codes C0h-DFh. These characters (used for drawing frames & borders) create unbroken horizontal lines that can be connected without any space in between them.

= Foreground color

= Background color

Character Box - Pixel pattern for “A”9 X 16 VGA text-mode character box

* The right-hand column of pixels is a duplicate ofthe pattern in Column 0

Data = 38h00111000 binary

Bit Patternof font asstored inmemory

15

7 6 5 4 3 2 1 0 *

2

4

5

9

01

3

6

7

8

10

1112

13

14

0000

3810

6CC6C6FEC6C6C6

C600000000

Characters can be 9 dots wide in some modes and 8 dots wide in others.

Default VGA Text Video Mode 3

Character Row #’s

Page 16: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

16

Text Mode Character GenerationBecause the 8-bit ASCII codes can’t be directly displayed

on the the screen, they are translated by the hardware Alphanumeric Character Generation circuitry into the pixel patterns corresponding to those codes.

> e.g. 41h = “A”

Regardless of the fonts character size, 32 (20h) bytes is reserved for each of the 256 characters.

> The BIOS contains a default table of character bit patterns.

Each character table occupies 8 KB of memory.» 32 bytes/ character * 256 characters = 8192 bytes.

Up to 8 character sets can be resident in Bit Plane 2.» 8 * 8KB = 64KB (A0000 - AFFFF)

Page 17: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

17

Text Mode Character Generation

AttributeController(Palette)CRT

Controller

Character Gen[Lookup Table]

(Bit Plane 2)e.g. A0823

Character Row

(e.g. 3)

Latch Latch

MemoryAddr

(e.g. B8000)

Dots

Attribute

(41h)Character Memory

Bit Plane 0(e.g. B8000)

(07h)Attribute Memory

Bit Plane 1(e.g. B8001)

Video Buffer (DRAM)

(07h)(41h) R

G

B

32 (20h) bytes are reserved for each of the 256 character fontsCharacter Generator would use ASCII code of 41h to get the start

address of the bit patterns for font “A” to display.

» e.g. 41h x 20h = 820h (offset from base of A0000h)

Page 18: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

18

Text Mode Character GenerationThe Character Generator uses a Bit plane 2 as a Lookup

Table to translate the ASCII value into a matrix of dots called a character box or cell to display on the screen.

The default font is automatically copied from ROM to video memory map 2 when a TEXT display mode is selected via the BIOS.

Direct access by the CPU to Bit plane 2 is not allowed when the Video Controller is programmed during POST.

» Bit plane 2 (which is loaded by the BIOS during POST) is accessed internally by the Video Controller hardware and is not normally visible to the programmer.

» To be able to read the bit pattern, it is necessary to re-program the video controller so the automatic odd/even addressing shuffle in text mode is not utilized.

Page 19: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

19

Text Mode Character Generation

32 (20h) bytes are reserved for each character. The start address is calculated as follows for “A” (41h):

A0000h + (20h * 41h) => A0000h + 820h => A0820h

The start address calculated for “a” (61h) would be:A0000h + (20h * 61h) => A0000h +C20h => A0C20h

The 32 bytes stored in Bit Plane 2 for ASCII code 41 are: 0x0000000a0820P 00 00 10 38 6c c6 c6 fe '...8l...'0x0000000a0828P c6 c6 c6 c6 00 00 00 00 '........'0x0000000a0830P 00 00 00 00 00 00 00 00 '........'0x0000000a0838P 00 00 00 00 00 00 00 00 '........'

Note: Address A0823h contain 38h (0011 1000 binary)

The above pattern was read after programming the Video Controller to read Map 2 (not normally visible to the programmer).

Page 20: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

20

Text Mode Character GenerationCharacter Fonts - Bit Plane 2

9 X 16 VGA text-mode character box

Character Generator would use ASCII code of 41h to get the start address of the bit patterns for font “A” to display. e.g. 41h x 20h = 820h

NOTE: Offset of each scan linefrom start address of ASCII 41h.e.g. 4th scan line (Char Row 3) addr => 820+3= 823h

A0823h = 38h (0011 1000 binary)

To display 1 row of characters, the CRTC reads out 80 8-bit codes from character memory 16 times in succession for an 80 x 25 display.

15

7 6 5 4 3 2 1 0 *

2

4

5

9

= Foreground color

= Background color

0

1

3

6

7

8

10

1112

13

14

0a082b

0a082d0a082e

0a08200a0821

0a08230a0822

0a08240a08250a08260a08270a08280a08290a082a

0a082c

0a082f

0000

3810

6CC6C6FEC6C6C6

C600000000

Page 21: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

21

Color Generation - Text Mode 3

In alphanumeric modes, the microprocessor writes each symbol to the video buffer as a series of 2 bytes.

e.g. B800:0 = 41h, B800:1 = 07hLow-order byte = (41h); High-order byte (07h)

Low-order byte

7 6 5 4 3 2 1 0

8-bit character code

4-bit foreground attribute

4-bit background attribute

7 6 5 4 3 2 1 0

High-order byte

Now we’ll describe the Attribute Byte and Color Generation

Page 22: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

22

Video Buffer (DRAM)

AttributeController

(Palette)CRTController

Character Gen[Lookup Table]

(Bit Plane 2)e.g. A0820

Character Row

Latch Latch

MemoryAddr

Dots

Attribute

(41h)Character Memory

Bit Plane 0(e.g. B8000)

(07h)Attribute Memory

Bit Plane 1(e.g. B8001)

(07h)(41h) R

G

B

Each attribute nibble selects registers in the color palette

Color Generation - Text Mode 3 The second byte represents the character’s attribute

(i.e. color of foreground/background, blinking, intensity)

Page 23: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

23

Color Generation - Text Mode 3ATTRIBUTE BYTE:

The Video hardware translates the attribute nibbles into the indicated foreground & background colors.e.g. [0000 0111] -> 07h = Normal (white on black)e.g. [0000 1111] -> 0Fh = High Intensitye.g. [1000 0001] -> 81h = Blinking Blue

Attribute Bits7 - Blinking (Note: No intensity component)6 - Background color - Red component5 - Background color - Green component4 - Background color - Blue component3 - Foreground color - Intensity component2 - Foreground color - Red component1 - Foreground color - Green component0 - Foreground color - Blue component

Page 24: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

24

Color Generation - The Palette The color palette is a lookup table consisting of 16 six-

bit values in the Attribute Controller.Port 3C0, 3C1 Offset 00-0Fh (16 registers)Each character can be displayed in any of 16 foreground

colors (bits 3-0) and 8 background colors (bits 6-4).

One reason for using a color palette is that the total number of possible colors can be greater than the number of colors that can be displayed simultaneously16 colors simultaneously out of 64 colors combinations.

» A total of 64 colors combinations are available with 6 bits. (26 = 64)

» With 16 registers, 16 colors can be loaded into the Palette Registers at the same time.

Page 25: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

25

Color Generation - The Palette Each of the 16 Palette Registers contains six bits.

On earlier EGA cards, these 6 bits directly correspond to the signals going to the monitor.

» The EGA TTL level monitor color signal pins were:> RED, red, GREEN, green, BLUE, blue where each

color had 2 signals, one representing a brighter, more intense display (r,g,b) and the other for a normal display (RGB).

Note: VGA uses analog signal levels and the 6 bits in the Palette Registers are inputs to the Video DAC (Digital to Analog Converter) which can produce the same colors as on a TTL EGA system.

Page 26: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

26

Color Generation - The Palette

e.g. - Attribute Nibble = 2h: Palette = 2h = xx00 0010b xx00 0010=> Green (G) Foreground Pixels

e.g. - Attribute Nibble = 5h: Palette = 5h = xx00 0101b xx00 0101b => Magenta (R+B) ~ purple

Memory Buffer Example: B8000 = 41 (ASCII Capital A)

B8001 = 52 (Attribute) Foreground Pixels = 2 Background Pixels = 5

Produces Green Character “A” on magenta background

TO DAC

7 6 5 4 3 2 1 0

X X r g b R G B

BLUE

GREEN

RED

blue

green

red

X X 0 0 0 0 1 0 => Green

Page 27: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

27

Color Generation - The Palette

e.g. - Attribute Nibble = 7h: Palette = 7h = xx00 0111b xx00 0111b => White (R+G+B) Foreground Pixels

e.g. - Attribute Nibble = 0h: Palette = 0h = xx00 0000b xx00 0000=> Black (no colors) Background Pixels

Memory Buffer Example: B8000 = 41 (ASCII Capital A)

B8001 = 07 (Attribute) Foreground Pixels = 7 Background Pixels = 0

Produces White Character “A” on black background

TO DAC

7 6 5 4 3 2 1 0

X X r g b R G B

BLUE

GREEN

RED

blue

green

red

X X 0 0 0 1 1 1 => White

Page 28: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

28

Color Generation - The PaletteRED, red, GREEN, green, BLUE, blue where each color has 2

signals, one representing a brighter, more intense display (r,g,b) and the other for a normal display (R,G,B).

Light Blue (r+g+b + B) [XX11 1001] white + Blue

7 6 5 4 3 2 1 0

X X r g b R G B

BLUE

GREEN

RED

blue

green

red

X X 1 1 1 0 0 1

Note: r, g, & b, are allselected when Bit 3 of foreground Attribute nibble is a one.e.g. - 9h = 1001b for“light blue” [intense]

X X r g b R G B

I R G B => Light Blue

Page 29: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

29

Color Generation - The Palette

The following 2 tables show the relationship between the Attribute nibble value, the Palette Register value, and the color displayed. (Values loaded by BIOS)

Attribute Nibble Palette Value Default Color

0h - 0000 00h Black [ xx00 0000 ]

1h - 0001 01h Blue (B) [ xx00 0001 ]

2h - 0010 02h Green (G) [ xx00 0010 ]

3h - 0011 03h Cyan (G+B) [ xx00 0011 ]

4h - 0100 04h Red (R) - [ xx00 0100 ]

5h - 0101 05h Magenta (R+B) [ xx00 0101 ]

6h - 0110 14h Brown (g+R) [ xx01 0100 ]

7h - 0111 07h White (R+G+B) [ xx00 0111 ]e.g., White Foreground

e.g., BlackBackground

Modified Brown

Page 30: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

30

Color Generation - The Palette

Attribute Nibble Palette Value Default Color

8h - 1000 38h Dim White (r+g+b) [xx11 1000]

9h - 1001 39h Light Blue (r+g+b+B) [xx11 1001]

Ah - 1010 3Ah Light Green (r+g+b+G) [xx11 1010]

Bh - 1011 3Bh Light Cyan (r+g+b+G+B ) [xx11 1011]

Ch - 1100 3Ch Light Red (r+g+b+R) [xx11 1100]

Dh - 1101 3Dh Lt Magenta (r+g+b+R+B) [xx11 1101]

Eh - 1110 3Eh Yellow (r+g+b+R+G) [xx11 1110]

Fh - 1111 3Fh Int. White (r+g+b +R+G+B)[xx11 1111]

Relationship between the Attribute nibble value, the Palette Register value, and the color displayed. (Cont.)Note: r, g, & b are all selected when Bit 3 of foreground Attribute

nibble is a one. e.g., 9h = 1001b for “light blue” [intense]

Dark Gray

Page 31: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

31

Colors: The Digital to Analog Converter VGA uses ANALOG SIGNAL LEVELS to drive the monitor, and the

6 bits in the Palette Registers are inputs to the Video DAC. The 6-bit Palette Register output combined with 2 bits from a

Color Select register to form an 8-bit value passed to the DAC.

4-bitAttribute

From Video Buffer

(1 of 16 Registers)

6-bits(bits 0-5)

r,g,b,R,G,B(1 of 64

Registers)

8-bits(1 of 256 [FFh]

Registers)[4 banks of 64 [3Fh] colors]

bits 6 & 7(Mode 3=00)Attr Ctlr

PaletteRegisters3C0, 3C1Offsets00-0Fh

Attribute ControllerColor Select Register

Ports 3C0, 3C1Offset 14 - Bits 3 & 2

(1 of 4 banks)

VIDEO DAC3C7, 3C8, 3C9

Offsets00-FFh

[Note: 00-3Fhw/ 6 bits]

R

G

B

To MonitorAnalogOutput0 - 0.7 V

Attribute Mode Control Reg Ports 3C0, 3C1

Offset 10 - Bits 7 = 0(Palette Size Select - 16 color

4 banks of 64 entries)

Additional information NOT covered in class

Page 32: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

32

Colors: The Digital to Analog Converter The Video DAC use the 8-bit input to select one of its

256 color registers. Each of DAC 256 color registers contains an 18-bit

RGB specification (6-bits for each color: 3 x 6 = 18)The 4-bit attribute value decodes into a set of three

analog RGB values to the monitor.The larger the number contained in the DAC register, the

greater the analog output voltage.

By default, the Video BIOS initializes the first 64 DAC registers with RGB values to produce the the same 64 colors available on the EGA.The 6 bits from the Palette Registers select 1 of 64 (00 -

3Fh) registers in the DAC.

Page 33: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

33

Colors: The Digital to Analog Converter BIOS initializes the DAC to emulate EGA in Text Mode:

00h => XX00 0000b => 00t: Black (0 v - 0% Saturation)15h => XX01 0101b => 21t: Dim (Low Intensity - 33% )2Ah => XX10 1010b => 42t: Normal (Medium Int. - 66%)3Fh => XX11 1111b => 63t: High (High Intensity (0.7 v -100%)

Palette Value - Color(Offset in DAC)

DACRed

DACGreen

DACBlue

00 - Black 00 00 0001 - Normal Blue (B) 00 00 2A02 - Normal Green (G) 00 2A 0003 - Cyan (G+B) 00 2A 2A04 - Normal Red (R) 2A 00 0005 - Magenta (R+B) 2A 00 2A14 - Brown ( g+R) 2A 15 0007 - White (R+G+B) 2A 2A 2A39 - Light Blue ( r+g+b+B) 15 15 3F3C - Light Red ( r+g+b+R) 3F 15 153F - Bright White 3F 3F 3F

Note that the 64t bits are divided into 3 groups with a separation of 21t between

each intensity level.

The larger the number contained in the DAC

register, the greater the analog output voltage.

NOTE: This is only a partial list of the 256 DAC registers.

Page 34: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

34

Colors: The Digital to Analog Converter

I R G B X X 1 1 1 1 0 0

Bit 31

Bit 21

Bit 10

Bit 00

Ch => 1100From Video Buffer

Foreground Color Value (e.g.-Low Nibble from B80001)

Palette RegNumber (Ch)

Palette Register

Reg 15t Data = 3F

Reg 15t Data = 3E

Reg 13t Data = 3D

Reg 12t Data = 3C

Reg 03t Data = 03

Reg 02t Data = 02

Reg 01t Data = 01

Reg 00t Data = 00

Video DAC

3F 15 15

00 00 00

00 00 2A

00 2A 00

00 2A 2A

3F 3F 3F

3F 3F 15

3F 15 3F

3F 15 15

FFh=255t

254t

253t

252t

3Ch=060t

003t

002t

001t

000t

Color #

R G B

Notes:1- Attribute C hex produces Light Red (White + Red)2- 3Ch=60t=xx11 1100 Binary 60t -> decimal (base ten)

3Ch => xx11 11006 bits in Palette Reg

selected by 0Ch address

3Ch => 3F 15 1518 bits in DAC

selected by 3Ch address

I R G B

Page 35: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

35

REVIEW & SUMMARYWE HAVE DISCUSSED THE FOLLOWING:

Video Display Modes in a Graphics SystemVideo subsystems operate in multiple display modes

which control certain aspects of the video operation.» Text OR Graphics; Screen Resolution; Number of colors.

Characteristics of VGA Mode 03h» Video Buffer @ B8000h

» Character size = 9 x 16

» Resolution = 720 pixels x 400 lines

» 80 Characters/line; 25 lines frame (screen)

» 4K of Memory used (2K chars * 2 bytes/char = 4K bytes)15

7 6 5 4 3 2 1 0

2

4

5

9

01

3

6

7

8

10

1112

13

14

Page 36: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

36

REVIEW & SUMMARY The ASCII standard.

The ASCII standard ensures that each of the common characters are assigned a unique 7 bit code that is the same, regardless of keyboard, computer or monitor.

The Text Mode Video Buffer data format. In Text Mode each character is represented in the Video

Buffer by a pair of bytes:» The first byte represents the character’s ASCII value.

» The second byte represents the character’s attribute

Each location in the video hardware’s display buffer maps to a location on the display screen.

» As memory addresses increase, the screen location moves from left to right & top to bottom.

Page 37: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

37

REVIEW & SUMMARY Text Mode character fonts.

The Character Generator uses a Bit plane 2 as a Lookup Table to translate the ASCII value into a matrix of dots called a character box or cell to display on the screen.

» The font is automatically copied from ROM to video memory map 2 when a TEXT display mode is selected via the BIOS.

The attribute byte.The Video hardware translates the attribute nibbles into

the indicated foreground & background colors.Attribute Bits

7 - Blinking (Note: No intensity component)6 - Background color - Red component5 - Background color - Green component4 - Background color - Blue component3 - Foreground color - Intensity component2 - Foreground color - Red component1 - Foreground color - Green component0 - Foreground color - Blue component

Foreground Nibble

Background Nibble

Page 38: 1 PC Peripherals for Technicians PC Peripherals for Technicians Chapter 3.2 - Video Text Mode Operation Chapter 3.2 - Video Text Mode Operation Systems

38

REVIEW & SUMMARY The palette registers.

Each of the 16 Palette Registers contains six bits.

r, g, & b, are all selected when Bit 3

of foreground Attribute nibble is a one

.e.g. - 9h = 1001b for “light blue” [intense]

Color generation using the Video DAC.VGA uses analog signal levels to drive the monitor, and

the 6 bits in the Palette Registers are inputs to the DAC.

4-bitAttribute

From Video Buffer

(1 of 16 Regs)

6-bits(bits 0-5)

r,g,b,R,G,B(1 of 64

Registers)

8-bits(1 of 256 [FFh]

Registers)[4 banks of 64 [3Fh] colors]

bits 6 & 7(Mode 3=00)Attr Ctlr

PaletteRegisters3C0, 3C1Offsets00-0Fh

VIDEO DAC3C7, 3C8, 3C9

Offsets00-FFh

[Note: 00-3Fhw/ 6 bits]

R

G

B

To MonitorAnalogOutput0 - 0.7 V

X X r g b R G B

I R G B

X X 1 1 1 0 0 1

End of Chapter 3-2