HARDWARE ManualVDP1 User's Manual
BackForward
VDP1 User's Manual / Chapter 6 Command Table

■ Color mode

Color mode bit: color mode bit, bits 5-3
Specifies the number of colors and the representation method of the color to draw the sprite. Only valid for sprites. For non-texture, set the color mode to 000B. Non-texture specifies the color with non-texture color.
There are three ways to specify the color mode: color bank mode, which is specified by the palette code and color bank, lookup table mode, which uses a color lookup table, and RGB mode, which directly specifies the brightness.
In the color bank mode, you can select from 16, 64, 128, and 256 colors depending on the number of bits of pixel data. In the lookup table mode, you can draw 16 colors, and in the RGB mode, you can draw 32768 colors.
The contents of the color mode bits are as follows:

 Color mode
 mode
 Contents
 Number of bits per pixel
 Bit 5
 Four
 3
 Number of colors
 Mode name
0 0 0 0
 16 colors
 Color bank mode
 4bit
0 0 1 1
 16 colors
 Lookup table mode
 4bit
0 1 0 2
 64 colors
 Color bank mode
 8bit
0 1 1 3
 128 colors
 Color bank mode
 8bit
1 0 0 Four
 256 colors
 Color bank mode
 8bit
1 0 1 Five
 32768 colors
 RGB mode
 16bit
 Other than those above
 Setting prohibited (Please do not set)

Character pattern of each mode
Character patterns are stored in VRAM in each mode. Take 8 pixels horizontally and 1 pixel vertically as an example.

Mode 0
16 color bank mode. Colors are represented by palette codes and color banks.
1 pixel is represented by 4 bits. You can draw 16 colors. 4 bytes are required to represent 8 pixels. There is 2 pixels of data in 1Byte, and when it is not flipped horizontally, the upper 4 bits represent the left pixel and the lower 4 bits represent the right pixel.
The palette code is represented by 4 bits, and the upper 12 bits are added with a color bank from the color bank word (command table start address + 06H) and written to the frame buffer as 16-bit data.
At 8bit / pixel (when frame buffer rotation or high resolution), the lower 8 bits of 16bit are written to the frame buffer. The upper 8 bits are discarded.
Since the drawing pixel data is a color bank code, color calculation is not possible.

  Bits 15 12 11 8 7 4 3 0 
┌────────┬────────┬────────┬────────┐
+ 00H │ pixel 0 pixel 1 pixel 2 pixel 3 │
├────────┼────────┼────────┼────────┤
+ 02H │ Pixel 4 Pixel 5 Pixel 6 Pixel 7 │
└────────┴────────┴────────┴────────┘

Mode 1
Look-up table mode using a color lookup table.
1 pixel is represented by 4 bits. 16 colors can be drawn. The character data is the same as mode 0.
The data of one color from the 16 colors of 16 bits stored in the color lookup table is selected by 4 bits and written to the frame buffer. At 8bit / pixel (when frame buffer rotation or high resolution), the lower 8 bits of 16bit are written to the frame buffer.
Writes the address of the color lookup table to the lookup table address (command table start address + 06H, shared with the color bank word). The color code of the lookup table can be specified by either the color bank code or the RGB code. However, RGB code is prohibited at 8bit / pixel.

Figure 6.11 Drawing example of modes 0 and 1
In the case of an original picture with 8 pixels in width 
┌───────┬───────┐
+ 00H → │ 0 1 2 3 4 5 6 7 │ ← + 02H
├───────┼───────┤
+ 04H → │ 8 9 A B C D E F │ ← + 06H
├───────┼───────┤
│ :: │
│ :: │

Mode 2, mode 3, mode 4
Mode 2 is a color bank mode with 64 colors, mode 3 with 128 colors, and mode 4 with 256 colors. Colors are represented by palette codes and color banks.
1 pixel is represented by 8 bits. You can draw 64 colors, 128 colors, and 256 colors, respectively. 8 bytes are required to represent 8 pixels.
The palette code is represented by 6bit, 7bit, and 8bit, and the upper 10bit, 9bit, and 8bit are added with a color bank from the color bank word (command table start address + 06H) and written to the frame buffer as 16-bit data. In mode 2 and mode 3, the upper 2 bits and 1 bit are ignored, respectively. At 8bit / pixel (when frame buffer rotation or high resolution), the lower 8 bits of 16bit are written to the frame buffer.
Since the drawing pixel data is a color bank code, color calculation is not possible.

  Bit 15 8 70 
