Loading AI tools
Video display controller From Wikipedia, the free encyclopedia
The TMS9918 is a video display controller (VDC) manufactured by Texas Instruments, in manuals referenced as "Video Display Processor" (VDP) and introduced in 1979.[1] The TMS9918 and its variants were used in the ColecoVision, CreatiVision, Memotech MTX, MSX, NABU Personal Computer, SG-1000/SC-3000, Spectravideo SV-318, SV-328, Sord M5, Tatung Einstein, TI-99/4, Casio PV-2000, Coleco Adam, Hanimex Pencil II, PECOS and Tomy Tutor.
This article needs additional citations for verification. (April 2015) |
The TMS9918 generates both grid-based character graphics (used to display text or background images) and sprites used for moving foreground objects.
The key features of this chip are, as highlighted in a 1980 presentation by Karl Guttag (one of the designers):[1]
All of the ICs in this family are usually referred to by the TMS9918 name, sometimes with an 'A' postfix. The 'A' indicates a second version of the chip which added new features, most prominently the addition of a bitmap mode (Graphic II).
The TMS9918 was only used in the TI-99/4; the TI-99/4A and the other computers had the A version VDC.
The TMS9918A and TMS9928A output a 60 Hz video signal, while the TMS9929A outputs 50 Hz. The difference between '1' and the '2' in 'TMS9918A' and 'TMS9928A' is that the '1' version outputs composite NTSC video, while the '2' versions (including the TMS9929A) outputs analog Y luminance and R-Y and B-Y colour difference signals. The need for the latter was predominant in the 50 Hz world, including Europe, due to the different video signal standards PAL and SECAM. It was more cost-effective to output Y, R-Y and B-Y and encode them into PAL or SECAM in the RF modulator, than to try to have a different console for every different color standard. The '1' version also features an external composite video input which made it a handy chip to use in video "titlers" that could overlay text or graphics on video, while the '2' version does not.
The original variants of the TMS9918 were depletion load NMOS and manufactured on a 4.5 μm process; it was one of the first depletion load NMOS chips Texas Instruments manufactured in contrast to the TMS9900 microprocessor which used the older enhancement load NMOS process that required three supply voltages. Due to the large die size and relatively high internal speed, the TMS9918 ran warm enough to necessitate a heat sink--some devices such as the Taiwanese DINA console (a hybrid Colecovision/SG-1000) neglected to install sinks and suffered from malfunctions of the chip. By 1983 Texas Instruments had shrunk the die size to 3 μm which ran cooler and no longer required a sink--MSX machines and the Sega SG-1000 used the newer 3 μm TMS9918 while most Colecovisions had the original 4.5 μm variant (the final run of the consoles produced in 1985 had the newer model TMS9918).
A later variant of the TMS9918 series chips, the TMS9118, TMS9128, and TMS9129, were released in the mid-late 1980s, but were never very popular. The function of one pin is changed, and the mapping of the video memory allows two 16K×4-bit chips to be used instead of the eight 16K×1-bit chips the TMS99xx needs. Otherwise the chips are completely identical to the TMS9918A, TMS9928A and TMS9929A respectively.
The VDP has 16K × 8 bits of external video memory. This memory is outside the address space of the CPU. Having a separate address space means that the CPU has to do more work to write or read this memory, but it also means that the VDC doesn't slow the CPU down when it periodically reads this memory to generate the display. Additionally, it leaves more address space available to the CPU for other memory and memory-mapped hardware.
Depending on the screen mode being used, not all of the video memory may be needed to generate the display. In these cases, the CPU may use the extra video memory for other purposes. For example, one use is as a scratch-pad for uncompressing graphics or sound data stored in cartridge ROM into. Another popular use is to create a second copy of some or all of the display data to eliminate flickering and tearing, a technique known as double buffering.
The CPU communicates with the VDP through an 8-bit bus. A pin controlled by the CPU separates this bus into two "ports", a control port and a data port. To write or read a byte of video memory, the CPU first has to write two bytes on the VDP's control port to the VDC's internal address register. Next, the CPU performs the actual write or read on the VDP's data port. As a data byte is written or read, the TMS9918 automatically increments the internal address register. This auto-increment feature accelerates writes and reads of blocks of data. The control port is also used to access various internal registers.
The TMS9918 has two separate and distinct graphics types: characters and sprites.
Characters are typically used to create text or background images. They appear behind sprites.
The TMS9918 has a number of screen modes that control the characteristics of the characters.
There are four documented screen modes available in the TMS9918A (as mentioned before, the TMS9918 lacks mode Graphic 2):
Technically, mode 2 is a character mode with a colorful character set. The screen is horizontally divided into three 256×64 pixel areas, each of which gets its own character set. By sequentially printing the characters 0 through 255 in all three areas, the program can simulate a graphics mode where each pixel can be set individually. However, the resulting framebuffer is non-linear.
The program can also use three identical character sets, and then deal with the screen like a text mode with a colorful character set. Background patterns and sprites then consist of colorful characters. This was commonly used in games, because only 32×24 bytes would have to be moved to fill and scroll the entire screen.
The challenge of using TMS9918 mode 2 was that every 8×1 pixel area could have only two colors, foreground and background. They could be freely picked out of the 16 color palette, but for each 8×1 area, only two colors could exist. When manipulating the screen in BASIC with the LINE
command, one easily could exceed the maximum 2 colors per 8×1 area and end up with "color spill".
Texas Instruments originally only documented the four modes listed above. However the bit that enables mode 2 is more interesting than initially let on. It is best described as a modifier bit for the other modes. Enabling it does three things:[2]
With this in mind, three additional modes are possible. Note that although genuine TMS9918A chips support these modes, clones and emulators may not.
The TMS9918 does not have any scroll registers, so scrolling must be done by software. Furthermore, scrolling can only be done on character boundaries, not pixel by pixel.[citation needed]
Sprites are typically used to create moving foreground objects. They appear in front of characters (tiles).
Modes 1, 2, and 3 can render sprites. There can be up to 32 monochrome sprites of either 8×8 or 16×16 pixels on screen, each sprite with its own, single color. The illusion of multicolor sprites can be created by stacking multiple sprites on top of each other.
There can be no more than 4 sprites on a single scanline; any additional sprites' horizontal pixels are dropped. Sprites with a higher priority are drawn first. The VDP reports in a status register the number of the first dropped sprite. The CPU can get around this limitation by rotating sprite priorities so that a different set of sprites is drawn on every frame; instead of disappearing entirely, the sprites will flicker. This technique is known as sprite multiplexing.
Automatic sprite movement is not handled by the VDP. Instead, in practice, the CPU will pick up on the VDP's vertical interrupt - a standard VDP output, which is triggered automatically once every 50th or 60th of a second (depending on chip variant), at the start of the VBI (vertical blanking interval). The CPU then jumps to a sprite-handling routine in the software, which in turn tells the VDP where to reposition the sprites.
The sprite collision flag is set when non-zero pattern bits of two sprites coincide, even if either sprite has transparent colour. This is useful for triggering more advanced collision detection routines inside the software which can then determine the exact location of the collision and act upon it, as the VDP is itself incapable of reporting which two sprites have collided.
The TMS9918 family chips used a composite video palette. Colors were generated based on a combination of luminance and chrominance values for the TMS9918A and Y, R-Y and B-Y values are for the TMS9928A/9929A .
The TMS9918 has a fixed 16-color palette, composed of 15 displayed colors and a "transparent" color.
According to "Table 2.3 - Color Assignments" on the datasheet[4] outputs levels are the following:
Color code | Color | Luminance | Chrominance | Y | R-Y | B-Y |
---|---|---|---|---|---|---|
0 | transparent | - | - | - | - | - |
1 | black | 0% | - | 0% | 47% | 47% |
2 | medium green | 53% | 53% | 53% | 7% | 20% |
3 | light green | 67% | 40% | 67% | 17% | 27% |
4 | dark blue | 40% | 60% | 40% | 40% | 100% |
5 | light blue | 53% | 53% | 53% | 43% | 93% |
6 | dark red | 47% | 47% | 47% | 83% | 30% |
7 | cyan | 67% | 60% | 73% | 0% | 70% |
8 | medium red | 53% | 60% | 53% | 93% | 27% |
9 | light red | 67% | 60% | 67% | 93% | 27% |
10 | dark yellow | 73% | 47% | 73% | 57% | 7% |
11 | light yellow | 80% | 33% | 80% | 57% | 17% |
12 | dark green | 46% | 47% | 47% | 13% | 23% |
13 | magenta | 53% | 40% | 53% | 73% | 67% |
14 | gray | 80% | - | 80% | 47% | 47% |
15 | white | 100% | - | 100% | 47% | 47% |
Notes: Colors are merely illustrative, and were converted from the YPrPb values (MS9928A/9929A) to sRGB taking into account Gamma correction. SMPTE C colorimetry was not taken into account - see the next section for alternate color conversions.
In order to convert Y, R-Y and B-Y to RGB you need to consider how Y originated, namely:
Y = R * 0.30 + G * 0.59 + B * 0.11
Thus you need to use the following formulas:
R = R-Y + Y B = B-Y + Y G = (Y - 0.30 * R - 0.11 * B) / 0.59
But at first you need to spend attention to the fact that for all colors that have no chrominance - thus black, gray and white - R-Y and B-Y are not 0% but all have an offset of 47%. So you need to subtract this offset from all R-Y and B-Y values at first. Due to the fact that in practice this one step will never be done alone, it's no problem that some results will be negative:
Color code | Color | Y | R-Y | B-Y |
---|---|---|---|---|
1 | black | 0% | 0% | 0% |
2 | medium green | 53% | -40% | -27% |
3 | light green | 67% | -30% | -20% |
4 | dark blue | 40% | -7% | 53% |
5 | light blue | 53% | -4% | 46% |
6 | dark red | 47% | 36% | -17% |
7 | cyan | 73% | -47% | 23% |
8 | medium red | 53% | 46% | -20% |
9 | light red | 67% | 46% | -20% |
10 | dark yellow | 73% | 10% | -40% |
11 | light yellow | 80% | 10% | -30% |
12 | dark green | 47% | -34% | -24% |
13 | magenta | 53% | 26% | 20% |
14 | gray | 80% | 0% | 0% |
15 | white | 100% | 0% | 0% |
Now you can do the conversion to RGB. All results must be in the range from 0% to 100%:
Color code | Color | R | G | B |
---|---|---|---|---|
1 | black | 0% | 0.0000% | 0% |
2 | medium green | 13% | 78.3729% | 26% |
3 | light green | 37% | 85.9831% | 47% |
4 | dark blue | 33% | 33.6780% | 93% |
5 | light blue | 49% | 46.4576% | 99% |
6 | dark red | 83% | 31.8644% | 30% |
7 | cyan | 26% | 92.6102% | 96% |
8 | medium red | 99% | 33.3390% | 33% |
9 | light red | 113% | 53.9492% | 47% |
10 | dark yellow | 83% | 75.3729% | 33% |
11 | light yellow | 90% | 80.5085% | 50% |
12 | dark green | 13% | 68.7627% | 23% |
13 | magenta | 79% | 36.0508% | 73% |
14 | gray | 80% | 80.0000% | 80% |
15 | white | 100% | 100.0000% | 100% |
You might come to the conclusion that the erroneous value of 113% for R of color "light red" results out of a typo within the datasheet and there R-Y must not be greater than 80%. But if you measure the output signals of the chip with an oscilloscope, you'll find that all values in the table are correct. So the error is inside the chip and drives the red signal into saturation. For this reason this value is to be corrected to 100%.
Furthermore, you need to consider that up to that time only cathode ray tubes have been available for computer monitors as well as for televisions, and that these CRTs had a gamma. The TMS9918 series chips had been designed to work with televisions and their CRTs had a gamma of 1.6 (remark: CRTs of Macintosh monitors had 1.8 and the CRTs of PC monitors had 2.2). Flat screens do not have gamma. For this reason the colors of the TMS9918 look somewhat pale here as you can see in the first table above. The below table uses the gamma-corrected values, which are (written in hexadecimal because this is needed by Wikipedia's coding):
Color code | Color | R | G | B |
---|---|---|---|---|
1 | black | 00 | 00 | 00 |
2 | medium green | 0A | AD | 1E |
3 | light green | 34 | C8 | 4C |
4 | dark blue | 2B | 2D | E3 |
5 | light blue | 51 | 4B | FB |
6 | dark red | BD | 29 | 25 |
7 | cyan | 1E | E2 | EF |
8 | medium red | FB | 2C | 2B |
9 | light red | FF | 5F | 4C |
10 | dark yellow | BD | A2 | 2B |
11 | light yellow | D7 | B4 | 54 |
12 | dark green | 0A | 8C | 18 |
13 | magenta | AF | 32 | 9A |
14 | gray | B2 | B2 | B2 |
15 | white | FF | FF | FF |
Note: The used steps are: Round all values to two decimal places, then raise to the power of 1.6 for gamma correction and finally transform the range of values from 0...100 to 0...255.
Texas Instruments' TMS9918A was succeeded by Yamaha's V9938, which added additional bitmap modes, more colorful sprites, a vertical full-screen scroll register, vertical and horizontal offset registers, a hardware blitter and a customizable palette. The V9938 was designed for the MSX2 standard of computers, and later used in a third-party upgrade to the TI-99/4A: the Geneve 9640 "computer-on-a-card".
The V9938, in turn, was succeeded by the V9958, which added some additional high-colour modes and a horizontal two-page scroll register, these chips were used in the MSX2+/turboR systems.
Toshiba made a clone called the T6950 and does not support the undocumented pattern / color table masking feature in graphics 2 mode.[5][better source needed] Later, Toshiba released the T7937A MSX-Engine with a built-in VDP and fixed the masking features. Both VDPs by Toshiba feature a slightly different palette than the Texas VDPs, with more vivid colors.
The TMS9918 was the basis for the VDP chips in the Master System, Game Gear, and Mega Drive (Genesis).[citation needed] They use additional display modes and registers, and added hardware scrolling capabilities and other advanced features. The Ricoh PPU chip in the Nintendo Entertainment System (Famicom) is also based on the TMS9918.[citation needed]
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.