Texas Instruments TMS9918

VDP TMS9918A
VDP TMS9918A
VDP TMS9928A

The TMS9918 is a Video Display Controller (VDC) manufactured by Texas Instruments in the late 1970s and 1980s. It was the controller used in the Texas Instruments TI-99/4, most MSX computers and the ColecoVision games console. Modified versions were used in the Sega Master System and a variety of arcade games.

General Information

The TMS9918 was used in systems such as ColecoVision and CreatiVision (a Japanese variant), Memotech MTX, MSX, Sega SG-1000/SC-3000, Spectravideo, Sord M5, Tatung Einstein, Texas Instruments TI-99/4, Casio PV-2000 and Tomy Tutor/Pyuuta. Modified versions with additional display modes and registers were used in the Sega Master System, Sega Game Gear, and the Mega Drive. (Note that the Mega Drive VDP cannot access any of the TMS9918 display modes discussed below.)

The TMS9918 has two separate and independent graphic types that do not interact with each other.

Characters (Tiles): Tiles are 8x8 pixels in size, and can only be placed on 8-pixel boundaries. Tiles appear underneath sprites. Several screen modes are available which change various characteristics of the background tiles (tiles are 6x8 in one mode).

Sprites: Sprites are either 8x8 or 16x16 pixels in size, and can be placed anywhere. Sprites appear on top of tiles. Sprites are always single color, and up to 32 can be displayed at once (with restrictions).

Product Family

There are several variants called TMS9918, TMS9918A, TMS9928A and TMS9929A, where the 'A' indicates a second version of the chip which added new features, most prominently the addition of a bitmap mode (Graphic II). The non-A version 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 60Hz video signal, while the TMS9929A outputs 50Hz. 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 YPbPr, more precisely the Y, R-Y and B-Y colour differences (luminance and colour difference signals). The need for the latter was predominant in the 50Hz 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 and 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.

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 a different mapping of the 16k × 8 bit block of video memory is supported. Otherwise the chips are completely identical to the TMS9918A, TMS9928A and TMS9929A respectively.

All of the ICs in this family are usually referred to by the TMS9918 name, sometimes with an 'A' postfix.

Texas Instruments TMS9918 Product Family Summary
Chip Variant Video Out Video In Video Frequency Mode 2 Support
9918 Composite Composite 60Hz No
9918A / 9118 Composite Composite 60Hz Yes
9928A / 9128 Luminance and Color Difference (None) 60Hz Yes
9929A / 9129 Luminance and Color Difference (None) 50Hz Yes

Clones and Successors

Texas Instruments' TMS9918A was succeeded by Yamaha's V9938, which added additional bitmap modes, more colorful sprites, a vertical scroll register and a customizable palette. The V9938 was used in a third-party upgrade to the TI-99/4A — the Geneve 9640 'computer-on-a-card' and the MSX2 standard of computers. The V9938, in turn, was succeeded by the V9958, which added some additional high-colour modes and a horizontal scroll register. These chips were used in the "TIM" upgrade card for the TI-99/4A, as well as on the MSX2+/turboR systems, although rumor has it that the V9958 was also used in a generation of the Photo Play arcades. Yamaha also produced a V9990, which is considered the follow-up of the V9958 by some, but it is not backwards compatible.

Toshiba made a clone called the T6950 and does not support the undocumented pattern / colour table masking feature in graphics 2 mode.[1] 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.

Interfaces

Video RAM

The VDC 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 VDC 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 VDC's control port to the VDC's internal address register. Next, the CPU performs the actual write or read on the VDC'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.

Screen Modes

The screen mode determines the properties and layout of the background characters, or tiles, on the screen.

Documented

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

Mode 0 (Text): 40×24 characters on screen, pulled from 1 character set of 256 6x8 characters. The entire character set has a 2-color limitation. This mode doesn't support sprites.

Mode 1 (Graphic 1): 32×24 characters on screen, pulled from 1 character set of 256 8x8 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): 32×24 characters on screen, pulled from 3 character sets of 256 8x8 characters each. 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): 64×48 'pixels' on screen. Pixels are actually 4x4 in size, although each one can have its own color, hence the name. This mode is very blocky, and rarely used.

Undocumented

There are three screen mode bits (for a total of eight combinations / modes). However, TI only documented the four modes listed above, leaving the possibility of four other modes. While two of these modes produce only static images, the other two produce useful results.

Furthermore, when in mode 2, the lower bits of the color and pattern table address bits act as mask bits rather than address bits.[2]

Graphic 2 + Graphic 1: This mode is commonly referred to as half-bitmap mode. Texas Instruments actually documented this "undocumented" screen mode in their manual titled "Video Display Processors Programmers Guide SPPU004". In section 8.4.2, Playing Games with VRAM Addressing, 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 actually a misnomer. However, because this manual was not widely known, this mode is generally considered to be one of the undocumented modes.

Graphic 2 + Text: 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). The address mask bits can be used to further reduce the size.

Graphic 2 + Multicolor: This mode is more of a novelty, as it offers nothing beyond what the standard Multicolor mode can already do. The address mask bits can be used to further reduce the size.

Sprites

In modes 1, 2, and 3, the VDC 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 VDC. Instead, in practice, the CPU will pick up on the VDC's 'vertical interrupt' - a standard VDC 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 VDC 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. Note that unlike the Atari's chips (TIA in the 2600 and CTIA/GTIA in the 8-bit computers) and the Commodore 64's VIC-II, the VDC does not tell the program which two sprites have collided, just that a collision has occurred.

Colors

The TMS9918 has a fixed 16-color palette, composed of 15 displayed colors and a "transparent" color. When "transparent" is used in sprites, it will show the background. When "transparent" is used in the background, it will show the external video signal.

Screen mode 2 detail

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 32x24 bytes would have to be moved to fill and scroll the entire screen. Games on other home computers such as the Commodore 64 also worked on a character basis. The graphics can be drawn such that the 8×8 pixel borders are not too obvious, an art where Konami was particularly well known for their excellence.

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

In comparison, the MOS Technology VIC-II used in the Commodore 64 limited programmers to 4 colors per 4×8 fat-pixel area. This meant there was less local color pressure, but more global color pressure: while three of the 4 colors could be freely picked out of palette of 16, the remaining fourth was a universal background color.

The TMS9918 does not have any scroll registers. Scrolling must be done in software.

Tradeoffs used in games

Some games tried to get around the 8 pixel scroll limitation, by scrolling the character set itself. Parsec (TI-99/4A) does this.

Circus Charlie (MSX) scrolled horizontally, and hence bumped into the maximum of 2 colors per 8×1 area limit. The graphics were "monochrome-ish" and there were some glitches halfheartedly covered by sprites.

Pippols (MSX) scrolled vertically. Because this isn't affected by the 8×1 area limit, the player character could walk along smoothly scrolling colorful flowers and other such graphical flourishes. However there are not many distinct objects onscreen, because the character set is cut down by factor 8. Pippols seems to be even below that limit by some factor.

When moving at full speed in Road Fighter (MSX, vertically scrolling racing game), the screen moves 8 pixels each frame. This results in a smooth scroller in spite of the 8 pixel jumps. For many games this scrolling speed is not feasible, though.

In Knightmare (MSX), the scene scrolls vertically so slowly that the 8 pixel jump doesn't disturb much. Zanac scrolls vertically fairly fast, but, due to the soft backgrounds with which you never collide, it is a minor issue. It is most problematic in Nemesis ("R-Type style" horizontal space shooter).

Specifications

See also

References

External links

This article is issued from Wikipedia - version of the Thursday, May 05, 2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.