General Notice When using this document, keep the following in mind: ntial 1. This document is confidential. By accepting this document you acknowledge that you are bound by the terms set forth in the non-disclosure and confidentiality agreement signed separately and /in the possession of SEGA. If you have not signed such a non-disclosure agreement, please contact SEGA immediately and return this document to SEGA. 2. This document may include technical inaccuracies or typographical errors. Changes are periodi- cally made to the information herein; these changes will be incorporated in new versions of the program(s) described in this document at any time. de document. SEGA may make improvements and/or changes in the product(s) and/or the 3. No one is permitted to reproduce or duplicate, in any form, the whole or part of this document without SEGA’S written permission. Request for copies of this document and for technical information about SEGA products must be made to your authorized SEGA Technical Services representative. nfi 4. No license is granted by implication or otherwise under any patents, copyrights, trademarks, or other intellectual property rights of SEGA Enterprises, Ltd., SEGA of America, Inc., or any third party. describe herein. Co 5. Software, circuitry, and other examples described herein are meant merely to indicate the character- istics and performance of SEGA’s products. SEGA assumes no responsibility for any intellectual property claims or other problems that may result from applications based on the examples 6. It is possible that this document may contain reference to, or information about, SEGA products (development hardware/software) or services that are not provided in countries other than Japan. Such references/information must not be construed to mean that SEGA intends to provide such SEGA products or services in countries other than Japan. Any reference of a SEGA licensed prod- GA uct/program in this document is not intended to state or simply that you can use only SEGA’s licensed products/programs. Any functionally equivalent hardware/software can be used instead. 7. SEGA will not be held responsible for any damage to the user that may result from accidents or any other reasons during operation of the user’s equipment, or programs according to this document. NOTE: A reader's comment/correction form is provided with this document. Please address comments to : SE SEGA of America, Inc., Developer Technical Support (att. Evelyn Merritt) 150 Shoreline Drive, Redwood City, CA 94065 SEGA may use or distribute whatever information you supply in any way it believes appropriate without incurring any obligation to you. (6/27/95- 002) TM ntial de nfi Co GA VDP1 User's Manual SE Doc. # ST-013-R3-061694 © 1994-95 SEGA. All Rights Reserved. READER CORRECTION/COMMENT SHEET Keep us updated! nti If you should come across any incorrect or outdated information while reading through the attached document, or come up with any questions or comments, please let us know so that we can make the al required changes in subsequent revisions. Simply fill out all information below and return this form to the Developer Technical Support Manager at the address below. Please make more copies of this form if more space is needed. Thank you. General Information: Your Name Phone Document number Document name Corrections: Chpt. pg. # ST-013-R3-061694 VDP1 User's Manual Correction de Date nfi Co GA Questions/comments: SE Fax: Where to send your corrections: (415) 802-1717 Attn: Evelyn Merritt, Developer Technical Support Mail: SEGA OF AMERICA Attn: Evelyn Merritt, Developer Technical Support 150 Shoreline Dr. Redwood City, CA 94065 REFERENCES with the assistance of the technical literature listed below. nti In translating/creating this document, certain technical words and/or phrases were interpreted 1. Dictionary of Science and Engineering, 350,000 words, 3rd Edition al Inter Press Tokyo, Japan 1990 2. Computer Dictionary Kyoritsu Publishing Co., LTD. Tokyo, Japan 1978 de 3. IBM Dictionary of Computing McGraw-Hill, Inc. New York, New York 1994 nfi Co GA SE Revision History Revision 7.1 December 6, 1993 First Edition • Minor corrections • Total 155 pages February 20, 1994 ntial • Added even/odd coordinate selection bit (EOS) to frame buffer change mode register (FBCR) • Added high speed shrink (HSS) and pre-clipping disable (Pclp) to plot mode word (+04H) in the command table. • Total 163 pages de nfi Co GA SE Introduction defines draw data and performs drawing. nti This manual explains the functions of the VDP1 and how they are used. The VDP1 primarily Definitions al The terms used in this manual are defined as follows: VDP1 de VDP1 is an integrated circuit (IC) that controls drawing. The VRAM and frame buffer (both DRAM) are connected to the VDP1. The CPU writes draw commands to VRAM via the VDP1. The VDP1 reads draw commands from VRAM and writes (draws) draw data to the frame buffer, and later transfers this data to a display monitor. The frame buffer is a bit-mapped memory, and any data written to it has a 1-to-1 correspon- values in these registers. nfi dence with the contents of the display screen. Therefore, the frame buffer is a map of the dis- play screen. There are system registers in the VDP1 and screen display is controlled by setting Display regular TV. Co Televisions are commonly used as display devices. The standard used in Japan and in the United States is NTSC. PAL system TVs are used in Europe. Hi-res is a high resolution mode that doubles the horizontal resolution. 31KC is a system that doubles the horizontal frequency of 15KC in order to raise the vertical resolution. Hi-vision (HDTV), or so-called “high-definition” TV, has twice the horizontal and vertical resolution of A TV display is comprised of fields and frames. A field is the time it takes a scanning line to scan one screen. In the NTSC system, this is 1/60th of a second and in the PAL system, 1/50th system. GA of a second. A frame is the time it takes from one change of the frame buffer to the next change. When the change mode of the frame buffer is in a one cycle mode, one frame is equal to one field. When the frame buffer is changed every two fields such as in single density inter- lace, one frame comprises two fields. When the frame buffer is changed only once a second in the manual mode, one frame comprises 60 fields in the NTSC system, and 50 fields in the PAL SE (1) Before each frame is drawn, the frame buffer is automatically erased. Erase is performed by writing (filling) a code specified in a register to the frame buffer. This operation is referred to as erase/write. Access nti Reading and writing of data by the CPU and VDP1 in VRAM, the system registers, and frame al buffers are referred to as access. When two or more devices attempt access at the same time, the accesses are arbitrated, with writes normally given priority over reads. When a DMA controller is used, access of VRAM can be performed continuously and rapidly by burst transfer. However, do not perform burst access of registers. Data Commands de A bit is the smallest unit of data which is represented by “0” or “1.” A combination of 8 bits is called a byte, and 16 bits (or 2 bytes) is called a word. When a byte is divided into its upper 4 bits and its lower 4 bits, each is referred to as a nibble. Commands include draw commands, clipping coordinate set commands, and local coordinate nates. nfi set commands. Clipping is the removal of graphics outside a set area. Local coordinates change the drawing position using the coordinates specified by the draw command as local coordi- Commands are defined in VRAM as command tables. In addition to the command table, there are the character pattern table, the Gouraud shading table, and the color lookup table. Co Tables are defined by addresses with an 8H-byte boundary or a 20H-byte boundary, and are stored in VRAM. A boundary is the splitting of addresses at the 8H or 20H boundary so there is no remainder. Registers have 2H-byte (one = word) boundaries. The VDP1 fetches command tables successively and draws according to these commands. Fetch is the act of reading from VRAM in order to process commands. GA SE (2) Parts Objects drawn by using the draw command are called parts. Parts are divided into textured and non-textured parts. Textured parts are called sprites; non-textured parts include polygons, polylines, and lines. nti Sprites are characters and the color codes of these characters are defined in VRAM as a charac- al ter pattern table. Polygons are filled squares, polylines are non-filled squares, and lines are straight lines that connect two points. The VDP1 processes draw commands in VRAM and draws parts in the frame buffer 1 pixel at a time. The color resolution of the data in the frame buffer is in 8 or 16 bits per pixel (bpp). Color palette. de The RGB code method and the color bank method, which uses palette codes and color banks are used to express color. The RGB code method specifies the luminance of each of the colors: red (R), green (G), and blue (B), in 5 bits. In the color bank method, the VDP2 color palette is selected from a color bank, and a palette code is used to select the desired color from this RGB or color bank codes. nfi Sprite colors can be specified using the color lookup table method. The color is selected from among the 16 colors defined in the color lookup table. The color code can be specified using Color Calculation Co Color calculation is a special function of the VDP1. Gouraud shading is an example of color calculation. The luminance of the RGB code of a particular part can be changed using the RGB codes of four points defined in the Gouraud shading table. GA SE (3) Notations Used in this Manual The notations used in this manual are as follows: Binary and Hexadecimal Numbers ntial Binary numbers are designated with a “B” at the end of the number— for example, 100B. Hexadecimal numbers are designated with an “H” at the end of the number— for example, 00H, FFH. Units 1 Kbyte is equal to 1024 bytes. 1 Mbit is 1,048,576 bits. MSB, LSB de In the configuration of bytes and words, the left is the most significant bit (MSB) and the right is the least significant bit (LSB). Undefined Bits nfi Bits that are not defined in the command table or the system registers are indicated by a hy- phen “-”. Write 0B to undefined bits in the system registers. Write “0” or “1” to undefined bits in command tables. If an entire word is unused, fill with either "0" or "1". When a word is partially used, fill the remaining unused bits with "0". Addresses Co The addresses shown in this manual are relative VDP1 addresses . VDP1 is at the absolute address 5C00000H of the system. Add 5C00000H to a relative address to determine the absolute address. For example, the abso- lute address 000000H in VRAM is address 5C00000H, and the absolute address 180000H in the system registers becomes 5D80000H. GA SE (4) Table of Contents Introduction nti Definitions .................................................................................................................................. (1) Notations Used in this Manual .................................................................................................. (4) al Contents ...................................................................................................................... (5) List of Figures ............................................................................................................................ (8) List of Tables............................................................................................................................ (10) Chapter 1 Functions of the VDP1 ............................................................................. 1 1.1 VDP1 .............................................................................................................. 2 de System Configuration ............................................................................ 2 Functions of the VDP1 .......................................................................... 3 Parts ..................................................................................................... 4 Textured Parts ....................................................................................... 5 1.2 nfi Non-Textured Parts ............................................................................. 10 Color ................................................................................................... 12 Screen Modes.................................................................................................. 14 Screen Modes and Display Areas ....................................................... 14 Rotated Reading of Frame Buffer ....................................................... 15 Chapter 2 Co Address Map ............................................................................................................ 17 2.1 Address Map .................................................................................................... 18 VRAM ................................................................................................. 19 Frame Buffer ....................................................................................... 20 System Registers ................................................................................ 23 2.2 Tables in VRAM ............................................................................................... 24 GA Command Table .................................................................................. 25 Color Lookup Table ............................................................................. 26 Gouraud Shading Table ...................................................................... 26 Character Pattern Table ...................................................................... 26 Chapter 3 Processing Flow .................................................................................... 27 3.1 Draw Procedure Flow ...................................................................................... 28 SE 3.2 Command Table Flow ...................................................................................... 30 3.3 Table Referencing ............................................................................................ 31 (5) Chapter 4 System Registers ................................................................................... 33 4.1 TV Mode Selection Register ............................................................................ 36 4.2 4.3 4.4 nti Frame Buffer Change Mode Register .............................................................. 38 Plot Trigger Register ........................................................................................ 45 Erase/Write ...................................................................................................... 46 al Erase/Write Data Register .................................................................. 46 Erase/Write Upper-Left Coordinate Register ...................................... 47 Erase/Write Upper-Right Coordinate Register ................................... 47 4.5 Draw Forced Termination Register .................................................................. 51 4.6 Transfer End Status Register ........................................................................... 52 Chapter 5 4.7 4.8 4.9 de Last Operation Command Address Register ................................................... 54 Current Operation Command Address Register ............................................. 55 Mode Status Register ...................................................................................... 57 Tables ......................................................................................................................... 59 5.1 Character Pattern Tables ................................................................................. 60 Chapter 6 5.2 5.3 5.4 nfi Color Lookup Tables ........................................................................................ 62 Gouraud Shading Table ................................................................................... 64 Command Tables ............................................................................................. 66 Command Tables ................................................................................... 69 6.1 Co CMDCTRL (Control Words) ............................................................................. 70 Commands ......................................................................................... 71 Jump Mode ......................................................................................... 72 Zoom Point ......................................................................................... 73 Character Read Direction ................................................................... 77 6.2 CMDLINK (Link Specification) ......................................................................... 78 6.3 CMDPMOD (Draw Mode Word) ....................................................................... 79 GA High Speed Shrink .............................................................................. 81 Pre-Clipping Disable ........................................................................... 83 User Clipping Enable .......................................................................... 84 User Clipping Mode ............................................................................ 84 Mesh Enable ....................................................................................... 85 End Code Disable ............................................................................... 86 SE Trasparent Pixel Disable ..................................................................... 88 Color Mode ......................................................................................... 89 Color Calculation................................................................................. 93 MSB ON .............................................................................................. 97 (6) 6.4 CMDCOLR (Color Control Word) ..................................................................... 98 Color Bank .......................................................................................... 99 6.5 6.6 6.7 nti Color Lookup Table ........................................................................... 101 Non-Textured Color ........................................................................... 102 CMDSRCA (Character Address) .................................................................... 103 al CMDSIZE (Character Size)............................................................................ 104 CMDXA~CMDYD (Vertex Coordinate Data) ................................................. 105 6.8 CMDGRDA (Gouraud Shading Table) ........................................................... 106 Chapter 7 Commands ........................................................................................... 107 7.1 System Clipping Coordinate Set Command .................................................. 110 7.2 7.3 de System Clipping ................................................................................ 111 User Clipping Coordinate Set Command ....................................................... 112 User Clipping .................................................................................... 113 Local Coordinate Set Command .................................................................... 116 Local Coordinates ............................................................................. 117 7.4 7.5 nfi Normal Sprite Draw Command ...................................................................... 118 Scaled Sprite Draw Command....................................................................... 120 Specification of Two Coordinate Vertices ......................................... 120 Specification of Fixed Point (Scaled Sprite Draw Command) .......... 122 7.6 7.7 7.8 7.9 7.10 Co Distorted Sprite Draw Command ................................................................... 124 Polygon Draw Command ............................................................................... 126 Polyline Draw Command ............................................................................... 128 Line Draw Command ..................................................................................... 130 Draw End Command ..................................................................................... 132 Chapter 8 Quick Reference ................................................................................... 133 8.1 System Registers ........................................................................................... 134 Chapter 9 GA 8.2 8.3 8.4 Tables ............................................................................................................ 140 Command Tables ........................................................................................... 142 Commands .................................................................................................... 151 Precautions for Use .............................................................................. 157 Index ................................................................................................................................................ 161 SE (7) List of Figures (Chapter 1 Functions of the VDP1) nti Figure 1.1 System Configuration ................................................................................................ 2 Figure 1.2 Normal Sprites ........................................................................................................... 5 al Figure 1.3 Scaled Sprites (Two Vertices Specified) .................................................................... 6 Figure 1.4 Scaled Sprites (Zoom Point Specified) ...................................................................... 7 Figure 1.5 Distorted Sprites ........................................................................................................ 8 Figure 1.6 Fill-In Processing ....................................................................................................... 9 Figure 1.7 Polygons.................................................................................................................. 10 (Chapter 2 de Figure 1.8 Polylines .................................................................................................................. 11 Figure 1.9 Line ......................................................................................................................... 11 Figure 1.10 Bit Configuration of Color Bank Method ................................................................ 12 Address Map) (Chapter 3 nfi Figure 2.1 Address Map ........................................................................................................... 18 Figure 2.2 Frame Buffer Plane ................................................................................................. 21 Processing Flow) (Chapter 4 Co Figure 3.1 Command Table Flow .............................................................................................. 30 Figure 3.2 Referencing of Tables .............................................................................................. 31 System Registers) Figure 4.1 Single Interlace and Double Interlace Display ......................................................... 43 Figure 4.2 Erase/Write Area ..................................................................................................... 48 Figure 4.3 Last Operation Command and Current Operation Command Address .................. 54 (Chapter 5 GA Tables) Figure 5.1 Examples of Character Pattern Tables ....................................................................61 Figure 5.2 Color Lookup Table .................................................................................................. 62 Figure 5.3 Relationship between Tables in Lookup Table System ........................................... 63 Figure 5.4 RGB Code Format ................................................................................................... 64 SE Figure 5.5 Command Table ...................................................................................................... 66 (8) (Chapter 6 Command Tables) Figure 6.1 Zoom Point .............................................................................................................. 73 nti Figure 6.2 Drawing Area ........................................................................................................... 75 Figure 6.3 Zoom Point and Drawing Area................................................................................. 76 Figure 6.4 Character Read Direction ........................................................................................ 77 al Figure 6.5 High Speed Shrink .................................................................................................. 82 Figure 6.6 Pre-Clipping ............................................................................................................ 83 Figure 6.7 Drawing Area ........................................................................................................... 84 Figure 6.8 Mesh Processing ..................................................................................................... 85 Figure 6.9 Mesh Processing of Lines and Polylines ................................................................. 85 de Figure 6.10 (a) End Code Processing (1 of 2) .......................................................................... 87 Figure 6.10 (b) End Code Processing (2 of 2) .......................................................................... 87 Figure 6.11 Example of Drawing in Modes 0 and 1 .................................................................. 90 Figure 6.12 Example of Drawing in Modes 2, 3, and 4 ............................................................. 91 Figure 6.13 RGB Code Format ................................................................................................. 92 Figure 6.16 MSB ON nfi Figure 6.14 Example of Drawing in Mode 5 .............................................................................. 92 Figure 6.15 Examples of Color Calculation .............................................................................. 96 ............................................................................................................ 97 Figure 6.17 Color Bank ............................................................................................................ 99 (Chapter 7 Co Figure 6.18 Color Lookup Table.............................................................................................. 101 Figure 6.19 CMDSIZE .......................................................................................................... 104 Commands) Figure 7.1 System Clipping .................................................................................................... 111 Figure 7.2 User Clipping Settings ........................................................................................... 114 Figure 7.3 User Clipping ......................................................................................................... 115 GA (Chapter 8 Quick Reference) Figure 8.1 Examples of Character Pattern Tables .................................................................. 140 Figure 8.2 Color Lookup Table................................................................................................ 140 Figure 8.3 Command Table .................................................................................................... 142 SE (9) List of Tables (Chapter 1 Functions of the VDP1) (Chapter 2 nti Table 1.1 Classification of Parts ................................................................................................. 4 Table 1.2 Screen Modes and Display Areas ............................................................................. 14 Address Map) al Table 2.1 System Registers ...................................................................................................... 23 Table 2.2 Tables in VRAM ........................................................................................................ 24 (Chapter 4 System Registers) de Table 4.1 System Registers ...................................................................................................... 34 Table 4.2 Screen Modes ........................................................................................................... 37 Table 4.3 (a) Example of Use of Frame Buffer Change Mode (Fixed at VBE = 0) ................... 41 Table 4.3 (b) Example of Use of Frame Buffer Change Mode (VBE Is Used) ......................... 42 Table 4.4 Number of Rasters and Number of Pixels ................................................................. 49 (Chapter 5 nfi Table 4.5 Number of Pixels that Can Be Used in V-Blank Erase (in Non-Interlace Display) .... 50 Tables) Table 5.1 Size of Character Pattern Tables .............................................................................. 60 Table 5.2 Gouraud Shading Table ............................................................................................ 64 (Chapter 6 Co Table 5.3 Relationship between Gouraud Shading Table Settings and Correction Values .. ... 65 Command Tables) Table 6.1 Commands Table 6.2 Pixel Data ............................................................................................................ 71 ............................................................................................................ 92 Table 6.3 CMDCOLR ............................................................................................................ 98 GA Table 6.4 Example of Relationship of Defined Data and Draw Data to Color Bank ............... 100 Table 6.5 Relationships between Settings and Drawn Pixels ................................................ 104 Table 6.6 Correspondence between Commands and CMDXA~CMDYD ............................... 105 (Chapter 7 Commands) Table 7.1 Commands .......................................................................................................... 109 SE (Chapter 8 Quick Reference) Table 8.1 Screen Modes ......................................................................................................... 134 Table 8.2 Gouraud Shading Table .......................................................................................... 141 Table 8.3 Commands .............................................................................................................. 145 Table 8.4 CMDCOLR .............................................................................................................. 149 Table 8.5 Relationships between Settings and Drawn Pixels ................................................ 149 Table 8.6 Correspondence between Commands and CMDXA~CMDYD ............................... 150 (10) Chapter 1 ntial Functions of the VDP1 de nfi Contents Co 1.1 VDP1 .............................................................................................. 2 GA System Configuration ........................................................... 2 Functions of the VDP1 ......................................................... 3 Parts ..................................................................................... 4 Textured Parts ....................................................................... 5 Non-textured Parts .............................................................. 10 Color ................................................................................... 12 SE 1.2 Screen Modes.................................................................................. 14 Screen Modes and Display Areas ...................................... 14 Rotated Reading of Frame Buffer ...................................... 15 VDP1 User's Manual 1 1.1 VDP1 System Configuration nti The VDP1 is a sprite drawing IC for the SEGA SATURN because the VDP1 uses a frame buffer, it is much faster, is characterized by an increased RAM capacity, and can display many more sprites (characters) compared to previous systems. A VRAM (4-Mbit DRAM) and a two-plane frame buffer (2-Mbit DRAM per screen) al are connected to the VDP1. The image data defined in VRAM by the CPU are output to the display device via the frame buffer. Draw data is sent from the CPU to the VDP1 via the system control IC and is written changed every frame. de in VRAM. Parts written in VRAM are drawn in the frame buffer in a 16- or 8-bit/ pixel form. The frame buffer data that is drawn is displayed on the display device via the priority circuit in the VDP2. The priority circuit prioritizes the scroll plane and the priority plane. The frame buffer has two screens, and draw and display are VRAM nfi The information that controls draws is set in the VDP1 system registers by the CPU via the system controller IC. The system registers control draws. Co (4 Mbit) VDP1 System Display CPU Controller System VDP2 Device IC Registers GA Frame Buffer (2 Mbit) Frame Buffer (2 Mbit) SE Figure 1.1 System Configuration 2 Functions of the VDP1 The functions of the VDP1 include the drawing of parts (characters and lines), speci- fication of colors, color calculation of Gouraud shading, specification of clipping Parts nti coordinates and local coordinates, and control of display by the frame buffer. Parts, color, and coordinates are controlled by the command table in VRAM, and display of the frame buffer is controlled by the system registers. The following graphics can be drawn as parts. al · Normal sprites · Scaled sprites (with zooming) · Distorted sprites (includes rotation) · Polygons (quadrangles) · Lines de · Polylines (quadrangles comprising four lines) Collectively, sprites are referred to as textured parts, and polygons, polylines, and lines are referred to as non-textured parts. Color nfi · The possible numbers of colors for each textured part are 16, 64, 128, 256, and 32,768. Special Functions · When RGB codes are used, color calculation of half-luminance, half-trans- Coordinate Control Co parency, Gouraud shading, and shadowing are possible. · Mesh (tiling). · System and user clipping settings are possible. · Local coordinates can be set during drawing. Frame Buffer Display Control · Enlargement, reduction, and rotation of the entire frame buffer screen. GA · Specification of the TV display mode. · Specification of the frame buffer change mode, the change trigger, and the plot trigger. · Specification of double interlace. · Specification of fill area and fill data during erase/write. · End status of transfer to the frame buffer as help information during pro- gram development. SE VDP1 User's Manual 3 Parts Parts are classified as shown in Table 1.1. Table 1.1 Classification of Parts Classification Textured parts Part name Normal sprites Scaled sprites Function Character, vertical, and horizontal inversion Character, vertical, and horizontal inversion, enlargement and reduction, stretching nti 1 vertex and direction of al readout How defined 2 vertices and direction of readout or zoom point, width and direction of readout Parts Distorted Character, vertical, and 4 vertices and direction of sprites horizontal inversion, readout enlargement and reduction, stretching, rotation, twisting Non- textured parts Polygons Polylines Lines Filled quadrangles Quadrangles Straight lines de 4 vertices 4 vertices Starting vertex and ending vertex nfi Co GA SE 4 Textured Parts Textured parts are called sprites. Sprites draw character patterns. Character patterns define pixel data as character pattern tables in VRAM. The size of the pixel data is twisted. nti determined by the color mode and the size of the characters. Sprites include normal sprites, scaled sprites, and distorted sprites. Normal sprites al can be inverted vertically and horizontally; scaled sprites can be inverted vertically and horizontally, enlarged and reduced, and stretched; and distorted sprites can be inverted vertically and horizontally, enlarged and reduced, stretched, rotated, and Normal Sprites The character pattern is drawn at a specified position. The coordinates of the upper- de left vertex at which the character pattern is drawn are specified. The character pat- tern is drawn from the specified coordinates to the right in the X direction and down in the Y direction. When vertical and horizontal inversion are specified for the read- out direction of the character pattern, the right side of the defined character pattern is drawn from the left and the bottom side is drawn from the top. perform 90° rotation. nfi Normal sprites cannot be rotated 90°. Specify the distorted sprite draw command to A B Original graphic Co Draw Vertex (A) Vertex (A) A B Normal A B Vertex (A) Vertex (A) B A Horizontal inversion A B Vertical Vertical & GA inversion horizontal inversion ... . Figure 1.2 Normal Sprites SE VDP1 User's Manual 5 Scaled Sprites The character pattern is drawn enlarged or reduced at a specified position. There are two methods by which the position and scaling can be specified. The coordinates of fied in another. nti the upper-left vertex and the lower-right vertex are specified in one method, while the zoom point coordinates and the horizontal and vertical display widths are speci- al Scaled sprites cannot be rotated 90°. Specify the distorted sprite draw command to perform 90° rotation. Specification of Coordinates of Two Vertices In this method, the coordinates of the upper-left and the lower-right vertices are specified. The draw direction (direction of drawing a character) is determined by the de positional relationship of the lower-right coordinate with respect to the upper-left coordinate. The character pattern is drawn from the upper-left coordinate toward the lower-right coordinate. When the value of X of the lower-right coordinate is smaller than the X value of the upper-left coordinate, the character pattern is in- verted horizontally, and when the Y value of the lower-right coordinate is smaller than the Y value of the upper-left coordinate, the character pattern is inverted verti- cally. nfi As with normal sprites, inversion can be specified by the read direction. However, when the coordinates and the direction of readout are both inverted vertically, the inversions cancel each other out and the character remains unchanged. A B Original graphic Draw Co Vertex (A) A B Normal Vertex (C) Vertex (C) Vertex (A) Vertical-horizontal reduction & horizontal inversion Vertex (C) Vertex (C) GA Vertex (A) Horizontal enlargement, vertical reduction & vertical inversion AB Vertical-horizontal Vertex (A) ... . enlargement & vertical- horizontal inversion Figure 1.3 Scaled Sprites (Two Vertices Specified) SE 6 Specification of Zoom Point Scaled sprites can be drawn by specifying the zoom point and display width. The zoom point of the character pattern, the draw coordinates of the zoom point, and the nti display width at which the character pattern is drawn are specified. The zoom point specifies which point on the character pattern is used as a stationary point for draw- ing. The point is selected from the left side, center, and right side in the horizontal al direction and from the top side, center, and bottom side in the vertical direction. The display width specifies the display width in the X direction and the Y direction. When vertical and horizontal inversions are specified for the character pattern readout direction, each character patter is drawn inverted vertically and horizontally with reference to each zoom point. The draw area differs depending on vertical or horizontal inversion. AB Zoom point AB de Zoom point A B Display width Original graphic Draw nfi Normal size Display width Vertical/horizontal reduction & horizontal inversion with zoom point at center. Display width Co Zoom point Horizontal enlargement, vertical reduction & Zoom point AB Display width Vertical/horizontal enlargement vertical inversion with & vertical/horizontal inverstion zoom point at upper right. with zoom point at right center. GA Figure 1.4 Scaled Sprites (Zoom Point Specified) SE VDP1 User's Manual 7 Distorted Sprites Draw a character pattern by specifying four coordinates. Specify the four draw coordinates corresponding to the four vertices of the character pattern. These four how they are specified. nti coordinates can assume any position relative to each other, and therefore the charac- ter pattern can be inverted, enlarged or reduced, rotated, or twisted, depending on al Distorted sprites are created by skewing the character pattern. At this time holes are filled to prevent the dropout of pixels. For this reason, there may be some pixels that are written twice, and therefore the results of half-transparent processing as well as other processing in color calculation cannot be guaranteed. Because drawing is done with lines, part of the character pattern may result outside de the graphic formed by linking the four vertices if it is twisted or rotated. nfi Co GA SE Figure 1.5 Distorted Sprites 8 Anti-aliasing Distorted sprites and polygons contain diagonal lines that may result in pixel drop- out (aliasing). When this happens, holes are anti-aliased as shown below. Copied color code ntial Indicates direction of drawing. Anti-aliasing de nfi Figure 1.6 Anti-aliasing Co GA SE VDP1 User's Manual 9 Non-Textured Parts Non-textured parts are different from textured parts in that they do not require an original picture, and VRAM is not frequently accessed from the VDP1. Polygons nti Draw a quadrangle by specifying four vertices and filling the enclosed area with a al single color. The four vertices can be specified as desired. The color is specified as a non-textured color. Polygons contain diagonal lines that may result in pixel dropout (aliasing). When this occurs, holes are anti-aliased. For this reason, some pixels may be written twice, and therefore the results of half-transparency processing as well as other color calculations cannot be guaranteed. Concave polygons can also be drawn. However, Vertex (A) Vertex (B) de fills may extend outside of the polygon since lines are used to fill the polygon. nfi Vertex (D) Vertex (A) Concave polygon Co Vertex(B) Vertex (C) Vertex (D) Vertex (C) GA Figure 1.7 Polygons SE 10 Polylines A quadrangle is drawn by connecting four lines. Specify four vertices, and lines and other color calculations cannot be guaranteed. nti connecting the vertices are drawn in order. Unlike polygons, the area enclosed by the four vertices cannot be filled. The four vertices can be specified as desired. Specify the color as non-textured color. Because four lines are drawn, the pixels near al the vertices are written twice. Therefore, the results of half-transparent processing Vertex (B) Vertex (A) de Vertex (C) Vertex (D) nfi Figure 1.8 Polylines Lines Co A line is drawn in a single color between two specified coordinates. Specify the color as a non-textured color. Vertex A GA Figure 1.9 Line Vertex B SE VDP1 User's Manual 11 Color The functions and special functions related to color are as follows. Gouraud shading, and shadowing is possible. nti • The number of colors per textured part unit is 16, 64, 128, 256, and 32,768. • In the RGB mode, color calculation of half-luminance, half-transparency, • Mesh (tiling). al The color bank and RGB code methods are used to express the colors of pixels drawn (written) in the frame buffer. The color capability of the color bank method is 16, 64, 128, or 256 colors and the RGB code method is 32,768 colors. Color Bank Method de The color bank method combines the color bank with the palette codes for 16, 64, 128, and 256 colors, and references the colors stored in the color RAM of the VDP2. A 16 color palette code requires four bits of memory. The upper 12 bits of the color bank is added to the palette to give a total of 16 bits which is written to the frame buffer. Graphics that use 64, 128, or 256 colors (8-bit graphics) require a total of eight bits of memory. Only the lower 6 bits and 7 bits are significant for 64 and 128 color the color bank are added. nfi graphics, respectively, while 256 colors use all 8 bits. The upper 10, 9, and 8 bits of The data written by the color bank method are divided into function bits as shown in Figure 1.10 and processed in the VDP2. (Refer to the VDP2 manual for more information.) MSB Co Color bank Palette code LSB Priority GA Color calculation Figure 1.10 Bit Configuration of Color Bank Method RGB Code Method The RGB code method represents colors using a 5-bit luminance for each of red, SE green, and blue (RGB) dot. The luminance of each of RGB is represented by 00H to 1FH. The closer the number is to 00H, less light is emitted from the RGB dots, the closer it is to 1FH, more light is emitted. Up to 32,768 colors can be formed by RGB codes. RGB codes are 16-bit data, and the most significant bit (MSB) is 1. 12 Part Colors The color bank method, the color lookup table method, or the RGB code method can such as polygons, polylines, and lines. nti be used to set the color of sprites. Set a non-textured color for each non-textured part Color Lookup Table al The color lookup table references the 4-bit graphic data to a 16-color lookup table and converts it to 16-bit data. Because the 16-bit data in the table are written as is to the frame buffer, there is no distinction between color bank codes and RGB codes for textured data. When read to the VDP2, the code is handled as a color bank code when the MSB of Non-textured Color de the 16-bit data is “0” and as an RGB code when the MSB is “1.” Non-textured color is handled as pixel data without the use of a color bank or color lookup table. 8 Bits/Pixel Color nfi When using high resolution or specifying a bit width of 8 bits/pixel for a rotated frame buffer, the graphics will be written to the frame buffer in 8 bits/pixel. When there are 8 bits/pixel, the lower 8 bits are written to the frame buffer when using a color lookup table or non-textured color. In either case, the lower 8 bits of the 16 bits are written to the frame buffer. This will be abbreviated as 8 bits/pixel (high resolu- tion or rotation 8). Co GA SE VDP1 User's Manual 13 1.2 Screen Modes Screen Modes and Display Areas nti Table 1.2 shows the screen modes and the coordinate values displayed in each. Table 1.2 Screen Modes and Display Areas Screen mode (pixels) Standard X range al High Y range resolution Non-interlace 320 H × 224 V 0≤X≤319 0≤X≤639 0≤Y≤223 Single interlace 320 H × 240 V 0≤X≤319 0≤X≤639 0≤Y≤239 NTSC, PAL 352 H × 224 V 0≤X≤351 0≤X≤703 0≤Y≤223 Double interlace NTSC, PAL Non-interlace 352 H × 240 V 320 H × 224 V 320 H × 240 V 352 H × 224 V 352 H × 240 V 320 H × 240 V de 0≤X≤351 0≤X≤319 0≤X≤319 0≤X≤351 0≤X≤351 0≤X≤319 0≤X≤703 0≤X≤639 0≤X≤639 0≤X≤703 0≤X≤703 — 0≤Y≤239 0≤Y≤447 0≤Y≤479 0≤Y≤447 0≤Y≤479 0≤Y≤239 31KC, HDTV H = Horizontal V = Vertical nfi 352 H × 240 V 0≤X≤351 • These are coordinate ranges and are not the sizes of the areas occupied in the frame buffer. For more information about the size of the frame buffer, see “Frame Buffer” in Section 2.1 Address Map. 0≤Y≤239 resolution. Co • High-resolution display has a color resolution of 8 bits/pixel, which is half the standard mode. Rotated display of the frame buffer is not possible in high- • Rotated display of the frame buffer is not possible with double interlace. • A double interlaced display system uses graphic information from both buffers to make one frame. • A single interlaced display system switches frame buffers every two fields and displays the same picture in both the odd and even display lines. In both cases, GA there are no gaps between the scanning lines. • The resolution in single interlace and non-interlace are the same, and the method of writing to the frame buffer is the same. • In 31KC and HDTV, the same color is displayed in 4-pixel units, 2 vertical pixels and 2 horizontal pixels. That is, the resolution is the same as 320 x 240 (31KC) and 352 x 240 (HDTV) in the standard mode, and the method of writing to the frame buffer is the same. • For information about how to set the interlace, refer to the VDP2 manual. SE Notes Field: The time it takes the scanning lines to scan one screen (1/60 second). Frame: The time period during which one image is displayed. If interlaced, two fields make one frame (1/30 second.) 14 Rotated Reading of Frame Buffer • By reading the frame buffer diagonally, the entire frame buffer plane can be dis- played rotated. screen. nti • Display coordinates that exceed the frame buffer address range are handled as transparent (XX00H for 8-bit graphics and 0000H for 16-bit graphics). • Even if rotated reading of the frame buffer is performed, the clipping area and al erase/write area remain fixed with respect to the frame buffer plane. Therefore, the clipping area and erase/write area become inclined with respect to the display • To prevent dropout of any of the display screen when the frame buffer is dis- played rotated, the coordinate range of the frame buffer must be made large. In this case the frame buffer is set to 8 bits/pixel and the screen to 512 × 512 rather than 512 × 256. The number of colors that can be expressed at one time becomes fewer than 256. de • Rotation is prohibited when normal, high resolution, HDTV, or double interlace is set. • The read start coordinates and read movement value for rotated reading from the frame buffer are received from the VDP2. nfi • Rotated reading of the frame buffer is only valid in rotation 16 and rotation 8, and is prohibited in all other cases. In the case of non-rotation, any rotation data re- ceived from the VDP2 are invalid and the parameters of the VDP1 become valid. Co GA SE VDP1 User's Manual 15 (Page 16 is blank in the original Japanese version.) ntial de nfi Co GA SE 16 Chapter 2 Address Map ntial de nfi Contents Co GA 2.1 Address Map .................................................................................... 18 VRAM ................................................................................. 19 Frame Buffer ....................................................................... 20 System Registers ................................................................ 23 2.2 Tables in VRAM ............................................................................... 24 SE Command Table .................................................................. 25 Color Lookup Table .............................................................26 Gouraud Shading Table ..................................................... 26 Character Pattern Table ..................................................... 26 VDP1 User's Manual 17 2.1 Address Map Figure 2.1 shows the address map for the VRAM, frame buffer, and system registers controlled by the VDP1. 000000~07FFFFH *3 VRAM (4 Mbit) *1 ntial Frame buffer 0 Frame buffer 1 080000~0BFFFFH (2 Mbit) (2 Mbit) *2 0C0000~0FFFFFH 100000~17FFFFH 180000~1FFFFH Reserved System registers Access prohibited de Notes *1 nfi The following tables are stored in VRAM. Command tables, Character pattern tables Color lookup tables Gouraud shading tables Co *2 The frame buffer comprises two screens at 080000~0BFFFFH. Only the drawing screen can be accessed. The display screen cannot be accessed. *3 Address is absolute. To find absolute address, add 5C00000H. Figure 2.1 Address Map GA SE 18 VRAM • The VRAM is a 4-Mbit DRAM. • The command table, sprite character pattern table, color lookup table, and enced by specifying the address of each. nti Gouraud shading table are defined in VRAM. It doesn’t matter where in VRAM the data of each are, or whether they are in a nested condition. They are refer- al • Fetching of the command must be performed from the top (000000H) of VRAM. • Fetching of VRAM is repeated in the following order: Command table Gouraud shading table (only when Gouraud shading is used) Color lookup table (only when lookup table method is used) Character pattern table (only when drawing sprites) priority. de • When fetching of the command table goes beyond the end address (07FFFFH) of VRAM, fetching wraps to the top address (000000H) of VRAM. • Byte access and word access are both possible from the CPU. • Read-write access of the VRAM by the system controller IC, and parameter read and pattern read access by the VDP1, are performed after assigning an order of controller IC) > drawing. nfi • The order of priority of access of the VRAM is always: system controller (system • Because access is performed after assigning an order of priority, there may be more than 10 wait cycles according to that timing, depending on the operating clock of the CPU. The operating clock of the CPU is 28 MHz. • Perform access from the CPU when drawing is not being performed in order to Co prevent interruption of drawing. To determine if drawing is being performed, poll the system registers, or use an interrupt signal. Access of the VRAM and frame buffer is performed in a short period of time using burst transfer. GA SE VDP1 User's Manual 19 Frame Buffer • The frame buffer comprises two 2-Mbit DRAM and is divided into two screens: a display frame buffer and a draw frame buffer. it cannot be accessed. nti • The function of the two buffers is changed immediately before the screen display period (DISP). After powering on or resetting, frame buffer 0 becomes the draw- ing frame buffer, and frame buffer 1 becomes the display frame buffer. al • Read-write access of the frame buffer by the system controller IC is performed only on the draw frame buffer. The display frame buffer becomes the rear bank, so • Drawing is performed in sync with the CPU operating clock. The CPU operating clock is 28 MHz, and the data for 1 pixel is drawn in sync with this. • Read-write access of the frame buffer by the system controller IC and draw access drawing de by the VDP1 are performed after assigning an order of priority. • The order of priority of access of the frame buffer is always: system controller IC > • When access from the system controller is performed during drawing, drawing is interrupted and must wait. Therefore this situation should be avoided as much as possible. nfi • Because drawing and access of the CPU are not performed together, perform control by using a method that uses a manual start for drawing start. • Access can be performed using word access. Byte access is only possible when display is 8 bits/pixel. Do not use byte access when display is 16 bits/pixel. • The entire frame buffer can be displayed rotated by reading the frame buffer diagonally. Also, by skipping or repeating read addresses, the entire frame buffer performed simultaneously. Co plane can be enlarged or reduced. Rotation, enlargement, and reduction can be • Rotation is specified from the VDP2. Refer to the VDP2 instruction manual for more information about the specification of rotation. GA SE 20 Frame Buffer Plane The coordinates of the frame buffer plane are as follows. Coordinates increase in value toward the lower-right. X Y -1024 ≤ X ≤ 1023 -1024 ≤ Y ≤ 1023 nti Operation cannot be guaranteed when specified values exceed these values. al de nfi Co GA SE Figure 2.2 Frame Buffer Plane As shown in Figure 2.2, parts can be positioned outside the display screen. However, nothing is written for parts that exceed the range of the frame buffer plane. VDP1 User's Manual 21 Pixel Data in Frame Buffer The pixel data in the frame is shown below. There is 16-bit and 8-bit data. RGB data, which does not go through the color RAM in the VDP2, is only 16-bit data. When all bits are 0, the dot is treated as a transparent dot by the VDP2. • Bit configuration when data goes through color RAM (color RAM address) 16-color mode b15* b14 b13 b12 b11 b10 b9 (4 bits/pixel) b8 b7 b6 b5 nti b4 al b3 b2 b1 b0 Color bank Character data 64-color mode b15* b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 (6 bits/pixel) (7 bits/pixel) Color bank 128-color mode b15* b14 b13 b12 b11 b10 b9 Color bank 256-color mode b15* b14 b13 b12 b11 b10 b9 b8 b7 de b6 b5 Character data b4 b3 Character data b2 b1 b0 (8 bits/pixel) Color bank nfi b8 b7 b6 b5 b4 b3 Character data Note: b15 = 0 when RGB data are mixed; b15 can be either when not mixed. b2 b1 b0 (16 bits/pixel) Co • Bit configuration when data do not go through color RAM (RGB data) RGB mode 1 b14 b13 b12 b11 b10 BLUE data b9 b8 GREEN data b7 b6 b5 b4 b3 b2 RED data b1 b0 • Bit configuration when pixel data is 8 bit (color RAM address) GA 16-color mode b7 b6 b5 b4 b3 b2 b1 b0 (4 bits/pixel) Color bank Character data 64-color mode b7 b6 b5 b4 b3 b2 b1 b0 (6 bits/pixel) Color bank Character data 128-color mode b7 b6 b5 b4 b3 b2 b1 b0 SE (7 bits/pixel) Color bank Character data 256-color mode b7 b6 b5 b4 b3 b2 b1 b0 (8 bits/pixel) Character data 22 System Registers • System registers are memory used for making system settings for the VDP1. They are housed inside the VDP1 separately from the VRAM and frame buffer. nti • There are read-only registers and write-only registers. • The write-only registers are used to control display of the frame buffer. They select the TV mode, specify change of display and the drawing trigger, and define al the fill data and area for erase/write. Drawing can also be forcibly terminated. • Read-only registers are used as help information during program development. They make it possible to know the address of the command table that underwent draw processing last. • Read/write access from the CPU must be performed in word units. • Do not use DMA burst transfer when accessing the system registers. suitable value is set. de • Except for the plot trigger register (PTMR), the values in the write-only registers become undefined after powering on and after resetting, so be sure to set the values from the CPU. Undefined data is displayed from the frame buffer until a • Set the unused bits of write-only system registers to “0”. Table 2.1 System Registers Address 100000H 100002H 100004H 100006H 100008H Name TVHR FBCR PTMR EWDR EWLR nfi TV mode selection Description Frame buffer change mode Draw trigger Erase/write data Erase/write upper-left coordinate Access Write-only (word) Write-only (word) Write-only (word) Write-only (word) Write-only (word) 10000AH 10000CH 100010H 100012H 100014H 100016H EWRR ENDR EDSR LOPR COPR MODR CoErase/write lower-right coordinate Draw forced termination Transfer end status Last operation command address Current operation command address Mode status Write-only (word) Write-only (word) Read-only (word) Read-only (word) Read-only (word) Read-only (word) GA SE VDP1 User's Manual 23 2.2 Tables in VRAM The command table, color lookup table, Gouraud shading table, and character tables. nti pattern table are defined in VRAM. Table 2.2 shows the sizes and boundaries of the Table 2.2 Tables in VRAM Name Function Textured Draw Commands Normal sprite draw command Scaled sprite draw commandal Size Boundary Draw Command Distorted sprite draw command Commands Polygon draw command Command Non-textures Polyline draw command 1EH 20H Line draw command Table de User clipping coordinate set Coordinate Clipping coordinate command Set Commands set commands System clipping coordinate set command Local coordinate set command Drawing end command Color lookup table 20H 20H Gouraud shading table Character pattern table nfi Note: *Differs depending on the character size and color mode. 8H optional* The VRAM is 4 Mbit (512 Kbyte), and it is addressed in byte units from 000000H to 07FFFFH. Table data cannot be written beyond 07FFFFH. Each table must be kept 8H 20H within the size of the VRAM. Co GA SE 24 Command Table • The command table is a table in VRAM where commands are defined, and in • The commands are as follows: nti which the VDP1 reads commands, draws parts and processes clipping. Draw commands al These are divided into texture drawing and non-texture drawing. Texture drawing includes normal sprite, scaled sprite, and distorted sprite draw commands. Non-texture drawing includes polygon, polyline, and line draw commands. Draw commands draw these parts. Clipping coordinate set commands Includes user clipping and system clipping coordinate set commands, and they set the draw area for parts. Local coordinate set commands de Specifies the definition of the parts draw coordinate by the local coordinate. Draw end command Terminates drawing. bytes. nfi • The size of the command table is 1EH (30) bytes, and its boundary is 20H (32) • Each command is read to the VDP1 and is processed. This operation is referred to as fetching. • Fetching of the command table is performed from the top address (000000H) of VRAM, and the next command table is fetched according to the specification of the jump mode. Co • According to the command table specification, the color lookup table, Gouraud shading table, and character pattern table are referenced after the command table. GA SE VDP1 User's Manual 25 Color Lookup Table • This is a table in which 16-bit color codes for 16 colors are defined in VRAM. • When a lookup table method is used for the color mode according to the texture draw command, the table is referenced as color data. nti • The pixel data of character patterns is converted to color codes and written to the frame buffer. al • The size of the table is 20H (32) bytes, and its boundary is also 20H (32 ) bytes. • The table is referenced according to the instruction at the lookup table address of the texture draw command. Gouraud Shading Table • This is a table in VRAM in which 16-bit RGB codes for 4 points are defined. instructed by the draw command for the part. de • It is referenced when the processing of Gouraud shading by color calculation is • The pixel data of the part undergoes processing for Gouraud shading and is written to the frame buffer. • The size of the table is 8H bytes, and its boundary is also 8H bytes. • It is referenced according to the instruction at the Gouraud shading table address of the draw command for the part. nfi • When Gouraud shading is performed, the pixel data of the part is limited to RGB code. When the pixel data of the part is a color bank code, the results cannot be guaranteed. Character Pattern Table Co • This is a table in VRAM in which the pixel data for character patterns is defined. • The table is referenced by the texture draw command. • The pixel data is defined as 4, 8, or 16 bits/pixel, according to the specification of the color mode. • In the color bank mode, a color bank is added to the pixel data of the character pattern; in the color lookup table mode it is converted in the color lookup table; in the RGB mode it is written, as is, to the frame buffer. GA • The size of the table is determined by the size of the characters and the color mode. Its boundary is 20H (32) Bytes. • The table is referenced according to the instruction at the character address of the texture draw command. SE 26 Chapter 3 Processing Flow ntial de nfi Co GA Contents SE 3.1 Draw Procedure Flow ................................................. 28 3.2 Command Table Flow ................................................. 30 3.3 Table Referencing ....................................................... 31 VDP1 User's Manual 27 3.1 Draw Procedure Flow Draw procedure flow using the VDP1 is as follows. Step 1. Power on the system. ntial Step 2. Set the necessary values in the system registers of the VDP1. Step 3. Write the necessary character pattern table to VRAM. Step 4. Write the necessary color lookup table to VRAM. Step 5. Write the necessary Gouraud shading table to VRAM. Step 6. Write the necessary command table to VRAM. de Step 7. Drawing to the frame buffer starts automatically at the start of frame change, and the drawn frame buffer is displayed in the next frame change. Step 8. Repeat steps 3 through 6 as required. nfi Co GA SE 28 Table Access The procedure VDP1 uses to access the table in VRAM and draw is as follows: registers. nti Step 1. Controls drawing and display according to the instructions set in the system al Step 2. Fetches the command table at the top address of VRAM. Step 3. The fetched command table: (1) Terminates drawing in the case of a draw end command (goes to step 9). (2) Is ignored when jump mode is skipped; reading of the table is termi- nated and the table is not processed (goes to step 8). (3) de In cases other than (1) and (2), goes to step (4). Step 4. In the case of a clipping coordinate set command or a local coordinate set command, each is processed (goes to step 8). Step 5. In the case of a drawing command, the Gouraud shading table and color nfi lookup table are read if specified. Step 6. In the case of a textured drawing, the character pattern table is read and is written to the frame buffer according to the specification. At this time, processing of the color mode, color calculation, inversion, enlargement and reduction, and rotation are performed. 3). Co Step 7. In the case of a non-textured drawing, writing to the frame buffer is per- formed according to the specification. Step 8. The next command table is fetched according to the specification of the jump mode and processing of the command table is repeated (goes to step Step 9. Drawing is repeated with the start of framing (goes to step 1). GA SE VDP1 User's Manual 29 3.2 Command Table Flow Except for the draw end command, a jump mode to the next command table to be processed can be specified in other commands. Those jump modes include the following. · Jump to a command table · Skip to a command table · Call a command table group (subroutine) · Return (to main routine) ntial Figure 3.1 shows an example of the flow of a command using a jump mode. VRAM/Command Table 000000 H Clipping coordinates Local coordinates Parts Subroutine call Parts Parts de • Fetched from the top of VRAM during frame switching. • The specified table receives a subroutine call. Jump Parts Parts Return : nfi • Moves to specified table. • Returns to main routine. Co : Parts Parts Skip/parts • Skips (this part is not drawn). Parts Parts Jump Parts Parts GA Jump : Clipping coordinate change Parts Local coordinate change Parts : SE Terminate drawing : • Drawing is terminated. Figure 3.1 Command Table Flow 30 3.3 Table Referencing Referencing of the tables stored in VRAM begins with the following command table. VRAM : : Parts draw command ntial • The data size of the command : table is 1EH bytes and the boundary is 20H bytes. Color mode and color calculation Address of color lookup table Character address Character size : : de Address of Gouraud shading table nfi: : : Color lookup table Co : • Both the data size and boundaries are 20H bytes when the color mode : is the lookup table mode. : : Gouraud shading table • Both the data size and boundaries : are 8H bytes when Gouraud shading is used for color calculation. : GA : : Character pattern • In the case of a sprite draw command, : the data size has 20H-byte boundaries as determined by the character size : and color mode. : : SE Figure 3.2 Referencing of Tables VDP1 User's Manual 31 (This page is blank in the original Japanese document.) ntial de nfi Co GA SE 32 Chapter 4 System Registers ntial de nfi Contents Co 4.1 TV Mode Selection Register ............................................................ 36 4.2 Frame Buffer Change Mode Register ............................................. 38 GA 4.3 4.4 Plot Trigger Register ........................................................................ 45 Erase/Write ...................................................................................... 46 Erase/Write Data Register ................................................. 46 Erase/Write Upper-Left Coordinate Register ...................... 47 Erase/Write Upper-Right Coordinate Register ................... 47 4.5 Draw Forced Termination Register ................................................. 51 SE 4.6 4.7 4.8 4.9 Transfer End Status Register .......................................................... 52 Last Operation Command Address Register .................................. 54 Current Operation Command Address Register ............................. 55 Mode Status Register ...................................................................... 57 VDP1 User's Manual 33 The following table shows the functions of the systems registers. nti Table 4.1 System Registers Abbrevi - Internal update Register Names ation Address Access Function period TV mode selection TVMR 100000H Write-only Specifies TV display mode PTM as occasion demands al (word) VBE is field Frame buffer switch FBCR Write-only Controls frame buffer toggle and FCM and FMT are set for each field, others mode 100002H (word) double interlace mode are frame buffer SW timing PTMR Write-only Controls start of drawing 01B write as the occasion demands, Plot trigger 100004H (word) 00B and 10B write are frame buffer SW timing Erase/write data EWDR Write-only Specifies fill data for frame buffer Frame buffer SW 100006H (word) during erase/write timing Erase/write upper - left coordinate Erase/write lower - right coordinate Plot abnormal end Transfer end status EWLR EWRR ENDR EDSR 100008H 10000AH 10000CH Write-only (word) Write-only (word) Write-only (word) Read-only erase/write erase/write de Specifies upper-left coordinate of area Frame buffer SW in frame buffer to fill during Specifies lower-right coordinate of area in frame buffer to fill during Forces termination of drawing Status of ‘END’ bit of current/previous timing Frame buffer SW timing As the occasion demands – Last Operation Command Address Current Operation Command Address Mode status LOPR COPR MODR 100010H 100012H 100014H 100016H (word) Read-only (word) Read-only (word) Read-only (word) nfi frame Address of last accessed command table for previous frame Address of last accessed command table being processed Displays setting of write-only register – – – Co GA SE 34 System Register Settings Switch Timing The timing with which the system register settings become valid is as follows. • Settings that change immediately Plot trigger mode (PTM, when 01B is written) TV mode selection (TVM) nti • Settings that change with each field (1/60 second) al Frame buffer change mode (FCM) Frame buffer change trigger (FCT) Erase/write data de • Settings that change with the switching of the frame buffer Plot trigger mode (PTM, when 00B or 10B is written) Even/odd coordinate selection bit (EOS) Double-density interlace enable (DIE) Double-density interlace draw line (DIL) interrupt. nfi Erase/write coordinates (upper-left, lower-right) • Changes following the termination of display of one line after the V-blank IN Enables V-blank erase/write (VBE) Co GA SE VDP1 User's Manual 35 4.1 TV Mode Selection Register The TV mode selection register (TVMR, TV mode register) enables V-blank erase and specifies the TV display mode. It is a 16-bit write-only register, and is at address 100000H. Its value becomes undefined after powering on or resetting; therefore the TV display mode must be set. The unused bits must be set to “0.” TVMR bit 15 100000H 0 14 0 13 0 12 0 11 0 10 0 9 0 8 0 7 0 6 0 5 0 nti 4 al 0 3 VBE 2 1 TVM 0 Write-only V-Blank Erase/Write Enable (VBE): bit 3 “Frame Buffer Change Mode Register.” de • When VBE = 1, erase/write is performed during V-blank. VBE = 1 can only be set when FCM = 1 and FCT = 1 are written. For more information, refer to section 4.2, • When VBE is set to “0” or “1,” TVM of the same value before making the setting must be set at the same time. • The VBE setting must be set immediately after the V-blank IN interrupt. Access is the next H-blank IN interrupt. nfi prohibited from the first H-blank IN interrupt after the V-blank IN interrupt until TV Mode Select (TVM): bits 2~0 • Specifies the TV display mode. • For more information about the coordinate values of the displayed area, refer to screen. Co “Screen Mode and Display Areas” in section 1.2. • When TVM = 010B(2), the frame buffer has only 512 (H) x 256 (V) pixels, and therefore if the screen is greatly inclined, a transparent area occurs in the display • Since only non-interlace is possible when HDTV is specified (TVM = 100B(4)), and only non-interlace and single interlace are possible when rotated display is speci- fied (TVM = 010B(2), 011B(3)), the frame buffer change mode register must be set to double-interlace disable (DIE bit = 0). For more information, refer to section 4.2, GA “Frame Buffer Change Mode Register.” • TVM settings must be performed from the second H-blank IN interrupt after the V-blank IN interrupt to the H-blank IN interrupt immediately after the V-blank OUT interrupt. SE 36 • The function of each bit is as follows. Bit 2: HDTV enable bit 0 = NTSC, PAL 1 = HDTV, 31KC Bit 1: Frame buffer rotation enable bit 0 = non-rotation 1 = rotation Bit 0: Bit depth selection bit 0 = 16 bits/pixel ntial 1 = 8 bits/ pixel Table 4.2 Screen Modes Bits 2 0 TVM 1 0 0 0 Normal High Name Screen Mode (NTSC, PAL) Resolution HxV 320x224 320x240 352x224 352x240 640x224 de Bit width (bit/pixel) 16 Frame buffer screen size 512 H x 256 V 1024 H Interlace Yes VDP CLK (MHz) NTSC 26.8426 26.8426 28.6364 28.6364 26.8426 PAL 26.6564 26.6564 28.4375 28.4375 26.6564 0 0 0 1 1 0 resolution (NTSC, PAL, Hi- Res) Rotation 16 (NTSC, PAL Rotation) Rotation 8 (NTSC, nfi 640x240 704x224 704x240 320x224 320x240 352x224 352x240 320x224 8 16 x 256 V 512 H x 256 V 512 H Yes Single Only Single 26.8426 28.6364 28.6364 26.8426 26.8426 28.6364 28.6364 26.8426 26.6564 28.4375 28.4375 26.6564 26.6564 28.4375 28.4375 26.6564 0 1 1 0 All other 1 0 PAL Rotation) HDTV Co (31KC, HDTV) 320x240 352x224 352x240 320x240 352x240 8 16 x 512 V 512 H x 256 V Setting prohibited (do not use) Only No 26.8426 28.6364 28.6364 26.8426 28.6364 26.6564 28.4375 28.4375 26.6564 28.4375 GA SE VDP1 User's Manual 37 4.2 Frame Buffer Change Mode Register The frame buffer change mode register (FBCR, frame buffer change register) controls drawing and display change of the frame buffer, as well as double interlace drawing. It is a 16-bit read-only register at address 100002H. Its value becomes undefined after powering on or resetting, and therefore the change mode must be set. Unused bits must be set to “0.” FBCR 100002H bit 15 0 14 0 13 0 12 0 11 0 10 0 9 0 8 0 7 0 6 0 5 0 4 EOS nti 3 DIE al 2 DIL 1 FCM 0 FCT Write-only Frame Buffer Change Mode (FCM): bit 1 Frame Buffer Change Trigger (FCT): bit 0 de • Normally the two frame buffers are used as a front screen and a back screen. The front screen is displayed and the back screen is drawn. Also, the front screen and back screen are toggled after the time required to change one frame has elapsed. The front screen that was displayed becomes the back screen to be drawn, and the back screen that was being drawn becomes the front screen to be displayed. displayed cannot be accessed. nfi • Only that part of the frame buffer being drawn can be accessed. The side being • The number of characters that can be drawn in one frame is limited. Therefore, in order to draw multiple characters, the manual mode must be set and controls erased and changed from the CPU. • When selected data is written from the CPU to FBCR, the values of FCM and FCT Co are updated at the time of a field change in the VDP1. • When in the manual mode, the FCT bit setting is only valid for the next frame. The contents of FCT are updated internally at the time of frame change. • Make the FCM and FCT settings immediately after the V-blank OUT interrupt. Access is prohibited from the first H-blank IN interrupt after the V-blank OUT interrupt until the next H-blank IN interrupt. VBE FCM FCT Change mode Change time 0 0 0 1-cycle mode Change every 1/60 second 0 0 0 1 1 1 1 0 1 1 0 0 1 1 GA 1 0 1 0 1 0 1 Setting prohibited Manual mode (erase) Manual mode (change) Setting prohibited Setting prohibited Setting prohibited Manual mode (erase and change) — Erase in next field Change in next field — — — Erase by V-blank and change in next field SE 38 1-Cycle Mode • This is the normal mode. • One frame changes automatically every 1/60 second. • Set the value of the VBE and FCT bits to “0.” Erase (Manual Mode) nti • Erase/write for one frame is controlled from the CPU. al • Manual erase/write of the frame buffer is specified by writing “0” to the VBE, FCM and FCT registers. Erase/write of the display frame buffer is performed in the next specified field, and the display frame buffer is cleared. • Changing of the drawing and display frame buffers is not performed. Because the display frame buffer is cleared when erase is performed, it is necessary to specify is used in the field before changing. de change in the next field when display is performed for which erase is specified and to perform change of drawing and display. • This mode is used when there are two or more fields in one frame, as in double interlace. Also, when changing from manual mode to the 1-cycle mode, this erase • Erase is used when it is known that frame change will be performed two fields in Change (Manual Mode) nfi advance. Use erase and change when it is unclear up until the prior field that frame change will be performed. • The changing of one frame is controlled by the CPU. • Change is specified by writing “0” to the VBE register and “1” to the FCM and Co FCT registers. The drawing and display are changed in the next specified field. • Because erase/write is not performed, it is necessary to specify erase in the prior field in which change is specified and to erase/write the frame buffer. • Until change is specified, characters can be drawn in the back screen. • This change is normally used when switching from the 1-cycle mode to the manual mode. This change is also used when changing the frame buffer in manual mode. GA SE VDP1 User's Manual 39 Erase & Change (Manual Mode) • By writing “1” to the VBE register, V-blank erase is specified; and by writing “1” to the FCM and FCT registers at the same time, switching of the frame buffer after V-blank is specified. nti • This mode is used when frame change is unclear up until the prior V-blank, as when the frame buffer cannot be changed by the end of processing by the CPU. al • Once VBE has been set to “1,” erase/write is performed automatically even in the next V-blank, and therefore VBE must be set to “0” before the next V-blank after frame change. • Place the erase & change setting immediately after the V-blank IN interrupt. When set at another time, the change may be performed without being able to erase. • If the timing for frame change is known in advance as in normal, high resolution, Sequence When Using Erase & Change de and interlace, specify erase & change and perform erase/write during the display period. In this case, erase/write of the entire display screen is possible. 1) Set VBE to “0” and FCM and FCT to “1.” 2) Wait for the end of processing by the CPU without selecting the TV mode or setting the FB change mode. nfi 3) When processing by the CPU ends by the H-blank IN interrupt time (224th line in 224-line display and 240th line in 240-line display) immediately before V- blank, then VBE, FCM, and FCT are set to “1” (erase & change). The erase & change setting should be placed immediately after the V-blank IN interrupt. 4) V-blank erase is started after completion of the V-blank IN interrupt. 8) Return to 2). Co 5) At the end of V-blank, erase/write is interrupted and the frame is changed. 6) If erase/write is not completed, erase/write non-erased areas with polygons. 7) Return VBE to “0” after the V-blank OUT interrupt to stop V-blank erase. GA SE 40 Example Table 4.3(a) shows the frame buffer change mode being used. Table 4.3(a) Example of Use of Frame Buffer Change Mode (Fixed at VBE = 0) Setting1 FCM FCT 0 0 Draw Frame buffer 0 2 Display and erase/write Draw Draw Frame buffer 1 2 Display and erase/write Display and nti Frame buffer change mode al 1-cycle mode Change time 60 frames/sec Erase/write Display and Draw erase/write 1 1 Draw Display and Manual mode 1 1 0 1 Display Display Display and erase/write Draw erase/write Draw Draw Draw Display de (change)3 Manual mode (erase)4 Manual mode (change)4 20 frames/sec 1 0 0 0 Draw Draw Display and erase/write Draw nfi Display Display and erase/write Draw Display and erase/write Manual mode (erase)5 1-cycle mode 60 frames/sec Notes: Co 1Value written to register immediately after the V-blank OUT interrupt. 2Changes from the first of the field. 3Changes from the 1-cycle mode to the manual mode with change. 4Be sure to continue to specify erase & change. 5Specify erase in the field immediately before changing to the 1-cycle mode. GA SE VDP1 User's Manual 41 Table 4.3 (b) Example of Use of Frame Buffer Change Mode (VBE Is Used) ntial de nfi Co GA SE 42 Double Interlace Enable (DIE): bit 3 Double Interlace Draw Line (DIL): bit 2 • In single interlace, the same picture is displayed in the even fields and the odd the even fields and the odd fields. nti fields. In double interlace, however, the vertical resolution is doubled by display- ing different pictures (each draws only even lines and odd lines, respectively) in • Double interlace is enabled by DIE = 1. al • The contents of the first screen displayed after changing DIE cannot be guaran- teed. • In double interlace, the fields are changed every 1/60 second, and therefore FCM = FCT = 0 (1-cycle mode) is set. DIE 0 0 1 1 DIL 0 1 0 1 Interlace mode Non-interlace/single interlace Setting prohibited Double interlace Double interlace de Plot after next frame change Plot both even and odd lines — Plot even-numbered lines only Plot odd-numbered lines only Single interlace mode display line 0 nfi Double interlace mode display line 0 line 1 line 2 Co line 0 line 1 line 2 line 4 line 1 line 3 line 2 line 5 GA line 3 line 6 line 3 line 7 • Appears as 256 lines vertically • Appears as 512 lines vertically • The frame is changed every 1/60th of a • Even and odd numbered lines are second, and either the same picture is rendered into different frame buffers. displayed two times or the frame is changed every 1/30th of a second (a 1/60 sec signal is SE used and is specified from the CPU). Figure 4.1 Single Interlace and Double Interlace Display VDP1 User's Manual 43 Even/Odd Coordinate Select Bit (EOS): bit 4 • When “1” is specified for high speed shrink (HSS) with a scaled or distorted sprite, this bit is enabled. When HSS = 1 is specified, lines drawn with a magnifi- sampled. nti cation ratio of less than 1 are drawn by sampling only the even or odd pixels of the original picture data. This bit specifies whether even or odd coordinates are al • When EOS = 0, only pixels at even coordinates are sampled. When EOS = 1, only pixels at odd coordinates are sampled. • If HSS = 0, this bit is not referenced. • Refer to “High Speed Shrink” under “6.3 CMDPMOD (Draw Mode Word” for more information. EOS Even/odd coordinate select bit 0 1 Samples only pixels at even coordinates Samples only pixels at odd coordinates de nfi Co GA SE 44 4.3 Plot Trigger Register The plot trigger mode register (PTMR) controls the start of drawing. It is a 16-bit write-only register at address 100004H. Its value is reset to 00B after powering on or resetting. Set unused bits to “0”. PTMR 100004H Write-only bit 15 0 14 0 13 0 12 0 11 0 10 0 9 0 8 0 7 0 ntial 6 0 5 0 4 0 3 0 2 0 1 PTM 0 Plot Trigger Mode (PTM): bits 1, 0 • Controls the start of drawing. • When the plot trigger mode bits are 10B, drawing begins automatically at the start of the frame. drawing begins from the top of the command table. de • When the plot trigger mode bits are made 01B, drawing begins when the register is written. When 01B is written to the plot trigger mode bits during drawing, • When the plot trigger mode bits are 00B, drawing does not start even at the start of the frame. An idling condition is set. • The value of the bits is reset to 00B after powering on or resetting. Bit 1 0 0 1 PTM 0 0 1 0 nfi Idle at frame change Drawing mode Starts drawing when 01B is written Starts drawing automatically with frame change Co 1 1 Setting prohibited (do not set) • When the plot trigger mode bits are rewritten from 01B to 00B, drawing becomes valid from the next frame. However, when the plot trigger bits are rewritten from 00B or 10B to 01B, drawing becomes valid at that point and drawing is started even if drawing is automatically started by 10B. • When the table is not rewritten the same drawing is performed, and therefore the results of color calculation of half-transparency change. Use the following proce- dure to change only the draw start mode without drawing. GA 1) 2) Change the plot trigger mode bits from 10B to 00B. Change the plot trigger mode bits from 00B to 01B in the next frame. SE VDP1 User's Manual 45 4.4 Erase/Write Before rendering data into the frame buffer, the VDP1 erases the contents of the and the erase/write right coordinate register. nti frame buffer. This erasure is referred to as erase/write, and it specifies the fill area to be erased and the fill data to be written to that area. The three registers related to erase/write are the erase/write data register, the erase/write left coordinate register Erase/Write Data Register al The erase/write data register (EWDR) specifies the fill data during erase/write. It is a 16-bit write-only register at address 100006H. Its value becomes undefined after powering on or resetting, and therefore the fill data must be set. EWDR 100006H 16 bits/pixel 8 bits/pixel Write-only bit 15 Erase/write data for even X coordinates Erase/Write Data: bits 15~0 14 13 12 11 10 9 8 7 de 6 Erase/write data 5 4 3 2 1 0 Erase/write data for odd X coordinates nfi When parts are written to the frame buffer, the VDP1 automatically erases the frame buffer. At the time of this erase/write, the frame buffer is filled with the 16-bit data set in the erase/write register. Erase/write is performed 2 pixels at a time when the frame buffer depth is 8 bits/pixel. The area of erase/write is set by the erase/write left coordinate register and the erase/write right coordinate register. Co GA SE 46 Erase/Write Upper-Left Coordinate Register The erase/write left register (EWLR) sets the upper-left coordinate of the erase/ write area. It is a 16-bit write-only register at address 100008H. Its value becomes bit 15 nti undefined after powering on or resetting, and therefore the coordinates must be set. Set unused bits to “0.” EWLR 100008H Write-only 0 14 13 12 11 10 9 Upper-left coordinate X1 8 7 6 al 5 4 3 2 Upper-left coordinate Y1 1 0 Erase/Write Upper-Left Coordinate X1: bits 14~9 Erase/Write Upper-Left Coordinate Y1: bits 8~0 Erase/Write Upper-Right Coordinate Register de The erase/write right coordinate register (EWRR) sets the lower-right coordinate of the erase/write area. It is a 16-bit write-only register at address 10000AH. Its value becomes undefined after powering on or resetting, and therefore the coordinates must be set. Set unused bits to “0”. EWRR 10000AH Write-only bit 15 nfi 14 13 12 11 10 9 Lower-right coordinate X3 Erase/Write Lower-Right Coordinate X3: bits 15~9 Erase/Write Lower-Right Coordinate Y3: bits 8~0 8 7 6 5 4 3 Lower-right coordinate Y3 • These registers specify the fill area in the frame buffer during erase/write. 2 1 0 Co • The X coordinate is set in 8-pixel units when there are 16 bits/pixel (normal, rotation 16, HDTV) and in 16-pixel units when there are 8 bits/pixel (high resolu- tion, rotation 8). When the value of the system register is 1, it becomes 8 or 16. The actual lower-right X coordinate takes a value that is 8 or 16 times the register setting and from which 1 is subtracted. • The Y coordinate is set in one-line units. Because the register setting for the Y coordinate is doubled during double interlace, the actual coordinate value should be set to one half. For example, when the setting is 223, the coordinate becomes GA 447. • The actual X coordinate is expressed by the following equations. 16 bits/pixel 8 bits/pixel Upper-left coordinate X 1 = register setting × 8 Lower-right coordinate X 3 = register setting × 8 – 1 Upper-left coordinate X1 = register setting × 16 Lower-right coordinate X3 = register setting × 16 – 1 SE VDP1 User's Manual 47 Therefore the values that the upper-left coordinate X1 and the lower-right coordinate X3 can take are as shown in the following table. nti Value set 16 bits/pixel 8 bits/pixel in register High Resolution Rotated 8 Upper left Lower right Upper left Lower right Upper left Lower right coordinate X1 coordinate X3 coordinate X1 coordinate X3 coordinate X1 coordinate X3 Setting Setting Setting 0 1 2 : 31 32 33 0 8 16 : 248 256 264 prohibited 7 15 : 247 255 263 0 16 32 : 496 512 528 prohibited 15 31 : 495 511 527 al0 16 32 : 496 Setting prohibited Setting prohibited prohibited 15 31 : 495 511 Setting prohibited : 40 : 43 44 : 62 63 : 320 : 344 352 : 496 504 : 319 : 343 351 : 495 503 : 640 : 688 704 : 992 1008 de: 639 : 687 703 : 991 1007 : : : : : : : : : : : : : : : : 64 over 65 Setting prohibited Setting prohibited 511 Setting prohibited nfi Setting prohibited Setting prohibited 1023 Setting prohibited • The coordinates for erase/write are not checked, and therefore the registers must be set in the CPU in advance so that X1 < X3 and Y1 ≤ Y3. : Setting prohibited : Setting prohibited ranges. Co • Set the erase/write range in each TV mode within their respective memory map (X1, Y1) (X3, Y3) GA (X3, Y3) (X1, Y1) (a) X1 < X3, Y1 ≤ Y3 (b) X1 ≥ X3, Y1 > Y3 SE White area undergoes erase-write Figure 4.2 Erase/Write Area No erase-write 48 • If the setting is X1 ≥ X3 or Y1 > Y3, then erase/write is performed for 1 dot in the normal or high-resolution mode and for 8 dots in the case of rotation or HDTV. In these cases, erase/write is performed under the assumption that the area (X1, Y1) is set to (X3 = X1 + 1, Y3 = Y1). nti • When VBE = 0 in the normal or high-resolution mode, erase/write is performed beyond the frame buffer during the display period. When setting the X3 coordi- al nate beyond the display screen, after the end of the effective data (fall of HTIM), erase/write is continued for 4 pixels in the normal mode and for 8 pixels in the high-resolution mode, and erase/write is not performed beyond the display screen other than in those areas. • When the erase/write area is set within the display screen area, no erase/write is performed outside the display area. • Erase/write is not affected by clipping. de • Erase/write cannot be performed on the frame buffer during display when in the HDTV mode, when the frame buffer is enlarged or reduced, or when display is rotated. Because erase/write is performed in the vertical blanking period (V- BLANK), there is not enough time to erase/write the entire screen. To perform erase/write on the entire screen, the non-erased areas must be filled with poly- gons at the start of drawing. nfi • The number of pixels required for V-blank erase is expressed by (X3 – X1 + 1) x (Y3 – Y1 + 1) x 8 If this is within the number of pixels that can be used in V-blank erase, then erase/ write is completed. • The number of pixels that can be used in V-blank erase is given by Screen mode Co {(number of pixels in 1 raster) – 200} × {(number of rasters in 1 field) – (number of display rasters)} The respective values are shown in Tables 4.4 and 4.5. Table 4.4 Number of Rasters and Number of Pixels Number of horizontal pixels Number of pixels in 1 raster Number of rasters in 1 field NTSC 320 1708 263 PAL 352 1820 313 GA 31KC — 852 525 HDTV — 848 562 SE VDP1 User's Manual 49 Table 4.5 Number of Pixels that Can Be Used in V-Blank Erase (in Non-Interlace Display) Screen mode Resolution Number of pixels that can (horizontal x vertical) be used nti 320 × 224 58812 NTSC 320 × 240 34684 352 × 224 63180 352 × 240 37260 PAL 31KC HDTV 320 × 224 320 × 240 320 × 256 352 × 224 352 × 240 352 × 256 320 × 480 352 × 480 134212 110084 85956 144180 118260 92340 29340 53136 al de nfi Co GA SE 50 4.5 Draw Forced Termination Register The draw forced termination register (ENDR) forces termination of drawing. It is a write-only 16-bit register at address 10000CH. ENDR 10000CH Write-only bit 15 0 14 0 13 0 Draw Forced termination: draw end 12 0 11 0 10 0 9 0 8 0 7 0 nti 6 0 5 0 al 4 0 3 0 2 0 1 0 0 0 • Forces termination of the drawing currently being processed. • Forces termination of the drawing in the frame within approximately 30 clock cycles after the data is written to the register. • Specify 0000H for the write data. • Interrupted drawing cannot be resumed. de • When the amount of data drawn is large and cannot be drawn in one frame, a pseudo draw continuation is used to divide the data into two parts and draw it. This draw forced termination is used to terminate drawing during this pseudo draw continuation. For more information, refer to section 4.8 “Current Operation Command Address Register.” nfi Co GA SE VDP1 User's Manual 51 4.6 Transfer End Status Register The transfer end status register (EDSR) indicates the end status of the prior frame processing. It is a 16-bit read-only register at address 100010H. Set unused bits to “0.” EDSR 100010H Read-only bit 15 0 14 0 13 0 12 0 11 0 10 0 0 9 0 8 0 7 0 6 0 5 0 4 nti 0 3 al 0 2 1 CEF 0 BEF Current End Bit Fetch Status (CEF): bit 1 This register indicates whether or not the end bit (draw forced termination com- mand) has been fetched from the command table in the frame currently being CEF de drawn. When it is “0,” the end bit indicates a non-fetched status; when it is “1,” it indicates that the end bit has been fetched and that drawing is terminated. 0 1 End bit fetch status The end bit in current frame has not been fetched. The end bit in current frame has been fetched and plotting is ended. nfi • The VDP1 successively fetches the following command tables in VRAM and draws them in the frame buffer. When the draw end command (when end bit is 1) is fetched, the drawing of one frame is terminated. CEF is set to “1” at this time. • When data are transferred from the CPU to VRAM while in a draw end (CEF = 1) status, VRAM can be accessed without the overhead for stopping drawing and without causing the CPU to wait. Co • When the draw end command is fetched, the VDP1 sets CEF to “1” and generates an interrupt signal. • There are two methods of judging termination of drawing: one confirms the fetch status of the end bit with CEF (polling) and the other uses the interrupt signal. • When there is no draw end command in VRAM, or when there is one and it is defined by the jump mode such that it cannot be fetched, this bit remains “0.” • This bit is reset to “0” when the frame buffers are changed or when drawing is GA started. • If fetch of the draw terminate command matches when the frame buffer changes, CEF and BEF might not become “1.” SE 52 Before End Bit Fetch Status (BEF): bit 0 been fetched and that drawing is terminated. nti This register indicates whether or not the end bit (draw terminate command) has been fetched from the command table in the previous frame. When it is “0,” it indi- cates that the end bit has not been fetched; when “1,” it indicates that the end bit has BEF 0 al End bit fetch status The end bit in previous frame has not been fetched. 1 The end bit in previous frame has been fetched and drawing is terminated. • The VDP1 successively fetches the following command tables in VRAM and draws them in the frame buffer. When the draw terminate command (when end This bit indicates a transfer-over status. de bit is 1) is fetched, the drawing of one frame is terminated. If there are many commands, or if there are many pixels to be drawn because of enlargement, draw- ing may not be terminated in one frame. This is referred to as “transfer-over.” • When transfer-over has occurred, it is necessary to reduce the drawing commands or to reduce the pixels drawn. change. nfi • When there is no draw terminate command in VRAM, or when there is one and it is defined by a jump mode such that it cannot be fetched, this bit remains at “0.” • This bit is written with the value of the CEF value when the frame buffer is changed or at the start of drawing, and is maintained until the next frame buffer Co GA SE VDP1 User's Manual 53 4.7 Last Operation Command Address Register 15 14 nti The last operation command address register (LOPR) indicates the command table address processed at the end of the previous frame. It is a 16-bit read-only register at address 100012H. LOPR bit 100012H Read-only 13 12 11 10 9 8 7 6 Last operation command address/8H 5 4 al 3 2 1 0 0 0 Last Operation Command Address: bits 15~0 • When the frame buffer is changed, the value resulting from dividing the address of the command table read to the VDP1 from the VRAM by 8H is written to this register. de • This register is updated when the frame buffer is changed, so it is possible to know the address of the command table last processed in the previous frame. • Because the boundary of the table address is 20H bytes, the lower 2 bits of the register are fixed at 00B. VRAM Parameters VDP1 Command nfi Parameters Frame buffer Co Address Table read address GA To current operation command address To last operation SE Latch command address Figure 4.3 Last Operation Command and Current Operation Command Address 54 4.8 Current Operation Command Address Register The current operation command address register (COPR) indicates the address of the command table being processed. It is a 16-bit read-only register at address 100014H. COPR 100014H Read-only bit 15 14 13 12 11 10 9 Current operation command address/8H Current Operation Command Address: bits 15~0 8 7 nti 6 al 5 4 3 2 1 0 0 0 • The value resulting from dividing the command table address, which has received the parameter currently being processed, by 8H is written to this register. • It is possible to know the address of the command table currently being pro- by a frame change or plot trigger. de cessed. The address value is continually updated during command processing. • When the draw end command is fetched and drawing is abnormally ended, the value of the address updated at that time is retained as is until drawing is started • When the draw end command is fetched, this is the address (divided by 8H) of the draw end command table. In the case of draw forced termination, this is the register are fixed at 00B. nfi address (divided by 8H) of the abnormally ended command table. • Because the boundary of the table address is 20H bytes, the lower 2 bits of the Co GA SE VDP1 User's Manual 55 Pseudo Draw Continuation • When the amount of data drawn is large and cannot be drawn in one frame, divide the data into two parts and to draw it. nti drawing is terminated part way through and pseudo draw continuation is used to • Pseudo draw continuation is performed using the following procedure. Drawing al is terminated, at which time the top command is written so that it jumps to the address of the table whose processing was terminated at that time, and the plot trigger mode is set to start drawing (PTM = 01B) when it is written. • As much drawing is performed as possible in the time of one frame, at which point drawing is terminated (interrupted) by the CPU. Next, the CPU writes the jump destination in the top command in VRAM to the command table address at the time of termination, and drawing is immediately started by the plot trigger time to the end of the frames. de mode (PTM = 01B). This is how pseudo draw continuation is done. However, drawing cannot be continued when the command table address is in the subrou- tine at the time of a forced termination. In this case, the drawing times necessary to transfer the respective pixel data to the frame buffer are set shorter than the • When color calculation of half-transparent is being performed at the time of an performed. nfi forced termination of drawing, it is possible that dots may occur for which half- transparent processing is performed twice (color calculation is performed twice) when drawing is continued using the above method. A forced termination of drawing must be performed when color calculation of half-transparency is not Co GA SE 56 4.9 Mode Status Register The mode register (MODR) indicates the setting of the write-only register. It is a 16- bit read-only register at address 100016H. MODR 100016H Read-only bit 15 14 13 VER 12 11 10 9 8 7 nti 6 5 al 4 3 — — — PTM1 EOS DIE DIL FCM VBE 2 1 TVM Because the registers at addresses from 100000H to 10000CH are write-only, they 0 cannot be read to confirm the settings. The settings in write-only registers can be confirmed by this register. It is mainly used as help information during program development. However, because these values are the actual system register settings, they may be different from the values taken in as internal signals. Version Number (VER): bits 15~12 de Indicates the version number of VDP1. The value is “1” (0001B). Plot trigger Mode (PTM1): bit 8 Setting of bit 1 of the plot trigger register (PTMR: 100004H). nfi Even/Odd Coordinate Select Bit (EOS): bit 7 Setting of bit 4 of the frame buffer change mode register (FBCR: 100002H). Double Interlace Enable Bit (DIE): bit 6 Setting of bit 3 of the frame buffer change mode register (FBCR: 100002H). Co Double Interlace Draw Line (DIL): bit 5 Setting of bit 2 of the frame buffer change mode register (FBCR: 100002H). Frame Buffer Change Mode Bit (FCM): bit 4 Setting of bit 1 of the frame buffer change mode register (FBCR: 100002H). GA SE VDP1 User's Manual 57 V-Blank Erase/Write Enable Bit (VBE): bit 3 Setting of bit 3 of the TV mode selection register (TVHR: 100000H). TV Mode Selection Bits (TVM): bit 2~0 nti Setting of bits 2 through 0 of the TV mode selection register (TVHR: 100000H). al de nfi Co GA SE 58 Chapter 5 Tables ntial de nfi Co GA Contents SE 5.1 5.2 5.3 5.4 Character Pattern Tables ................................................................. 60 Color Lookup Tables ........................................................................ 62 Gouraud Shading Table ................................................................... 64 Command Tables ............................................................................. 66 VDP1 User's Manual 59 5.1 Character Pattern Tables A character pattern is data that becomes the basis for a sprite drawn by a texture draw command. nti Define character patterns continuously to VRAM as tables. The stored data are al referenced at the character address of the command table, and the data size is deter- mined by the size of the character pattern and the color mode of the sprite. Character Pattern Table Addresses Define character pattern boundaries with a 20H (32)-byte boundary. However, character patterns starting from address 00000H in VRAM cannot be defined. Char- acter patterns are stored in a 20H-byte boundary, so that part of the 20H bytes not patterns beyond address 80000H. de filled becomes free space. The address of VRAM is 7FFFFH. Do not define character Table Size Depending on the color mode, 1 pixel of the character pattern becomes 4-, 8- or 16- bit data. The character size can be specified from 8 pixels to 504 pixels horizontally nfi in 8-pixel units and from 1 pixel to 255 pixels vertically in 1-pixel units. For example, in order to represent a character pattern 8 horizontal pixels by 3 verti- cal pixels, 0CH (12) bytes is required for 4 bits/pixel, 18H (24) bytes is required for 8 bits/pixel; and 30H (48) bytes is required for 16 bits/pixel. The table of a character pattern requires 4H bytes when the character pattern is 8 horizontal pixels by 1 Item Co vertical pixel and 4 bits/pixel, and the maximum data of a character pattern is 3EC10H (257,040) bytes when the character pattern is 504 horizontal pixels by 255 vertical pixels and 16 bits/pixel. Table 5.1 Size of Character Pattern Tables Minimum Maximum Character size 8 horizontal pixels x 504 horizontal pixels x 1 vertical pixel 255 vertical pixels Color mode 4 bits/pixel 16 bits/pixel GA Character pattern 4H bytes* 3EC10H (257,040) bytes *Even a 4H-byte character requires 20H bytes in VRAM, so use caution. SE 60 Examples of Character Pattern Tables The examples of character patterns in Figure 5.1 are shown with a character size of 8 horizontal pixels by 3 vertical pixels: For 4 bits/pixel, 0CH (12) bytes is required. pixel +00H 0 1 + 0 2 3 + 1 4 5 + 2 6 7 + 3 ntial Value is relative address from character pattern address +04H + 4 + 5 + 6 + 7 +08H + 8 + 9 + A + B For 8 bits/pixel, 18H (24) bytes is required. pixel +00H +08H +10H 0 +0 +8 +10 1 +1 +9 +11 +2 +A 2 +12 +B 3 +3 +13 4 +4 +C +14 5 +5 +D +15 de +6 +E 6 +16 7 +7 +F +17 pixel nfi For 16 bits/pixel, 30H (48) bytes is required. 0 1 2 3 4 5 +00H +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F 6 7 Co +10H +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +1A +1B +1C +1D +1E +1F +20H +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +2A +2B +2C +2D +2E +2F Figure 5.1 Examples of Character Pattern Tables GA SE VDP1 User's Manual 61 5.2 Color Lookup Tables The color lookup table is used to specify the color of the pixels of the character of the pixel. nti pattern in the lookup table mode. The color lookup table defines the respective color codes of 16 colors in VRAM as 16-bit data. In the lookup table mode, character patterns are defined in the character pattern table in 4 bits/pixel, and 1 color of the al 16 colors defined as 4-bit data in the color lookup table is selected. The 16 bits of the color code of the selected color are written to the frame buffer, as is as the color code The size of the color lookup table is 20H (32) bytes. The table should be written from the boundary addresses of 20H-byte units in VRAM. However, 00000H cannot be defined. VRAM occupies up to address 7FFFFH. Do not define color lookup tables beyond address 80000H. de The data written to the color lookup table can be either color bank code or RGB code. If RGB code, MSB = 0. If color bank code, MSB = 0 if RGB code is mixed, and MSB can be either 0 or 1 if RGB is not mixed. Set MSB to match data processing by the VDP2. +00H +02H +04H 16-bit data 16-bit data 16-bit data nfi (color code of 0H) (color code of 1H) (color code of 2H) +1CH +1EH : : Co 16-bit data 16-bit data (color code of EH) (color code of FH) Figure 5.2 Color Lookup Table GA Lookup Table Mode The color mode is set to the lookup table mode by the sprite draw command. Ac- cording to this specification, the character patterns stored in VRAM with 4 bits/pixel are converted to color codes by referencing the specified color lookup table, and are written to the frame buffer. The storage address and size of the character pattern and the storage address in the color lookup table are specified by the sprite draw command. SE 62 Character Patterns In the lookup table mode a character pattern is 4 bits/pixel and is stored in VRAM. Command Tables nti The address of the color lookup table referenced by the sprite is specified in the color lookup table address (top address + 06H) of the command table. The specified value al is address/8H. Since the color lookup table is stored in boundaries of 20H-byte units, the lower two bits become 00B. The relationship between the command table, color lookup table and character pattern table is shown below. Command Table Lookup Table address Character address de nfi Character size Character Pattern Table 4-bit data Frame buffer Address Co Color Lookup Table Address GA 16-bit data Figure 5.3 Relationship between Tables in Lookup Table System SE VDP1 User's Manual 63 5.3 Gouraud Shading Table This table specifies RGB data for four points when processing Gouraud shading for Gouraud shading tables beyond 80000H. nti parts. The data for each of the four points is 16 bit, so 8 bytes are required for one table. The table is positioned where an 8H-byte boundary address begins, but do not write from 00000H to 0001FH. VRAM occupies up to address 7FFFFH. Do not define al The table defines RGB data for vertices (A), (B), (C), and (D), in that order. In the case of lines, only vertices (A) and (B) are valid and correspond to the start and end of the line. In the case of sprites, vertices (A), (B), (C), and (D) correspond to the upper-left, upper-right, lower-right, and lower-left. This table is referenced when Gouraud shading processing is specified. Table 5.2 Gouraud Shading Table Table address Table top address Table top address + 2 Table top address + 4 de Corresponding Vertices Sprites, polygons, polylines Vertex (A) Vertex (B) Vertex (C) Lines Line start point Line end point Ignored Table top address + 6 MSB nfi Vertex (D) LSB Ignored X B Co G R 4 3 2 1 0 4 3 2 1 0 4 3 2 1 0 Note: The MSB 1 bit is ignored. Figure 5.4 RGB Code Format Gouraud Shading GA Gouraud shading can be performed on parts drawn in RGB code. Gouraud shading specifies the amount of change in the luminance of each of R, G, and B, which are changed in RGB code parts in a Gouraud shading table. It is only effective on RGB color codes. The color cannot be guaranteed when Gouraud shading is specified for color bank color codes. Gouraud Shading Specification SE Gouraud shading is specified with color calculation bits. The color calculation bits are at bits 2~0 of the draw mode word at the top address + 04H of the command table. When Gouraud shading is specified, the address of the Gouraud shading table is specified. The top address/8H of the Gouraud shading table is positioned at the top address + 1CH of the command table. 64 Gouraud Shading Processing This specifies the data for the amount of change in R, G, and B for the four points (two points in the case of lines) of the part in the Gouraud shading table. The data nti interpolated for each of R, G, and B between the four points are added to the original color of the part. Because each of the values of R, G, and B takes the values 00H to 1FH, the result of subtracting 10H from the complementary RGB data is added to the al original color of the part. For example, if the value of RGB is 10H, the original color is left as is; if the value is 00H, the original color becomes –10H; and if the value is 1FH, then the original color becomes +0FH. If the value after color calculation be- comes less than 00H, then 00H is used; if it is larger than 1FH, then 1FH is used. The relationship between Gouraud shading table settings and correction values is shown as follows. 01H –0FH de Table 5.3 Relationship between Gouraud Shading Table Settings and Correction Values Table setting 00H 02H Correction for original data –10H –0EH Table setting 10H 11H 12H Correction for original data 0 +01H +02H 03H 04H 05H 06H 07H 08H 09H nfi –0DH –0CH –0BH –0AH –09H –08H –07H 13H 14H 15H 16H 17H 18H 19H +03H +04H +05H +06H +07H +08H +09H 0AH 0BH 0CH 0DH 0EH 0FH Co –06H –05H –04H –03H –02H –01H 1AH 1BH 1CH 1DH 1EH 1FH +0AH +0BH +0CH +0DH +0EH +0FH Real Gouraud shading changes only the luminance, but in this system it changes each of R, G, and B, and therefore in some cases the hue also changes. To avoid GA changing the hue, define the same value for each RGB for one point defined in the Gouraud shading table. By this means, white Gouraud shading is applied. Gouraud shading is performed on non-textured colors in the case of lines, polylines, and polygons and on colors referenced by the character pattern data or the color lookup table in the case of sprites. SE VDP1 User's Manual 65 5.4 Command Tables Command tables comprise 1EH (30) bytes. Because command tables are fetched every 20H (32) bytes, they should be defined with 20H boundaries. The 2 bytes following command tables are dummy bytes, and are skipped when the command table is fetched. Command tables stored in VRAM are fetched from the top address (00000H) every frame. A command table must always be stored at address 00000H to 0001EH. Drawing operation cannot be guaranteed when other than a command table (color ntial lookup table, Gouraud shading table, or character pattern table) is stored there. VRAM occupies up to 7FFFFH. Do not define Gouraud shading tables beyond address 80000H. CMDCTRL +00H CMDLINK +02H +04H CMDCOLR bit CMDPMOD MON 15 END 14 0 13 JP 0 12 HSS 11 Pclp 10 ZP Clip 9 8 LINK specification/8H Cmod Mesh 0 7 de ECD SPD 0 6 5 Dir Color mode 4 Color bank, color lookup table/8H (LSB is set to 00), non-textured color 3 2 Comm 1 0 0 0 Color calculation bit +06H CMDSRCA +08H CMDSIZE +0AH CMDXA +0CH CMDYA +0EH CMDXB 0 0 Code extension Code extension Code extension Character size X/8 nfi Character address/8H Character size Y Point (A) X coordinate (XA) * Point (A) Y coordinate (YA) Point (B) X coordinate (XB) 0 0 +10H CMDYB +12H CMDXC +14H CMDYC +16H CMDXD +18H CMDYD +1AH Code extension Code extension Code extension Code extension Code extension Co Point (B) Y coordinate (YB) Point (C) X coordinate (XC) Point (C) Y coordinate (YC) Point (D) X coordinate (XD) Point (D) Y coordinate (YD) CMDGRDA Gouraud Shading Table/8H +1CH +1EH (Dummy) Skipped during table fetch GA +20H Succeeding table : +40H Succeeding table : +60H : : * Note: The top bit of the vertex coordinate is a sign bit. A negative value is indicated by a complement of 2. Extend the sign for the upper 6 bits. SE Figure 5.5 Command Table 66 The order in which sprites and other parts are drawn is determined by how they are placed in the VRAM of this command table. last are the closest to the view point. nti Drawn parts processed first are the farthest from the view point, and parts processed al de nfi Co GA SE VDP1 User's Manual 67 (Page 68 is blank in the original Japanese document.) ntial de nfi Co GA SE 68 Chapter 6 Command Tables ntial Contents 6.1 CMDCTRL (Control Words) .............................................................70 de Commands ......................................................................... 71 Jump Mode ......................................................................... 72 Zoom Point ......................................................................... 73 Character Read Direction .................................................. 77 6.2 6.3 nfi CMDLINK (Link Specification) ........................................................ 78 CMDPMOD (Draw Mode Word) ...................................................... 79 High Speed Shrink .............................................................. 81 Pre-Clipping Disable .......................................................... 83 User Clipping Enable ......................................................... 84 Co User Clipping Mode ............................................................ 84 Mesh Enable ....................................................................... 85 End Code Disable ...............................................................86 Transparent Pixel Disable .................................................. 88 Color Mode ......................................................................... 89 Color Calculation................................................................. 93 GA MSB ON .............................................................................. 97 6.4 CMDCOLR (Color Control Word) .................................................... 98 Color Bank .......................................................................... 99 Color Lookup Table .......................................................... 101 Non-textured Color............................................................ 102 6.5 CMDSRCA (Character Address) ................................................... 103 SE 6.6 CMDSIZE (Character Size)............................................................ 104 6.7 CMDXA~CMDYD (Vertex Coordinate Data) ................................. 105 6.8 CMDGRDA (Gouraud Shading Table) .......................................... 106 Note: Refer to “5.4 Command Tables” for more information on command tables. VDP1 User's Manual 69 6.1 CMDCTRL (Control Words) CMDCTRL specifies commands and also controls command tables and specifies the inversion and zoom point of sprites. CMDCTRL is 16 bits at the top address + 00H of the command table, and its bit configuration is as follows. Set unused bits to “0.” bit 15 CMDCTRL +00H END 14 13 JP 12 11 10 ZP 9 8 7 0 6 0 5 Dir 4 nti 3 al2 Comm 1 0 End Bit (END): bit 15 Indicates the draw terminate command. If there is no draw terminate command, the command selection bit becomes valid. Jump Select (JP): bits 14~12 de Indicates the method by which the next command table to be read (fetched) is speci- fied. Zoom Point (ZP): bits 11~8 Character Read Direction (Dir): bits 5, 4 nfi Indicates the zoom point in the case of a scaled sprite draw command. The zoom point specifies the reference point for inversion and enlargement or reduction. Indicates the read direction from the character pattern table in the case of a texture draw command. Command Select (Comm): bits 3~0 Co Indicates the function of the command. When the end bit is a terminate command, command select is disabled. GA SE 70 Commands Commands are determined by the end bit (END, bit 15) of CMDCTRL and the command selection bit (Comm, bits 3~0). The commands set by the end bit and the VRAM is determined by the command. nti command selection bit are shown in Table 6.1. The content of the command table in Table 6.1 Commands END Comm al Bit 15 3 2 1 0 Function Commands 0 0 0 0 0 Textured draw Normal sprite draw command 0 1 command Scaled sprite draw command 1 1 0 1 0 0 1 0 0 0 1 0 0 Draw commands Register set de Non-textured draw command Distorted sprite draw command Polygon draw command Polyline draw command Line draw command Set command for user clipping Clipping coodinate coordinates 1 0 All other codes 0 1 0 1 0 0 commands nfi Draw end command set commands Set command for system clipping coordinates Local coordinate set command Setting prohibited (do not use) Co GA SE VDP1 User's Manual 71 Jump Mode The jump mode specifies the command table to be processed next and how to jump to the table. When the jump mode specifies the address and jumps to it, the address command table, 16 bits). nti of the command table (prior to jumping) is set to a CMDLINK (top address + 02H of Jump Mode (JP): top address + 00H of command table, bits 14~12 al Specifies the jump mode for jumping to the next command table to be processed. When the jump mode is skipped (bit 14 = 1), reading of the command table is termi- nated there and the table is not processed. There is 1 level of nesting by a jump call. Do not use jump calls in subroutines. JP Bit 14 0 0 0 0 13 0 1 1 0 12 0 1 0 1 Jump mode Jump next Jump assign Jump call Jump return de Automatically jumps to next table (address +20 H) a fter this table is processed (CMDLINK is ignored). Jumps to CMDLINK table after this table is processed. CMDLINK table receives subroutine call after this table is processed. Processing Returns to main routine after this table is processed 1 1 1 1 0 0 1 1 0 1 0 1 Skip next Skip assign Skip call Skip return nfi (CMDLINK is ignored). Jumps to next table (address +20H ) a fter this table is processed (CMDLINK is ignored). Jumps to CMDLINK table without processing this table. CMDLINK table receives subroutine call without processing this table. Returns to main routine without processing this table ignored. Co (CMDLINK is ignored). When jump assign, jump call, skip assign, or skip call is specified, the address of the table to be processed next is specified by CMDLINK. When jump next, jump return, skip next, or skip return is specified, CMDLINK is GA SE 72 Zoom Point Zoom point specifies the zoom point of the character when a scaled sprite is drawn enlarged or reduced. It functions only with scaled sprites. Zoom Point (ZP): top address + 00H of command table, bits 11~8 nti Zoom point specifies the fixed point of the character when a scaled sprite is drawn al enlarged or reduced. The relationship between the value of the zoom point and the fixed point is as follows. When the zoom point (ZP) is “0,” there is no zoom point, and drawing is performed by specifying the upper-left coordinates and the lower- right coordinates. Fix the zoom point to 0H for sprites other than scaled sprites. Bit 11 0 0 0 10 0 1 1 ZP 9 0 0 1 8 0 1 0 Code 0H 5H 6H de Zoom point Specifies two coordinates Upper-left Upper-center 0 1 1 1 1 1 1 1 0 0 0 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 7H 9H AH BH DH EH FH nfi Upper-right Center-left Center-center Center-right Lower-left Lower-center Lower-right Other than above +1 +2 Co +3 Setting prohibited (do not set) +4 The result of adding the vertical and horizontal values is the value GA of the zoom point. +8 +C Center line SE Figure 6.1 Zoom Point VDP1 User's Manual 73 When a value other than “0” is specified for the zoom point (ZP), the drawing posi- tion and drawing size of the sprite are determined by the zoom point (ZP), zoom point coordinates, and display width. The zoom point of a character whose zoom drawing size is determined by the display width (CMDXB, CMDYB). nti point is specified is drawn at the zoom point coordinates (CMDXA, CMDYA). The al When reduced, pixels are pulled out, and therefore the specified zoom point may disappear. Do not specify values other than those that have been established as the zoom point. Drawing cannot be guaranteed when values other than those that have been established are specified. Because the character size in the X direction is a multiple of 8, the zoom point will not be exactly in the center. When the length in the Y direction is an even value, the de zoom point will not be exactly in the center. When the length is an even number, the coordinates for the left side, right side, top, and bottom are calculated from point (A) and the display width, and therefore the position of the zoom point may shift. The direction of drawing of the character is specified by the read direction of the character. A negative value cannot be specified for the display width. Drawing cannot be guaranteed when a negative value is specified for the display width. Zoom Point Specification When ZP is other than 0H, the zoom point coordinates are specified by CMDXA and CMDYA and the display width is specified by CMDXB and CMDYB. bit 15 14 13 12 11 10 9 nfi 8 7 6 5 4 3 2 1 0 CMDXA +0CH CMDYA +0EH CMDXB +10H CMDYB +12H Code extension Code extension Code extension Code extension Co Zoom point, X coordinate (XA) Zoom point, Y coordinate (YA) Display, X width (XB) Display, Y width (YB) Specification of Coordinates for Two Points GA When ZP is 0H, coordinates for the upper-left and coordinates for the lower-right can be specified. Vertex (A) is specified by CMDXA and CMDYA, and vertex (C) is specified by CMDXC and CMDYC. bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 CMDXA +0CH Code extension Vertex (A), X coordinate (XA) CMDYA +0EH Code extension Vertex (A), Y coordinate (YA) SE +10H +12H CMDXC +14H CMDYC +16H Code extension Code extension : : Vertex (C), X coordinate (XC) Vertex (C), Y coordinate (YC) 74 Drawing Area The zoom point coordinates are specified by CMDXA and CMDYA. The zoom point specified by the Zoom Point (ZP) is drawn at the zoom point coordinates. The zoom point becomes the reference point when zooming the character. nti The display width is specified by CMDXB and CMDYB. The display width becomes the size drawn. al The area in which the character is drawn is determined by the zoom point bit, zoom point coordinates, and the display width. When the zoom point coordinate is (XA, YA) and the display width is (XB, YB), the drawing area is as shown in Figure 6.2. de Left side is zoom point, left side =XA, right side = XA + XB Center is zoom point, left side = XA-XB/2, right side = XA + (XB + 1)/2 Right side is zoom point, left side = XA-XB, right side = XA nfi Top side is zoom point, top side = YA, bottom side = YA + YB Center if zoom point, top side = YA-YB/2, bottom side = YA + (YB + 1)/2 Co Bottom side is zoom point, top side = YA-YB, bottom side = YA Values to the left of the decimal point are rounded off. Figure 6.2 Drawing Area GA SE VDP1 User's Manual 75 Zoom Point and Drawing Area When the zoom point coordinates are (100, 50) and the display widths are (40, 30), the coordinates for each of the vertices are as follows. A sprite for which vertical or and vertex (C) is (140, 80) when the zoom point (ZP) is 0H. nti horizontal inversion is not specified is assumed. In this case, vertex (A) is (100, 50) al de nfi Co GA SE Figure 6.3 Zoom Point and Drawing Area 76 Character Read Direction The read direction of the character can be specified. This specification makes it possible to invert the character vertically and horizontally. fied. nti Character Read Direction (Dir) Bits: Command table start address + 00H, bits 5, 4 al These bits specify the read direction of the character pattern. Vertical inversion, horizontal inversion, or simultaneous vertical and horizontal inversion can be speci- When bit 5 is “0,” the vertical (Y) direction is drawn as is, without inversion. When bit 5 is “1,” the character pattern is inverted vertically. When bit 4 is “0,” the horizontal (X) axis is drawn as is, without inversion. When bit other than sprites. de 4 is “1”, then the character pattern is inverted horizontally. When bits 4 and 5 are both “0”, then the character pattern is drawn as is with no inversion. When bits 4 and 5 are both “1”, then the character pattern is inverted both vertically and horizontally. Fix the character read direction to 00B for characters Y 0 0 Dir X 0 1 nfi Not inverted Inverted horizontally Inversion processing 1 1 0 1 A B CoInverted vertically Inverted vertically and horizontally Draw A B Original graphic Dir = 00B Dir = 01B Not inverted Inverted horizontally GA Dir = 10B Inverted vertically .... Dir = 11B Inverted vertically & horizontally Figure 6.4 Character Read Direction SE VDP1 User's Manual 77 6.2 CMDLINK (Link Specification) CMDLINK specifies the address of the command table to be processed next when assign or call is specified in the jump mode. The specification is made with the 16 bits at the top address + 02H of the command table. bit CMDLINK +02H 15 14 13 12 11 10 9 8 7 Link specification/8H 6 5 4 nti 3 al 2 1 0 0 0 CMDLINK: Top Address + 02H of Command Table When the command table being processed is completed, processing moves to the and processing moves to the next command table to be processed. de command table at the address of CMDLINK if the jump mode is set to assign, and if it is set to call, the command table at the CMDLINK address is called in a subroutine A value resulting from dividing the address in VRAM by 8H is specified with 16 bits as the address. Because command tables are stored in boundaries of 20H (32)-byte units, the lower 2 bits of CMDLINK become 00H. this CMDLINK is ignored. nfi When the jump mode specifies the next table or specifies return to the main routine, Co GA SE 78 6.3 CMDPMOD (Draw Mode Word) CMDPMOD enables or disables clipping, specifies mesh processing and the trans- 14 13 nti parent code, specifies the color mode, and controls color calculation and shade processing. It occupies the 2 bytes from the top address + 04H of the command table, and its bit configuration is as follows. Set unused bits to “0.” bit CMDPMOD 15 +04H MON 0 0 12 11 HSS Pclp 10 Clip 9 Cmod 8 Mesh 7 ECD al 6 SPD 5 4 3 Color mode 2 1 0 Color calculation bits High Speed Shrink (HSS): bit 12 Specifies whether speed or precision is given priority when scaled or distorted sprites are reduced and drawn. Pre-clipping Disable (Pclp): bit 11 de Specifies whether coordinate calculation, which judges whether clipping is required or not, is disabled or not. Clipping Mode Bit (Clip): bit 10 User Clipping Enable Bit (Cmod): bit 9 nfi Specifies whether or not the part is drawn according to the user clipping coordinates already set in the case of a part draw command. Specifies whether clipping is performed inside or outside the user clipping coordi- command. Co nates when user clipping is enabled (Clip = 1). Mesh Enable Bit (Mesh): bit 8 Specifies whether or not mesh processing is performed in the case of a part draw End Code Disable (ECD): bit 7 Specifies whether or not the end code of the character pattern is disabled. GA Transparent Pixel Disable (SPD): bit 6 Specifies whether or not the transparent pixel of the character pattern is disabled. Color Mode Bits: bits 5~3 Specifies the number of colors in which the sprite is drawn and how they are ex- pressed. SE VDP1 User's Manual 79 Color Calculation Bits: bits 2~0 Specifies color calculation of Gouraud shading, shadow, half-luminance, and half- transparent. MSB On Bit (MON): bit 15 nti Looks at the MSB of the sprite data in the VDP2 and performs shadow or window al processing. This bit is assigned when this function is used. Refer to the VDP2 manual for more information. de nfi Co GA SE 80 High Speed Shrink High Speed Shrink (HSS): bit 12 sprites are reduced and drawn. nti Specifies whether speed or precision is given priority when scaled or distorted This bit is only valid for drawing commands for scaled sprites and distorted sprites. Set it to “0” for other drawing commands. al When this bit is set to “1”, only the pixels at even or odd coordinates of the original picture data are sampled for lines to be reduced when drawn. The selection of even coordinates or odd coordinates is performed by the even/odd coordinate selection (EOS) bit of the frame buffer change mode register (FBCR). irrespective of even or odd coordinates. de When “1” is specified, the end code of the original picture is ignored regardless of whether the sprite is being enlarged or reduced. When “0” is specified, the original picture data is sampled at any magnification ratio Specify “0” to give precedence to precision of drawing even though operation may HSS nfi be slowed down, and specify “1” to give fast operation precedence over precision. 0 1 High speed shrink disabled High speed shrink enabled Processing Co GA SE VDP1 User's Manual 81 Original Picture •When HSS = 0 00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17 20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37 40 41 42 43 44 45 46 47 X3/8 X4/8 X5/8 X6/8 X7/8 Zooming nti Plotting Drawing 01 04 06 al 11 13 15 17 20 22 24 25 27 30 32 33 34 36 37 40 41 42 44 45 46 47 50 51 52 53 54 55 56 57 X1 50 51 52 53 54 55 56 57 60 61 62 63 64 65 66 67 X9/8 60 61 62 63 63 64 65 66 67 70 71 72 73 74 75 76 77 X10/8 70 71 72 72 73 74 75 75 76 77 •When HSS = 1, EOS = 0 00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17 20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37 de Sampling only even X coordinates 00 02 04 06 10 12 14 16 20 22 24 26 30 32 34 36 00 04 06 10 12 14 16 20 22 22 24 26 30 32 32 34 34 36 40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57 60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77 nfi 40 42 44 46 40 40 42 42 44 44 46 50 51 52 53 54 55 56 57 60 61 62 63 63 64 65 66 67 70 71 72 72 73 74 75 75 76 77 •When HSS = 1, EOS = 1 00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17 20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37 40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57 Co Sampling only odd X coordinates 01 03 05 07 11 13 15 17 21 23 25 27 31 33 35 37 41 43 45 47 01 05 07 11 13 15 17 21 23 23 25 27 31 33 33 35 35 37 41 41 43 43 45 45 47 50 51 52 53 54 55 56 57 60 61 62 63 64 65 66 67 60 61 62 63 63 64 65 66 67 70 71 72 73 74 75 76 77 70 71 72 72 73 74 75 75 76 77 GA Figure 6.5 High Speed Shrink SE 82 Pre-Clipping Disable Pre-Clipping Disable (Pclp): bit 11 information specified by the CPU. nti Specifies whether pre-clipping is enabled or disabled. When “0” is specified, pre- clipping is performed. When “1” is specified, pre-clipping is not performed. One drawing command comprises a group of several lines, and the respective lines al comprise a number of dots. Each dot is drawn based on clipping area (drawing area) For lines that are completely separated from the drawing area or if drawing of the entire line is not necessary and can be detected in advance, drawing efficiency can be raised by specifying the drawing not be started. Also, when one end of a line is outside the drawing area, efficiency can be improved by starting drawing from the drawing efficiency. de inside the drawing area (limited to vertical and horizontal lines). VDP1 normally performs this detection, but in the case of small elements whose points are in the (A)—(B) or (D)—(C) direction, the overhead required for that detec- tion (up to five CPU clock cycles for one line) becomes conspicuous and can lower to “0” for other commands. nfi In the case of large elements that extend greatly out of the drawing area, it is more efficient to perform pre-clipping. This bit is only valid for drawing commands. Set it Pclp Processing 0 1 Co Pre-clipping with horizontal inversion No pre-clipping and no horizontal inversion GA SE Figure 6.6 Pre-clipping VDP1 User's Manual 83 User Clipping Enable User Clipping Enable Bit (Clip): bit 10 This bit specifies whether or not the part is drawn according to the already set user clipping coordinates when the command is a draw command for a part. nti When the bit is “0,” the user clipping coordinates are ignored and the part is clipped and drawn according to the system clipping coordinates. When the bit is “1,” the al part is clipped and drawn according to the user clipping coordinates and the specifi- cation of the clipping mode bit (Cmod). Even when this bit is “1,” the part is clipped according to the system clipping coordinates. Both the user and system clipping coordinates become undefined after resetting. Therefore, the clipping register set command must be used to set the system clipping coordinates after resetting and to set the user clipping coordinates prior to the user clipping specification. User Clipping Mode Clipping Mode Bit (Cmod): bit 9 de Specifies whether drawing is performed inside or outside the user clipping coordi- nfi nates when user clipping is enabled (Clip = 1). When it is 0, drawing is performed inside. When it is 1, drawing is performed outside. When Cmod = 1, the user clipping rectangle (including the lines) already specified becomes the drawing area. When Cmod = 0, the drawing area does not include the lines of the rectangle. Co Cmod = 0 (inside drawing mode) Frame buffer Cmod = 1 (outside drawing mode) Frame buffer GA Upper-right coordinate of user clipping Drawing area Lower-right coordinate of user clipping Figure 6.7 Drawing Area SE Do not set this bit to “1” when user clipping is disabled (Clip = 0). Combinations of the user clipping enable bit and the clipping mode bit have the following results. Clip 0 0 1 1 Cmod 0 1 0 1 User clipping processing User clipping disabled Setting prohibited (do not set) Inside drawing mode Outside drawing mode 84 Mesh Enable Mesh Enable Bit: bit 8 This bit specifies whether or not mesh processing is performed when the command Mesh nti is a draw command for a part. When it is “0,” the part is drawn without mesh pro- cessing. When it is “1,” the part is drawn with mesh processing. 0 1 Mesh enable Draw without mesh processing Draw with mesh processing al When mesh processing is specified (Mesh = 1), every other pixel of the part is drawn to form a mesh. Only pixels for which (X coordinate value + Y coordinate value) is even (XLSB XOR YLSB = 0) are drawn, and odd pixels are skipped and not drawn. When the starting point of a 45° diagonal line is an odd coordinate, nothing is coordinate. de drawn. Nothing is drawn in some cases when the point of a 45° polyline is an odd 0 1 0 1 2 3 4 5 6 7 8 9 AB C DE F : not drawn 2 3 4 5 6 7 8 9 A nfi : drawn B C D E F Co Figure 6.8 Mesh Processing 0 1 2 34 5 67 8 9 ABC DEF GA 0 1 2 3 4 5 6 7 8 9 : not drawn : drawn This line is not drawn A This polyline is not drawn B SE C D E F Figure 6.9 Mesh Processing of Lines and Polylines VDP1 User's Manual 85 End Code Disable End Code Disable (ECD): bit 7 This bit specifies whether or not the end code of the character pattern is disabled. Set this bit to “1” for polygons, polylines, and lines. nti When it is “0,” the end code is enabled; when it is “1,” the end code is disabled. The end code disable bit is only valid for drawing sprites with a character pattern. al If a second end code is read in the horizontal direction during drawing of a character pattern when end code is enabled (ECD = 0), drawing of that row is terminated there and drawing moves to the head of the next row. End codes are not drawn and that pixel becomes transparent. When the end code is disabled (ECD = 1), the end code is processed in the same way as other color codes. the transparent pixel disable bit (SPD). de Drawing in the horizontal direction is terminated when an end code is read twice, and an end code is only processed in the horizontal direction of the character pattern and is not affected by the vertical direction. Processing is performed irrespective of When the end code is enabled (ECD = 0), it cannot be used for color display, and direction by HSS = 1. nfi therefore, the number of colors that can be used is reduced by one. Use caution. Use end code disable (ECD = 1) in the case of sprites reduced in the horizontal HSS 0 ECD 0 End code processing End code enabled: drawing in horizontal direction is disabled when second Co end code is read and end code becomes transparent. 0 1 End code disabled: end code is not processed, color of code is expressed. 1& 0 End code enabled: drawing in horizontal direction is disabled when second enlarge end code is read and end code becomes transparent. 1& 0 End code disabled: end code is not processed, reduce color of code is expressed. 1 1 End code disabled: end code is not processed, color of code is expressed. The relationship between the color mode and the end code is as follows. The number GA of bits of the end code differs depending on the color mode. Color mode End code 0 16 colors (color bank mode) FH ( 4 bits) 1 16 colors (lookup table mode) FH ( 4 bits) 2 64 colors (color bank mode) FFH ( 8 bits) 3 128 colors (color bank mode) FFH ( 8 bits) 4 256 colors (color bank mode) FFH ( 8 bits) 5 32,768 colors (RGB mode) 7FFFH (16 bits) SE 86 An example of end code processing is shown below. ntial de nfi Figure 6.10(a) End Code Processing (1 of 2) Co Since drawing is not allowed toward the outside from the end code when read from the left or right, place only a transparent pixel there. Therefore, when ECD = 0, SPD must equal 0. Do not use the combination ECD = 0 and SPD=1. The drawing direction may be inverted by pre-clipping. When using end codes in the original picture, do so as shown below. Place only transparent pixels toward GA the outside of end codes. Place one end code each at the right and left of pictures E E made up of non-transparent pixels 0 E E 1 E E Even if transparent pixels are included inside, only 2 E E 3 E E one end code each is placed to the far outside. E E 4 5 Two end codes are placed at either end of 6 lines comprising all transparent pixels. 7 0 1 2 3 4 5 6 7 8 9 AB CDE F Transparent pixel End codes are not placed in lines in which either SE both ends or one end is not a transparent pixel. E :End code :Other pixels Figure 6.10(b) End Code Processing (2 of 2) VDP1 User's Manual 87 Transparent Pixel Disable Transparent Pixel Disable (SPD): bit 6 This bit specifies whether or not the transparent pixel of the character pattern is and lines. nti disabled. When it is “0,” the transparent pixel is enabled; when it is “1,” the trans- parent pixel is disabled. The transparent pixel disable bit is only valid for drawing sprites with a character pattern. Be sure to set this bit to “1” for polygons, polylines, al When the transparent pixel is enabled (SPD = 0), transparent color codes in the character pattern become transparent pixels and are not drawn. When the end code is disabled (SPD = 1), the transparent color code is processed like other color codes. When the transparent pixel is enabled (SPD = 0), the number of colors that can be used decreases by one, so use caution. For example, only 14 colors can be displayed when ECD = 0, SPD = 0, and color mode = 0. SPD 0 1 Transparent pixel enable: Transparent pixel disable: de End code processing transparent color codes are not drawn; transparent color codes become transparent. transparent color code is not color mode. nfi processed, color of code is expressed. The relationship between the color mode and the transparent color code is as fol- lows. The number of bits of the transparent color code differs depending on the 0 1 2 3 4 5 Co Color mode 16 colors (color bank mode) 16 colors (lookup table mode) 64 colors (color bank mode) 128 colors (color bank mode) 256 colors (color bank mode) 32,768 colors (RGB mode) Transparent color code 0H ( 4 bits) 0H ( 4 bits) 00H ( 8 bits) 00H ( 8 bits) 00H ( 8 bits) 0000H (16 bits) GA SE 88 Color Mode Color Mode Bits: bits 5~3 These bits specify the method by which the number of colors to be drawn is ex- nti pressed. It is only valid for sprites. Set the color mode to 000B for non-textures. The possible color modes include the color bank mode, which specifies the color with a palette code and a color bank; the lookup table mode, which uses a color lookup al table; and the RGB mode, which specifies the luminance directly. In the color bank mode, the color can be selected from among 16, 64, 128, or 256 colors, depending on the number of bits of the pixel data. In the lookup table mode, the color can be selected from among 16 colors. And in the RGB mode, 32,768 colors can be drawn. The color mode bits are described in the following table. Bit 5 0 0 0 Color mode 4 0 0 1 3 0 1 0 Mode 0 1 2 Number of colors 16 16 64 de Description Color bank mode Mode Lookup table mode Color bank mode Bits per pixel 4 bits 4 bits 8 bits 0 1 1 1 0 0 1 0 1 Other than above 3 4 5 nfi 128 256 32,768 Color bank mode Color bank mode RGB mode Setting prohibited (do not set) 8 bits 8 bits 16 bits Co GA SE VDP1 User's Manual 89 Character Patterns in Each Mode Character patterns are stored in VRAM in each mode. An example is shown that is 8 horizontal pixels and 1 vertical pixel. Mode 0 This is the 16-color color bank mode. Color is expressed using palette codes and a nti color bank. One pixel is represented by 4 bits. 16 colors can be drawn. 4 bytes are al necessary to express 8 pixels. The data for 2 pixels are contained in 1 byte, and when there is no horizontal inversion, 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 the color bank added from the color bank word (top address + 06H of command table), resulting in 16-bit data being written to the frame buffer. When there are 8 bits/pixel (frame buffer rotation or high resolution), the lower 8 bits of the 16 bits are written to the frame buffer. The upper 8 bits are ignored. Because the draw pixel data is color bank code, color calculation cannot be performed. bit +00H 15 14 13 Pixel 0 12 11 10 1 9 8 7 6 de 2 5 4 3 2 3 1 0 Mode 1 +02H 4 5 nfi 6 This mode is the lookup table mode which uses a color lookup table. One pixel is represented by 4 bits. 16 colors can be drawn. The character data is the same as in mode 0. The data for 1 color of the 16-bit 16 colors stored in the color lookup table is 7 the frame buffer. Co selected with 4 bits and written to the frame buffer. When there are 8 bits/pixel (frame buffer rotation or high resolution), the lower 8 bits of the 16 bits are written to The address of the color lookup table is written to the lookup table address (top address + 06H of command table; also used as color bank word). Either color bank code or RGB code can be specified as the color code of the lookup table. However, RGB code is prohibited when there are 8 bits per pixel. GA +00H → +04H → Original picture with 8 horizontal pixels 0 8 1 9 2 A 3 B 4 C 5 D 6 E 7 ← +02H F ← +06H Figure 6.11 Example of Drawing in Modes 0 and 1 SE 90 Mode 2, Mode 3, Mode 4 Mode 2, mode 3, and mode 4 are respectively 64-color, 128-color, and 256-color palette bank modes. Colors are represented by palette code and a color bank. 256 colors can be drawn. 8 bytes are required to represent 8 pixels. nti One pixel is represented by 8 bits. In the respective modes, 64 colors, 128 colors, and al The palette code is represented by bits 6, 7, and 8, and upper bits 10, 9, and 8 are the color bank added from the color bank word (top address + 06H of command table), resulting in 16-bit data being written to the frame buffer. In mode 2 and mode 3, the respective upper 2 bits and upper 1 bit are ignored. When there are 8 bits/pixel (frame buffer rotation or high resolution), the lower 8 bits of the 16 bits are written to the frame buffer. Because the draw pixel data is color bank code, color calculation cannot be performed. bit +00H +02H +04H +06H 15 14 13 12 11 Pixel 0 2 4 6 10 de 9 8 7 6 5 4 1 3 5 7 3 2 1 0 +00H → +08H → Original picture with 8 horizontal pixels 0 8 nfi 1 9 2 A 3 B 4 C 5 D 6 E 7 ← +06H F ← +0EH Mode 5 Co Figure 6.12 Example of Drawing in Modes 2, 3, and 4 This is the 32,768-color RGB mode. The color is expressed by the respective lumi- nances of red, green, and blue (RGB). One pixel is represented by 16 bits. It is pos- sible to draw 32,768 colors. 16 bytes are required to express 8 pixels. The RGB code is represented by a MSB (value 1), which indicates that the code is GA RGB code, and the respective luminances of R, G, and B are represented by 5 bits each. The respective luminances of R, G and B are represented by the values 00H to 1FH. The closer the value is to 00H, the darker the color; the closer it is to 1FH, the brighter the color. When all of R, G, and B are 00H, the value is 8000H, which repre- sents black; when all are 1FH, the value is FFFFH, which represents white. RGB codes are written in their original 16-bit form to the frame buffer. When there are 8 bits/pixel (frame buffer rotation or high resolution), this mode cannot be used. SE Color calculation can be performed on RGB code. VDP1 User's Manual 91 bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 +00H Pixel 0 (upper byte) Pixel 0 (lower byte) nti +02H 1 (upper byte) 1 (lower byte) +04H 2 (upper byte) 2 (lower byte) +06H 3 (upper byte) 3 (lower byte) +08H 4 (upper byte) 4 (lower byte) al +0AH 5 (upper byte) 5 (lower byte) +0C H 6 (upper byte) 6 (lower byte) +0EH 7 (upper byte) 7 (lower byte) MSB LSB 1 B G R 4 3 Note: The MSB is 1. Table 6.2 Pixel Data 2 1 0 4 3 2 1 0 Figure 6.13 RGB Code Format 4 3 de 2 1 0 Pixel data 0000H 0001H : 7FFEH 7FFFH 8000H Transparent color code Setting prohibited (Do not set in RGB mode) (Palette bank code) End code nfi Draw data : FFFFH RGB code +00H → +10H → Original picture with 8 horizontal pixels 0 8 Co 1 9 2 A 3 B 4 C 5 D 6 E 7 ← +0EH F ← +1EH GA Figure 6.14 Example of Drawing in Mode 5 SE 92 Color Calculation Color Calculation Bits: bits 2~0 These bits specify Gouraud shading, shadow, half-luminance, and half-transparency. The functions of each of the bits are as follows. Bit 2 1 0 Function Gouraud shading enable bit 1/2 original graphic enable bit 1/2 background enable bit ntial Color calculation is performed on sprites or non-textured pixel data to be drawn and on pixel data already drawn in the frame buffer. Except for color calculation of replace and shadow, color calculation can only be anteed. de performed when the color code of the original picture is RGB code. Color calculation can be executed when the color code is color bank code, but the results are not guar- In the case of sprites, color calculation can be performed when the color mode is mode 1 (lookup table mode) and the color code of the color lookup table is RGB nfi code, or when the color mode is mode 5 (RGB mode). Color calculation can be per- formed for non-textured colors when the color code is RGB code. In color calculation of parts with an original picture, the transparent code is valid when SPD = 0 and the end code is valid when ECD = 0, and therefore color calcula- tion cannot be performed on those pixels. Co Color calculation for polygons, polylines, and lines is enabled only when the non- textured color is RGB code. Color calculation cannot be performed when there are 8 bits/pixel (high resolution or rotation 8). GA SE VDP1 User's Manual 93 Color Calculation Color calculation includes replace, shadow, half-luminance, half-transparent, Gouraud shading, and the combination of half-luminance with Gouraud shading and half-transparent with Gouraud shading. These are specified as follows. calculation 2 0 0 Color (in Bit) 1 0 0 0 0 1 Background MSB — 0 1 Original graphic 1 0 01 Background 0 1 1/2 Type of color calculation Replace Cannot rewrite Shadow ntial Usable modes Original graphic Not restricted Not restricted Background Not restricted Not restricted RGB 0 1 0 — 1/2 0 Half-luminance RGB Not restricted 0 1 1 0 1 0 Replace RGB Not restricted 1 1/2 1/2 Half-transparent RGB 1 0 0 — Gouraud 0 Gouraud shading RGB Not restricted 1 1 1 Notes 0 1 1 1 0 1 — — 0 1 —: doesn’t matter — Gouraud 1/2 Gouraud Gouraud 1/2 — 0 0 1/2 de Setting prohibited (do not set) Gouraud shading + half-luminance 2 Gouraud shading Gouraud shading + half- transparent 3 — RGB RGB — Not restricted Not restricted RGB half. nfi Original graphic: sprite or pixel data to be drawn in non-textured color. Background: pixel data already drawn in the frame buffer. 1Original graphic (transparent pixels, end code) is referenced. 2Data that has undergone saturation processing after Gouraud calculation is reduced by 3Background is added to data that has undergone saturation processing after Gouraud calculation is reduced by half. Replace (Color Calculation Mode = 0) Co Color calculation is not performed for replace. Parts to be drawn are written, as is, to the frame buffer. Pixel data already written to the frame buffer are not affected. Color calculation cannot be performed when there are 8 bits/pixel, so replace should be specified. Shadow (Color Calculation Mode = 1) GA Processing differs depending on the MSB of the pixel data already written to the frame buffer. When the MSB of the frame buffer is “0,” processing of color calcula- tion, including replace, is not performed and the frame buffer is left as is. When the MSB of the frame buffer is “1,” shadow is performed. In shadow, pixel data already written to the frame buffer is subjected to color calcu- lation. The area in the frame buffer on which color calculation is to be performed is sought from the character pattern and its draw coordinates in the case of sprites, and SE from the draw coordinates in the case of non-textures. The luminance of pixel data already written in the frame buffer in the area where the part is to be drawn becomes one half for each of R, G, and B. Shadow does not change the MSB of the background. Transparent areas remain transparent. 94 Shadow halves the luminance of pixels in the frame buffer. To make the luminance one fourth, set the same command table in VRAM twice. To make it one eighth, set the same command table in VRAM three times. performed. nti In shadow, calculation is performed on the pixel data read from the coordinates to which the pixel data of the original graphic is written. Drawing in this case slows al down, so use caution—It takes six times longer than when color calculation is not Half-Luminance (Color Calculation Mode = 2) Half-luminance halves the luminance of each of R, G, and B of the pixel data of the part to be drawn. Pixel data already written to the frame buffer is not affected. Half-Transparency (Color Calculation Mode = 3) de Processing differs depending on the MSB of the frame buffer. When the MSB is “0,” replace is performed. When the MSB of the frame buffer is “1,” half-transparency results. In half-transparency, one half (average) the sum of the data of the original graphic and the background is written to the frame buffer. not performed. nfi Color calculation of half-transparency is performed on the pixel data of the original graphic and the pixel data read from the write coordinates. Drawing in this case slows down, so use caution—it takes six times longer than when color calculation is Gouraud Shading (Color Calculation Mode = 4) Co Processes Gouraud shading using the RGB code set in the Gouraud shading table. Pixel data already written to the frame buffer is not affected. The Gouraud shading table address is specified by CMDGRDA (top address + 1CH of command table). Gouraud Shading + Half-luminance (Color Calculation Mode = 6) Gouraud shading + half-luminance is processing that combines half-luminance with Gouraud shading. The part undergoes half-luminance processing after receiving Gouraud shading processing. GA Gouraud Shading + Half-Transparency (Color Calculation Mode = 7) Processing differs depending on the MSB of the frame buffer. When the MSB of the frame buffer is “0,” Gouraud shading is performed. When the MSB of the frame buffer is “1,” Gouraud shading + half-transparency is performed. SE VDP1 User's Manual 95 Original Graphic In parts (sprites) with an original graphic, color calculation other than shadow is enabled only in the RGB mode (lookup table is RGB code in color mode 1 and color be guaranteed. nti mode 5). If not in the RGB mode (characters in color bank mode), the results cannot In color calculation of parts with an original graphic, the transparent code is enabled when SPD = 0 and the end code is enabled when ECD = 0; therefore color calcula- tion of that pixel cannot be performed. al When color calculation other than shadow is performed in the RGB mode (color mode 5) and when SPD = 1, the result for pixels with transparent color code (0000H) of the original graphic cannot be guaranteed. They are treated as black in color calculation. tured color is enabled only for RGB code. de When color calculation other than shadow is performed in the RGB mode (color mode 5) and when ECD = 1, the result for pixels with end code (7FFFH) of the origi- nal graphic cannot be guaranteed. They are treated as white in color calculation. In color calculation other than shadow on polygons, polylines, and lines, non-tex- Original graphic nfi Background MSB = 0 MSB = 1 (Palettes, etc.) (RGB, etc.) Replace Co Color Calculation mode= 0 Color Calculation mode= 2 Color Calculation mode= 1 Shadow Color Calculation mode= 3 Half- Replace Luminance Half- Luminance GA Color Calculation mode= 4 Gouraud Color Calculation= 6 Color Calculation mode= 5 Setting Prohibited Color Calculation mode= 7 Gouraud+Half- Gouraud SE Luminance Gouraud+Half- Transparent Figure 6.15 Examples of Color Calculation 96 MSB ON MSB ON Bit (MON): bit 15 MON 0 1 Processing nti MSB of pixel data in frame buffer is not changed Sets MSB of pixel data in frame buffer to 1 al When a mode is set in which the VDP2 uses shadow (drops luminance of pixel data in scroll screen) or window (displays a different screen in the specified area), shadow and window processing are performed when the most significant bit (MSB) is “1.” Set the MSB to “1” (ON) for the pixels already written to the frame buffer. The color code is valid only when the frame buffer is color bank code (this is because the MSB replace for color calculation. de is used for shadow enable and window enable in the VDP2, eliminating an RGB recognition bit), thus making it impossible to perform color calculation. Specify In the case of textured parts, this can be used only when the original graphic data has or does not have pixels (no pixels for transparent and end codes and pixels for drawing. nfi everything else), and therefore RGB code or color bank code can be used as the color code. In the case of non-textured parts, the non-textured color is not reflected in the Do not specify color calculation (specify replace instead) when the MSB is set to “1.” When the MSB is set to “1,” color calculation has no meaning and processing takes a Co long time, so use caution. For parts that undergo mesh processing, the MSB is set to ON in the mesh condition. An example of MSB ON is shown below. When MSB is ON in distorted sprite Original graphic The MSB of the data in the GA frame buffer in this area becomes "1". Since it becomes "1" whether or not it is already drawn, the address becomes 0000H →8000H, so Transparent use caution. Figure 6.16 MSB ON SE VDP1 User's Manual 97 6.4 CMDCOLR (Color Control Word) CMDCOLR specifies the color of the part. The function differs depending on the part and the color mode. It specifies the color bank, the color lookup table address, or non-textured colors. CMDCOLR is at the top address + 06H of the command table and is 16 bits. bit 15 CMDCOLR +06H 14 13 12 11 10 9 8 7 6 5 4 ntial3 2 Color bank, color lookup table/8H (LSB fixed at 00), non-textured colors 1 0 CMDCOLR: top address + 06H of command table When a textured part is in the color bank mode, color bank is specified; when it is a textured part in the lookup table mode, the lookup table address is specified, and part in the RGB mode, this word is ignored. de when it is a non-textured part, a non-textured color is specified. When it is a textured Table 6.3 CMDCOLR Part Color mode Color bank mode Color bank CMDCOLR Textured part Lookup table mode RGB mode Non-textured part nfi Lookup table address Ignored Non-textured color Co GA SE 98 Color Bank • Color banks are bits added to the upper bit when the pixel data of the character the color bank mode. nti pattern are written to the frame buffer when the color mode of a textured part is • Color bank is specified using 16 bits, but the lower 4 bits must be fixed at “0.” al Depending on the color mode, 12, 10, 9 or 8 bits are added. Figure 6.17 shows the addition of bits. • When there are 16 bits/pixel, the data is written to the frame buffer as is. When there are 8 bits/pixel, the lower 8 bits are written. Color bank 16-color mode Color Bank Color Bank Upper 12 bits 64-color mode Color Bank Upper 10 bits de 0 0 0 0 lower44bits Fix lower color banktoto colorbank Bit dataofofcharacter Bit data bitsofof "0". "0". character 128-color mode nfi Color Bank Upper 9 bits 256-color mode Color Bank Upper 8 bits When 16 bits/pixel When 8 bits/pixel pattern pattern for which lower lower bits are defined is is written frame buffer. Written for bits which are writtentotothe defined the the the Writtentotoframe framebuffer. Co RGB mode: Data of defined character patterns is written to frame buffer. Lookup table mode: Data of lookup table referenced from defined character patterns is written to frame buffer. buffer GA Figure 6.17 Color Bank SE VDP1 User's Manual 99 • The data written to the frame buffer are transferred to the VDP2 as is (16-bit data) when the data written to the frame buffer become the display buffer in the next frame. nti • Table 6.4 shows the relationship between the color bank, defined character pat- tern data, and draw frame buffer data. al Table 6.4 Example of Relationship of Defined Data and Draw Data to Color Bank de nfi Co Note: The shaded areas represent color bank code. GA SE 100 Color Lookup Table • Defines the address of the color lookup table. • When the color mode is the lookup table mode, the 4-bit data of the character lookup table, and is written to the frame buffer. nti pattern of textured parts is converted to 16-bit pixel data by referencing the color • The color lookup table defines 16-bit color codes for 16 colors. The 16-bit data in al the table is written as is to the frame buffer, and therefore there is no distinction between palette bank code and RGB code in the character pattern of textured parts. When read to the VDP2, the code is handled as color bank code when the MSB of the 16 bits is “0,” and as RGB code when it is “1.” • The color lookup table address defines the address/8H of the color lookup table. Because the color lookup table is defined with 20H-byte boundaries, the two LSBs of the lookup table address are fixed at “00.” Character pattern de 16-color color lookup table specified by table address +00H 16-bit data (0Hcolor code) Frame buffer Defined 4-bit data +02H +04H : : +1CH nfi 16-bit data 16-bit data : : 16-bit data (1Hcolor code) (2Hcolor code) : : (EHcolor code) Drawn 16-bit data Co +1EH 16-bit data (FHcolor code) The 16-bit data of the color lookup table selected with the 4 bits of the character pattern is written as is to the frame buffer as pixel data. Figure 6.18 Color Lookup Table GA SE VDP1 User's Manual 101 Non-Textured Color • Non-textured color defines the color of non-textured parts. • In the case of a non-textured part, the non-textured color is written, as is, to the frame buffer as pixel data. nti • Non-textured colors are not related to transparent color codes and end codes. • When the display mode is 8 bits/pixel, the lower 8 bits become valid. Only palette bank codes can be specified at this time. al • When color calculation (except shadow) is performed on non-textured parts, be sure to set RGB code for the non-textured color. de nfi Co GA SE 102 6.5 CMDSRCA (Character Address) • CMDSRCA specifies the address that defines the character pattern. 14 13 nti • CMDSRCA is valid for texture draw commands. The address is specified with 16 bits at the top address + 08H of the command table. Set unused bits to “0.” CMDSRCA bit 15 +08H 12 11 10 9 8 7 Character address/8H 6 al 5 4 3 2 1 0 0 0 • Specifies an address that defines the character pattern drawn by the texture draw command. • This is an address in VRAM of the character pattern to be drawn, and the value acter pattern is specified. de resulting from dividing the address by 8H is specified with 16 bits. • The character address specifies the top address at which the pixel data of the defined character pattern is stored. The pixel data of the upper-left point of the character pattern is at the top address. Even if the character is rotated or inverted horizontally or vertically, the address of the upper-left point of the defined char- depending on the color mode. nfi • The content of the pixel data of the character pattern is 4, 8, or 16 bits/pixel, • The size of the table is specified by CMDSIZE (Character size). • Because the character pattern table is defined with 20H-byte boundaries, the two LSBs are fixed at “00B.” Co GA SE VDP1 User's Manual 103 6.6 CMDSIZE (Character Size) CMDSIZE specifies the size of the defined character pattern. CMDSIZE is valid for texture draw commands. It is specified with 16 bits at the top address + 0AH of the command table. Set unused bits to “0.” bit 15 CMDSIZE +0AH 0 14 0 13 12 11 10 9 Character size X/8 8 7 6 5 4 nti 3 al Character size Y 2 1 0 • The character size is defined in multiples of 8 horizontally (X) and in 1-pixel units vertically. • Horizontally, values from 1 to 63 can be specified with 5 bits. Because the size is not specify “0.” de specified in 8-pixel units, sizes from 8 to 504 pixels can actually be specified. Do • Vertically, values from 1 to 255 can be specified with 8 bits. Do not specify”0.” Horizontal size: 8~504 pixels Vertical size: 1~255 pixels nfi Co Figure 6.19 CMDSIZE • Table 6.5 shows the relationships between the values defined in the command table and the number of drawn pixels. GA Table 6.5 Relationships between Settings and Drawn Pixels Horizontal (X) direction Vertical (Y) direction Setting in command Number of pixels Setting in command Number of pixels table actually drawn table actually drawn 0 Setting prohibited 0 Setting prohibited 1 8 1 1 2 16 2 2 : : : : 63 504 255 255 SE 104 6.7 CMDXA~CMDYD (Vertex Coordinate Data) 13 nti The coordinates of clipping areas, the point coordinates for drawing sprites and other coordinates are specified by CMDXA~CMDYD. The coordinates for a maxi- mum of four vertex (X coordinates, Y coordinates) can be specified. They are defined in the 16 bytes (8 words) from the top address + 0CH to 1AH of the command table. bit 15 CMDXA +0CH 14 12 Code extension 11 10 9 8 7 6 al 5 4 Vertex (A), X coordinates (XA) 3 2 1 0 CMDYA +0EH Code extension Vertex (A), Y coordinates (YA) CMDXB +10H Code extension Vertex (B), X coordinates (XA); or display, X width (XB) CMDYB +12H CMDXC +14H CMDYC +16H CMDXD +18H CMDYD Code extension Code extension Code extension Code extension de Vertex (B), Y coordinates (YA); or display, Y width (YB) Vertex (C), X coordinates (XC) Vertex (C), Y coordinates (YC) Vertex (D), X coordinates (XD) +1AH Note: Code extension nfi Vertex (D), Y coordinates (YD) The top bit of the vertex coordinates is a sign bit. A negative value is indicated by a complement of two. Extend the code with the upper 6 bits. • Each of the coordinates is specified CMDXA~CMDYD with 16 bits. A negative value is specified by a complement of 2. The range that can be specified is -1024 written to them. Co to 1023. The upper 5 bits are code-extension bits, and the same value as bit 10 is • The meaning of CMDXA~CMDYD differs depending on the command. Table 6.6 shows the correspondence between the commands and CMDXA~CMDYD. For more information, refer to the section for each command in chapter 7. Table 6.6 Correspondence between Commands and CMDXA~CMDYD Command CMDXA CMDXB CMDXC CMDXD GA CMDYA CMDYB CMDYC CMDYD Normal sprite draw command Vertex (A) — — — Specify coordinates Scaled sprite draw for two points Vertex (A) — Vertex (C) — command (two methods) Specify fixed point Zoom point Display width — — coordinates Distorted sprite draw command Vertex (A) Vertex (B) Vertex (C) Vertex (D) Polygon draw command Vertex (A) Vertex (B) Vertex(C) Vertex (D) Polyline draw command Vertex (A) Vertex (B) Vertex (C) Vertex (D) SE Line draw command User clipping coordinate set command System clipping coordinate set command Local coordinate set command Note: "—" indicates unused. Vertex (A) Upper-left coordinates — Local coordinates Vertex(B) — — — — Lower-right coordinates Lower-right coordinates — — — — — VDP1 User's Manual 105 6.8 CMDGRDA (Gouraud Shading Table) 1. Specifies the address of the Gouraud shading table. 2. The Gouraud shading table address is valid when Gouraud shading processing is specified for color calculation and is specified with 16 bits at the top address + 1CH of the command table. bit 15 CMDGRDA +1CH 14 13 12 11 10 9 8 7 6 Gouraud shading table/8H 5 4 nti 3 al 2 1 0 3. The address of the Gouraud shading table is divided by 8H and is specified with 16 bits. defined with 8H-byte boundaries. de 4. The Gouraud shading table is a table for Gouraud shading processing, and it defines the amount of change in the luminances of R, G, and B at four vertices (two points for lines). The size of the table is 8H bytes (4 words), and the table is nfi Co GA SE 106 Chapter 7 Commands ntial de nfi Contents 7.1 7.2 Co System Clipping Coordinate Set Command ..................................110 System Clipping ................................................................ 111 User Clipping Coordinate Set Command ....................................... 112 User Clipping .................................................................... 113 7.3 Local Coordinate Set Command .................................................... 116 GA Local Coordinates ............................................................. 117 7.4 Normal Sprite Draw Command ...................................................... 118 7.5 Scaled Sprite Draw Command...................................................... 120 Specification of Two Coordinate Points ............................ 120 Specification of Zoom Point ............................................. 122 7.6 Distorted Sprite Draw Command .................................................. 124 SE 7.7 Polygon Draw Command ............................................................... 126 7.8 Polyline Draw Command ............................................................... 128 7.9 Line Draw Command ..................................................................... 130 7.10 Draw End Command ..................................................................... 132 VDP1 User's Manual 107 Page 108 was blank in the original document. ntial de nfi Co GA SE 108 Commands are determined by the end bit and the command selection bits. Table 7.1 lists the commands. Table 7.1 Commands END Bit 15 0 3 1 Comm 2 0 1 0 1 0 0 1 0 Coordinate set commands Function Clipping coordinate set commands ntial User clipping coordinate set command System clipping coordinate set command Local coordinate set command Command 0 0 0 0 Texture Normal sprite draw command 0 1 draw Scaled sprite draw command 1 0 commands 1 0 1 0 0 0 1 0 0 1 0 0 Draw commands Non-texture draw de commands Distorted sprite draw command Polygon draw command Polyline draw command Line draw command Draw terminate command nfi Co GA SE VDP1 User's Manual 109 7.1 System Clipping Coordinate Set Command drawn. Clipping includes system clipping, which sets the drawing area for the nti Clipping is the removal of graphics outside the set display area so that they are not system, and user clipping, which makes it possible to freely set the clipping area using software. al When the command select bits (bits 3 to 0) are 1001B, the system clipping coordinate set command is set; when they are 1000B, the user clipping coordinate set command is set. The contents of the system clipping coordinate set command table are shown in the following figure. CMDCTRL CMDLINK bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 +00H 0 +02H +04H JP 0 0 0 0 0 0 0 0 1 0 0 1 Link specification/8H 0 0 de (0,0) TV +06H +08H +0AH +0CH +0EH +10H +12H nfi Lower-right Coordinate System clipping area CMDXC CMDYC Co +14H 0 0 0 0 0 0 Lower-right X coordinate (XC) Upper-left coordinates are fixed at (0,0). +16H 0 0 0 0 0 0 0 Lower-right Y coordinate (YC) +18H +1AH +1CH Note: is ignored. The system clipping coordinate set command is defined as follows: CMDLINK. GA • When the end bit (bit 15) is set to 0B and the command select bits are set to 1001B, the system clipping coordinate set command is enabled. • The jump mode is specified. When the jump mode is assigned or called, the ad- dress of the command table to be processed next is divided by 8H and is set in • The lower-right coordinates of the clipping area are defined by CMDXC, CMDYC. The upper-left coordinates are fixed at (0,0). The lines of the rectangle (quad- SE rangle) represented by the upper-left coordinates (0,0) and the lower-right coordi- nates (XC, YC) and inside the rectangle make up the drawing area. 110 System Clipping System clipping coordinates are always valid when drawing, so that outside the set coordinates are fixed at (0,0). nti area is clipped; that is, the area inside the coordinates is drawn. Clipping processing is performed in a rectangle. The coordinates are specified by defining the values of the lower-right coordinates (XC, YC) in the command table, since the upper-left al Because the clipping coordinates are not checked, they should be set in advance so that XC ≥ 0 and YC ≥ 0. Operation cannot be ensured if XC < 0 or YC < 0. Points on the clipping line are treated as being inside the clipping area and are drawn. The clipping coordinate set command rewrites the internal clipping coordinate register. Parts subsequent to rewriting are drawn by referencing those values. set before drawing starts. de Because this command can be defined in any number in one frame, it is possible to give part groups different clipping coordinates. The system clipping coordinates become undefined after powering on or after resetting, and therefore they must be (a) System clipping setting (0,0) nfi System clipping area Co (lower-right coordinate (C)) Inside the area is displayed TV (b) Incorrect system clipping setting (lower-right System clipping area GA coordinate (C)) (0, 0) Operation cannot be ensured when XC < 0 or YC < 0 SE Figure 7.1 System Clipping TV VDP1 User's Manual 111 7.2 User Clipping Coordinate Set Command User clipping coordinates can be freely set using software. When the command selection bits are 1000B, the user clipping coordinate set command is enabled. The contents of the user clipping coordinate set command table are shown in the follow- ing figure. bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ntial CMDCTRL 0 JP 0 0 0 0 0 0 0 0 10 0 0 +00H Upper-left CMDLINK +02H Link specification/8H 0 0 coordinate TV +04H CMDXA +06H +08H +0AH +0CH CMDYA +0EH +10H 0 0 0 0 0 0 0 0 0 0 0 0 0 Upper-left X coordinate (XA) Upper-left Y coordinate (YA) de Lower-right coordinate User clipping area System clipping area +12H CMDXC +14H 0 0 0 0 0 0 CMDYC +16H 0 0 0 0 0 0 0 +18H +1AH +1CH nfi Lower-right X coordinate (XC) Lower-right Y coordinate (YC) Note: Co is ignored. The user clipping coordinate set command is defined as follows: • When the end bit is set to 0B and the command selection bits are set to 1000B, the user clipping coordinate set command is enabled. • The jump mode is then specified. When the jump mode is assign or call, the address of the command table to be processed next is divided by 8H and set in CMDLINK. GA • The upper-left coordinates of the clipping area are defined as vertex (A) (CMDXA, CMDYA), and the lower-right coordinates are defined as vertex (C) (CMDXC, CMDYC). The rectangle (quadrangle) represented by the upper-left coordinates (XA, YA) and the lower-right coordinates (XC, YC) is the clipping area. User clipping is enabled, and whether the inside or the outside of the area is clipped is determined by the draw mode of the draw command for the part. SE 112 User Clipping User clipping can be selected using software, and it is possible to specify whether or not user clipping is enabled for each part and whether the outside of the set area or the inside of the set area is clipped. nti User clipping coordinates can be enabled or disabled using the user clipping enable al bit (Clip bit, bit 10 at top address + 04H of command table). When this bit is dis- abled, the user clipping coordinates become disabled, and parts are only clipped by the system clipping coordinates. When the user clipping coordinates are enabled, parts are clipped by both the system clipping coordinates and the user clipping coordinates. When user clipping is enabled, user clipping can be set to the inside drawing mode is performed regardless of user clipping. de or the outside drawing mode with the clipping mode bit (Cmod bit, bit 9 at top address + 04H of command table). When set to the inside drawing mode, only those parts inside the area set by the user clipping coordinates are drawn; when set to the outside drawing mode, the area outside the coordinates is drawn. System clipping The clipping coordinates form a rectangle. The coordinates are the upper-left coordi- nfi nates (XA, YA) and the lower-right coordinates (XC, YC), and they are specified by defining the values of the coordinates of these two points in the command table. Because the clipping coordinates are not checked, they must be set in advance so that XA ≤ XC and YA ≤ YC. Operation cannot be guaranteed if XC < XA or YC < YA. Set the user clipping coordinates inside the set area (including on-line) of the system Co clipping coordinates. Operation cannot be guaranteed when the user clipping coor- dinates are set beyond the set area of the system clipping coordinates. Points on the clipping line are treated as being inside the clipping area. They are drawn in the inside drawing mode and not drawn in the outside drawing mode. Two or more user clipping commands can be set in the same frame. The clipping coordinate set commands rewrite the internal clipping coordinate registers. Parts subsequent to rewriting are drawn by referring to these values. GA Because the user clipping coordinates become undefined after powering on or after resetting, they must be set before drawing starts. SE VDP1 User's Manual 113 (a) User clipping setting (upper-left coordinate (A)) (lower-right coordinate (C)) User clipping area Set so that XA ≤ XC, YA ≤ YC. ntial TV System clipping area (b) Incorrect user clipping setting (lower-right coordinate (C)) User clipping area de Operation cannot be ensured if XC < XA or YC < YA. TV (upper-left coordinate (A)) System clipping area nfi Co Figure 7.2 User Clipping Settings GA SE 114 (a) User clipping disabled nti (upper-left coordinate (A)) User clipping area Since user clipping is disabled, the inside of the (lower-right coordinate (C)) system clipping area is drawn. TV System clipping area (b) Inside drawing mode al User clipping area TV (A) (C) System clipping area de When user clipping is enabled and the inside drawing mode is set, the inside of the user clipping area is drawn. (c) Outside drawing mode (A) nfi (C) User clipping area When user clipping is enabled and the outside drawing mode is set, the area inside the system clipping area and Co TV (d) Setting prohibited System clipping area outside the user clipping area is drawn. User clipping area Be sure to set the user clipping area inside the system clipping area. GA TV System clipping area Operation cannot be ensured when it is set outside the system clipping area. Figure 7.3 User Clipping SE VDP1 User's Manual 115 7.3 Local Coordinate Set Command The local coordinate set command makes the coordinates specified by the draw command local coordinates, and then makes them drawing coordinates by adding the value specified by the local coordinate command. When the command selection bits are 1010B, the local coordinate set command is enabled. The contents of the command table are as shown in the following figure. ntial bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 CMDCTRL +00H 0 JP 0 0 0 0 0 0 0 0 1 0 1 0 CMDLINK +02H CMDXA CMDYA +04H +06H +08H +0AH +0CH +0EH Link specification/8H Code extension Code extension 0 0 Local X coordinate (XA) de Local Y coordinate (YA) (0,0) Local Coordinates (A) TV +10H +12H +14H +16H +18H +1AH nfi System clipping area +1CH Note: Co is ignored. The local coordinate set command is defined as follows. • When the end bit is set to 0B and the command selection bits are set to 1010B, the local coordinate set command is enabled. • The jump mode is then specified. When the jump mode is assigned or called, the CMDLINK. GA address of the command table to be processed next is divided by 8H and set in • The local coordinates are defined in CMDXA, CMDYA. SE 116 Local Coordinates Local coordinates are set in the local coordinate register. The values of the local coordinates are added to the coordinates specified by the draw command, and they drawing coordinates as a reference. nti become the drawing coordinates. Parts are drawn in the frame buffer using the al When the local coordinates are (0,0), the part is drawn at the coordinates specified by the draw command using the upper-left corner of the screen as (0,0). When (0,0) is set approximately in the center of the screen, (160,112) are specified as the local coordinates. Because the local coordinates are retained in the register until they are set again, in order to move the coordinates of several parts and draw them together, the local de coordinates are set before their respective draw commands. Coordinate comparison in clipping is processed using the value resulting from adding these local coordinates to the coordinates specified by drawing of the part. Furthermore, because the local coordinates are not added to the clipping coordi- nates, the clipping area does not move. Because the values in the local coordinate before drawing starts. nfi register become undefined after powering on or after resetting, they must be set Co GA SE VDP1 User's Manual 117 7.4 Normal Sprite Draw Command The normal sprite draw command draws character patterns in the frame buffer. specified coordinates and drawn. nti When drawing, the character pattern can be inverted vertically or horizontally at the al When the end bit is 0B and the command selection bits are 0000B, the normal sprite draw command is enabled. Normal sprites cannot be rotated 90°. To rotate 90°, specify the distorted sprite draw command. The contents of the command table are shown in the following figure. CMDCTRL +00H CMDLINK +02H CMDPMOD CMDCOLR bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 +04H +06H 0 JP 0 0 0 0 0 0 Dir 0 0 0 0 Link specification/8H MO 0 0 0 Pc CI Cm Me EC SP Color mode de Color calculation Color bank, lookup table/8H (LSB fixed at 00) Normal sprite Vertex (A) Vertex (B) CMDSRCA CMDSIZE CMDXA CMDYA +08H +0AH +0CH +0EH +10H +12H 0 0 Character address/8H Character size X/8 nfi Character size Code extension Vertex (A), X coordinate (XA) Code extension Vertex (A), Y coordinate (YA) 0 0 Y Vertex (D) Vertex (C) Frame buffer CMDGRDA +14H +16H +18H +1AH +1CH Note: Co Gouraud shading table/8H is ignored. MO = MON, HS = HSS, Pc = Pclp, Cl = Clip, Cm = Cmod, Me = Mesh, EC = CD and SP = SPD. GA The normal sprite draw command is defined as follows: • When the end bit is set to 0B and the command selection bits are set to 0000B, the normal sprite draw command is enabled. • The jump mode is then specified. When the jump mode is assigned or called, the address of the command table to be processed next is divided by 8H and set in CMDLINK. SE • The read direction of the character pattern is set. The character pattern can be drawn with vertical or horizontal inversion by the specification of the read direc- tion. • Set pre-clipping. Specify enable or disable in consideration of the clipping area and the drawing position of the part. 118 • The user clipping enable bit and clipping mode are specified. Depending on the clipping mode, either the outside or the inside of the user clipping area is speci- fied. nti • Mesh is enabled, end code is disabled, and transparent pixel is disabled. MSB ON is set to perform shade processing in the VDP2. al • The color mode that defines the character pattern is set. Color bank is specified when the color mode is the color bank mode. When the color mode is the lookup table mode, the address of the color lookup table is defined by dividing by 8H. • Color calculation is specified. Color calculation is enabled in the RGB mode. When color calculation is not used, replace is specified. When Gouraud shading is used, the address of the Gouraud shading table is specified by dividing by 8H. Gouraud shading processing is enabled in the RGB mode. for the horizontal size. de • The address of the character pattern table is defined in CMDSRCA by dividing by 8H. The horizontal and vertical lengths of the character size defined in the character pattern table are defined in CMDSIZE. A value divisible by 8 is defined • The upper-left coordinates of the area to be drawn are defined in vertex (A) (CMDXA, CMDYA). nfi Co GA SE VDP1 User's Manual 119 7.5 Scaled Sprite Draw Command The scaled sprite draw command draws character patterns in the frame buffer. horizontally, enlarged or reduced, and stretched. nti Character patterns can be drawn at specified coordinates inverted vertically and/or al When the end bit is 0B and the command selection bits are 0001B, the scaled sprite draw command is enabled. When the zoom point is 0000B, the character pattern is defined by specifying the coordinates for two points. When the zoom point is other than 0000B, the zoom point is defined. The scaled sprite can not be rotated at 90°. When rotating 90°, specify using the scaled draw command. Specification of Two Coordinate Points (Scaled Sprite Draw Command) de The contents of the command table for specifying the coordinates of two points are shown in the following figure. CMDCTRL +00H 0 CMDLINK +02H CMDPMOD +04H CMDSRCA +08H nfi bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 JP 0 0 0 0 0 0 Dir Link specification/8H 0 0 0 1 Color MO 0 0 HS Pc Cl Cm Me EC SP Color mode calculation CMDCOLR +06H Color bank, lookup table/8H (LSB fixed at 00) Character address/8H 0 0 Scaled sprite Vertex (A) Vertex (B) CMDXA Co CMDSIZE +0AH 0 0 Character size X/8 +0CH +10H +12H Code extension Vertex (A), Character size Y X coordinate (XA) CMDYA +0EH Code extension Vertex (A), Y coordinate (YA) CMDXC +14H Code extension Vertex (C), X coordinate (XC) CMDYC +16H Code extension Vertex (C), Y coordinate (YC) Vertex (D) Vertex (C) Frame buffer +18H +1AH GA CMDGRDA +1CH Note: Gouraud shading table/8H is ignored. Specification of coordinates for two points by the scaled sprite draw command is defined as follows: SE • When the end bit is set to 0B and the command selection bits are set to 0001B, the scaled sprite draw command is enabled. • The jump mode is then specified. When the jump mode is assigned or called, the address of the command table to be processed next is divided by 8H and set in CMDLINK. • The zoom point is set to 0000B. The coordinates for two points are specified. 120 • The read direction of the character pattern is set. The character pattern can be drawn with vertical or horizontal inversion by the specification of the read direc- tion. When inversion is specified twice by the read direction and by the specifica- tion. nti tion of vertex (A) (CMDXA, CMDYA) and vertex (C) (CMDXC, CMDYC), the inversions cancel each other out and the direction returns to the original direc- al • Set high speed shrink. Specify priority to precision or to speed. • Set pre-clipping. Specify enable or disable in consideration of the clipping area and the drawing position of the part. • The user clipping enable bit and clipping mode are specified. Depending on the clipping mode, either the outside or the inside of the user clipping area is speci- fied. • Mesh is enabled, end code is disabled, and transparent pixel is disabled. MSB by 8H. de ON is set to perform shade processing in the VDP2. • The color mode that defines the character pattern is set. The color bank is speci- fied when the color mode is the color bank mode. When the color mode is the lookup table mode, the address of the color lookup table is defined by dividing nfi • Color calculation is specified. Color calculation is enabled in the RGB mode. When color calculation is not used, replace is specified. When Gouraud shading is used, the address of the Gouraud shading table is specified by dividing by 8H. Gouraud shading processing is enabled in the RGB mode. • The address of the character pattern table is defined in CMDSRCA by dividing by 8H. The horizontal and vertical lengths of the character size defined in the horizontal size. Co character pattern table are defined. A value divisible by 8 is defined for the • The upper-left coordinates of the area to be drawn are defined as vertex (A) (CMDXA, CMDYA), and the lower-right coordinates are defined as vertex (C) (CMDXC, CMDYC). Enlargement, reduction, and stretching are possible by the specification of vertex (A) and vertex (C). Also, when X of (A) is greater than X of (C), the part is inverted horizontally. When Y of (A) is greater than Y of (C), the part is inverted vertically. GA • When vertex A and vertex C are set at the same coordinates, they are drawn with one pixel. SE VDP1 User's Manual 121 Specification of Zoom Point (Scaled Sprite Draw Command) The contents of the command table for specifying the zoom point are shown in the following figure. CMDCTRL CMDLINK bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 +00H +02H 0 JP ZP 0 0 Dir 0 0 0 1 Link specification/8H Color ntial CMDPMOD MO 0 0 HS Pc Cl Cm Me EC SP Color mode calculation +04H Scaled sprite CMDCOLR Color bank, lookup table/8H (LSB fixed at 00) +06H Vertex (A) Vertex (B) CMDSRCA Character address/8H 0 0 +08H CMDSIZE CMDXA CMDYA CMDXB CMDYB +0AH +0CH +0EH +10H +12H 0 0 Character size X/8 Code extension Zoom point, X coordinate (XA) Code extension Zoom point, Y coordinate (YA) Code extension Code extension Character size Y Display, X width (XB) Display, Y width (YB) de Vertex (D) Zoom Point Display width (XB) Vertex (C) Display width (YB) CMDGRDA +1AH +1CH +14H +16H +18H nfi Gouraud shading table/8H Frame buffer follows: Note: Co is ignored. Specification of the zoom point of the scaled sprite draw command is defined as • When the end bit is set to 0B and the command selection bits are set to 0001B, the scaled sprite draw command is enabled. • The jump mode is then specified. When the jump mode is assigned or called, the CMDLINK. GA address of the command table to be processed next is divided by 8H and set in • The zoom point is specified. When the zoom point is set to other than 0000B, it becomes the display width specification. When 0000B is set, it becomes the coor- dinate specification for two points. • For more information on zoom point, refer to “Zoom Point” in section 6.1. • The read direction of the character pattern is set. The character pattern can be drawn with vertical or horizontal inversion by the specification of the read direc- SE tion. • Set high speed shrink. Specify priority to precision or to speed. • Set pre-clipping. Specify enable or disable in consideration of the clipping area and the drawing position of the part. 122 • The user clipping enable bit and clipping mode are specified. Depending on the clipping mode, either the outside or the inside of the user clipping area is speci- fied. nti • Mesh is enabled, end code is disabled, and transparent pixel is disabled. MSB ON is set to perform shade processing in the VDP2. • The color mode that defines the character pattern is set. Color bank is specified al when the color mode is the color bank mode. When the color mode is the lookup table mode, the address of the color lookup table is defined by dividing by 8H. • Color calculation is specified. Color calculation is enabled in the RGB mode. When color calculation is not used, replace is specified. When Gouraud shading is used, the address of the Gouraud shading table is specified by dividing by 8H. Gouraud shading processing is enabled in the RGB mode. • The address of the character pattern table is defined in CMDSRCA by dividing for the horizontal size. de by 8H. The horizontal and vertical lengths of the character size defined in the character pattern table are defined in CMDSIZE. A value divisible by 8 is defined • The coordinates of the zoom point of the character to be drawn are set at zoom point coordinates (CMDXA, CMDYA). The display width is defined in CMDXB, specifying the display width. nfi CMDYB. The character pattern can be drawn enlarged, reduced, or stretched by • When the value of CMDXB, CMDYB is set to (0, 0), the sprite is drawn as one pixel. Co GA SE VDP1 User's Manual 123 7.6 Distorted Sprite Draw Command The distorted sprite draw command draws character patterns in the frame buffer. Character patterns can be drawn at specified coordinates inverted vertically and/or horizontally, enlarged or reduced, stretched, rotated or twisted. When the end bit is 0B and the command selection bits are 0010B, the distorted sprite draw command is enabled. The contents of the command table are shown in the following figure. ntial bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 CMDCTRL +00H 0 CMDLINK +02H CMDPMOD CMDCOLR CMDSRCA CMDSIZE +04H +06H +08H MO 0 0 JP 0 0 Color HS 0 0 0 0 0 0 Dir 0 0 1 0 Link specification/8H Pc bank, Character Cl Cm lookup size Me X/8 EC SP table/8H Character address/8H Color (LSB Character mode fixed at size de Color 0 0 calculation 00) Y 0 0 Distorted sprite Vertex (D) Vertex (A) CMDXA CMDYA CMDXB CMDYB CMDXC +0AH +0CH +0EH +10H +12H +14H Code extension Code extension Code extension Code extension Code extension nfi Vertex (A), X coordinate (XA) Vertex (A), Y coordinate (YA) Vertex (B), X coordinate (XB) Vertex (B), Y coordinate (YB) Vertex (C), X coordinate (XC) Vertex (C) Vertex (B) Frame buffer CMDYC CMDXD CMDYD CMDGRDA +16H +18H +1AH +1CH Code extension Code extension Code extension Note: CoVertex (C), Y coordinate (YC) Vertex (D), X coordinate (XD) Vertex (D), Y coordinate (YD) Gouraud shading table/8H is ignored. The distorted sprite draw command is defined as follows: CMDLINK. GA • When the end bit is set to 0B and the command selection bits are set to 0010B, the distorted sprite draw command is enabled. • The jump mode is then specified. When the jump mode is assigned or called, the address of the command table to be processed next is divided by 8H and set in • The read direction of the character pattern is set. The character pattern can be drawn with vertical or horizontal inversion by the specification of the read direc- SEtion. When inversion is specified twice by the read direction and by the specifica- tion of vertex (A), vertex (B), vertex (C), and vertex (D), the inversions cancel each other out. • Set high speed shrink. Specify priority to precision or to speed. • Set pre-clipping. Specify enable or disable in consideration of the clipping area and the drawing position of the part. 124 • The user clipping enable bit and clipping mode are specified. Depending on the clipping mode, either the outside or the inside of the user clipping area is speci- fied. nti • Mesh is enabled, end code is disabled, and transparent pixel is disabled. MSB ON is set to perform shade processing in the VDP2. • The color mode that defines the character pattern is set. Color bank is specified al when the color mode is the color bank mode. When the color mode is the lookup table mode, the address of the color lookup table is defined by dividing by 8H. • Color calculation is specified. Color calculation is enabled in the RGB mode. When color calculation is not used, replace is specified. When Gouraud shading is used, the address of the Gouraud shading table is specified by dividing by 8H. Gouraud shading processing is enabled in the RGB mode. • The address of the character pattern table is defined in CMDSRCA by dividing for the horizontal size. de by 8H. The horizontal and vertical lengths of the character size defined in the character pattern table are defined in CMDSIZE. A value divisible by 8 is defined • The upper-left coordinates of the area to be drawn are defined as vertex (A) (CMDXA, CMDYA), the upper-right coordinates are defined as vertex (B) nfi (CMDXB, CMDYB), the lower-right coordinates are defined as vertex (C) (CMDXC, CMDYC), and the lower-left coordinates are defined as vertex (D) (CMDXD, CMDYD). The relationships between the positions of the four vertices can be set as desired, and therefore enlargement, reduction, stretching, rotation, and twist can be specified when drawing the character pattern by the specifica- tion of vertex (A), vertex (B), vertex (C), and vertex (D). Vertical and horizontal one pixel. Co inversion are also possible. • When two vertices are set at the same coordinates, the sprite is drawn as a tri- angle. When four vertices are set at the same coordinates, the sprite is drawn as GA SE VDP1 User's Manual 125 7.7 Polygon Draw Command The polygon draw command draws quadrangles in the frame buffer. The inside of the quadrangle is filled with the specified color. When the end bit is 0B and the command selection bits are 0100B, the polygon draw command is enabled. The contents of the command table are shown in the following figure. ntial bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 CMDCTRL +00H 0 JP 0 0 0 0 0 0 0 0 0 1 0 0 Link specification/8H 0 0 Polygon CMDLINK +02H Filled with Color CMDPMOD +04H MO CMDCOLR +06H +08H +0AH CMDYA +0EH 0 0 0 CMDXA +0CH Code extension Pc Code extension Cl Cm Me 1 1 Non-textured color 0 0 0 de calculation Vertex (A), X coordinate (XA) Vertex (A), Y coordinate (YA) Vertex (D) Vertex (C) non-textured l Vertex (A) Vertex (B) CMDXB +10H CMDYB +12H CMDXC +14H CMDYC +16H CMDXD +18H Code extension Code extension Code extension Code extension Code extension nfi Vertex (B), X coordinate (XB) Vertex (B), Y coordinate (YB) Vertex (C), X coordinate (XC) Vertex (C), Y coordinate (YC) Vertex (D), X coordinate (XD) Frame buffer CMDYD +1AH CMDGRDA +1CH Co Code extension Note: Vertex (D), Y coordinate (YD) Gouraud shading table/8H is ignored. The polygon draw command is defined as follows: • When the end bit is set to 0B and the command selection bits are set to 0100B, the CMDLINK. GA polygon draw command is enabled. • The jump mode is specified. When the jump mode is assigned or called, the address of the command table to be processed next is divided by 8H and set in • Set pre-clipping. Specify enable or disable in consideration of the clipping area and the drawing position of the part. • The user clipping enable bit and clipping mode are specified. Depending on the clipping mode, either the outside or the inside of the user clipping area is speci- SEfied. • Mesh is enabled. MSB ON is set to perform shade or window processing in the VDP2. • The color mode is set to 000B. The color code is set to non-textured color (CMDCOLR). 126 • Specify color calculation. Color calculation is enabled when the non-textured color is in the RGB mode. When color calculation is not used, replace is specified. When Gouraud shading is used, the address of the Gouraud shading table is non-textured color is in the RGB mode. nti specified by dividing by 8H. Gouraud shading processing is enabled when the • The upper-left coordinates of the quadrangle to be drawn are defined as vertex al (A) (CMDXA, CMDYA), the upper-right coordinates are defined as vertex (B) (CMDXB, CMDYB), the lower-right coordinates are defined as vertex (C) (CMDXC, CMDYC), and the lower-left coordinates are defined as vertex (D) (CMDXD, CMDYD). The relationships between the positions of the four vertices can be set as desired, and therefore rotation and twist can be specified when drawing the character pattern by the specification of vertex (A), vertex (B), vertex (C), and vertex (D). as one pixel. de • When two vertices are set at the same coordinates, a polygon is drawn as a tri- angle. When four vertices are set at the same coordinates, the polygon is drawn nfi Co GA SE VDP1 User's Manual 127 7.8 Polyline Draw Command The polyline draw command draws quadrangles in the frame buffer. The inside of the quadrangle is not filled. When the end bit is 0B and the command selection bits are 0101B, the polyline draw command is enabled. The contents of the command table are shown in the following figure. CMDCTRL bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ntial +00 H 0 JP 0 0 0 0 0 0 0 0 0 1 0 1 Polyline CMDLINK +02 H Link specification/8 H 0 0 CMDPMOD +04 H MO 0 0 0 Pc C1 Cm Me 1 1 0 0 0 Color calculation Vertex (A) CMDCOLR Vertex (D) CMDXA CMDYA CMDXB CMDYB +06 H +08 H +0AH +0CH +0EH +10 H +12 H Code extension Code extension Code extension Code extension Non-textured color Vertex (A), X coordinate (XA) Vertex (A), Y coordinate (YA) Vertex (B), X coordinate (XB) Vertex (B), Y coordinate (YB) de Vertex (C) Frame buffer Vertex (B) CMDXC CMDYC CMDXD CMDYD CMDGRDA +14 H +16 H +18 H +1AH +1CH Code extension Code extension Code extension Code extension Vertex (C), X coordinate (XC) Vertex (C), Y coordinate (YC) Vertex (D), X coordinate (XD) Vertex (D), Y coordinate (YD) Gouraud shading table/8 H nfi NOTE: Co is ignored. The polyline draw command is defined as follows: • When the end bit is set to 0B and the command selection bits are set to 0101B, the polyline draw command is enabled. • The jump mode is then specified. When the jump mode is assigned or called, the address of the command table to be processed next is divided by 8H and set in CMDLINK. GA • Set pre-clipping. Specify enable or disable in consideration of the clipping area and the drawing position of the part. • The user clipping enable bit and clipping mode are specified. Depending on the clipping mode, either the outside or the inside of the user clipping area is speci- fied. • Mesh is enabled. When mesh is enabled, the entire sprite may not be drawn depending on the position and shape of the polyline. SE • MSB ON is set to perform shade or window processing in the VDP2. • The color mode is set to 000B. The color code is set to non-textured color (CMDCOLR). 128 • Color calculation is specified. Color calculation is enabled when the non-textured color is in the RGB mode. When color calculation is not used, replace is specified. When Gouraud shading is used, the address of the Gouraud shading table is non-textured color is in the RGB mode. nti specified by dividing by 8H. Gouraud shading processing is enabled when the • When half-transparency processing is performed on polylines, two lines overlap al at each point. As a result half-transparency is applied twice, thus causing original picture 3/4 + background 1/4. • When shadow processing is performed on polylines, two lines overlap at each point. As a result shadow is applied twice, thus causing one half the luminance. • The upper-left coordinates of the quadrangle to be drawn are defined as vertex (A) (CMDXA, CMDYA), the upper-right coordinates are defined as vertex (B) (CMDXB, CMDYB), the lower-right coordinates are defined as vertex (C) (C), and vertex (D). de (CMDXC, CMDYC), and the lower-left coordinates are defined as vertex (D) (CMDXD, CMDYD). The relationships between the positions of the four vertices can be set as desired, and therefore rotation and twist can be specified when drawing the character pattern by the specification of vertex (A), vertex (B), vertex as one pixel. nfi • When two vertices are set at the same coordinates, a polygon is drawn as a tri- angle. When four vertices are set at the same coordinates, the polygon is drawn Co GA SE VDP1 User's Manual 129 7.9 Line Draw Command The line draw command draws quadrangles in the frame buffer. The inside of the quadrangles is not filled. When the end bit is 0B and the command selection bits are 0110B, the line draw command is enabled. The contents of the command table are shown below. ntial bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 JP 0 0 0 0 0 0 0 0 0 1 1 0 CMDCTRL +00H Link specification/8H 0 0 CMDLINK +02H Line CMDPMOD CMDCOLR CMDXA CMDYA +04H +06H +08H +0AH +0CH MO 0 0 0 Pc Code extension Code extension Cl Cm Me 1 1 0 0 0 Non-textured color deColor calculation Vertex (A), X coordinate (XA) Vertex (A), Y coordinate (YA) Vertex (A) Vertex (B) CMDXB CMDYB +0EH +10H +12H +14H +16H +18H Code extension Code extension nfi Vertex (B), X coordinate (XB) Vertex (B), Y coordinate (YB) Frame buffer CMDGRDA +1AH +1CH Note: Co Gouraud shading table/8H is ignored. The line draw command is defined as follows. • When the end bit is set to 0B and the command selection bits are set to 0110B, the GA line draw command is enabled. • The jump mode is then specified. When the jump mode is assigned or called, the address of the command table to be processed next is divided by 8H and set in CMDLINK. • Set pre-clipping. Specify enable or disable in consideration of the clipping area and the drawing position of the part. • The user clipping enable bit and clipping mode are specified. Depending on the clipping mode, either the outside or the inside of the user clipping area is specified. SE • Mesh is enabled. When mesh is enabled, the entire sprite may not be drawn de- pending on the position and shape of the line. • MSB ON is set to perform shade or window processing in the VDP2. • The color mode is set to 000B. The color code is set to non-textured color (CMDCOLR). 130 • Color calculation is specified. Color calculation is enabled when the non-textured color is in the RGB mode. When color calculation is not used, replace is specified. When Gouraud shading is used, the address of the Gouraud shading table is is defined in CMDXB, CMDYB. nti specified by dividing by 8H. Gouraud shading processing is enabled when the non-textured color is in the RGB mode. Only vertex (A) and vertex (B) in the Gouraud shading table are enabled; vertex (C) and vertex (D) are ignored. al • Vertex (A) of the line to be drawn is defined in CMDXA, CMDYA and vertex (B) • When the two vertices are set to the same coordinates, the line is drawn as one pixel. de nfi Co GA SE VDP1 User's Manual 131 7.10 Draw End Command The draw end command specifies the end of drawing. When the end bit is “1”, the following figure. nti draw end command is enabled. The contents of the command table are shown in the bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 al CMDCTRL +00H 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +02H +04H +06H +08H +0AH +0CH +0EH +10H de +12H +14H +16H +18H +1AH nfi +1CH Note: Co is ignored. Gouraud shading table/8H • When the +00H address is set to 8000H, the draw end command is enabled. GA SE 132 Chapter 8 Quick Reference ntial de nfi Co GA Contents SE 8.1 8.2 8.3 8.4 System Registers ........................................................................... 134 Tables ............................................................................................ 140 Command Tables ........................................................................... 142 Commands .................................................................................... 151 VDP1 User's Manual 133 8.1 System Registers nti TV Mode Selection Register (TVMR) TVMR bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 100000H 0 0 0 0 0 0 0 0 0 0 0 0 VBE TVM Write-only V-blank Erase/Write Enable (VBE): bit 3 VBE 0 0 0 FCM 0 0 1 FCT 0 1 0 Change mode One cycle mode Setting prohibited Manual mode (erase) al Change time Changes every 1/60 second — Erase in next field 0 1 1 1 1 1 0 0 1 1 1 0 1 0 1 TV Mode Select (TVM): bits 2 - 0 Manual mode (change) Setting prohibited Setting prohibited Setting prohibited Manual mode (erase & change) de Change in next field — — — Erase with V-blank, change in next field Table 8.1 Screen Modes TVM Bit 2 1 0 Name Normal Screen mode Resolution 320x224 nfi Bit depth (bits/pixel) Frame buffer screen size 512H Double Inter- lace possible? Yes VDP CLK (MHz) NTSC 26.8426 PAL 26.6564 0 0 0 0 0 1 0 1 0 (NTSC, PAL) High resolution (NTSC, PAL, Hi - Res) Rotation 16 (NTSC, PAL Co 320x240 352x224 352x240 640x224 640x240 704x224 704x240 320x224 320x240 16 8 16 x 256V 1024H x 256V 512H x Yes Single only 26.8426 28.6364 28.6364 26.8426 26.8426 28.6364 28.6364 26.8426 26.8426 26.6564 28.4375 28.4375 26.6564 26.6564 28.4375 28.4375 26.6564 26.6564 Rotation) 352x224 256V 28.6364 28.4375 352x240 28.6364 28.4375 GA Rotation 8 (NTSC, 320x224 512H Single 26.8426 26.6564 0 1 1 PAL 320x240 8 x only 26.8426 26.6564 Rotation) 352x224 512V 28.6364 28.4375 352x240 28.6364 28.4375 1 0 0 HDTV 320x240 16 512H x No 26.8426 26.6564 (31KC, HDTV) 352x240 256V 28.6364 28.4375 Other Setting prohibited (do not set) SE 134 Frame Buffer Change Mode Register FBCR bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 100002H 0 0 0 0 0 0 0 0 0 0 0 EOS DIE DIL FCM FCT Write-only Frame Buffer Change Mode (FCM): bit 1 Frame Buffer Change Trigger (FCT): bit 0 VBE 0 0 FCM 0 0 FCT 0 1 Change mode 1 cycle mode Setting prohibited ntial Change time Changes every 1/60 second — 0 1 0 Manual mode (erase) Erase in next field 0 1 1 Manual mode (change) Change in next field 1 0 0 Setting prohibited — 1 0 1 Setting prohibited — 1 1 1 1 0 1 Double Interlace Enable (DIE): bit 3 Setting prohibited Manual mode (erase & change) Double Interlace Draw Line (DIL): bit 2 de — Erase with V-blank and change in next field DIE 0 0 1 1 DIL 0 1 0 1 nfi Interlace mode Non-interlace/single interlace Setting prohibited Double-interlace Double-interlace Draw after next frame change Draw all lines — Only even numbered (EVEN) lines drawn Only odd numbered (ODD) lines EOS Co Even/Odd Coordinate Select Bit (EOS): bit 4 0 1 drawn Even/odd coordinate select bit Samples only pixels at even coordinates Samples only pixels at odd coordinates GA SE VDP1 User's Manual 135 Plot Trigger Register PTMR bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 nti 100004H 0 0 0 0 0 0 0 0 0 0 0 0 0 0 PTM Write-only Plot Trigger Mode (PT): bits 1, 0 Bit 1 0 0 1 1 PTM 0 0 1 0 1 Idle at frame change Drawing mode Starts drawing when 01B is written Starts drawing automatically with frame change Setting prohibited (do not set) al Erase/Write Data Register EWDR 100006H 16 bits/pixel 8 bits/pixel bit 15 14 13 12 11 10 9 8 Erase/write data for even X coordinates de 7 6 Erase/write Data 5 4 3 2 1 0 Erase/write data for odd X coordinates Write-only Erase/Write Data: bits 15~0 nfi Co GA SE 136 Erase/Write Upper-Left Coordinate Register EWLR bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 100008H Write-only 0 Upper-left coordinate X1 Erase/Write Upper-Left Coordinate X1: bits 14~9 Erase/Write Upper-Left Coordinate Y1: bits 8~0 Erase-Write Lower-Right Coordinate Register ntial Upper-left coordinate Y1 EWRR bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 10000AH Lower-right coordinate X3 Lower-right coordinate Y3 Write-only Erase/Write Lower-Right Coordinate X3: bits 15~9 Erase/Write Lower-Right Coordinate Y3: bits 8~0 Value set 16 bits/pixel Upper-left Lower-right de High Resolution Upper-left 8 bits/pixel Lower-right Rotated 8 Upper-left Lower-right in register 1 2 0 : coordinate X1 coordinate X3 0 8 16 : Setting prohibited 7 15 : nfi coordinate X1 coordinate X3 coordinate X1 coordinate X3 0 16 32 : Setting prohibited 15 31 : 0 16 32 : Setting prohibited 15 31 : 31 32 33 40 : 248 256 264 320 : Co 247 255 263 319 : 496 512 528 640 : 495 511 527 : 639 496 Setting prohibited Setting prohibited : : 495 511 Setting prohibited : : : : : : : : : GA43 44 62 63 : 344 352 496 504 : 343 351 495 503 : 688 704 992 1008 : 687 703 : 991 1007 : : : : : : : : : : SE 64 Setting 511 Setting 1023 : : prohibited prohibited 65 and Setting Setting Setting Setting Setting Setting over prohibited prohibited prohibited prohibited prohibited prohibited VDP1 User's Manual 137 Draw Forced Termination Register ENDR bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 10000CH 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Write-only Transfer End Status Register EDSR 100010H Read-only bit 15 0 14 0 13 0 12 0 11 0 10 0 9 0 8 0 7 0 6 0 nti 5 0 al 4 0 3 0 2 0 1 CEF 0 BEF • Current End Bit Fetch Status (CEF): bit 1 CEF End bit fetch status 0 The end bit in current frame has not been fetched. 1 de The end bit in current frame has been fetched and that drawing is terminated. • Before End Bit Fetch Status (BEF): bit 0 BEF 0 1 End bit fetch status The end bit in previous frame has not been fetched. The end bit in previous frame has been fetched and that drawing is terminated. Last Operation Table Address Register LOPR 100012H Read-only bit 15 14 13 12 nfi 11 10 9 8 7 6 Last operation table address/8H 5 4 3 2 1 0 0 0 bit 15 Co • Last Operation Table Address: bits 15~0 Current Operation Table Address COPR 100014H Read-only 14 13 12 11 10 9 8 7 6 5 Current operation table address/8H 4 3 2 1 0 0 0 • Current Operation Table Address: bits 15~0 GA SE 138 Mode Status Register MODR bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 100016H VER — — — PTM1 EOS DIE DIL FCM VBE TVM Read-only Version Number (VER): bits 15~12 Plot Trigger Mode 1 (PTM1): bit 8 Even/Odd Coordinate Select Bit (EOS): bit 7 ntial Double Interlace Enable Bit (DIE): bit 6 Double Interlace Draw Line (DIL): bit 5 Frame Buffer Change Mode Bit (FCM): bit 4 V-Blank Erase/Write Enable Bit (VBE): bit 3 TV Mode Selection Bits (TVM): bits 2~0 de nfi Co GA SE VDP1 User's Manual 139 8.2 Tables Character Pattern Tables For 4 bits/pixel, 0CH (12) bytes is required. pixel +00H +04H +08H 0 1 + 0 + 4 + 8 2 3 + 1 + 5 + 9 4 5 + 2 + 6 + A 6 7 + 3 + 7 + B ntial ← Value is local address from character pattern For 8 bits/pixel, 18H (24) bytes is required. pixel 0 +00H +0 +08H +8 +10H +10 1 +1 +9 +11 +A 2 +2 +12 +3 +B 3 +13 4 +4 +C +14 5 +5 +D +15 For 16 bits/pixel, 30H (48) bytes is required. +6 +E 6 +16 7 +7 +F +17 de pixel 0 1 2 3 4 5 nfi +00H +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F 6 7 +10H +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +1A +1B +1C +1D +1E +1F +20H +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +2A +2B +2C +2D +2E +2F Figure 8.1 Examples of Character Pattern Tables Color Lookup Table +00H +02H Co 16-bit data 16-bit data (color code of 0H) (color code of 1H) +04H 16-bit data (color code of 2H) : GA : +1CH 16-bit data (color code of EH) +1EH 16-bit data (color code of FH) Figure 8.2 Color Lookup Table SE 140 Gouraud Shading Table Table 8.2 Gouraud Shading Table Table address Table top address Table top address + 2 Table top address + 4 Table top address + 6 nti Corresponding vertex Sprites, polygons, polylines Vertex (A) Vertex (B) Vertex (C) Vertex (D) al Line start vertex Line end vertex Ignored Ignored Lines de nfi Co GA SE VDP1 User's Manual 141 8.3 Command Tables CMDCTRL +00H CMDLINK +02H CMDPMOD MON +04H CMDCOLR +06H CMDSRCA +08H CMDSIZE bit 15 END 0 14 13 JP 0 12 HSS 11 Pclp 10 ZP Clip 9 Cmod 8 LINK specification/8H Mesh Character address/8H 0 7 ECD SPD 0 6 5 Dir Color modenti 4 Color bank, color lookup table/8H (LSB is set to 00), non-textured color al 3 2 Comm 1 0 0 0 Color calculation bit 0 0 0 0 Character size X/8 Character size Y +0AH CMDXA +0CH Code extension Vertex (A) and X coordinate (XA) * CMDYA Code extension Vertex (A) and Y coordinate (YA) +0EH CMDXB +10H CMDYB +12H CMDXC +14H CMDYC +16H CMDXD +18H CMDYD Code extension Code extension Code extension Code extension Code extension de Vertex (B) and X coordinate (XB) Vertex (B) and Y coordinate (YB) Vertex (C) and X coordinate (XC) Vertex (C) and Y coordinate (YC) Vertex (D) and X coordinate (XD) +1AH CMDGRDA +1CH +1EH +20H : +40H Code extension nfi Gouraud Shading Table/8H Vertex (D) and Y coordinate (YD) (Dummy) Skipped during table fetch Succeeding table : +60H : Co Succeeding table : * Note: The top bit of the vertex coordinate is a sign bit. A negative value is indicated by the complement of 2. Extend the sign for the upper 6 bits. Figure 8.3 Command Table GA SE 142 CMDCTRL (Control Words) bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 CMDCTRL +00H END End bit (END): bit 15 END 0 1 JP ZP End bit nti 0 al 0 Dir Drawing command or coordinate setting command (other than draw end command) Draw end command Comm Jump Mode (JP): bits 14~12 JP Bit 14 0 0 0 0 13 0 0 1 1 12 0 1 0 1 Jump mode Jump next Jump assign Jump call Jump return de Automatically jumps to next table (address +20 H) after this table is processed (CMDLINK is ignored). Jumps to CMDLINK table after this table is processed. CMDLINK table receives subroutine call after this table is processed. Processing Returns to main routine after this table is processed (CMDLINK is ignored). 1 1 1 1 0 0 1 1 0 1 0 1 Skip next Skip assign Skip call Skip return nfi Jumps to next table (address +20H ) after this table is processed (CMDLINK is ignored). Jumps to CMDLINK without processing this table. CMDLINK table receives subroutine call without processing this table. Returns to main routine without processing this table (CMDLINK is ignored). Co GA SE VDP1 User's Manual 143 Zoom Point (ZP): bits 11~8 ZP Bit 11 10 9 8 Code Zoom point 0 0 0 0 1 1 1 1 0 1 1 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 0 1 1 0 1 1 0H 5H 6H 7H 9H AH BH DH Specifies two coordinates Upper-left Upper-center Upper-right Center-left Center-center Center-right Lower-left ntial 1 1 1 0 EH Lower-center 1 1 1 1 FH Lower-right Other than above Setting prohibited (do not set) Character Read Direction (Dir): bits 5 and 4 Y 0 0 1 Dir X 0 1 0 Not inverted Inverted horizontally Inverted vertically de Inversion processing 1 1 nfi Inverted vertically and horizontally Co GA SE 144 Command Select (Comm): bits 3~0 Table 8.3 Commands END Bit 15 0 3 0 Comm 2 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 0 Draw commands Function Textured draw command ntiScaled sprite draw command al Distorted sprite draw command Non-textured draw Polygon draw command command Command Normal sprite draw command Polyline draw command Line draw command 1 0 0 0 Coordinates Clipping User clipping coordinates set set coordinate set command commands commands 1 System clipping coordinates set command 1 0 All other codes 0 1 0 0 0 CMDLINK (Link Specification) End draw command de Local coordinate set command Setting prohibited (do not set) bit 15 CMDLINK +02H 14 nfi 13 12 11 10 9 8 7 Link specification/8H 6 5 4 3 2 1 0 0 0 Co GA SE VDP1 User's Manual 145 CMDPMOD (Draw Mode Word) bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 nti CMDPMOD +04H MON 0 0 HSS Pclp Clip Cmod Mesh ECD SPD Color mode Color calculation bits High Speed Shrink (HSS): bit 12 HSS 0 1 High speed shrink disabled High speed shrink enabled Pre-clipping Disable (Pclp): bit 11 Pclp 0 1 Processing Processing Pre-clipping with horizontal inversion No pre-clipping and no horizontal inversion al User Clipping Enable Bit (Clip): bit 10 Clipping Mode Bit (Cmod): bit 9 Clip 0 0 1 Cmod 0 1 0 de User clipping processing User clipping disabled Setting prohibited (do not set) Inside drawing mode 1 1 Mesh Enable Bit (Mesh): bit 8 Mesh 0 1 Outside drawing mode Mesh enable Draw without mesh processing Draw with mesh processing nfi Co GA SE 146 End Code Disable (ECD): bit 7 HSS ECD End code processing 0 0 End code enable: drawing horizontally is disabled when second 0 1& enlarge 1& reduce 1 1 0 0 1 End code disable: End code enable: End code disable: End code disable: nti end code is read and end code becomes transparent. end code is not processed, color of code is expressed. drawing horizontally is disabled when second al end code is read and end code becomes transparent. end code is not processed, color of code is expressed. end code is not processed, color of code is expressed. Transparent Pixel Disable (SPD): bit 6 SPD End code processing 0 1 Transparent pixel enable: Transparent pixel disable: Color Mode Bits: bits 5~3 de transparent color codes are not drawn; transparent color codes become transparent. transparent color code is not processed, color of code is expressed. Bit 5 0 0 0 0 Color mode 4 0 0 1 1 3 0 1 0 1 Mode 0 1 2 3 nfi Number of colors 16 16 64 128 Description Mode Color bank mode Lookup table mode Color bank mode Color bank mode Bits per pixel 4 bits 4 bits 8 bits 8 bits 1 1 0 0 0 1 Co Other than above 4 5 256 32,768 Color bank mode RGB mode Setting prohibited (do not set) 8 bits 16 bits GA SE VDP1 User's Manual 147 Color Calculation Bits: bits 2-–0 Bit Function 2 Gouraud shading enable bit 2 Color calculation (in Bit) 1 0 1 0 1/2 original graphic enable bit 1/2 background enable bit Background MSB Original graphic Background Type of color calculation ntial Usable modes Original graphic Background 0 0 0 — 1 0 Replace Not restricted Not restricted 0 0 1 0 0 1 Cannot rewrite Not Not restricted 1 01 1/2 Shadow restricted RGB 0 1 0 — 1/2 0 Half-luminance RGB Not restricted Not restricted 0 1 1 1 1 1 0 0 1 1 1 0 1 0 1 0 1 — — — 0 1/2 Gouraud — 1 Gouraud 1/2 Gouraud Gouraud 1/2 — 0 0 0 0 Replace de Half-transparent Gouraud shading Setting prohibited (do not set) Gouraud shading + Half-luminance 2 Gouraud shading Gouraud shading + RGB RGB — RGB RGB Not restricted — Not restricted Not restricted Notes 1 —: doesn't matter 1/2 1/2 nfi Half- transparent3 RGB Original graphic: sprite or pixel data to be plotted in non-textured color. Background: pixel data already plotted in the frame buffer. 1Original graphic (transparent pixels, end code) is referenced. RGB 2Data that has undergone saturation processing after Gouraud calculation is reduced by half. MON Bit (MSB on): bit 15 Co 3Background is added to data that has undergone saturation processing after Gouraud calculation is reduced by half. MON 0 1 Processing MSB of pixel data in frame buffer is not changed Sets MSB of pixel data in frame buffer to 1 GA SE 148 CMDCOLR (Color Control Word) bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 CMDCOLR +06H Table 8.4 CMDCOLR Part Textured part nti Color bank, color lookup table/8H (LSB fixed at 00), non-textured colors Color mode Color bank mode Lookup table mode RGB mode al Color control word Color bank Color lookup table address Ignored Non-textured part Non-textured color CMDSRCA (Character Address) CMDSRCA +08H bit CMDSIZE (Character Size) 15 14 13 12 11 de 10 9 8 Character address/8H 7 6 5 4 3 2 1 0 0 0 bit CMDSIZE +0AH 15 0 14 0 13 nfi 12 11 10 Character size X/8 Table 8.5 Relationships between Settings and Drawn Pixels 9 8 7 6 5 4 Character size Y 3 2 1 0 Setting in command table 0 1 2 : 63 Co Horizontal (X) direction Number of pixels actually drawn Setting prohibited 8 16 : 504 Setting in command table 0 1 2 : 255 Vertical (Y) direction Number of pixels actually drawn Setting prohibited 1 2 : 255 GA SE VDP1 User's Manual 149 CMDXA~CMDYD (Vertex Coordinate Data) bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 nti CMDXA +0CH Code extension Vertex (A), X coordinates (XA) CMDYA +0EH Code extension Vertex (A), Y coordinates (YA) CMDXB +10H CMDYB +12H CMDXC +14H CMDYC +16H CMDXD +18H Code extension Code extension Code extension Code extension Code extension Vertex (B), X coordinates (XA); or display, X width (XB) Vertex (B), Y coordinates (YA); or display, Y width (YB) Vertex (C), X coordinates (XC) Vertex (C), Y coordinates (YC) Vertex (D), X coordinates (XD) al CMDYD +1AH Note: Code extension de Vertex (D), Y coordinates (YD) The top bit of the parameter is a sign bit. A negative value is indicated by a complement of 2. Extend the code with the upper 6 bits. Table 8.6 Correspondence between Commands and CMDXA-CMDYD Normal sprite draw command Scaled sprite draw command Command (two methods) CMDXA CMDYA Specify coordinates for two points Specify zoom point CMDXB CMDYB Vertex (A) Vertex (A) Zoom point coordinates nfi — — Display width CMDXC CMDYC — Vertex (C) — CMDXD CMDYD — — — Distorted sprite draw command Polygon draw command Polyline draw command Line draw command User clipping coordinate set command System clipping coordinate set Co Vertex (A) Vertex (A) Vertex (A) Vertex (A) Upper-left coordinates — Vertex (B) Vertex (B) Vertex (B) Vertex (B) — — Vertex (C) Vertex (C) Vertex (C) — Lower-right coordinates Lower-right Vertex (D) Vertex (D) Vertex (D) — — — command coordinates Local coordinate set command Local coordinates — — — GA Note: "—" indicates unused. CMDGRDA (Gouraud Shading Table) CMDGRDA +1CH bit 15 14 13 12 11 10 9 8 Gouraud shading table/8H 7 6 5 4 3 2 1 0 SE 150 8.4 Commands System Clipping Coordinate Set Command CMDCTRL CMDLINK bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 +00H 0 +02H +04H JP 0 0 0 0 0 0 0 0 Link specification/8H nti 1 0 0 1 0 0 al (0, 0) +06H TV +08H +0AH CMDXC CMDYC +0CH +0EH +10H +12H de +14H 0 0 0 0 0 0 Lower-right X coordinate (XC) +16H 0 0 0 0 0 0 0 Lower-right Y coordinate (YC) Lower-right Coordinate System clipping area Upper-left coordinates are fixed at (0, 0). +18H +1AH +1CH Note: is ignored. nfi CMDCTRL Co User Clipping Coordinate Set Command CMDLINK bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 +00H 0 +02H JP 0 0 0 0 0 0 0 0 1 0 0 0 Link specification/8H 0 0 Upper-left coordinate +04H TV +06H GA CMDXA CMDYA CMDXC +08H +0AH +0CH 0 0 0 0 0 0 Upper-left X coordinate (XA) +0EH 0 0 0 0 0 0 0 Upper-left Y coordinate (YA) +10H +12H Lower-right coordinate User clipping area System clipping area +14H 0 0 0 0 0 0 Lower-right X coordinate (XC) CMDYC SE +16H 0 0 0 0 0 0 0 Lower-right Y coordinate (YC) +18H +1AH +1CH Note: is ignored. VDP1 User's Manual 151 Local Coordinate Set Command CMDCTRL CMDLINK +00H 0 +02H +04H +06H +08H bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 JP 0 0 0 0 0 0 0 0 1 0 1 0 Link specification/8H 0 0 ntial (0,0) Local coordinate (A) TV +0AH CMDXA +0CH Code extension Local X coordinate (XA) CMDYA +0EH Code extension Local Y coordinate (YA) +10H +12H +14H +16H +18H +1AH de System clipping area +1CH Normal Sprite Draw Command Note: is ignored. nfi MO 0 0 0 Co bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 CMDCTRL +00H CMDLINK +02H CMDPMOD +04H 0 JP 0 0 0 0 0 0 Dir 0 0 0 0 Pc Link specification/8H CI Cm Me EC SP Color mode Color calculation Normal sprite Vertex (A) Vertex (B) Color bank, lookup table/8H (LSB fixed at 00) CMDCOLR +06H Character address/8H 0 0 CMDSRCA +08H GA CMDSIZE +0AH CMDXA +0CH CMDYA +0EH +10H +12H +14H +16H 0 0 Character size X/8 Character size Y Code Code extension Vertex (A), X coordinate (XA) extension Vertex (A), Y coordinate (YA) Vertex (D) Vertex (C) Frame buffer +18H SE CMDGRDA +1AH +1CH Note: Gouraud shading table/8H is ignored. MO = MON, HS = HSS, Pc = Pclp, Cl = Clip, Cm = Cmod, Me = Mesh, EC = CD and 152 Scaled Sprite Draw Command (Coordinates of 2 Points Specification ) CMDCTRL +00H CMDLINK +02H CMDPMOD CMDCOLR +06H bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 JP 0 0 0 0 0 0 Link specification/8H MO 0 0 HS Pc Cl Cm Me EC SP Color mode Dir Color calculation +04H Color bank, lookup table/8H (LSB fixed at 00) 0 0 0 1 ntial Scaled sprite Vertex (A) Vertex (B) CMDSRCA Character address/8H 0 0 +08H CMDSIZE 0 0 Character size X/8 Character size Y Vertex (D) Vertex (C) +0AH CMDXA Code extension Vertex (A), X coordinate (XA) +0CH CMDYA Code extension Vertex (A), Y coordinate (YA) CMDXC CMDYC +0EH +10H de +12H Code extension Vertex (C), X coordinate (XC) +14H Code extension +16H +18H Vertex (C), Y coordinate (YC) Frame buffer CMDGRDA +1AH +1CH Note: nfi Gouraud shading table/8H is ignored. Scaled Sprite Draw Command (Specification of Zoom Point ) CMDCTRL+00H CMDLINK+02H 0 Co bit 15 14 13 12 11 10 9 8 JP ZP 7 6 0 0 Link Specification/8H 5 4 Dir 3 2 1 0 0 0 0 1 Color MO 0 0 HS Pc Cl Cm Me EC SP Color mode calculation Scaled sprite CMDPMOD+04H CMDCOLR Color bank, lookup table/8H (LSB fixed at 00) GA +06H Vertex (A) Vertex (B) CMDSRCA Character address/8H 0 0 +08H Zoom Point CMDSIZE 0 0 Character size X/8 Character size Y Display +0AH Code extension Zoom point (A), X coordinate (XA) width (YB) CMDXA+0CH CMDYA Code extension Zoom point (A), Y coordinate (YA) Vertex (D) +0EH Vertex (C) CMDXB+10H Code extension Display, X width (XB) CMDYB Code extension Display, Y width (YB) Display Width (XB) +12H +14H SE CMDGRDA +1AH +1CH +16H +18H Note: Gouraud shading table/8H is ignored. Frame buffer VDP1 User's Manual 153 Distorted Sprite Draw Command CMDCTRL +00H CMDPMOD CMDCOLR CMDSRCA +06H bit 15 14 13 12 11 10 9 8 7 CMDLINK +02H +04H 0 MO 0 0 JP HS Pc 0 0 0 Character address/8H 0 0 0 6 5 Link specification/8H Cl Cm Me EC SP Color bank, lookup table/8H (LSB fixed at 00) 0 0 4 3 2 1 0 Dir Color mode 0 0 1 0 Color 0 0 calculation ntial Vertex (D) Distorted sprite Vertex (A) +08H 0 0 Character size X/8 Character size Y CMDSIZE +0AH Code extension Vertex (A), X coordinate (XA) CMDXA Vertex (B) +0CH Code extension Vertex (A), Y coordinate (YA) Vertex (C) CMDYA CMDXB CMDYB CMDXC CMDYC CMDXD +0EH +10H +12H +14H Code extension +16H +18H Code extension Code extension Code extension Code extension Vertex (B), X coordinate (XB) Vertex (B), Y coordinate (YB) Vertex (C), X coordinate (XC) Vertex (C), Y coordinate (YC) Vertex (D), X coordinate (XD) de Frame buffer CMDYD CMDGRDA +1AH +1CH Code extension nfi Vertex (D), Y coordinate (YD) Gouraud shading table/8H Note: is ignored. Polygon Draw Command CMDCTRL Co bit 15 14 13 12 11 10 9 8 7 6 +00H 0 CMDLINK+02H JP 0 0 0 0 0 0 Link specification/8H 5 4 0 0 3 2 1 0 0 1 0 0 0 0 Polygon Color Filled with CMDPMOD+04H MO 0 0 0 Pc Cl Cm Me 1 1 0 0 0 calculation non-textured color GA CMDCOLR Non-textured color Vertex (A) +06H Vertex (D) +08H +0AH CMDXA Code extension Vertex (A), X coordinate (XA) +0CH Vertex (B) CMDYA+0EH Vertex (C) Code extension Vertex (A), Y coordinate (YA) CMDXB Code extension +10H Vertex (B), X coordinate (XB) CMDYB Code extension Vertex (B), Y coordinate (YB) +12H CMDXC Frame buffer +14H Code extension Vertex (C), X coordinate (XC) SE CMDYC+16H CMDXD+18H CMDYD CMDGRDA +1AH +1CH Code extension Code extension Code extension Note: Vertex (C), Y coordinate (YC) Vertex (D), X coordinate (XD) Vertex (D), Y coordinate (YD) Gouraud shading table/8H is ignored. 154 Polyline Draw Command CMDCTRL CMDLINK CMDPMOD CMDCOLR +06 bit +00 H +02 H +04 H MO 0 0 0 Pc CI Cm Me 1 1 0 0 0 H +08 H 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 JP 0 0 0 Link specification/8 H Non-textured color 0 0 0 0 0 0 1 0 1 Color 1 0 0 0 calculation ntial Vertex (D) Polyline Vertex (A) +0AH Vertex (B) CMDXA Code extension Vertex (A), X coordinate (XA) Vertex (C) CMDYA +0CH Code extension Vertex (A), Y coordinate (YA) +0EH CMDXB Code extension Vertex (B), X coordinate (XB) +10 H CMDYB CMDXC CMDYC CMDXD CMDYD CMDGRDA +12 H +14 H +16 H +18 H +1AH +1CH Code extension Code extension Code extension Code extension Code extension Vertex (B), Y coordinate (YB) Vertex (C), X coordinate (XC) Vertex (C), Y coordinate (YC) Vertex (D), X coordinate (XD) Vertex (D), Y coordinate (YD) Gouraud shading table/8 H de Frame buffer NOTE: Line Draw Command is ignored. nfi CMDCTRL +00H CMDLINK +02H CMDPMOD +04H Co bit 15 14 13 12 11 10 9 8 7 0 MO JP 0 0 0 0 0 0 0 0 0 Link specification/8H Pc Cl Cm Me 1 1 6 5 4 0 0 0 3 2 1 0 0 1 1 0 0 0 Color 0 0 calculation Line CMDCOLR Non-textured color +06H GA +08H Vertex (A) Vertex (B) +0AH CMDXA Code extension Vertex (A), X coordinate (XA) +0CH CMDYA Code extension Vertex (A), Y coordinate (YA) +0EH CMDXB Code extension Vertex (B), X coordinate (XB) +10H CMDYB Code extension Vertex (B), Y coordinate (YB) Frame buffer +12H +14H +16H SE CMDGRDA +1AH +1CH +18H Note: Gouraud shading table/8H is ignored. VDP1 User's Manual 155 Draw End Command CMDCTRL bit 15 14 13 12 11 10 9 8 7 6 +00H 1 +02H +04H 0 0 0 0 0 nti 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 al +06H +08H +0AH +0CH +0EH +16H +10H +12H +14H de +18H +1AH +1CH Note: is ignored. nfi Co GA SE 156 Chapter 9 nti Precautions for Use al de nfi Co GA SE VDP1 User's Manual 157 VDP1 · Rotated reading of the frame buffer is prohibited during normal, high resolu- tion, HDTV, and double interlace. · The CPU can only access the draw frame buffer. System Registers ntial · DMA access of the system registers is prohibited. Word access must be used. · Be sure to set the system registers after powering on. · Be sure to set bits not used in the system registers to “0.” · Be sure to set DIE to “0” for rotated reading of the frame buffer. Rotated read- ing is prohibited in double interlace. · An undefined screen is displayed in the first frame after changing the DIE bit, so use caution. changed when they are 1/60 second. de · When changing the TVM bit, the frame buffer must be masked. An undefined screen is displayed for one frame during the change. · Set FCM and FCT to “0” during double interlace. The fields can only be · Set the erase/write areas so that upper-left coordinate XA is less than lower- right coordinate YC. nfi right coordinate XC and upper-left coordinate YA is less than or equal to lower- Commands · Local coordinates must be set after powering on. · The clipping coordinate setting range is from (0, 0) to (1023, 511). right coordinate YC. Co · In the clipping coordinate range, upper-left coordinate XA is less than lower- right coordinate XC and upper-left coordinate YA is less than or equal to lower- · Set suitable values for clipping to match the screen mode set by the TVM bit. · Always set the user clipping area inside the system clipping area. They can be set on the same lines. · The upper-left coordinate of the system clipping area is fixed at (0,0) in the hardware. GA · Set unused bits in words used in commands tables to “0.” · Call (call, jump call, skip call) is prohibited in command subroutines. SE 158 · Return (return, jump return, skip return) is prohibited in command main rou- tines. · Only 0H, 5H, 6H, 7H, 9H, AH (10), BH (11), DH (13), EH (14,) and FH (15) are sprite is enlarged or reduced. nti allowed as zoom-point values. Settings other than these are prohibited. · When HSS = 1, the end codes of the original graphic are ignored whether the · Set the lower 2 bits of CMDLINK to “00”.” · Set the lower 2 bits of lookup tables to “00.” al · When setting a color bank, set the lower 4 bits of the color bank data to “0000.” · Set ECD and SPD to “1” and the color mode to “0” for non-textures. · When calculating colors in non-textures, set the non-texture color using RGB data (greater than 8000H). · Set ECD to “0” when the color mode is set to the RGB mode and 7FFFH data are used for the original graphic. de · Set SPD to “0” when the color mode is set to the RGB mode and 0000H data are used for the original graphic. · When the color mode is set to the RGB mode, the frame buffer cannot be set to 8 bits/pixel. The only color modes in which 8 bits/pixel can be set are modes 0, 1, 2, 3, and 4. nfi · When the frame buffer is set to 8 bits/pixel, set the color calculation mode to “0.” Only replace is possible. Color calculation other than this is prohibited. · When the frame buffer is set to 8 bits/pixel, the upper 8 bits of non-textured colors are ignored. The use of RGB data is prohibited at this time. · When the frame buffer is set to 8 bits/pixel, set the MSB ON bit (MON) to “1.” “0.” Co · When the MSB ON bit (MON) is set to “1,” set the color calculation mode to · Store command tables to address 000000H of VRAM. GA SE VDP1 User's Manual 159 (Page 160 is blank in the original Japanese version.) ntial de nfi Co GA SE 160 INDEX # (color) lookup table mode ............................... 89 disable (transparent pixel) ............................... 88 (color) palette code ........................................... 89 1-cycle mode ...................................................... 38 31KC ................................................................... 37 A access (system registers) .................................. 23 address map ...................................................... 18 nti display device ...................................................... 2 display range ..................................................... 14 distorted sprite draw command ................... 124 distorted sprites .................................................. 8 al DMA burst transfer .......................................... 23 double interlace ................................................. 43 double interlace enable bit .............................. 43 double interlace draw line ............................... 43 B draw forced termination register ................... 51 background ........................................................ 94 draw command ............................................... 109 boundaries ......................................................... 24 draw mode word .............................................. 79 burst transfer (DMA)........................................ 23 draw procedure flow ........................................ 28 byte access (VRAM) ......................................... 19 C change (manual mode) .................................... 39 character address ............................................ 103 character pattern (each color mode) .............. 90 character pattern ............................................... 60 de draw end command ....................................... 132 dropout processing ............................................. 9 E end bit ........................................................... 70, 71 end code disable................................................ 86 erase & change (manual mode) ...................... 40 clipping coordinate set command ................ 109 nfi character pattern table ............................... 26, 60 character read direction ................................... 77 character size ................................................... 104 CMDCOLR ........................................................ 98 CMDCTRL ......................................................... 70 erase (manual mode) ........................................ 39 erase/write ........................................................ 46 even lines ........................................................... 43 even/odd coordinate selection ....................... 44 F Co CMDGRDA ..................................................... 106 CMDLINK ......................................................... 78 CMDPMOD ....................................................... 79 CMDSIZE ......................................................... 104 CMDSRCA ....................................................... 103 CMDXA~CMDYD .......................................... 105 color .................................................................... 12 color bank .......................................................... 99 fetch .................................................................... 29 fetch status (of end bit) .................................... 52 fill data (erase/write) ....................................... 46 fill-in (polygons) ............................................... 10 fixed point (zoom point) .................................. 73 flow (of command tables) ................................ 30 flow (of draw procedure) ................................ 28 frame ................................................................... 38 color bank code ............................................... 100 frame buffer ................................................... 2, 20 color calculation ................................................ 93 frame buffer change mode bit ......................... 38 GA color control word ............................................ 98 frame buffer change mode register ................ 38 color lookup table ............................... 26, 62, 101 frame buffer change trigger bit ....................... 38 color mode ......................................................... 89 command table ...................................... 25, 66, 69 G command table flow ......................................... 30 Gouraud shading ........................................ 64, 95 commands .................................................. 71, 109 Gouraud shading table ...................... 26, 64, 106 control words .................................................... 70 coordinate set command ................................ 109 H CPU ....................................................................... 2 SE current operation table address (register) ..... 55 half-luminance .................................................. 95 half-transparent ................................................. 95 D HDTV ................................................................. 37 disable (end code) ............................................. 86 high resolution .................................................. 37 disable (pre-clipping) ....................................... 83 high speed shrink ............................................. 81 horizontal inversion ......................................... 77 VDP1 User's Manual 161 I inside drawing mode ............................... 84, 115 plot trigger mode ..................................................45 interlace mode ................................................... 43 plot trigger mode register....................................45 interrupt signal .................................................. 52 point coordinate data .........................................105 inversion (horizontal, vertical) ....................... 77 J jump assign ........................................................ 72 jump call ............................................................. 72 jump mode ......................................................... 72 jump next ........................................................... 72 nti polling ....................................................................52 polygon draw command ...................................126 polygons .................................................................10 al polyline draw command ...................................128 polylines ................................................................. 11 pre-clipping ...........................................................83 last operation table address (register) ................54 jump return ........................................................ 72 pseudo draw continuation ..................................56 L R line draw command ....................................... 130 read direction (character) .....................................77 lines ..................................................................... 11 LINK specification ............................................ 78 local coordinate set command ...................... 116 local coordinates ............................................. 117 lookup table mode ............................................ 89 luminance (Gouraud shading) ........................ 64 luminance (RGB) ............................................... 91 de read/write access (VRAM)..................................19 referencing (of tables) ...........................................31 registers (system) ..................................................34 replace ....................................................................94 reset .........................................................................23 RGB code ................................................................91 RGB mode ..............................................................89 M manual mode ..................................................... 39 mesh enable ....................................................... 85 mode 0 (color mode) ........................................ 90 mode 1 (color mode) ........................................ 90 mode 2 (color mode) ........................................ 91 nfi S scaled sprite .............................................................6 scaled sprite draw command ............................120 screen modes ...................................................14, 37 shadow (color calculation) ..................................94 shadow (MSB ON) ................................................97 N Co mode 3 (color mode) ........................................ 91 mode 4 (color mode) ........................................ 91 mode 5 (color mode) ........................................ 91 mode status register ......................................... 57 MSB ON ............................................................. 97 single interlace ......................................................43 skip assign..............................................................72 skip call...................................................................72 skip next .................................................................72 skip return ..............................................................72 specification of coordinates of two points (scaled sprite draw command) .120 non-textured color .................................... 13, 102 specification of coordinates non-textured parts ............................................ 10 of two points (scaled sprites) ................................6 non-textured draw commands ..................... 109 specification of zoom point O GA normal sprite ....................................................... 5 normal sprite draw command ...................... 118 NTSC system ..................................................... 37 odd lines ............................................................. 43 order of priority (frame buffer) ....................... 20 (scaled sprite draw command) .........................122 specification of zoom point (scaled sprites) ........7 sprite IC ....................................................................2 subroutines (jump call, skip call)..................30, 72 system clipping ................................................... 111 system clipping coordinate set command....... 110 system controller.....................................................2 order of priority (VRAM) ................................ 19 system registers ...........................................2, 23, 34 original picture .................................................. 94 P SE outside drawing mode ............................. 84, 115 PAL system ........................................................ 37 palette code ........................................................ 89 parts ...................................................................... 4 162 T table referencing flow ....................................... 31 tables (in VRAM) ........................................ 24, 59 texture draw commands ................................ 109 textured parts ...................................................... 5 transfer end status register .............................. 52 transfer-over ...................................................... 53 transparent color code ...................................... 88 transparent pixel disable ................................. 88 trigger (draw) .................................................... 45 TV mode selection bit ....................................... 36 ntial TV mode selection register .............................. 36 U user clipping .................................................... 113 user clipping coordinate set command ....... 112 user clipping enable ......................................... 84 user clipping mode ........................................... 84 V V-blank erase/write enable bit ....................... 36 VDP1 ..................................................................... 1 de nfi VDP1 Functions .................................................. 3 VDP2 ..................................................................... 2 version number ................................................. 57 vertex coordinate data.................................... 105 vertical inversion .............................................. 77 VRAM ............................................................. 2, 19 W Co window (MSB ON) ........................................... 97 word access (VRAM) ........................................ 19 Z zoom point(fixed point) ................................... 73 GA SE VDP1 User's Manual 163