┌─────────────────┬─────────────────┐
+ 00H │ Pixel 0 Pixel 1 │
├─────────────────┼─────────────────┤
+ 02H │ Pixel 2 Pixel 3 │
├─────────────────┼─────────────────┤
+ 04H │ Pixel 4 Pixel 5 │
├─────────────────┼─────────────────┤
+ 06H │ Pixel 6 Pixel 7 │
├─────────────────┼─────────────────┤
│ :: │

Figure 6.12 Drawing example of modes 2, 3 and 4
In the case of an original picture with 8 pixels in width 
┌───┬───┬───┬───┐
+ 00H → │ 0 1 │ 2 3 │ 4 5 │ 6 7 │ ← + 06H
├───┼───┼───┼───┤
+ 08H → │ 8 9 │ AB │ CD │ EF │ ← + 0EH
├───┼───┼───┼───┤
│: │: │: │: │
│: │: │: │: │

Mode 5
RGB mode with 32768 colors. Colors are represented by the brightness of each RGB (red, green, and blue). 1 pixel is represented by 16 bits. You can draw 32768 colors. 16 bytes are required to represent 8 pixels.
The RGB code is MSB 1bit (value is 1), which represents the RGB code, and RGB, which represents the brightness in 5 bits. The brightness of each RGB is from 00H to 1FH. The closer it is to 00H, the darker it becomes, and the closer it gets to 1FH, the brighter it becomes. When all RGB are 00H, it becomes 8000H and represents black, and when all RGB are 1FH, it becomes FFFFH and represents white.
As for the RGB code, 16 bits are written to the frame buffer as it is. This mode cannot be used at 8bit / pixel (frame buffer rotation or high resolution).
RGB code can perform color calculation.

  Bit 15 8 70 
┌─────────────────┬─────────────────┐
+ 00H │ Pixel 0 (upper byte) Pixel 0 (lower byte) │
├─────────────────┼─────────────────┤
+ 02H │ Pixel 1 (upper byte) Pixel 1 (lower byte) │
├─────────────────┼─────────────────┤
+ 04H │ Pixel 2 (upper byte) Pixel 2 (lower byte) │
├─────────────────┼─────────────────┤
+ 06H │ Pixel 3 (upper byte) Pixel 3 (lower byte) │
├─────────────────┼─────────────────┤
+ 08H │ Pixel 4 (upper byte) Pixel 4 (lower byte) │
├─────────────────┼─────────────────┤
+ 0AH │ Pixel 5 (upper byte) Pixel 5 (lower byte) │
├─────────────────┼─────────────────┤
+ 0CH │ Pixel 6 (upper byte) Pixel 6 (lower byte) │
├─────────────────┼─────────────────┤
│ :: │

Figure 6.13 RGB code format
MSB LSB
┌─┬─────────┬─────────┬─────────┐
│ │ B │ G │ R │
│ 1 ├─┬─┬─┬─┬─┼─┬─┬─┬─┬─┼─┬─┬─┬─┬─┤
│ │ 4 │ 3 │ 2 │ 1 │ 0 │ 4 │ 3 │ 2 │ 1 │ 0 │ 4 │ 3 │ 2 │ 1 │ 0 │
└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
[Note] MBS is "1"

Table 6.2 Pixel data
 Pixel data
 Drawing data
 0000H
 Transparent color code
 0001H
:
7FFEH
 Setting prohibited (Do not set in RGB mode)
(Palette bank code)
 7FFEH
 End code
 8000H
:
FFFFH
 RGB code

Figure 6.14 Mode 5 drawing example
In the case of an original picture with 8 pixels in width 
┌─┬─┬─┬─┬─┬─┬─┬─┐
+ 00H → │ 0 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ ← + 0EH
├─┼─┼─┼─┼─┼─┼─┼─┤
+ 10H → │ 8 │ 9 │ A │ B │ C │ D │ E │ F │ ← + 1EH
├─┼─┼─┼─┼─┼─┼─┼─┤
│: │: │: │: │: │: │: │: │
│: │: │: │: │: │: │: │: │


BackForward
HARDWARE ManualVDP1 User's Manual
Copyright SEGA ENTERPRISES, LTD., 1997