<s>
The	O
TMS9918	B-Architecture
is	O
a	O
video	B-General_Concept
display	I-General_Concept
controller	I-General_Concept
(	O
VDC	O
)	O
manufactured	O
by	O
Texas	O
Instruments	O
,	O
in	O
manuals	O
referenced	O
as	O
"	O
Video	O
Display	O
Processor	O
"	O
(	O
VDP	B-General_Concept
)	O
and	O
introduced	O
in	O
1979	O
.	O
</s>
<s>
The	O
TMS9918	B-Architecture
and	O
its	O
variants	O
were	O
used	O
in	O
the	O
ColecoVision	B-Device
,	O
CreatiVision	B-General_Concept
,	O
Memotech	B-Device
MTX	I-Device
,	O
MSX	B-Operating_System
,	O
NABU	O
Personal	O
Computer	O
,	O
SG-1000/SC	O
-3000	O
,	O
Spectravideo	B-Device
SV-318	I-Device
,	O
Spectravideo	O
SV-328	B-Device
,	O
Sord	B-Device
M5	I-Device
,	O
Tatung	B-Operating_System
Einstein	I-Operating_System
,	O
Texas	B-Device
Instruments	I-Device
TI-99/4	I-Device
,	O
Casio	O
PV-2000	O
,	O
Coleco	B-Device
Adam	I-Device
,	O
Hanimex	O
Pencil	O
II	O
,	O
and	O
Tomy	O
Tutor	O
.	O
</s>
<s>
The	O
TMS9918	B-Architecture
generates	O
both	O
grid-based	O
character	O
graphics	O
(	O
used	O
to	O
display	O
text	O
or	O
background	O
images	O
)	O
and	O
sprites	O
used	O
for	O
moving	O
foreground	O
objects	O
.	O
</s>
<s>
All	O
of	O
the	O
ICs	O
in	O
this	O
family	O
are	O
usually	O
referred	O
to	O
by	O
the	O
TMS9918	B-Architecture
name	O
,	O
sometimes	O
with	O
an	O
'	O
A	O
 '	O
postfix	O
.	O
</s>
<s>
The	O
non-A	O
version	O
was	O
only	O
used	O
in	O
the	O
TI-99/4	B-Device
;	O
the	O
TI-99/4A	B-Device
and	O
the	O
other	O
computers	O
had	O
the	O
A	O
version	O
VDC	O
.	O
</s>
<s>
The	O
TMS9918A	B-Architecture
and	O
TMS9928A	O
output	O
a	O
60	O
Hz	O
video	O
signal	O
,	O
while	O
the	O
TMS9929A	O
outputs	O
50Hz	O
.	O
</s>
<s>
The	O
difference	O
between	O
'	O
1	O
 '	O
and	O
the	O
'	O
2	O
 '	O
in	O
'	O
TMS9918A	B-Architecture
 '	O
and	O
'	O
TMS9928A	O
 '	O
is	O
that	O
the	O
'	O
1	O
 '	O
version	O
outputs	O
composite	O
NTSC	O
video	O
,	O
while	O
the	O
'	O
2	O
 '	O
