Programmer's Guide to PC & PS/2 Video Systems

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Richard Wilton
Publisher: Microsoft Press
Year: 1987

Language: English
City: Redmond
Tags: IBM Video hardware and firmware; IBM Monochrome Display Adapter; IBM Color Display Adapter; Hercules Graphics Card; Hercules Graphics Card Plus; IBM Enhanced Graphics Adapter; Hercules inColor Adapter; Multi-Color Graphics Array; Video Graphics Array; Interrupt 10h; BIOS; CGA; MDA; MCGA; HGC; HGC+; InColor Card; EGA; VGA; computer video systems; IBM PC; IBM XT; IBM AT; IBM PS/2; video display system; video display programming

Cover
Contents
Acknowledgments
Introduction
What This Book Is About
What You Need to Use This Book
Languages
Operating System
Hardware
Manuals
Special Offer
1 IBM Video Hardware and Firmware
IBM PC and PS/2 Video Hardware
IBM Monochrome Display Adapter and Color Graphics Adapter
Hercules Graphics Card
Hercules Graphics Card Plus
IBM Enhanced Graphics Adapter
Hercules InColor Card
Multi-Color Graphics Array
Video Graphics Array
Introduction to the ROM BIOS Interface
Interrupt 10H
Video Display Data Area
Accessing the Video BIOS from a High-Level Language
2 Programming the Hardware
Functional Components of IBM PC and PS/2 Video Subsystems
Monitor
Video Buffer
Color and Character Display Hardware
CRT Controller
The Display Refresh Cycle
Horizontal Timing
Vertical Timing
Programming the CRT Controller
MDA
CGA
Hercules Adapters
EGA
MCGA
VGA
Basic CRTC Computations
Dot Clock
Horizontal Timing
Vertical Timing
The CRT Status Register
Video Modes
Resolution
Colors
Video Buffer Organization
Hardware Video Mode Control
MDA
CGA and MCGA
HGC
HGC+ and InColor Card
EGA and VGA
Sequencer
Graphics Controller
Attribute Controller
Video BIOS Support
Combinations of Video Subsystems
MDA
Hercules
CGA
EGA
MCGA
VGA
3 Alphanumeric Modes
Using Alphanumeric Modes
BIOS and Operating-System Support
Speed
Compatibility
Representation of Alphanumeric Data
Attributes
MDA
HGC
CGA
EGA
InColor Card
MCGA 5
VGA
Gray-Scale Summing
Border Color
CGA
EGA and VGA
Avoiding CGA Snow
Blanking the Display
Using the Vertical Blanking Interval
Using the Horizontal Blanking Interval
Using All the Video Buffer
CGA Video Pages
EGA, MCGA, and VGA Video Pages
Cursor Control
Cursor Size on the MDA and CGA
Cursor Location on the MDA and CGA
MCGA Cursor Control
EGA and VGA Cursor Control
ROM BIOS Cursor Emulation
An Invisible Cursor
4 Graphics Modes
Using Graphics Modes
Mapping Pixels to the Screen
CGA
HGC
EGA
Hercules InColor Card
MCGA and VGA
Pixel Coordinates
Pixel Coordinate Scaling
Aspect Ratio
Pixel Display Attributes
CGA
HGC
EGA
CGA Emulation Modes
16-Color Modes
Monochrome Graphics
Blinking
Border Color
Hercules InColor Card
MCGA
2-Color Graphics Modes
4-Color Graphics Mode
256-Color Graphics Mode
VGA 11
5 Pixel Programming
Bit-Plane Programming
EGA and VGA
Read mode 0
Read mode 1
Write mode 0
Write mode 1
Write mode 2
Write mode 3
Sequencer Map Mask
InColor Card
Write mode 0-3
Read mode
Reading a Pixel’s Value
CGA
HGC and HGC+
EGA
InColor Card
MCGA
VGA
Setting a Pixel’s Value
CGA
HGC and HGC+
EGA
Write mode 0
Write mode 2
InColor Card
MCGA
VGA
Filling the Video Buffer
CGA
HGC and HGC+
EGA and VGA
InColor Card
MCGA
6 Lines
An Efficient Line-drawing Algorithm
Scan-converting a Straight Line
Bresenham's Algorithm
Optimization
Efficient Pixel Addressing
Performance Comparisons
Special Cases
PC and PS/2 Implementations
Modular Routines
Minimizing Video Buffer Accesses
Efficient Address Calculations
CGA
HGC
EGA
MCGA
VGA
InColor Card
Line Attributes
Clipping
Pixel-by-Pixel Clipping
A Brute-Force Approach
A Better Algorithm
7 Circles and Ellipses
Circles and Pixel Scaling
An Ellipse-drawing Algorithm
Scan-converting an Ellipse
An Incremental Algorithm
A Typical Implementation
Problems and Pitfalls
Accuracy
Optimization
Clipping
True Circles
8 Region Fill
What Is a Region?
Interior and Border Pixels
Connectivity
Simple Fills with Horizontal Lines
Three Region Fill Algorithms
Simple Recursive Fill
Line-Adjacency Fill
Border Fill
Comparing the Algorithms
9 Graphics Text
Character Definition Tables
Video BIOS Support
Default CGA Characters
Default EGA, VGA, and MCGA Characters
Creating a Character Definition Table
Software Character Generators
Video BIOS Support
Pixel Handling
Designing a Software Character Generator
Horizontal Alignment
Variable Character Sizes
Clipping
Character Orientation
Cooperating with the Video BIOS
More Power, More Complexity
Implementing a Software Character Generator
CGA
HGC and HCG+
MCGA
EGA and VGA
InColor Card
10 Alphanumeric Character Sets
Character Definition Tables
Alphanumeric Character Definitions in ROM
200-Line Modes
350-Line Modes
400-Line Modes
Alphanumeric Character Definitions in RAM
EGA and VGA
HGC+
InColor Card
MCGA
Updating Character Generator RAM
EGA and VGA
HGC+
InColor Card
MCGA
Using RAM-based Character Sets
ASCII Character Sets
EGA, VGA, and MCGA
HGC+ and InColor Card
Extended Character Sets
EGA y VGA
MCGA
HGC+ and InColor Card
Compatibility Problems with Extended Character Codes
Changing the Displayed Character Matrix
EGA
VGA
MCGA
HGC+ and InColor Card
Programming Examples
Graphics Windows in Alphanumeric Modes
HGC+ and InColor Card
EGA and VGA
MCGA
11 Bit Blocks and Animation
Bit Block Move
CGA and MCGA
EGA and VGA
HGC
InColor Card
Bitwise Pixel Operations
XOR
NOT
AND
OR
Bit Block Tiling
Animation
XOR Animation
Outlining
Rubberbanding
Bit Block Moves
Problems with XOR Animation
Overlapping Bit Block Moves
A Graphics-Mode Cursor
XOR
Bit Block Move
12 Some Advanced Video Programming Techniques
A Vertical Interrupt Handler
EGA and VGA
MCGA
Panning on the EGA and VGA
Positioning the Screen Window
Panning
Resizing the Video Buffer
Bit-Plane Layering
EGA and VGA Split Screen
The Light Pen Interface
Light Pen Position
Light Pen Switch
Determining Hercules Video Modes
13 Graphics Subroutines in High-Level Languages
Linking Graphics Subroutines
Subroutine Calls
Microsoft C
Microsoft FORTRAN
Turbo Pascal
BASIC
Interrupts to a Memory-Resident Driver
Inline Code
Global Data Areas
Layered Graphics Interfaces
Direct Hardware Programming
Extended BIOS Interface
High-Level Interface
Appendix A: Video BIOS Summary
Hardware Supported by ROM Video BIOS
MDA and CGA
EGA
MCGA
VGA
VGA Adapter
Interrupt 10H
Video BIOS Data Areas
Video Display Data Area
Save Areas
Video Parameter Table
Parameter Save Area
Alphanumeric Character Set Override
Graphics Character Set Override
Display Combination Code Table
User Palette Profile Table
Video BIOS Save Area Programming
Interrupt IDH Vector
IBM PC and PS/2 Video BIOS Functions (INT 10H Interface)
Function 0: Select Video Mode
Function 1: Set Alphanumeric Cursor Size
Function 2: Set Cursor Location
Function 3: Return Cursor Status
Function 4: Return Light Pen Position
Function 5: Select Video Pages
Function 6: Scroll Up
Function 7: Scroll Down
Function 8: Return Character Code and Attribute at Cursor
Function 9: Write Character and Attribute at Cursor
Function 0AH: Write Character(s) at Cursor Position
Function 0BH: Set Overscan Color, Select 4-Color Palette
Function 0CH: Store Pixel Value
Function 0DH: Return Pixel Value
Function 0EH: Display Character in Teletype Mode
Function 0FH: Return Current Status
Function 10H: Set Palette Registers, Set Intensity/Blink Attribute
Function 11H: Character Generator Interface
Function 12H: Video Subsystem Configuration (Alternate select)
Function 13H: Display Character String
Function 14H: (PC Convertible only)
Function 15H: (PC Convertible only)
Function 16H: (Reserved)
Function 17H: (Reserved)
Function 18H: (Reserved)
Function 19H: (Reserved)
Function 1AH: Video Display Combination
Function 1BH: Video BIOS Functionality/State Information
Function 1CH: Save or Restore Video State
Appendix B: Printing the Screen
Alphanumeric Modes
EGA, MCGA, VGA
Block Graphics Characters
Graphics Modes
Graphics
Writings a Screen Dump Routines
RAM-Based Alphanumeric Character Definitions
Appendix C: Identifying Video Subsystems
CGA and Clones
Other Video Adapters
PS/2s
Glossary
Index