CGA - IBM Color Graphics Monitor Adapter
CGA - IBM Color Graphics Monitor Adapter
CGA - IBM Color Graphics Monitor Adapter
Personal Computer
Hardware Reference
Library
mM Color/Graphics
Monitor Adapter
6361509
ii
Contents
Description .................................... 1
Controller ................................. 5
Specifications ................................. 23
iii
iv
Description
""
>
!"....
..,
s..,=.
g:
[I}
!')
i...
........
0'
..,
("")
Model
Control
Palette!
Overscan
6845
CRT
Controller
Address
Latch
Processor
Data
P rocessor
A ddress
Address
Latch
...
,"",
Data
Latch
~,
~~
Display
Buffer
(16K Bytes)
..
Timing
Generator
& Control
Character
Generator
ROM
Data
Latch
..
r-
Alpha
Serializer
~~
--"'"
...
--"'..."
"'"
rL:
Graphics
Serializer t--
Output
Latch
Input
Buffer
r-
Composite
Color
Generator
Color
Encoder
..."'"
~
~
~
~
Horizontal
Vertical
Process or
Data
Controller
The controller is a Motorola 6845 Cathode Ray Tube (CRT)
Controller. It provides the necessary interface to drive the
raster-scan CRT.
Display Buffer
The display buffer resides in the processor-address space, starting
at address hex B8000. It provides 16 bytes of dynamic
read/write memory. A dual-ported implementation allows the
processor and the graphics control unit access to this buffer. The
processor and the control unit have equal access to this buffer
during all modes of operation, except in the high-resolution
alphanumeric mode. In this mode, only the processor should have
access to this buffer during the horizontal-retrace intervals.
While the processor may write to the required buffer at any time,
a small amount of display interference will result if this does not
occur during the horizontal-retrace intervals.
Character Generator
Timing Generator
This generator produces the timing signals used by the 6845 CRT
Controller and by the dynamic memory. It also solves the
processor/graphic controller contentions for access to the display
buffer.
Alphanumeric Mode
Every display character position in the alphanumeric mode is
defined by two bytes in the regen buffer (a part of the monitor
adapter), not the system memory. Both the Color/Graphics
Monitor Adapter and the Monochrome Display and Printer
Adapter use the following 2-byte character-attribute format.
A ttribute Byte
543
432
Normal
Reverse Video
Nondisplay (Black)
Nondisplay (White)
A ttribute Byte
R G B
R G B
FG
Background
B
B
B
B
0
1
0
1
0
0
0
1
0
Foreground
I
I
I
I
0
0
1
0
0
1
0
0
1
IBI R G Bill R G BI
Foreground Color
Intensity
Background Color
Blinking
Color
0
0
0
0
0
0
1
1
1
1
1
1
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
0
0
1
1
Black
Blue
Green
Cyan
Red
Magenta
Brown
White
Gray
Light Blue
Light Green
Light Cyan
Light Red
Light Magenta
Yellow
White (High Intensity)
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Graphics Modes
The Color/Graphics Monitor Adapter has three graphics modes:
low-resolution, medium-resolution, and high-resolution color
graphics. However, only medium- and high-resolution graphics
are supported in ROM. The following figure shows these modes.
Mode
Horizontal
(PELsl
Vertical
(Rowsl
Low Resolution
160
100
16 Iinciudes black-and-white)
Medium
Resolution
320
200
4 Colors Total
1 of 16 for Background and
1 of Green, Red, or Brown or
1 of Cyan, Magenta, or White
High Resolution
640
200
Black-and-white only
C1
CO
C1
CO
C1
CO
o
C1
CO
First
Display
Second
Display
Third
Display
Fourth
Display
PEL
PEL
PEL
PEL
Function
B8000
Even Scans
8,000 bytes
B9F3F
Not Used
BAOOO
Odd Scans
8,000 Bytes
BBF3F
Not Used
BBFFF
co
Function
Color Set 2
Color 1 is Cyan
Color 2 is Magenta
Color 3 is White
The background colors are the same basic 8 colors defined for
low-resolution graphics, plus 8 alternate intensities defined by
the intensity bit, for a total of 16 colors, including black and
white.
I7 I6 I5 I4 I3
First Display PEL
Second Display PEL
Third Display PEL
Fourth Display PEL
Fifth Display PEL
121
10 1
I II
Basic Operations
In the alphanumeric mode, the adapter fetches character and
attribute information from its display buffer. The starting address
of the display buffer is programmable through the CRT
controller, but it must be an even address. The character codes
and attributes are then displayed according to their relative
positions in the buffer. The following addresses will produce an
"AB" in the upper-left corner of a 40 by 25 screen and an "X" in
the lower-right corner.
Memory
Address
(in hex)
Display Buffer
88000
(Even)
Starting
Address
Character Code A
88001
Attribute A
88002
(Example of a 40 by 25 Screen)
Character Code B
88003
AB
Attribute B
~------------------~
887CE
Character Code X
Last
Address
887CF
Attribute X
Video Screen
/"""""'\
The processor and the display control unit have equal access to
the display buffer during all of the operating modes, except the
high-resolution alphanumeric mode. During this mode, the
processor gains access to the display buffer during the vertical
retrace time. If it does not, the display will be affected with
random patterns as the microprocessor is using the display buffer.
In the alphanumeric mode, the characters are displayed from a
pre-stored ROM character generator that contains the dot
patterns for all of the displayable characters.
In the graphics mode, the displayed dots and colors, up to 16K
bytes, are fetched from the display buffer.
Programming Considerations
A9 AS A7 A6 A5 A4 A3 A2 A 1 AO
308
Function of Register
309
30A
30B
30C
304
305
Address Register
Register Number
Register
Type
40 by 25
Alphanumeric
BOby 25
Alpha- Graphic
numeric Modes
Units
I/O
RO
Horizontal
Total
Character
Write
Only
38
71
38
R1
Horizontal
Displayed
Character
Write
Only
28
50
28
R2
Horizontal
Character
Sync Position
Write
Only
2D
5A
2D
R3
Horizontal
Sync Width
Character
Write
Only
OA
OA
OA
R4
Vertical Total
Character
Row
Write
Only
1F
1F
7F
R5
Vertical Total
Adjust
Scan
Line
Write
Only
06
06
06
R6
Vertical
Displayed
Character
Row
Write
Only
19
19
64
R7
Vertical
Sync Position
Character
Row
Write
Only
1C
1C
70
R8
Interlace
Mode
Write
Only
02
02
02
R9
Maximum
Scan Line
Address
Scan
Line
Write
Only
07
07
01
R10
Cursor Start
Scan
Line
Write
Only
06
06
06
R11
Cursor End
Scan
Line
Write
Only
07
07
07
R12
Start
Address (Hl
Write
Only
00
00
00
R13
Start
Address (Ll
Write
Only
00
00
00
R14
Cursor
Address (Hl
Read/
Write
XX
XX
XX
R15
Cursor
Address (Ll
Read/
Write
XX
XX
XX
10
R16
Read
Only
XX
XX
XX
11
R17
Read
Only
XX
XX
XX
Color-Select Register
The color-select register is a 6-bit output-only register. Its I/O
address is hex 3D9, and it can be written to using a processor
'out' command. The following are the bit definitions for this
register.
Bit 0
Bit 1
Bit 2
Bit 3
Bit 4
Bit 5
r"..
co
0
0
Set Selected
Background (Defined by bits 0-3 of port hex 3D9)
Cyan
Magenta
White
1
1
co
0
1
0
Set Selected
Background (Defined by bits 0-3 of port hex 3D9)
Green
Red
Brown
Bit 6
Not used
Bit 7
Not used
Mode-Control Register
The mode-control register is a 6-bit output-only registeL Its I/O
address is hex 3D8, and it can be written to using a processor
'out' command. The following are bit definitions for this registeL
r"'\
Bit 0
Bit 1
Bit 2
Bit 3
Bit 4
Bit 5
40 x 25 Alphanumeric Black-and-White
40 x 25 Alphanumeric Color
80 x 25 Alphanumeric Black-and-White
80 x 25 Alphanumeric Color
Status Register
The status register is a 4-bit read-only register. Its I/O address is
hex 3DA, and it can be read using the processor 'in' instruction.
The following are bit definitions for this register.
Bit 0
Bit 1
Bit 2
Bit 3
Memory Requirements
The memory used by this adapter is self-contained. It consists of
16K bytes of memory without parity. This memory is used as
both a display buffer for alphanumeric data and as a bit map for
graphics data. The regen buffer's address starts at hex B8000.
Read/Write Memory
01000
System
Read/Write
Memory
AOOOO
B8000
Display Buffer
(16K Bytes)
128K Reserved
Regen Area
BCOOO
COOOO
r"\
Specifica tions
The following pages contain card and connector specifications for
the IBM Color/Graphics Monitor Adapter.
Color Direct
Drive 9-Pin
D-Shell Connector
At Standard TTL Levels
Ground
1
2
3
4
Ground
Red
IBM Color D isplay
or other Dir ect-Drive
Monitor
Green
Blue
Intensity
Reserved
Horizontal Drive
Vertical Drive
5
6
7
8
9
Color/Gr aphics
Direct-D rive
Adapter
Chassis Ground
Color/Graphics
Composite Jack
Color/Graphics
Monitor Adapter
RF
Modulator
+ 12 Volts
3
4
Logic Ground
Color/Graphics
Monitor
Adapter
RF Modulator Interface
Light
Pen
3
4
Chassis Ground
+ 5 Volts
+ 12 Volts
Color/Graphics
Monitor
Adapter
Logic Diagrams
The following pages contain the logic diagrams for the IBM
Color/Graphics Monitor Adapter.
co
....
........0
CD
CD
.c
...
CD
....C.
ca
"C
...
0
....
'2
0
:IE
II)
CJ
:2
c.
ca
...
~
di~n~jl"~
i!
-L,.
i.
~~
~~
~!!:::n~
n ~~!!
?: ~~~~~~~~
~~
;~~~~?
-...
0
"0
,,-....,
:::: ~
CD
'0
N
G)
.r;
...
I'll
1:1
c:(
...
....o
'2
::E
UI
:c
Q.
!!!
...
-
e"
o
'0
(,)
"
i!!~~~iii!
'~I
55
.
<> <>
dd
..
-.~
~~
oddl:
~21
..
5~
. -.afd
<>
CD
....
0
..
sa...
..
<...
..
'c
('I)
GI
GI
GI
Q.
a:I
"g
0
0
:l!:
1/1
L_
~.~.Ilr-
:cQ.
...a:I
...
0
C!I
'0
CJ
,,-.....,
~~
;-
4~ ~
~~
I
"w
~I'J':."
~ s
A~~
...'2o...
.
..
o
:!E
~r-
III
(J
:cCo
~
-
-"0...o
,--
~~
(.)
~) ..
1111
...
CD
0
...
It)
Q)
Q)
.J:
...
...
Q)
C.
ftI
1:1
...
0
...
'2
0
~
III
(,)
:c:c.
...
...0
ftI
"0
(.)
z
,,
,,,
1i
~~.~~:~::~~~~!~~~!~~~~
+ + + + + + + + + .. + + + + + + + ++
i'f'"
CD
....0
....
<0
Q)
Q)
&.
II"~
"2
...
....Q.
Q)
III
"C
oCt
...
....0
'2
0
"',..:rll"~"'''~
en
u
:2
Q.
...
...
0
III
(!)
-..
"5
Index
A
alphanumeric mode 6
B
basic operations 12
c
change modes 21
character generator 5
color-select register 18
controller 5
D
description 1
display buffer 5
Index-l
G
graphics modes 9
high-resolution black-and-white 11
low-resolution color 9
medium-resolution color 9
H
high-resolution black-and-white graphics mode 11
L
logic diagrams 27
M
medium-resolution color/graphics mode 9
memory requirements 22
mode types
alphanumeric 6
graphics 9
mode-control register 19
modes of operation 1
Index-2
p
programming considerations 15
R
registers
color-select 18
mode set 5
mode-control 19
status 21
specifications 23
status register 21
T
timing generator 6
Index-3
Index-4