The TMS9918 Video Display Processor (VDP) was used in systems like MSX, Coleco Vision, TI-99 and Sega SG-1000/SC-3000. Modified versions with addidional display modes and registers were used in the Sega Master System, Sega Game Gear, and Sega Genesis. Note that the Genesis VDP cannot access any of the TMS9918 display modes discussed below.
There are several variants called TMS9918A, TMS9928A and TMS9929A, where the 'A' indicates a second version of the chip which added new features, most prominently the addition of the Graphic II mode. The non-A version was only used in the TI-99/4; the TI-99/4A and the other computers had the A version VDP. The TMS9918A and TMS9928A output a 60Hz video signal, while the TMS9929A outputs 50Hz video. The difference between the TMS9918A and TMS9928A is that the '1' version outputs NTSC composite, while the '2' versions (including TMS9929A) output YUV (luminance and colour difference signals). The need for the latter was predominant in the 50Hz world, like Europe, due to the plethora of different video signals, like PAL and SECAM. Rather output YUV and encode it to PAL or SECAM in the RF modulator, than try and have a different machine for every country. All these chips are usually generically referred to as TMS9918 (sometimes with an A postfix).
The TMS9918A was succeeded by the Yamaha V9938, which added 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'. The V9938 in turn was succeeded by the V9958, which added some high colour modes and a horizontal scroll register. These chips were only used on the MSX 2 and MSX 2+/turboR systems, although rumor says 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. A graphic chip extension utilizing the V9990 exists for the MSX in the form of the 'Graphics9000' cartridge by Sunrise.
The TMS9918 has its own 16kB of video memory, outside the address space of the CPU. This memory cannot be mapped onto the CPU's space, as there is no way for the VDP to relinquish control of its bus to the CPU. A separate addressing space means that the CPU has to write a two-byte command word to the VDP's control port to set the address register, but it also means that the VDP doesn't slow down the main processor when it reads data out of its memory, and since the memory is not mapped onto the CPU's addressing space, there is more memory available for other hardware.
Data is transferred from the CPU to VDP RAM through port writes. As a byte is written, the TMS9918 incerments its internal address register, so that the CPU can quickly write a block of data. Writes to a different port can set various internal registers.
There are 4 different screen modes available in the TMS9918A (as mentioned before, the TMS9918 lacks mode Graphic II):
Mode 0 (Text): 40x24 characters monochrome. As the display is 256 pixels width, the character set is only 6 pixels wide. This mode doesn't support sprites, nor a separate border color setting.
Mode 1 (Graphic 1): 32x24 characters (256x192 bitmap), where for each 8 characters in the character set the foreground and background color can be set. The chars "0"-"7" for example all have the same attributes.
Mode 2 (Graphic 2): 32x24 characters (256x192 bitmap), with a 2-color limitation for each 8 pixel wide line inside a character.
Mode 3 (Multicolor): 64x48 mode, very blocky and rarely used. Each 'pixel' can have its own color defined though, hence the name. Its sprites still have the same resolution as in screen modes 1 and 2.
The TMS9918 has a 16 color palette, which is hardwired. e.g. color 4 is always dark blue.
In modes 1, 2, and 3, the VDP can manipulate sprites. There can be 32 monochrome sprites of either 8x8 or 16x16 pixels on screen, each of which can have its own color. There can be no more than 4 sprites on a single scanline; any additional sprites are dropped. Sprites with a higher priority are drawn first. 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.
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 and act upon it. Note that the VDP cannot tell the program which two sprites have collided.
Screen mode 2 detailEdit
Technically, mode 2 is a character mode with a colorful character set. The screen is vertically divided into three 256x64 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 to fill/scroll the entire screen, only 32x24 bytes had to be moved. Games on other home computers such as the Commodore 64 also worked on a character basis. The graphics have to be drawn such that the 8x8 pixel borders are not too obvious, an art where Konami was particularly well known for their excellence.
This is the TMS9918 screen mode 2 challenge: every 8x1 pixel area has two colors, foreground and background. They may be freely picked out of the 16 color palette. But within each 8x1 pixel area, only two different colors can exist. When manipulating the screen in BASIC with the LINE command, one easily could exceed the limit of max 2 colors per 8x1 area and end up with "color spill".
In comparison, the Commodore 64 limit was 4 colors per 4x8 fat-pixel area. This meant that there was less local color pressure, but more global color pressure: only three of the 4 colors actually could be freely picked out of 16, the other color had to be the same over the entire screen. That color could be redefined every scanline for various results.
The TMS9918 does not have any scroll registers. Scrolling must be done in software.
Tradeoffs used in gamesEdit
Some games tried to get around the 8 pixel scroll limitation, by scrolling the character set itself. This was too slow to be feasible, so the game filled the character set with 8 different versions of a single character.
Circus Charlie (MSX) scrolled horizontally, and hence bumped into the maximum of 2 colors per 8x1 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 8x1 area limit, the player character could walk along smoothly scrolling colorful flowers and other such graphical fourishes. However there aren't 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. A creative approach could be seen in Ghost'n'Goblins (Schneider/Amstrad CPC): as the player character walks near the border, the scene scrolls quickly (8 pixels/frame) until he is near the other side of the border. Then he could walk for a while with no scrolling at all.
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 which you never collide with it is a minor issue. It is most problematic in Nemesis ("R-Type style" horizontal space shooter). On the other hand, the Nemesis 2 backgrounds are really of "16 bit" beauty.
- Video RAM: 16 kB
- Text modes: 40 x 24 and 32 x 24
- Resolution: 256 x 192 (16 colours)
- Sprites: 32, 1 colour, max 4 per horizontal line