TMS9918

Last updated
VDP TMS9918A TMS9918A 01.jpg
VDP TMS9918A
VDP TMS9918A TMS9918A 02.jpg
VDP TMS9918A
VDP TMS9928A TMS9928A 01.jpg
VDP TMS9928A
VDP TMP9118NL prototype VDP TMP9118.png
VDP TMP9118NL prototype

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, and Tomy Tutor.

Contents

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 on a 1980 presentation by Karl Guttag (one of the designers): [1]

Product family

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).

Texas Instruments TMS9918 Product Family Summary
Chip VariantVideo OutVideo InVideo FrequencyMode 2 Support
9918 Composite Composite 60 Hz No
9918A / 9118CompositeComposite60 HzYes
9928A / 9128 YPbPr (None)60 HzYes
9929A / 9129YPbPr(None) 50 Hz Yes

TMS9918

The TMS9918 was only used in the TI-99/4; the TI-99/4A and the other computers had the A version VDC.

TMS9918A, TMS9928A and TMS9929A

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 YPbPr [2] (Y luminance and Pr (R-Y) and Pb (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, Pr and Pb 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.

TMS9118, TMS9128 and TMS9129

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.

External interfaces

Video RAM

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.

CPU

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.

Graphics

The TMS9918 has two separate and distinct graphics types: characters and sprites.

Characters

Characters are typically used to create text or background images. They appear behind sprites.

Screen modes

The TMS9918 has a number of screen modes that control the characteristics of the characters.

Documented

There are four documented screen modes available in the TMS9918A (as mentioned before, the TMS9918 lacks mode Graphic 2):

  • Mode 0 (Text): 240×192 pixels total, as 40×24 characters, pulled from 1 character set of 256 6×8 pixel characters. The entire character set has a 2-color limitation. This mode doesn't support sprites.
  • Mode 1 (Graphic 1): 256×192 pixels total, as 32×24 characters, pulled from 1 character set of 256 8×8 pixel characters. Each group of 8 characters in the character set has a 2-color limitation. For example, the characters "0" through "7" will all have the same color attributes.
  • Mode 2 (Graphic 2): 256×192 pixels total, as 32×24 characters, pulled from 3 character sets of 256 8×8 pixel characters. Each 8-pixel-wide line of a character in the character sets has a 2-color limitation. This mode provides a unique character for every character location on screen, allowing for the display of bitmapped images.
  • Mode 3 (Multicolor): 256×192 pixels total, 64×48 changeable virtual pixels, as 32×24 "semi-graphics" characters. These semi-graphics are defined in a special character set of 256 characters defined by 2×2 "fat-pixels". There are 4×4 pixels in each fat-pixel, but the pixels within a fat-pixel cannot be individually defined, although each fat-pixel can have its own color, hence the name of this mode (Multicolor). This mode is very blocky, and rarely used.
Screen Mode 2 details

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".

Undocumented

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: [3]

  1. Expands the color table size.
  2. Divides the screen horizontally into thirds.
  3. Changes two address bits of the pattern and color tables into mask bits, which controls whether each third of the screen has its own pattern and color table or not.

With this in mind, three additional modes are possible. Note that although genuine TMS9918A chips support these modes, clones and emulators may not.

  • Mode 0 (Text) + Mode 2 (Graphic 2): Known as Bitmap Text Mode. This mode allows for two-color bitmap images, with no color table. This saves memory, at the expense of a slightly reduced horizontal resolution (text mode has a horizontal resolution of 240 pixels instead of 256 pixels like the graphic modes do).
  • Mode 1 (Graphic 1) + Mode 2 (Graphic 2): Known as Half-Bitmap Mode. Texas Instruments actually documented this "undocumented" screen mode in their manual titled "Video Display Processors Programmers Guide SPPU004". [4] In section 8.4.2, "Playing Games with VRAM Addressing", [4] they discuss how this mode combines the memory savings of mode 1 with the color detail of mode 2. However, as they go on to say this mode limits the number of sprites that can be displayed to 8 instead of 32. Therefore, the term "undocumented" used to describe this mode is a misnomer. However, because this manual was not widely known, this mode is generally considered to be one of the undocumented modes. Generally, the only reason to use this mode over Mode 2 is to reduce memory consumption.
  • Mode 3 (Multicolor) + Mode 2 (Graphic 2): Known as Bitmap Multicolor Mode. This mode is more of a novelty, as it offers nothing beyond what the standard Multicolor mode can already do.

Scrolling

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

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.

When two non-transparent pixels in any pair of sprites collide, the sprite collision flag is set. 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.

Colors

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 .

Datasheet values

The TMS9918 has a fixed 16-color palette, composed of 15 displayed colors and a "transparent" color.

  • When "transparent" is used for sprites, it will show the background characters.
  • When "transparent" is used for characters, it will show the external video signal.

According to "Table 2.3 - Color Assignments" on the datasheet [5] outputs levels are the following:

Color codeColor Luminance Chrominance Y R-Y (Pr) B-Y (Pb)
0transparent-----
1black0%-0%47%47%
2medium green53%53%53%7%20%
3light green67%40%67%17%27%
4dark blue40%60%40%40%100%
5light blue53%53%53%43%93%
6dark red47%47%47%83%30%
7cyan67%60%73%0%70%
8medium red53%60%53%93%27%
9light red67%60%67%93%27%
10dark yellow73%47%73%57%7%
11light yellow80%33%80%57%17%
12dark green46%47%47%13%23%
13magenta53%40%53%73%67%
14gray80%-80%47%47%
15white100%-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.

CRT display

[ original research? ]

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 codeColorYR-YB-Y
1black0%0%0%
2medium green53%-40%-27%
3light green67%-30%-20%
4dark blue40%-7%53%
5light blue53%-4%46%
6dark red47%36%-17%
7cyan73%-47%23%
8medium red53%46%-20%
9light red67%46%-20%
10dark yellow73%10%-40%
11light yellow80%10%-30%
12dark green47%-34%-24%
13magenta53%26%20%
14gray80%0%0%
15white100%0%0%

Now you can do the conversion to RGB. All results must be in the range from 0% to 100%:

Color codeColorRGB
1black0%0.0000%0%
2medium green13%78.3729%26%
3light green37%85.9831%47%
4dark blue33%33.6780%93%
5light blue49%46.4576%99%
6dark red83%31.8644%30%
7cyan26%92.6102%96%
8medium red99%33.3390%33%
9light red113%53.9492%47%
10dark yellow83%75.3729%33%
11light yellow90%80.5085%50%
12dark green13%68.7627%23%
13magenta79%36.0508%73%
14gray80%80.0000%80%
15white100%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 codeColorRGB
1black000000
2medium green0AAD1E
3light green34C84C
4dark blue2B2DE3
5light blue514BFB
6dark redBD2925
7cyan1EE2EF
8medium redFB2C2B
9light redFF5F4C
10dark yellowBDA22B
11light yellowD7B454
12dark green0A8C18
13magentaAF329A
14grayB2B2B2
15whiteFFFFFF

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.

Specifications

Legacy

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. [6] [ 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 Sega's Master System, Game Gear, and Mega Drive.[ citation needed ] They used additional display modes and registers, and added hardware scrolling capabilities and other advanced features.

See also

Related Research Articles

<span class="mw-page-title-main">Amiga Original Chip Set</span> Chipset used in Amiga personal computer

The Original Chip Set (OCS) is a chipset used in the earliest Commodore Amiga computers and defined the Amiga's graphics and sound capabilities. It was succeeded by the slightly improved Enhanced Chip Set (ECS) and the greatly improved Advanced Graphics Architecture (AGA).

Amiga Advanced Graphics Architecture (AGA) is the third-generation Amiga graphic chipset, first used in the Amiga 4000 in 1992. Before release AGA was codenamed Pandora by Commodore International.

<span class="mw-page-title-main">Bally Astrocade</span>

The Bally Astrocade is a second-generation home video game console and simple computer system designed by a team at Midway, at that time the videogame division of Bally. It was originally announced as the "Bally Home Library Computer" in October 1977 and initially made available for mail order in December 1977. But due to production delays, the units were first released to stores in April 1978 and its branding changed to "Bally Professional Arcade". It was marketed only for a limited time before Bally decided to exit the market. The rights were later picked up by a third-party company, who re-released it and sold it until around 1984. The Astrocade is particularly notable for its very powerful graphics capabilities for the time of release, and for the difficulty in accessing those capabilities.

<span class="mw-page-title-main">Framebuffer</span> Portion of random-access memory containing a bitmap that drives a video display

A framebuffer is a portion of random-access memory (RAM) containing a bitmap that drives a video display. It is a memory buffer containing data representing all the pixels in a complete video frame. Modern video cards contain framebuffer circuitry in their cores. This circuitry converts an in-memory bitmap into a video signal that can be displayed on a computer monitor.

<span class="mw-page-title-main">TI-99/4A</span> Home computer by Texas Instruments

The TI-99/4 and TI-99/4A are home computers released by Texas Instruments in 1979 and 1981, respectively. The TI-99 series competed against home computers such as the Apple II, TRS-80, Atari 400/800, and VIC-20.

<span class="mw-page-title-main">MOS Technology VIC</span>

The VIC (Video Interface Chip), specifically known as the MOS Technology 6560 (NTSC version) / 6561 (PAL version), is the integrated circuit chip responsible for generating video graphics and sound in the VIC-20 home computer from Commodore. It was originally designed for applications such as low cost CRT terminals, biomedical monitors, control system displays and arcade or home video game consoles.

<span class="mw-page-title-main">MOS Technology VIC-II</span> Video microchip in the Commodore 64 and C128 home computers

The VIC-II, specifically known as the MOS Technology 6567/6566/8562/8564, 6569/8565/8566 (PAL), is the microchip tasked with generating Y/C video signals and DRAM refresh signals in the Commodore 64 and Commodore 128 home computers.

Text mode is a computer display mode in which content is internally represented on a computer screen in terms of characters rather than individual pixels. Typically, the screen consists of a uniform rectangular grid of character cells, each of which contains one of the characters of a character set; at the same time, contrasted to graphics mode or other kinds of computer graphics modes.

<span class="mw-page-title-main">X68000</span> 1987 home computer

The X68000 is a home computer created by Sharp Corporation. It was first released in 1987 and sold only in Japan.

<span class="mw-page-title-main">Sprite (computer graphics)</span> 2D bitmap displayed on top of a larger scene

In computer graphics, a sprite is a two-dimensional bitmap that is integrated into a larger scene, most often in a 2D video game. Originally, the term sprite referred to fixed-sized objects composited together, by hardware, with a background. Use of the term has since become more general.

<span class="mw-page-title-main">Attribute clash</span>

Attribute clash is a display artifact caused by limits in the graphics circuitry of some colour 8-bit home computers, most notably the ZX Spectrum, where it meant that only two colours could be used in any 8×8 tile of pixels. The effect was also noticeable on MSX software and in some Commodore 64 titles. Workarounds to prevent this limit from becoming apparent have since been considered an element of Spectrum programmer culture.

<span class="mw-page-title-main">CTIA and GTIA</span> Custom chips used in Atari 8-bit computers

Color Television Interface Adaptor (CTIA) and its successor Graphic Television Interface Adaptor (GTIA) are custom chips used in the Atari 8-bit computers and Atari 5200 home video game console. In these systems, a CTIA or GTIA chip works together with ANTIC to produce the video display. ANTIC generates the playfield graphics while CTIA/GTIA provides the color for the playfield and adds overlay objects known as player/missile graphics (sprites). Under the direction of Jay Miner, the CTIA/GTIA chips were designed by George McLeod with technical assistance of Steve Smith.

<span class="mw-page-title-main">Hold-And-Modify</span> Display mode used in Commodore Amiga computers

Hold-And-Modify, usually abbreviated as HAM, is a display mode of the Commodore Amiga computer. It uses a highly unusual technique to express the color of pixels, allowing many more colors to appear on screen than would otherwise be possible. HAM mode was commonly used to display digitized photographs or video frames, bitmap art and occasionally animation. At the time of the Amiga's launch in 1985, this near-photorealistic display was unprecedented for a home computer and it was widely used to demonstrate the Amiga's graphical capability. However, HAM has significant technical limitations which prevent it from being used as a general purpose display mode.

<span class="mw-page-title-main">Yamaha V9938</span>

The Yamaha V9938 is a video display processor (VDP) used on the MSX2 home computer, as well as on the Geneve 9640 enhanced TI-99/4A clone and the Tatung Einstein 256. It was also used in a few MSX1 computers, in a configuration with 16kB VRAM.

<span class="mw-page-title-main">Video display controller</span> Type of integrated circuit

A video display controller (VDC), also called a display engine or display interface, is an integrated circuit which is the main component in a video-signal generator, a device responsible for the production of a TV video signal in a computing or game system. Some VDCs also generate an audio signal, but that is not their main function. VDCs were used in the home computers of the 1980s and also in some early video picture systems.

The ColecoVision, SG-1000, CreatiVision, and first-generation MSX computers use the TMS9918A Video Display processor (VDP), which has its own 16 KiB of video memory that was not shared with main memory. Compared to the unified system and video memory used by other 8-bit computers of the time, such as the Apple II, ZX Spectrum, and Commodore 64, separate memory has the advantage of freeing up of the Z80 processor's 64 KiB address space for main RAM, and the VDP does not need to steal CPU cycles to access video memory. The disadvantage is that the program has to use the CPU's dedicated I/O instructions to command the VDP to manipulate the contents of the video RAM. This not only slows down video access but also makes the porting of games from unified-memory platforms more difficult. Attempts of porting ZX Spectrum games were often thwarted by this difference. Also, programmers had to learn to optimally use the more advanced capabilities of the VDP.

<span class="mw-page-title-main">PlayStation technical specifications</span> Overview of the technical specifications of the PlayStation

The PlayStation technical specifications describe the various components of the original PlayStation video game console.

References

  1. 1 2 "TMS9918 Arizona Technical Symposium Draft - Development - SMS Power!". www.smspower.org.
  2. "YUV, YCbCr, YPbPr colour spaces | DiscoveryBiz.Net". discoverybiz.net.
  3. Video Display Processor / Hybrid Modes., which is also put to use.
  4. 1 2 Video Display Processors - Programmer's Guide (PDF). Texas Instruments.
  5. Texas Instruments (1982), TMS9918A/TMS9928A/TMS9929A Video Display Processors (PDF), retrieved 2018-11-02
  6. "Undocumented Mode 1 + 2 : Poll/Discussion | MSX Resource Center (Page 2/4)".