versions	O
(	O
including	O
the	O
TMS9929A	O
)	O
outputs	O
analog	O
YPbPr	O
(	O
Y	O
luminance	O
and	O
R-Y	O
(	O
Pr	O
)	O
and	O
B-Y	O
(	O
Pb	O
)	O
colour	O
difference	O
signals	O
)	O
.	O
</s>
<s>
The	O
need	O
for	O
the	O
latter	O
was	O
predominant	O
in	O
the	O
50	O
Hz	O
world	O
,	O
including	O
Europe	O
,	O
due	O
to	O
the	O
different	O
video	O
signal	O
standards	O
PAL	B-Language
and	O
SECAM	O
.	O
</s>
<s>
It	O
was	O
more	O
cost-effective	O
to	O
output	O
Y	O
,	O
R-Y	O
and	O
B-Y	O
and	O
encode	O
them	O
into	O
PAL	B-Language
or	O
SECAM	O
in	O
the	O
RF	O
modulator	O
,	O
than	O
to	O
try	O
to	O
have	O
a	O
different	O
console	O
for	O
every	O
different	O
color	O
standard	O
.	O
</s>
<s>
A	O
later	O
variant	O
of	O
the	O
TMS9918	B-Architecture
series	O
chips	O
,	O
the	O
TMS9118	O
,	O
TMS9128	O
,	O
and	O
TMS9129	O
,	O
were	O
released	O
in	O
the	O
mid-late	O
1980s	O
,	O
but	O
were	O
never	O
very	O
popular	O
.	O
</s>
<s>
Otherwise	O
the	O
chips	O
are	O
completely	O
identical	O
to	O
the	O
TMS9918A	B-Architecture
,	O
TMS9928A	O
and	O
TMS9929A	O
respectively	O
.	O
</s>
<s>
The	O
VDP	B-General_Concept
has	O
16K	O
×	O
8	O
bits	O
of	O
external	O
video	O
memory	O
.	O
</s>
<s>
This	O
memory	O
is	O
outside	O
the	O
address	O
space	O
of	O
the	O
CPU	B-General_Concept
.	O
</s>
<s>
Having	O
a	O
separate	O
address	O
space	O
means	O
that	O
the	O
CPU	B-General_Concept
has	O
to	O
do	O
more	O
work	O
to	O
write	O
or	O
read	O
this	O
memory	O
,	O
but	O
it	O
also	O
means	O
that	O
the	O
VDC	O
does	O
n't	O
slow	O
the	O
CPU	B-General_Concept
down	O
when	O
it	O
periodically	O
reads	O
this	O
memory	O
to	O
generate	O
the	O
display	O
.	O
</s>
<s>
Additionally	O
,	O
it	O
leaves	O
more	O
address	O
space	O
available	O
to	O
the	O
CPU	B-General_Concept
for	O
other	O
memory	O
and	O
memory-mapped	O
hardware	O
.	O
</s>
<s>
In	O
these	O
cases	O
,	O
the	O
CPU	B-General_Concept
may	O
use	O
the	O
extra	O
video	O
memory	O
for	O
other	O
purposes	O
.	O
</s>
<s>
The	O
CPU	B-General_Concept
communicates	O
with	O
the	O
VDP	B-General_Concept
through	O
an	O
8-bit	B-General_Concept
bus	I-General_Concept
.	O
</s>
<s>
A	O
pin	O
controlled	O
by	O
the	O
CPU	B-General_Concept
separates	O
this	O
bus	O
into	O
two	O
"	O
ports	O
"	O
,	O
a	O
control	O
port	O
and	O
a	O
data	O
port	O
.	O
</s>
<s>
To	O
write	O
or	O
read	O
a	O
byte	O
of	O
video	O
memory	O
,	O
the	O
CPU	B-General_Concept
first	O
has	O
to	O
write	O
two	O
bytes	O
on	O
the	O
VDP	B-General_Concept
's	O
control	O
port	O
to	O
the	O
VDC	O
's	O
internal	O
address	B-General_Concept
register	I-General_Concept
.	O
</s>
<s>
Next	O
,	O
the	O
CPU	B-General_Concept
performs	O
the	O
actual	O
write	O
or	O
read	O
on	O
the	O
VDP	B-General_Concept
's	O
data	O
port	O
.	O
</s>
<s>
As	O
a	O
data	O
byte	O
is	O
written	O
or	O
read	O
,	O
the	O
TMS9918	B-Architecture
automatically	O
increments	O
the	O
internal	O
address	B-General_Concept
register	I-General_Concept
.	O
</s>
<s>
The	O
TMS9918	B-Architecture
has	O
two	O
separate	O
and	O
distinct	O
graphics	O
types	O
:	O
characters	O
and	O
sprites	O
.	O
</s>
<s>
The	O
TMS9918	B-Architecture
has	O
a	O
number	O
of	O
screen	O
modes	O
that	O
control	O
the	O
characteristics	O
of	O
the	O
characters	O
.	O
</s>
<s>
There	O
are	O
four	O
documented	O
screen	O
modes	O
available	O
in	O
the	O
TMS9918A	B-Architecture
(	O
as	O
mentioned	O
before	O
,	O
the	O
TMS9918	B-Architecture
lacks	O
mode	O
Graphic	O
2	O
)	O
:	O
</s>
<s>
For	O
example	O
,	O
the	O
characters	O
"	O
0	O
"	O
through	O
"	O
7	O
"	O
will	O
all	O
have	O
the	O
same	O
color	B-Algorithm
attributes	I-Algorithm
.	O
</s>
<s>
Mode	O
3	O
(	O
Multicolor	O
)	O
:	O
256×192	O
pixels	O
total	O
,	O
64×48	O
changeable	O
virtual	O
pixels	O
,	O
as	O
32×24	O
"	O
semi-graphics	B-Data_Structure
"	O
characters	O
.	O
</s>
<s>
These	O
semi-graphics	B-Data_Structure
are	O
defined	O
in	O
a	O
special	O
character	O
set	O
of	O
256	O
characters	O
defined	O
by	O
2×2	O
"	O
fat-pixels	O
"	O
.	O
</s>
<s>
However	O
,	O
the	O
resulting	O
framebuffer	B-Algorithm
is	O
non-linear	O
.	O
</s>
<s>
The	O
challenge	O
of	O
using	O
TMS9918	B-Architecture
mode	O
2	O
was	O
that	O
every	O
8×1	O
pixel	O
area	O
could	O
have	O
only	O
two	O
colors	O
,	O
foreground	O
and	O
background	O
.	O
</s>
<s>
They	O
could	O
be	O
freely	O
picked	O
out	O
of	O
the	O
16	O
color	O
palette	B-Data_Structure
,	O
but	O
for	O
each	O
8×1	O
area	O
,	O
only	O
two	O
colors	O
could	O
exist	O
.	O
</s>
<s>
When	O
manipulating	O
the	O
screen	O
in	O
BASIC	O
with	O
the	O
LINE	O
command	O
,	O
one	O
easily	O
could	O
exceed	O
the	O
maximum	O
2	O
colors	O
per	O
8×1	O
area	O
and	O
end	O
up	O
with	O
"	O
color	B-Algorithm
spill	I-Algorithm
"	O
.	O
</s>
<s>
Expands	O
the	O
color	B-Data_Structure
table	I-Data_Structure
size	O
.	O
</s>
<s>
Changes	O
two	O
address	O
bits	O
of	O
the	O
pattern	O
and	O
color	B-Data_Structure
tables	I-Data_Structure
into	O
mask	O
bits	O
,	O
which	O
controls	O
whether	O
each	O
third	O
of	O
the	O
screen	O
has	O
its	O
own	O
pattern	O
and	O
color	B-Data_Structure
table	I-Data_Structure
or	O
not	O
.	O
</s>
<s>
Note	O
that	O
although	O
genuine	O
TMS9918A	B-Architecture
chips	O
support	O
these	O
modes	O
,	O
clones	B-General_Concept
and	O
emulators	O
may	O
not	O
.	O
</s>
<s>
This	O
mode	O
allows	O
for	O
two-color	O
bitmap	O
images	O
,	O
with	O
no	O
color	B-Data_Structure
table	I-Data_Structure
.	O
</s>
<s>
The	O
TMS9918	B-Architecture
does	O
not	O
have	O
any	O
scroll	O
registers	O
,	O
and	O
so	O
scrolling	O
must	O
be	O
done	O
by	O
software	O
.	O
</s>
<s>
The	O
VDP	B-General_Concept
reports	O
in	O
a	O
status	O
register	B-General_Concept
the	O
number	O
of	O
the	O
first	O
dropped	O
sprite	O
.	O
</s>
<s>
The	O
CPU	B-General_Concept
can	O
get	O
around	O
this	O
limitation	O
by	O
rotating	O
sprite	O
priorities	O
so	O
that	O
a	O
different	O
set	O
of	O
sprites	O
is	O
drawn	O
on	O
every	O
frame	O
;	O
instead	O
of	O
disappearing	O
entirely	O
,	O
the	O
sprites	O
will	O
flicker	O
.	O
</s>
<s>
Automatic	O
sprite	O
movement	O
is	O
not	O
handled	O
by	O
the	O
VDP	B-General_Concept
.	O
</s>
<s>
Instead	O
,	O
in	O
practice	O
,	O
the	O
CPU	B-General_Concept
will	O
pick	O
up	O
on	O
the	O
VDP	B-General_Concept
's	O
vertical	O
interrupt	O
-	O
a	O
standard	O
VDP	B-General_Concept
output	O
,	O
which	O
is	O
triggered	O
automatically	O
once	O
every	O
50th	O
or	O
60th	O
of	O
a	O
second	O
(	O
depending	O
on	O
chip	O
variant	O
)	O
,	O
at	O
the	O
start	O
of	O
the	O
VBI	O
(	O
vertical	O
blanking	O
interval	O
)	O
.	O
</s>
<s>
The	O
CPU	B-General_Concept
then	O
jumps	O
to	O
a	O
sprite-handling	O
routine	O
in	O
the	O
software	O
,	O
which	O
in	O
turn	O
tells	O
the	O
VDP	B-General_Concept
where	O
to	O
reposition	O
the	O
sprites	O
.	O
</s>
<s>
This	O
is	O
useful	O
for	O
triggering	O
more	O
advanced	O
collision	O
detection	O
routines	O
inside	O
the	O
software	O
which	O
can	O
then	O
determine	O
the	O
exact	O
location	O
of	O
the	O
collision	O
and	O
act	O
upon	O
it	O
,	O
as	O
the	O
VDP	B-General_Concept
is	O
itself	O
incapable	O
of	O
reporting	O
which	O
two	O
sprites	O
have	O
collided	O
.	O
</s>
<s>
The	O
TMS9918	B-Architecture
family	O
chips	O
used	O
a	O
composite	O
video	O
palette	B-Data_Structure
.	O
</s>
<s>
Colors	O
were	O
generated	O
based	O
on	O
a	O
combination	O
of	O
luminance	O
and	O
chrominance	O
values	O
for	O
the	O
TMS9918A	B-Architecture
and	O
Y	O
,	O
R-Y	O
and	O
B-Y	O
values	O
are	O
for	O
the	O
TMS9928A/9929A	O
.	O
</s>
<s>
The	O
TMS9918	B-Architecture
has	O
a	O
fixed	O
16-color	B-Data_Structure
palette	I-Data_Structure
,	O
composed	O
of	O
15	O
displayed	O
colors	O
and	O
a	O
"	O
transparent	O
"	O
color	O
.	O
</s>
<s>
Luminance	O
and	O
chrominance	O
values	O
are	O
for	O
the	O
TMS9918A	B-Architecture
.	O
</s>
<s>
Furthermore	O
,	O
you	O
need	O
to	O
consider	O
that	O
up	O
to	O
that	O
time	O
only	O
cathode	B-Device
ray	I-Device
tubes	I-Device
have	O
been	O
available	O
for	O
computer	O
monitors	O
as	O
well	O
as	O
for	O
televisions	O
,	O
and	O
that	O
these	O
CRTs	O
had	O
a	O
gamma	O
.	O
</s>
<s>
The	O
TMS9918	B-Architecture
series	O
chips	O
had	O
been	O
designed	O
to	O
work	O
with	O
televisions	O
and	O
their	O
CRTs	O
had	O
a	O
gamma	O
of	O
1.6	O
(	O
remark	O
:	O
CRTs	O
of	O
Macintosh	B-Device
monitors	O
had	O
1.8	O
and	O
the	O
CRTs	O
of	O
PC	O
monitors	O
had	O
2.2	O
)	O
.	O
</s>
<s>
For	O
this	O
reason	O
the	O
colors	O
of	O
the	O
TMS9918	B-Architecture
look	O
somewhat	O
pale	O
here	O
as	O
you	O
can	O
see	O
in	O
the	O
first	O
table	O
above	O
.	O
</s>
<s>
Texas	O
Instruments	O
 '	O
