Unformatted text preview:

VGA Text Modealphanumeric informationFont images in ROMA character-glyph exampleVGA Timer-SequencerArrangement of VRAM planesmultiple fonts supportedText color ‘attributes’Layout for an ‘attribute’ byteVGA Sequencer RegistersAccess to character ramReset (index 0)Map Mask (index 2)Memory Mode (index 4)GC: Miscellaneous (index 6)GC: Mode (index 5)How to modify character ramDetails for this ‘prolog’Details for the ‘epilog’Some Class DemosAlgorithm for ‘backward.cpp’Attribute Controller (0x3C0) Color Plane Enable (index 18)In-Class ExercisesVGA Text ModeAn introduction to font selection and to reprogramming of the Character Generator ramalphanumeric information•Most early PC programs weren’t graphical•Screen was similar to a typewriter’s output•Used only a limited set of character-images:–letters, numerals, and punctuation symbols•Hardware can efficiently render such glyphs •VGA can emulate the MDA/EGA text modes:–mode 1: emulates EGA 40x25 text (320x200 pixels)–mode 3: emulates EGA 80x25 text (640x400 pixels)–mode 7: emulates MDA 80x25 text (720x350 pixels)Font images in ROM•VGA has built-in firmware (ROM-BIOS)•Both code and data are provided in ROM•VGA’s ROM is normally at 0x000C0000•Can be addressed by CPU in ‘real-mode’•VGA ROM includes character glyph tables–8x8 character-set is used with mode 1–8x16 character-set is used with mode 3–8x14 character-set is used with mode 7A character-glyph example•Here’s a sample 8x8 character glyph (‘A’):This glyph can be represented as an array of 8 bytes: 0x00, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x00, 0x00VGA Timer-Sequencer•A ‘character table’ is copied into VRAM•Glyphs organized as an array of bitmaps•Array holds 256 images (32 bytes/image)– Table-size: 256x32 = 8K bytes (= 0x2000)•The ascii-codes serve as array-indexes:–Example: ‘A’ has ascii-code 0x41 (=65)•Sequencer hardware accesses these images•Dedicated area of VRAM is used (plane 2)•Planes 0 and 1 are used as a text frame-bufferArrangement of VRAM planesplane 0plane 1plane 2plane 3Not used (masked)Holds the character glyph table(s)Stores color attribute-bytes for displayed textStores ASCII- codes for the currently displayed textCPU can read/write only to planes 0 and 1 (using odd/even addressing mode)multiple fonts supported•Plane 2 is the Character Generator’s ram•Enough room for eight separate tables:–8 x 8K = 64K•Two tables can be in use simultaneously•Tables must start at prescribed offsets:–Table 0: 0x0000 Table 4: 0x2000–Table 1: 0x4000 Table 5: 0x6000–Table 2: 0x8000 Table 6: 0xA000–Table 3: 0xC000 Table 7: 0xE000Text color ‘attributes’•In text mode, the picture-elements consist of character images, shown in two colors:–Foreground color, and Background color •Character colors individually programmed•A byte-pair in VRAM selects the bit-image (ascii code) and color-pair (attribute byte)•All colors come from a palette of 16 •But the color palette is ‘programmable’Layout for an ‘attribute’ byteR G B R BGForeground ColorBackground ColorBit function is Programmable: Default is “EnableBlinking”Bit function is programmable Default is “EnableIntensity”VGA Sequencer Registers•Five registers comprise VGA Sequencer:–index 0: Reset register–index 1: Clocking Mode register–index 2: Map Mask register–index 3: Character Map Select register–index 4: Memory Mode register•All accessed via i/o ports 0x3C4-0x3C5 using “multiplexing” scheme (index/data)Access to character ram•In text modes, CPU can’t access Plane 2•Plane 2 gets accessed by the Sequencer•Sequencer performs a ‘glyph-lookup’ for each ascii code stored by CPU in Plane 0•Both Sequencer and Graphics Controller must be suitably reprogrammed in order for the CPU to a read or write to Plane 2 •Six VGA registers are involved in that stepReset (index 0) 7 6 5 4 3 2 1 0Synchronous Reset bit (bit 1) 1 = normal sequencer operation0 = initiate a synchronous resetAsynchronous Reset bit (bit 0)1 = normal sequencer operation0 = initiate an asynchronous resetA synchronous reset is used inadvance of reprogramming theClocking Mode register (or theClock Select field in the VGA’sMiscellaneous Output register)Halts VRAM refresh cyclesand clears VRAM contentsMap Mask (index 2) 7 6 5 4 3 2 1 0Enables or disables CPU’s ability to access specific memory planes1 = write enable, 0 = write disablePlane 3Plane 2Plane 1Plane 0Memory Mode (index 4) 7 6 5 4 3 2 1 0“Chain-4” Addressing 1 = enabled 0 = disabledi.e., each plane holds every fourth byte“Odd/Even” Addressing 1 = disabled 0 = enabledIt’s used for text modesExtended Memory (>64K) 1 = present, 0 = absent(For EGA only) 1= text 0 = graphicsGC: Miscellaneous (index 6)Memory MapOdd/EvenenableG/A 7 6 5 4 3 2 1 0Memory Map options:00 = 0xA0000 (128K)01 = 0xA0000 (64K)10 = 0xB0000 (64K)11 = 0xB8000 (32K)1 = use Odd/Even Addressing 0 = use Sequential Addressing1 = Disable the character generator( graphics mode)0 = Enable the character generator (use “text mode”)Graphics Controller registers are accessed via i/o ports 0x3CE/0x3CFGC: Mode (index 5)256colorsSHIFTODD/EVENReadModeWrite Mode(0, 1, 2, 3) 7 6 5 4 3 2 1 01 = cpu data at odd addresses ismapped to odd-numbered planes, cpu data at even addresses getsmapped to even-numbered planes 0 = cpu addressing is sequentialNOT: This affects only the Graphics Controller. The Sequencer needs tobe programmed separately to matchThis affects the VGAAttribute Controller’soperation (text color:foreground color and background color) Should be 1 for textShould be 0 for text modeHow to modify character ram •Algorithm:–Reset the VGA for accessing Plane 2–Then CPU reads or modifies Plane 2–Reset the VGA for accessing Planes 0, 1•Acknowledgement:–Author Richard Wilton described this process in his classic book “Programmer’s Guide to PC Video Systems (2nd Edition)”Details for this ‘prolog’outw( 0x0100, 0x3C4 ); // do a synch. resetoutw( 0x0402, 0x3C4); // write Plane 2 onlyoutw( 0x0704, 0x3C4 ); // sequential accessoutw( 0x0300, 0x3C4 ); // end the


View Full Document

USF CS 686 - VGA Text Mode

Documents in this Course
Load more
Download VGA Text Mode
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view VGA Text Mode and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view VGA Text Mode 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?