OA - IBM Color Graphics Monitor Adapter (CGA)
OA - IBM Color Graphics Monitor Adapter (CGA)
----
-- ---
- --- - Personal Computer
-
-----
--_.- ---
--- Hardware Reference
Library
mM Color/Graphics
Monitor Adapter
6361509
ii
Contents
Description .................................... 1
Controller ................................. 5
Mode Set Register . . . . . . . . . . . . . . . . . . . . . . . . . .. 5
Display Buffer .............................. 5
Character Generator ......................... 5
Timing Generator ........................... 6
Composite Color Generator ................... 6
Alphanumeric Mode ......................... 6
Graphics Modes ............................ 9
Basic Operations ........................... 12
Programming Considerations ..................... 15
Programming the Mode Control and Status Register 15
Programming the 6845 CRT Controller ......... 15
Color-Select Register ....................... 18
Mode-Control Register ...................... 19
Mode-Control Register Summary .............. 20
Status Register ............................ 20
Sequence of Events for Changing Modes ........ 21
Memory Requirements ...................... 22
Specifications ................................. 23
Logic Diagrams ................................ 27
iii
iv
Description
...
Buffer Input
Buffer
~
~ ~~
Process or
Data
..,
0' (16K Bytes)
........
~ ~~ ~
i...
!')
[I}
g:
Processor
Data . 6845 ~
Address
Latch
r-
~,
Data
Latch
•
Data
Latch
~
Output
Latch
~
CRT
s..,=.
Controller
• i .. Graphics
Serializer t--
>
!"....
..,
~
Character ~ R
.. Generator
ROM
r- Alpha
Serializer
rL: Color
Encoder
~ G
Palette! ~ B
~ "'" ~
.
~
Overscan
I ..."'" Horizontal
Vertical
...
--"'" Composite
Model . Timing
--"'..."
Color
~
4 Control
Generator Generator
& Control
) ) )
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
A ROS character generator is used with 8K bytes of storage that
cannot be read from or written to under program control. This is
a general-purpose ROS character generator with three character
fonts. Two character fonts are used on the Color/Graphics
Monitor Adapter: a 7-high by 7-wide double-dot font and a
7-high by 5-wide single-dot font. The font is selected by a
jumper (P3). The single-dot font is selected by inserting the
~ jumper; the double-dot font is selected by removing the jumper.
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.
7 6 543 2 o 7 6 5 432 o
Normal B 0 0 0 I 1 1 1
Reverse Video B 1 1 1 I 0 0 0
Nondisplay (Black) B 0 0 0 I 0 0 0
Nondisplay (White) B 1 1 1 I 1 1 1
7 6 543 2 1 0
IBI R G Bill R G BI
Foreground Color
~
~ [
Intensity
I Background Color
i Blinking
R G B I Color
0 0 0 0 Black
0 0 1 0 Blue
0 1 0 0 Green
0 1 1 0 Cyan
1 0 0 0 Red
1 0 1 0 Magenta
1 1 0 0 Brown
1 1 1 0 White
0 0 0 1 Gray
0 0 1 1 Light Blue
0 1 0 1 Light Green
0 1 1 1 Light Cyan
1 0 0 1 Light Red
1 0 1 1 Light Magenta
1 1 0 1 Yellow
1 1 1 1 White (High Intensity)
7 6 5 4 3 2 o
C1 CO C1 CO C1 CO C1 CO
First Second Third Fourth
Display Display Display Display
PEL PEL PEL PEL
Memory
Address
(in hex) Function
B8000
Even Scans
(0,2,4, ... 198)
8,000 bytes
B9F3F
Not Used
BAOOO
Odd Scans
(1,3,5 ... 199)
8,000 Bytes
BBF3F
Not Used
BBFFF
C1 co Function
0 0 Dot takes on the color of 1 of 16 preselected background colors
0 1 Selects first color of preselected Color Set 1 or Color Set 2
1 0 Selects second color of preselected Color Set 1 or Color Set 2
1 1 Selects third color of preselected Color Set 1 or Color Set 2
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 121 1 10 1
~
Second Display PEL
Third Display PEL I II
Fourth Display PEL
Fifth Display PEL
Sixth Display PEL
Seventh Display PEL
Eighth Display PEL
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) Character Code A
Starting 88001
Address Attribute A
88002 (Example of a 40 by 25 Screen)
Character Code B
88003 AB
Attribute B
X /"""""'\
887CE ~------------------~
Character Code X Video Screen
Last 887CF
Address Attribute X
Hex
Address A9 AS A7 A6 A5 A4 A3 A2 A 1 AO Function of Register
The table on the next page defines the values that must be loaded
into the 6845 CRT Controller registers to control the different
modes of operation supported by the attachment. ~
C1 co Set Selected
C1 co Set Selected
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
Bits
0 1 2 3 4 5 40 x 25 Alphanumeric Black-and-White
0 0 1 1 0 1 40 x 25 Alphanumeric Color
0 0 0 1 0 1 80 x 25 Alphanumeric Black-and-White
1 0 1 1 0 1 80 x 25 Alphanumeric Color
1 0 0 1 0 1 320 x 200 Black-and-White Graphics
0 1 1 1 0 z 320 x 200 Color Graphics
0 1 0 1 0 z 640 x 200 Black-and-White Graphics
0 1 1 1 1 z
Bit 2 The light pen switch is reflected in this bit. The switch
is not latched or debounced. A 0 indicates that the
switch is on.
Read/Write Memory
Address Space (in hex)
01000
System
Read/Write
Memory
AOOOO
B8000
128K Reserved
Display Buffer Regen Area
(16K Bytes)
BCOOO
COOOO
r"\
Color/Graphics
Monitor Adapter
+ 12 Volts 1
RF (key) Not Used 2 Color/Graphics
Modulator Monitor
Composite Video Output 3
Adapter
Logic Ground 4
RF Modulator Interface
The following pages contain the logic diagrams for the IBM
Color/Graphics Monitor Adapter.
-...
~
"0
0
~ i! u
• -L,.
i. ~~ ~
~~ ~~ ~!!:::n~ n ~~!!§ ?: ~~~~~~~~ ;~~~~?
28 Color/Graphics Monitor Adapter
•
:::: ~
CD
'0
N
;
G)
.r;
~
...
!I'll
1:1
c:(
...
....o
'2
o
::E
UI
u
:c
Q.
!!!
-...
e"
o
'0
(,)
Color/Graphics Monitor Adapter 29
"
i!!~~~iii! i
. ~ .. ..
•
'~I
55 <> <>
dd H I ~~
oddl: I 5~
. -.afd
<>
-.~ ~21
~
CD
....
..
0
('I)
GI
GI
~
sa
.....
GI
Q.
a:I
"g
<...
..
0
'c
0
:l!:
1/1
U
,,-.....,
:cQ.
L L_ ...a:I
~.~.Ilr- ...
C!I
0
'0
CJ
30 Color/Graphics Monitor Adapter
E - • ~ • ;- ••
~ ,
~
~~
• ;
,
4~ ~
~~
I "w
...o...
~I'J':." ~ s
.« '2
~ .. o
- :!E
III
(J
A·~~
:cCo
~
e
~r-
-
,--
.
-...o
~
"0
~~ (.)
~) ..
I 1111
Color/Graphics Monitor Adapter 31
...
CD
0
...
It)
Q)
Q)
.J:
~
...
...
Q)
C.
ftI
1:1
«
......
0
'2
0
~
III ~
(,)
:c:c.
...
ftI
-...
~
0
"0
(.)
z ~
,,
• ,,, .
1i
•~
•• ••• •• ••
32 Color/Graphics Monitor Adapter
~~.~~:~::~~~~!~~~!~~~~
+ + + + + + + + + .. + + + + + + + ++
i'f'·"
CD
....0
<0
....
Q)
Q)
&.
~
II"~
"2 ...
....Q.
Q)
III
"C
oCt
...
....0
'2
0
"',..:rll"~"'''~
~
en
u
:2
Q.
...
III
(!)
...
-..
0
"5
u
Color/Graphics Monitor Adapter 33
34 Color/Graphics Monitor Adapter
Index
alphanumeric mode 6
basic operations 12
c
change modes 21
character generator 5
color-select register 18
composite color generator 6
controller 5
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
logic diagrams 27
low-resolution color/graphics mode 9
Index-2
p
programming considerations 15
programming the mode control and status register 15
programming the 6845 crt controller 15
registers
color-select 18
mode control and status 15
mode set 5
mode-control 19
status 21
T
timing generator 6
Index-3
Index-4