TMS9918A	B-Architecture
was	O
succeeded	O
by	O
Yamaha	O
's	O
V9938	B-General_Concept
,	O
which	O
added	O
additional	O
bitmap	O
modes	O
,	O
more	O
colorful	O
sprites	O
,	O
a	O
vertical	O
full-screen	O
scroll	O
register	B-General_Concept
,	O
vertical	O
and	O
horizontal	O
offset	O
registers	O
,	O
a	O
hardware	O
blitter	B-General_Concept
and	O
a	O
customizable	O
palette	B-Data_Structure
.	O
</s>
<s>
The	O
V9938	B-General_Concept
was	O
designed	O
for	O
the	O
MSX2	B-Operating_System
standard	O
of	O
computers	O
,	O
and	O
later	O
used	O
in	O
a	O
third-party	O
upgrade	O
to	O
the	O
TI-99/4A	B-Device
—	O
the	O
Geneve	B-Device
9640	I-Device
'	O
computer-on-a-card	O
'	O
.	O
</s>
<s>
The	O
V9938	B-General_Concept
,	O
in	O
turn	O
,	O
was	O
succeeded	O
by	O
the	O
V9958	B-General_Concept
,	O
which	O
added	O
some	O
additional	O
high-colour	O
modes	O
and	O
a	O
horizontal	O
two-page	O
scroll	O
register	B-General_Concept
,	O
these	O
chips	O
were	O
used	O
in	O
the	O
MSX2+	B-Operating_System
/turboR	O
systems	O
.	O
</s>
<s>
Toshiba	O
made	O
a	O
clone	B-General_Concept
called	O
the	O
T6950	O
and	O
does	O
not	O
support	O
the	O
undocumented	O
pattern	O
/	O
color	B-Data_Structure
table	I-Data_Structure
masking	O
feature	O
in	O
graphics	O
2	O
mode	O
.	O
</s>
<s>
Later	O
,	O
Toshiba	O
released	O
the	O
T7937A	O
MSX-Engine	O
with	O
a	O
built-in	O
VDP	B-General_Concept
and	O
fixed	O
the	O
masking	O
features	O
.	O
</s>
<s>
Both	O
VDPs	O
by	O
Toshiba	O
feature	O
a	O
slightly	O
different	O
palette	B-Data_Structure
than	O
the	O
Texas	O
VDPs	O
,	O
with	O
more	O
vivid	O
colors	O
.	O
</s>
<s>
The	O
TMS9918	B-Architecture
was	O
the	O
basis	O
for	O
the	O
VDP	B-General_Concept
chips	O
in	O
Sega	O
's	O
Master	O
System	O
,	O
Game	O
Gear	O
,	O
and	O
Mega	B-Operating_System
Drive	I-Operating_System
.	O
</s>
