?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. <html><head>
  2. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  3. <title>
  4. The MSX Red Book Revised - P.P.I.
  5. </title>
  6.  
  7. <style type="text/css">
  8.   code {color: #0000C0}
  9.   pre {color: #FF0000}
  10. </style>
  11.  
  12. </head>
  13.  
  14. <body>
  15.  
  16. <br><a name="VDP"></a><h2 align="Center">4. VIDEO DISPLAY PROCESSOR</h2><br><br>
  17.  
  18.  
  19. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The 9929 VDP contains all the circuitry necessary to
  20. generate the video display. It appears to the Z80 as two I/O
  21. ports called the Data Port and the Command Port. Although the
  22. VDP has its own 16 KB of VRAM (Video RAM), the contents of which
  23. define the screen image, this cannot be directly accessed by
  24. the Z80. Instead it must use the two I/O ports to modify the
  25. VRAM and to set the various VDP operating conditions.</p>
  26.  
  27. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The original version of "The MSX Red Book"
  28. documented the VDP ports associated to I/O addresses 98H and 99H,
  29. which are prevalent on most machines, but it is completely deprecated
  30. by MSX standard that foresees VDP expansions, which must use different
  31. I/O mapping to avoid conflicts with internal VDP. The MSX-BIOS contains
  32. two addresses that <b>must be</b> read to determine where the VDP read and write
  33. ports are mapped. These addresses are 0006H (read ports) and 0007H (write ports).
  34. On MSX, VDP has only two ports mapped. On MSX2, MSX2+ and turbo R, VDP has six ports mapped.</p>
  35.  
  36. <ul>
  37.   <table cellspacing="0" cellpadding="4" border="1">
  38.     <tbody><tr align="center"><td>VDP Port</td><td>Reading / Writing</td><td>Value</td><td>MSX Version</td><td>Function</td></tr>
  39.     <tr align="center"><td>#0</td><td>read</td><td>(0006H)</td><td>1&nbsp;2&nbsp;2+&nbsp;tR</td><td>VRAM datum read</td></tr>
  40.     <tr align="center"><td>#0</td><td>write</td><td>(0007H)</td><td>1&nbsp;2&nbsp;2+&nbsp;tR</td><td>VRAM datum write</td></tr>
  41.     <tr align="center"><td>#1</td><td>read</td><td>(0006H)+1</td><td>&nbsp;&nbsp;2&nbsp;2+&nbsp;tR</td><td>Status registers</td></tr>
  42.     <tr align="center"><td>#1</td><td>write</td><td>(0007H)+1</td><td>&nbsp;&nbsp;2&nbsp;2+&nbsp;tR</td><td>VDP Command</td></tr>
  43.     <tr align="center"><td>#2</td><td>write</td><td>(0007H)+2</td><td>&nbsp;&nbsp;2&nbsp;2+&nbsp;tR</td><td>Palette registers access</td></tr>
  44.     <tr align="center"><td>#3</td><td>write</td><td>(0007H)+3</td><td>&nbsp;&nbsp;2&nbsp;2+&nbsp;tR</td><td>Sequential registers access</td></tr>
  45.   </tbody></table>
  46. </ul>
  47.  
  48. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;Usage example:</p>
  49.  
  50. <ul>
  51.   <table cellspacing="0" cellpadding="0" border="0">
  52.     <tbody><tr valign="Top"><td><code>ld   c,(0006H)</code></td><td rowspan="8">&nbsp;&nbsp;&nbsp;&nbsp;</td><td>; Load standard VDP read port (0006H) in register C.</td></tr>
  53.     <tr valign="Top"><td><code>inc  c</code></td><td>; Set status register port in C.</td></tr>
  54.     <tr valign="Top"><td><code>in   a,(c)</code></td><td>; Read status into A register.</td></tr>
  55.     <tr valign="Top"><td><hr style="border-style:dashed"></td><td></td></tr>
  56.     <tr valign="Top"><td><code>ld   c,(0007H)</code></td><td>; Load standard VDP write port (0007H) in register C.</td></tr>
  57.     <tr valign="Top"><td><code>inc  c<br>inc  c<br>inc  c</code></td><td>; Set sequential register write port in C.</td></tr>
  58.     <tr valign="Top"><td><code>out  (c),l<br>out  (c),h</code></td><td>; Write datum in HL to sequential register port.</td></tr>
  59.   </tbody></table>
  60. </ul>
  61.  
  62. <br><a name="VDP-Data"></a><h3 align="Left">Data Port</h3><br>
  63.  
  64. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The Data Port, which value is
  65. stored in <a href="http://www.angelfire.com/art2/unicorndreams/msx/RR-BIOS.html">BIOS</a> address 00006H, is used to read or write single bytes to the
  66. VRAM. The VDP possesses an internal address register pointing
  67. to a location in the VRAM. Reading the Data Port will input the
  68. byte from this VRAM location, while writing to the Data Port
  69. will store a byte there. After a read or write the address
  70. register is automatically incremented to point to the next VRAM
  71. location. Sequential bytes can be accessed simply by continuous
  72. reads or writes to the Data Port.</p>
  73.  
  74.  
  75. <br><a name="VDP-Command"></a><h3 align="Left">Command Port</h3><br>
  76.  
  77. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The Command Port is used for three purposes:</p>
  78.  
  79. <ol>
  80.   <li><a href="#VDP-Address">To set up the Data Port address register.</a></li>
  81.   <li><a href="#ModeReg">To write to one of the VDP Mode Registers.</a></li>
  82.   <li><a href="#VDP-StatusReg">To read the VDP Status Registers.</a></li>
  83. </ol>
  84.  
  85.  
  86. <br><a name="VDP-Address"></a><h3 align="Left">Address Register</h3><br>
  87.  
  88. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The Data Port address register (VRAM pointer) must be set up in different
  89. ways depending on whether the subsequent access is to be a read
  90. or a write. The address register can be set to any value from
  91. 0000H to 3FFFH by first writing the LSB (Least Significant
  92. Byte) and then the MSB (Most Significant Byte) to the Command
  93. Port. Bits 6 and 7 of the MSB are used by the VDP to determine
  94. whether the address register is being set up for subsequent
  95. reads or writes as follows:</p>
  96.  
  97. <a name="Figure1"></a>
  98. <ul>
  99.   <table cellspacing="16" cellpadding="0" border="0">
  100.     <tbody><tr align="Center"><td></td><td>first byte</td><td>second byte</td></tr>
  101.     <tr align="Center"><td>Read:</td><td>xxxxxxxx</td><td>00xxxxxx</td></tr>
  102.     <tr align="Center"><td>Write:</td><td>xxxxxxxx</td><td>01xxxxxx</td></tr>
  103.   </tbody></table>
  104.   <p>Figure 1: VDP Address Setup.</p>
  105. </ul>
  106.  
  107. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;It is important that no other accesses are made to the VDP
  108. in between writing the LSB and the MSB as this will upset its
  109. synchronization. The MSX ROM interrupt handler is continuously
  110. reading the VDP Status Register as a background task so
  111. interrupts should be disabled as necessary. It is also important
  112. to prepare VDP for reading or writing every time the program
  113. needs to change from one operation to the other, that is, a
  114. program <b>cannot</b> read a byte from VRAM and, without setting
  115. VDP for writing, write a byte to the next address, or write
  116. a byte to VRAM and, after that, read a byte them the next
  117. address without preparing VDP for reading.</p>
  118.  
  119. <ul>
  120.   <table cellspacing="0" cellpadding="0" border="0">
  121.     <tbody><tr valign="Top"><td><code>di</code></td><td rowspan="15">&nbsp;&nbsp;&nbsp;&nbsp;</td><td>; Disable all maskable interruptions.</td></tr>
  122.     <tr valign="Top"><td><code>ld   c,(0007H)<br>inc  c</code></td><td>; Load standard VDP command port (0007H)+1 in register C.</td></tr>
  123.     <tr valign="Top"><td><code>out  (c),l</code></td><td>; Write LSB of VRAM address in HL to VDP.</td></tr>
  124.     <tr valign="Top"><td><code>ld   a,h</code></td><td>; Load MSB from VRAM addess in HL to A.</td></tr>
  125.     <tr valign="Top"><td><code>and  3FH</code></td><td>; VRAM read mask.</td></tr>
  126.     <tr valign="Top"><td><code>out  (c),a</code></td><td>; Write MSB of VRAM address, preparing it to be read.</td></tr>
  127.     <tr valign="Top"><td><hr style="border-style:dashed"></td><td></td></tr>
  128.     <tr valign="Top"><td><code>di</code></td><td>; Disable all maskable interruptions.</td></tr>
  129.     <tr valign="Top"><td><code>ld   c,(0007H)<br>inc  c</code></td><td>; Load standard VDP command port (0007H)+1 in register C.</td></tr>
  130.     <tr valign="Top"><td><code>out  (c),l</code></td><td>; Write LSB of VRAM address in HL to VDP.</td></tr>
  131.     <tr valign="Top"><td><code>ld   a,h</code></td><td>; Load MSB from VRAM addess in HL to A.</td></tr>
  132.     <tr valign="Top"><td><code>and  7FH<br>or   40H</code></td><td>; VRAM write mask.</td></tr>
  133.     <tr valign="Top"><td><code>out  (c),a</code></td><td>; Write MSB of VRAM address, preparing it for writing.</td></tr>
  134.   </tbody></table>
  135. </ul>
  136.  
  137.  
  138.  
  139. <br><a name="ModeReg"></a><h3 align="Left">VDP Mode Registers</h3><br>
  140.  
  141. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The VDP has
  142. forty-seven write-only registers, numbered 0 to 46,
  143. which control its general operation. A particular register is
  144. set by first writing a data byte then a register selection byte
  145. to the Command Port. The register selection byte contains the
  146. register number in the six lower bits: 10RRRRRR. As the Mode
  147. Registers are write-only, and cannot be read, the MSX ROM
  148. maintains an exact copy of the part of the registers in the Workspace
  149. Area of RAM (Chapter 6). Using the MSX ROM standard routines
  150. for VDP functions ensures that those registers images are correctly
  151. updated.</p>
  152.  
  153. <a name="Figure2"></a>
  154. <ul>
  155.   <table cellspacing="16" cellpadding="0" border="0">
  156.     <tbody><tr align="Center"><td></td><td>first byte</td><td>second byte</td></tr>
  157.     <tr align="Center"><td>Set up register:</td><td>xxxxxxxx</td><td>10xxxxxx</td></tr>
  158.   </tbody></table>
  159.   <p>Figure 2: VDP Address Setup.</p>
  160. </ul>
  161.  
  162.  
  163. <br><a name="ModeReg0"></a><h4 align="Left">Mode Register 0</h4><br>
  164.  
  165. <a name="Figure3"></a>
  166. <ul>
  167.   <table style="border-collapse: collapse" width="75%" cellspacing="0" cellpadding="4" border="0">
  168.     <tbody><tr align="Center"><td width="12.5%">7</td><td width="12.5%">6</td><td width="12.5%">5</td><td width="12.5%">4</td><td width="12.5%">3</td><td width="12.5%">2</td><td width="12.5%">1</td><td width="12.5%">0</td></tr>
  169.     <tr align="Center">
  170.       <td style="border: 1px solid">0</td>
  171.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg0-DG'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">DG</td>
  172.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg0-IE2'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'" bgcolor="#FFFFFF">IE2</td>
  173.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg0-IE1'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'" bgcolor="#FFFFFF">IE1</td>
  174.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg0-M5'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">M5</td>
  175.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg0-M4'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">M4</td>
  176.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg0-M3'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">M3</td>
  177.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg0-EV'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">EV</td>
  178.     </tr>
  179.   </tbody></table>
  180.   <p>Figure 3.</p>
  181. </ul>
  182.  
  183. <a name="ModeReg0-EV"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The <b>External VDP</b>
  184. (EV) bit determines whether external VDP input is to be enabled or disabled: 0=Disabled, 1=Enabled.</p>
  185.  
  186. <a name="ModeReg0-M3"></a><a href="#ModeReg0-M4"></a><a href="#ModeReg0-M5"></a>
  187. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The <b>M3</b>, <b>M4</b> and <b>M5</b>
  188. bits are three of the five <a href="#VDP-ScreenMode">VDP mode Selection</a> bits
  189. that define the VDP display mode.</p>
  190.  
  191. <a name="ModeReg0-IE1"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The <b>Interruption Enable 1</b> (IE1) bit,
  192. when set to "1", enables the line interruption, of which line number is defined by
  193. <a href="#ModeReg19">Mode Register 19</a>. When the display raster reaches the defined line,
  194. an interruption is sent to the CPU. The <a href="#VDP-StatusReg0-F">Status Register 0 Frame Flag</a> should be
  195. read to check if the interruption was not an end-of-frame interruption.</p>
  196.  
  197. <a name="ModeReg0-IE2"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The <b>Interruption Enable 2</b> (IE2) bit,
  198. when set to "1", enables light-pen interruption. When the display raster reaches the light-pen sensor position on
  199. screen, an interruption is sent to the system. The <a href="#VDP-StatusReg0-F">Status Register 0 Frame Flag</a> should be
  200. read to check if the interruption was not an end-of-frame interruption.</p>
  201.  
  202. <a name="ModeReg0-DG"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The <b>Digitizer</b> (DG) bit,
  203. when set to "1", enables the colour bus input mode, capturing data into the VRAM.</p>
  204.  
  205.  
  206. <br><a name="ModeReg1"></a><h4 align="Left">Mode Register 1</h4><br>
  207.  
  208. <a name="Figure4"></a>
  209. <ul>
  210.   <table style="border-collapse: collapse" cellspacing="0" cellpadding="4" border="0">
  211.     <tbody><tr align="Center"><td width="12.5%">7</td><td width="12.5%">6</td><td width="12.5%">5</td><td width="12.5%">4</td><td width="12.5%">3</td><td width="12.5%">2</td><td width="12.5%">1</td><td width="12.5%">0</td></tr>
  212.     <tr align="Center">
  213.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg1-4-16K'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">4/16K</td>
  214.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg1-Blank'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">Blank</td>
  215.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg1-IE'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">IE</td>
  216.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg1-M1'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">M1</td>
  217.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg1-M2'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">M2</td>
  218.       <td style="border: 1px solid">0</td>
  219.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg1-Size'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">Size</td>
  220.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg1-Mag'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">Mag</td></tr>
  221.   </tbody></table>
  222.   <p>Figure 4: VDP Mode Register 1.</p>
  223. </ul>
  224.  
  225.  
  226. <a name="ModeReg1-Mag"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The <b>Magnification</b>
  227. (Mag) bit determines whether sprites will be
  228. normal or doubled in size: 0=Normal, 1=Doubled.</p>
  229.  
  230. <a name="ModeReg1-Size"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The
  231. <b>Size</b> bit determines whether each sprite pattern will be
  232. 8x8 bits or 16x16 bits: 0=8x8, 1=16x16.</p>
  233.  
  234. <a name="ModeReg1-M1"></a><a name="ModeReg1-M2"></a>
  235. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The <b>M1</b>
  236. and <b>M2</b> bits determine the <a href="#VDP-ScreenMode">VDP
  237. operating mode</a> in conjunction with the M3, M4 and M5 bits
  238. from <a href="#ModeReg0">Mode Register 0</a>.</p>
  239.  
  240. <a name="ModeReg1-IE"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The
  241. <b>Interrupt Enable</b> bit enables or disables the interrupt
  242. output signal from the VDP: 0=Disable, 1=Enable.</p>
  243.  
  244. <a name="ModeReg1-Blank"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The
  245. <b>Blank</b> bit is used to enable or disable the entire video
  246. display: 0=Disable, 1=Enable. When the display is blanked it
  247. will be the same colour as the border.</p>
  248.  
  249. <a name="ModeReg1-4-16K"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The <b>4/16K</b> bit
  250. alters the VDP VRAM addressing characteristics to suit either 4 KB or 16 KB chips:
  251. 0=4 KB, 1=16 KB.</p>
  252.  
  253.  
  254. <br><a name="ModeReg2"></a><h4 align="Left">Mode Register 2</h4><br>
  255.  
  256. <a name="Figure5"></a>
  257. <ul>
  258.   <table style="border-collapse: collapse" cellspacing="0" cellpadding="4" border="0">
  259.     <tbody><tr align="Center"><td width="12.5%">7</td><td width="12.5%">6</td><td width="12.5%">5</td><td width="12.5%">4</td><td width="12.5%">3</td><td width="12.5%">2</td><td width="12.5%">1</td><td width="12.5%">0</td></tr>
  260.     <tr align="Center"><td style="border: 1px solid">0</td><td style="border: 1px solid">0</td><td style="border: 1px solid">0</td><td style="border: 1px solid">0</td><td colspan="4" style="border: 1px solid">Name&nbsp;Table&nbsp;Base</td></tr>
  261.   </tbody></table>
  262.   <p>Figure 5.</p>
  263. </ul>
  264.  
  265.  
  266. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;Mode Register 2 defines the starting address of the Name
  267. Table in the VDP VRAM. The four available bits only specify
  268. positions 00BB BB00 0000 0000 of the full address so register
  269. contents of 0FH would result in a base address of 3C00H.</p>
  270.  
  271.  
  272.  
  273. <br><a name="ModeReg3"></a><h4 align="Left">Mode Register 3</h4><br>
  274.  
  275. <a name="Figure6"></a>
  276. <ul>
  277.   <table style="border-collapse: collapse" width="75%" cellspacing="0" cellpadding="4" border="0">
  278.     <tbody><tr align="Center"><td width="12.5%">7</td><td width="12.5%">6</td><td width="12.5%">5</td><td width="12.5%">4</td><td width="12.5%">3</td><td width="12.5%">2</td><td width="12.5%">1</td><td width="12.5%">0</td></tr>
  279.     <tr align="Center"><td colspan="8" style="border: 1px solid">Colour&nbsp;Table&nbsp;Base</td></tr>
  280.   </tbody></table>
  281.   <p>Figure 6.</p>
  282. </ul>
  283.  
  284.  
  285. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;Mode Register 3 defines the starting address of the Colour
  286. Table in the VDP VRAM. The eight available bits only specify
  287. positions 00BB BBBB BB00 0000 of the full address so register
  288. contents of FFH would result in a base address of 3FC0H. In
  289. Graphics Mode only bit 7 is effective thus offering a base of
  290. 0000H or 2000H. Bits 0 to 6 must be 1.</p>
  291.  
  292.  
  293.  
  294. <br><a name="ModeReg4"></a><h4 align="Left">Mode Register 4</h4><br>
  295.  
  296. <a name="Figure7"></a>
  297. <ul>
  298.   <table style="border-collapse: collapse" cellspacing="0" cellpadding="4" border="0">
  299.     <tbody><tr align="Center"><td width="12.5%">7</td><td width="12.5%">6</td><td width="12.5%">5</td><td width="12.5%">4</td><td width="12.5%">3</td><td width="12.5%">2</td><td width="12.5%">1</td><td width="12.5%">0</td></tr>
  300.     <tr align="Center"><td style="border: 1px solid">0</td><td style="border: 1px solid">0</td><td style="border: 1px solid">0</td><td style="border: 1px solid">0</td><td style="border: 1px solid">0</td><td colspan="3" style="border: 1px solid">Character&nbsp;Pattern</td></tr>
  301.   </tbody></table>
  302.   <p>Figure 7.</p>
  303. </ul>
  304.  
  305.  
  306. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;Mode Register 4 defines the starting address of the
  307. Character Pattern Table in the VDP VRAM. The three available
  308. bits only specify positions 00BB B000 0000 0000 of the full
  309. address so register contents of 07H would result in a base
  310. address of 3800H. In Graphics Mode only bit 2 is effective thus
  311. offering a base of 0000H or 2000H. Bits 0 and 1 must be 1.</p>
  312.  
  313.  
  314.  
  315. <br><a name="ModeReg5"></a><h4 align="Left">Mode Register 5</h4><br>
  316.  
  317. <a name="Figure8"></a>
  318. <ul>
  319.   <table style="border-collapse: collapse" width="75%" cellspacing="0" cellpadding="4" border="0">
  320.     <tbody><tr align="Center"><td width="12.5%">7</td><td width="12.5%">6</td><td width="12.5%">5</td><td width="12.5%">4</td><td width="12.5%">3</td><td width="12.5%">2</td><td width="12.5%">1</td><td width="12.5%">0</td></tr>
  321.     <tr align="Center"><td style="border: 1px solid">0</td><td colspan="7" style="border: 1px solid">Sprite Attribute base</td></tr>
  322.   </tbody></table>
  323.   <p>Figure 8.</p>
  324. </ul>
  325.  
  326.  
  327. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;Mode Register 5 defines the starting address of the Sprite
  328. Attribute Table in the VDP VRAM. The seven available bits only
  329. specify positions 00BB BBBB B000 0000 of the full address so
  330. register contents of 7FH would result in a base address of
  331. 3F80H.</p>
  332.  
  333.  
  334.  
  335. <br><a name="ModeReg6"></a><h4 align="Left">Mode Register 6</h4><br>
  336.  
  337. <a name="Figure9"></a>
  338. <ul>
  339.   <table style="border-collapse: collapse" width="75%" cellspacing="0" cellpadding="4" border="0">
  340.     <tbody><tr align="Center"><td width="12.5%">7</td><td width="12.5%">6</td><td width="12.5%">5</td><td width="12.5%">4</td><td width="12.5%">3</td><td width="12.5%">2</td><td width="12.5%">1</td><td width="12.5%">0</td></tr>
  341.     <tr align="Center"><td style="border: 1px solid">0</td><td style="border: 1px solid">0</td><td style="border: 1px solid">0</td><td style="border: 1px solid">0</td><td style="border: 1px solid">0</td><td colspan="3" style="border: 1px solid">Sprite Pattern</td></tr>
  342.   </tbody></table>
  343.   <p>Figure 9.</p>
  344. </ul>
  345.  
  346.  
  347. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;Mode Register 6 defines the starting address of the Sprite
  348. Pattern Table in the VDP VRAM. The three available bits only
  349. specify positions 00BB B000 0000 0000 of the full address so
  350. register contents of 07H would result in a base address of
  351. 3800H.</p>
  352.  
  353.  
  354. <br><a name="ModeReg7"></a><h4 align="Left">Mode Register 7</h4><br>
  355.  
  356. <a name="Figure10"></a>
  357. <ul>
  358.   <table style="border-collapse: collapse" width="75%" cellspacing="0" cellpadding="4" border="0">
  359.     <tbody><tr align="Center"><td width="12.5%">7</td><td width="12.5%">6</td><td width="12.5%">5</td><td width="12.5%">4</td><td width="12.5%">3</td><td width="12.5%">2</td><td width="12.5%">1</td><td width="12.5%">0</td></tr>
  360.     <tr align="Center">
  361.       <td colspan="4" style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg7-TC'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'" bgcolor="#FFFFFF">Text Colour 1</td>
  362.       <td colspan="4" style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#ModeReg7-BC'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">Border Colour</td></tr>
  363.   </tbody></table>
  364.   <p>Figure 10.</p>
  365. </ul>
  366.  
  367.  
  368. <a name="ModeReg7-BC"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The
  369. <b>Border Colour</b> bits determine the colour of the region
  370. surrounding the active video area in all four VDP modes. They
  371. also determine the colour of all 0 pixels on the screen in
  372. 40x24 Text Mode. Note that the border region actually extends
  373. across the entire screen but will only become visible in the
  374. active area if the overlying pixel is transparent.</p>
  375.  
  376. <a name="ModeReg7-TC"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The
  377. <b>Text Colour</b> 1 bits determine the colour of all 1 pixels
  378. in 40x24 Text Mode. They have no effect in the other three
  379. modes where greater flexibility is provided through the use of
  380. the Colour Table. The VDP colour codes are:</p>
  381.  
  382. <a name="Figure11"></a>
  383. <ul>
  384.   <table cellspacing="8" cellpadding="0" border="0">
  385.     <tbody><tr align="Center"><td align="Right"><b>Index</b></td><td>&nbsp;</td><td bgcolor="#FFFFFF"><b>Colour</b></td><td>&nbsp;</td><td><b>Name</b></td></tr>
  386.     <tr align="Center"><td colspan="5"><hr></td></tr>
  387.     <tr align="Center"><td align="Right">0</td><td rowspan="16">&nbsp;</td><td bgcolor="#FFFFFF">&nbsp;</td><td rowspan="16">&nbsp;</td><td>Transparent</td></tr>
  388.     <tr align="Center"><td align="Right">1</td><td bgcolor="#000000">&nbsp;</td><td>Black</td></tr>
  389.     <tr align="Center"><td align="Right">2</td><td bgcolor="#20C840">&nbsp;</td><td>Green</td></tr>
  390.     <tr align="Center"><td align="Right">3</td><td bgcolor="#58D878">&nbsp;</td><td>Light Green</td></tr>
  391.     <tr align="Center"><td align="Right">4</td><td bgcolor="#5050E8">&nbsp;</td><td>Dark Blue</td></tr>
  392.     <tr align="Center"><td align="Right">5</td><td bgcolor="#7870F7">&nbsp;</td><td>Light Blue</td></tr>
  393.     <tr align="Center"><td align="Right">6</td><td bgcolor="#D05048">&nbsp;</td><td>Dark Red</td></tr>
  394.     <tr align="Center"><td align="Right">7</td><td bgcolor="#40E8F0">&nbsp;</td><td>Cyan</td></tr>
  395.     <tr align="Center"><td align="Right">8</td><td bgcolor="#F75050">&nbsp;</td><td>Red</td></tr>
  396.     <tr align="Center"><td align="Right">9</td><td bgcolor="#F77878">&nbsp;</td><td>Bright Red</td></tr>
  397.     <tr align="Center"><td align="Right">10</td><td bgcolor="#D0C050">&nbsp;</td><td>Yellow</td></tr>
  398.     <tr align="Center"><td align="Right">11</td><td bgcolor="#E0C880">&nbsp;</td><td>Light Yellow</td></tr>
  399.     <tr align="Center"><td align="Right">12</td><td bgcolor="#20B038">&nbsp;</td><td>Dark Green</td></tr>
  400.     <tr align="Center"><td align="Right">13</td><td bgcolor="#C858B8">&nbsp;</td><td>Purple</td></tr>
  401.     <tr align="Center"><td align="Right">14</td><td bgcolor="#C8C8C8">&nbsp;</td><td>Gray</td></tr>
  402.     <tr align="Center"><td align="Right">15</td><td bgcolor="#F7F7F7">&nbsp;</td><td>White</td></tr>
  403.   </tbody></table>
  404.   <p>Figure 11: MSX default colours.</p>
  405. </ul>
  406.  
  407. <a name="Figure11b"></a>
  408. <ul>
  409.   <table cellspacing="8" cellpadding="0" border="0">
  410.     <tbody><tr align="Center"><td align="Right"><b>Index</b></td><td>&nbsp;</td><td bgcolor="#FFFFFF"><b>Colour</b></td><td>&nbsp;</td><td><b>Name</b></td></tr>
  411.     <tr align="Center"><td colspan="5"><hr></td></tr>
  412.     <tr align="Center"><td align="Right">0</td><td rowspan="16">&nbsp;</td><td bgcolor="#FFFFFF">&nbsp;</td><td rowspan="16">&nbsp;</td><td>Transparent</td></tr>
  413.     <tr align="Center"><td align="Right">1</td><td bgcolor="#060653">&nbsp;</td><td>Dark Blue</td></tr>
  414.     <tr align="Center"><td align="Right">2</td><td bgcolor="#6A0606">&nbsp;</td><td>Dark Red</td></tr>
  415.     <tr align="Center"><td align="Right">3</td><td bgcolor="#6A0653">&nbsp;</td><td>Dark Purple</td></tr>
  416.     <tr align="Center"><td align="Right">4</td><td bgcolor="#066A06">&nbsp;</td><td>Dark Green</td></tr>
  417.     <tr align="Center"><td align="Right">5</td><td bgcolor="#066A53">&nbsp;</td><td>Dark Cyan</td></tr>
  418.     <tr align="Center"><td align="Right">6</td><td bgcolor="#6A6A06">&nbsp;</td><td>Dark Yellow</td></tr>
  419.     <tr align="Center"><td align="Right">7</td><td bgcolor="#6A6A53">&nbsp;</td><td>Gray</td></tr>
  420.     <tr align="Center"><td align="Right">8</td><td bgcolor="#F99053">&nbsp;</td><td>Orange</td></tr>
  421.     <tr align="Center"><td align="Right">9</td><td bgcolor="#0606F9">&nbsp;</td><td>Blue</td></tr>
  422.     <tr align="Center"><td align="Right">10</td><td bgcolor="#F90606">&nbsp;</td><td>Red</td></tr>
  423.     <tr align="Center"><td align="Right">11</td><td bgcolor="#F906F9">&nbsp;</td><td>Magenta</td></tr>
  424.     <tr align="Center"><td align="Right">12</td><td bgcolor="#06F906">&nbsp;</td><td>Green</td></tr>
  425.     <tr align="Center"><td align="Right">13</td><td bgcolor="#06F9F9">&nbsp;</td><td>Cyan</td></tr>
  426.     <tr align="Center"><td align="Right">14</td><td bgcolor="#F9F906">&nbsp;</td><td>Yellow</td></tr>
  427.     <tr align="Center"><td align="Right">15</td><td bgcolor="#F9F9F9">&nbsp;</td><td>White</td></tr>
  428.   </tbody></table>
  429.   <p>Figure 11b: (screen 8) sprite colours.</p>
  430. </ul>
  431.  
  432.  
  433. <br><a name="VDP-StatusReg"></a><h3 align="Left">VDP Status Registers</h3><br>
  434.  
  435. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;Reading the Command Port will input the contents of the VDP
  436. Status Registers. On MSX, there is only one status register. On MSX2, MSX2+ and turbo R, there
  437. are ten status registers (from S0 till S9), which are selected by
  438. <a href="#ModeReg15">Mode Register 15</a>.</p>
  439.  
  440.  
  441. <br><a name="VDP-StatusReg0"></a><h4 align="Left">VDP Status Register 0</h4><br>
  442.  
  443. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;On MSX, this is the only status register available:</p>
  444.  
  445. <a name="Figure12"></a>
  446. <ul>
  447.   <table style="border-collapse: collapse" width="75%" cellspacing="0" cellpadding="4" border="0">
  448.     <tbody><tr align="Center"><td width="12.5%">7</td><td width="12.5%">6</td><td width="12.5%">5</td><td width="12.5%">4</td><td width="12.5%">3</td><td width="12.5%">2</td><td width="12.5%">1</td><td width="12.5%">0</td></tr>
  449.     <tr align="Center">
  450.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#VDP-StatusReg0-F'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">F</td>
  451.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#VDP-StatusReg0-5S'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">5S</td>
  452.       <td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#VDP-StatusReg0-C'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">C</td>
  453.       <td style="border: 1px solid; cursor:pointer; cursor:hand" colspan="5" onclick="window.location='#VDP-StatusReg0-5SFlag'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">Fifth Sprite Number</td>
  454.     </tr>
  455.   </tbody></table>
  456.   <p>Figure 12: VDP Status Register.</p>
  457. </ul>
  458.  
  459. <a name="VDP-StatusReg0-5SNum"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The <b>Fifth Sprite Number</b> bits contain the number
  460. (0 to 31) of the sprite triggering the <a href="#VDP-StatusReg0-5SFlag">Fifth Sprite Flag</a>.</p>
  461.  
  462. <a name="VDP-StatusReg0-C"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The <b>Coincidence Flag</b> (C)
  463. is normally "0" but is set to "1" if any
  464. sprites have one or more overlapping pixels. Reading the Status
  465. Register will reset this flag to a 0. Note that coincidence is
  466. only checked as each pixel is generated during a video frame,
  467. every 1/60 s (on a UK machine this is every 20 ms). If fast
  468. moving sprites pass over each other between checks then no
  469. coincidence will be flagged.</p>
  470.  
  471. <a name="VDP-StatusReg0-5SFlag"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The <b>Fifth Sprite Flag</b> (5S)
  472. is normally 0 but is set to 1 when
  473. there are more than four sprites on any pixel line. On MSX2, MSX2+ and turbo R,
  474. this flag indicates when there are more than eight sprites in line. Reading the
  475. Status Register will reset this flag to "0".</p>
  476.  
  477. <a name="VDP-StatusReg0-F"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The <b>Frame Flag</b> (F)
  478. is normally 0 but is set to 1 at the end of
  479. the last active line of the video frame. This will occur every
  480. 1/60 s (for UK machines with a 50 Hz frame rate this will occur
  481. every 20 ms). Reading the Status register will reset this flag
  482. to a 0. There is an associated output signal from the VDP which
  483. generates Z80 interrupts at the same rate, this drives the MSX
  484. ROM interrupt handler.</p>
  485.  
  486.  
  487. <br><a name="VDP-ScreenMode"></a><h3 align="Left">Screen Modes</h3><br>
  488.  
  489. <ul>
  490.   <table cellspacing="0" cellpadding="4" border="0">
  491.     <tbody><tr align="Center"><td><b>M1</b></td><td><b>M2</b></td><td><b>M3</b></td><td><b>M4</b></td><td><b>M5</b></td><td>&nbsp;</td><td><b>Mode</b></td><td>&nbsp;</td><td><b>MSX<br>Version</b></td><td>&nbsp;</td><td><b>BASIC<br>Screen</b></td></tr>
  492.     <tr align="Center"><td colspan="11"><hr></td></tr>
  493.     <tr align="Center"><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td rowspan="10">&nbsp;</td><td>32x24 Text</td><td rowspan="10">&nbsp;</td><td>1&nbsp;2&nbsp;2+&nbsp;tR</td><td rowspan="10">&nbsp;</td><td>1</td></tr>
  494.     <tr align="Center"><td>1</td><td>0</td><td>0</td><td>0</td><td>0</td><td>40x24 Text</td><td>1&nbsp;2&nbsp;2+&nbsp;tR</td><td>0</td></tr>
  495.     <tr align="Center"><td>1</td><td>0</td><td>0</td><td>1</td><td>0</td><td>80x24 Text</td><td>&nbsp;&nbsp;2&nbsp;2+&nbsp;tR</td><td>0</td></tr>
  496.     <tr align="Center"><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>Multicolour</td><td>1&nbsp;2&nbsp;2+&nbsp;tR</td><td>3</td></tr>
  497.     <tr align="Center"><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>Graphics 1</td><td>1&nbsp;2&nbsp;2+&nbsp;tR</td><td>2</td></tr>
  498.     <tr align="Center"><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>Graphics 2</td><td>&nbsp;&nbsp;2&nbsp;2+&nbsp;tR</td><td>4</td></tr>
  499.     <tr align="Center"><td>0</td><td>0</td><td>1</td><td>1</td><td>0</td><td>Graphics 4</td><td>&nbsp;&nbsp;2&nbsp;2+&nbsp;tR</td><td>5</td></tr>
  500.     <tr align="Center"><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>Graphics 5</td><td>&nbsp;&nbsp;2&nbsp;2+&nbsp;tR</td><td>6</td></tr>
  501.     <tr align="Center"><td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>Graphics 6</td><td>&nbsp;&nbsp;2&nbsp;2+&nbsp;tR</td><td>7</td></tr>
  502.     <tr align="Center"><td>0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>Graphics 7</td><td>&nbsp;&nbsp;2&nbsp;2+&nbsp;tR</td><td>8</td></tr>
  503.   </tbody></table>
  504. </ul>
  505.  
  506. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The VDP has thirteen operating modes, each one offering a
  507. slightly different set of capabilities. Generally speaking, as
  508. the resolution goes up the price to be paid in VRAM size and
  509. updating complexity also increases. In a dedicated application
  510. these associated hardware and software costs are important
  511. considerations. For an MSX machine they are irrelevant, it
  512. therefore seems a pity that a greater attempt was not made to
  513. standardize on one particular mode. The Graphics Mode is
  514. capable of adequately performing all the functions of the other
  515. modes with only minor reservations.</p>
  516.  
  517. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;An added difficulty in using the VDP arises because
  518. insufficient allowance was made in its design for the
  519. overscanning used by most televisions. The resulting loss of
  520. characters at the screen edges has forced all the video-related
  521. MSX software into being based on peculiar screen sizes. UK
  522. machines normally use only the central thirty-seven characters
  523. available in 40x24 Text Mode. Japanese machines, with NTSC
  524. (National Television Standards Committee) video outputs, use the
  525. central thirty-nine characters.</p>
  526.  
  527. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The central element in the VDP, from the programmer's point
  528. of view, is the Name Table. This is a simple list of single-
  529. byte character codes held in VRAM. It is 960 bytes long in
  530. 40x24 Text Mode, 768 bytes long in 32x24 Text Mode, Graphics
  531. Mode and Multicolour Mode. Each position in the Name Table
  532. corresponds to a particular location on the screen.</p>
  533.  
  534. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;During a video frame the VDP will sequentially read every
  535. character code from the Name Table, starting at the base. As
  536. each character code is read the corresponding 8x8 pattern of
  537. pixels is looked up in the Character Pattern Table and
  538. displayed on the screen. The appearance of the screen can thus
  539. be modified by either changing the character codes in the Name
  540. Table or the pixel patterns in the Character Pattern Table.</p>
  541.  
  542. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;Note that the VDP has no hardware cursor facility, if one is
  543. required it must be software generated.</p>
  544.  
  545.  
  546. <br><a name="VDP-ScreenMode0"></a><h4 align="Left">40x24 Text Mode</h4><br>
  547.  
  548.  
  549. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The Name Table occupies 960 bytes of VRAM from 0000H to
  550. 03BFH:</p>
  551.  
  552. <a name="Figure25"></a>
  553. <ul><table cellspacing="0" cellpadding="0" border="0">
  554.  <tbody><tr><td></td><td rowspan="27">&nbsp;&nbsp;</td><td><tt>0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3</tt></td><td rowspan="27">&nbsp;&nbsp;</td><td></td></tr>
  555.  <tr><td></td><td><tt>0123456789012345678901234567890123456789</tt></td><td></td></tr>
  556.  <tr><td align="Right">0000H</td><td style="border-left: 1px solid; border-right: 1px solid; border-top: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">0</td></tr>
  557.  <tr><td align="Right">0028H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">1</td></tr>
  558.  <tr><td align="Right">0050H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">2</td></tr>
  559.  <tr><td align="Right">0078H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">3</td></tr>
  560.  <tr><td align="Right">00A0H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">4</td></tr>
  561.  <tr><td align="Right">00C8H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">5</td></tr>
  562.  <tr><td align="Right">00F0H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">6</td></tr>
  563.  <tr><td align="Right">0118H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">7</td></tr>
  564.  <tr><td align="Right">0140H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">8</td></tr>
  565.  <tr><td align="Right">0168H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">9</td></tr>
  566.  <tr><td align="Right">0190H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">10</td></tr>
  567.  <tr><td align="Right">01B8H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">11</td></tr>
  568.  <tr><td align="Right">01E0H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">12</td></tr>
  569.  <tr><td align="Right">0208H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">13</td></tr>
  570.  <tr><td align="Right">0230H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">14</td></tr>
  571.  <tr><td align="Right">0258H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">15</td></tr>
  572.  <tr><td align="Right">0280H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">16</td></tr>
  573.  <tr><td align="Right">02A8H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">17</td></tr>
  574.  <tr><td align="Right">02D0H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">18</td></tr>
  575.  <tr><td align="Right">02F8H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">19</td></tr>
  576.  <tr><td align="Right">0320H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">20</td></tr>
  577.  <tr><td align="Right">0348H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">21</td></tr>
  578.  <tr><td align="Right">0370H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">22</td></tr>
  579.  <tr><td align="Right">0398H</td><td style="border-left: 1px solid; border-right: 1px solid; border-bottom: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">23</td></tr>
  580.  <tr><td></td><td><tt>0123456789012345678901234567890123456789</tt></td><td></td></tr>
  581.  <tr><td></td><td rowspan="27">&nbsp;&nbsp;</td><td><tt>0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3</tt></td><td rowspan="27">&nbsp;&nbsp;</td><td></td></tr></tbody></table>
  582.  <p>Figure 25: 40x24 Name Table.</p>
  583. </ul>
  584.  
  585. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;Pattern Table occupies 2 KB of VRAM from 0800H
  586. to 0FFFH. Each eight byte block contains the pixel pattern for
  587. a character code:</p>
  588.  
  589. <a name="Figure26"></a>
  590. <ul><table cellspacing="0" cellpadding="0" border="0">
  591.  <tbody><tr><td bgcolor="#C0C0FF"><tt>0 0 1 0 0 0 0 0</tt></td><td rowspan="8">&nbsp;&nbsp;</td><td align="Right">Byte 0</td></tr>
  592.  <tr><td bgcolor="#C0C0FF"><tt>0 1 0 1 0 0 0 0</tt></td><td align="Right">Byte 1</td></tr>
  593.  <tr><td bgcolor="#C0C0FF"><tt>1 0 0 0 1 0 0 0</tt></td><td align="Right">Byte 2</td></tr>
  594.  <tr><td bgcolor="#C0C0FF"><tt>1 0 0 0 1 0 0 0</tt></td><td align="Right">Byte 3</td></tr>
  595.  <tr><td bgcolor="#C0C0FF"><tt>1 1 1 1 1 0 0 0</tt></td><td align="Right">Byte 4</td></tr>
  596.  <tr><td bgcolor="#C0C0FF"><tt>1 0 0 0 1 0 0 0</tt></td><td align="Right">Byte 5</td></tr>
  597.  <tr><td bgcolor="#C0C0FF"><tt>1 0 0 0 1 0 0 0</tt></td><td align="Right">Byte 6</td></tr>
  598.  <tr><td bgcolor="#C0C0FF"><tt>0 0 0 0 0 0 0 0</tt></td><td align="Right">Byte 7</td></tr></tbody></table>
  599.  <p>Figure 26: Character Pattern Block (No. 65 shown = 'A').</p>
  600. </ul>
  601.  
  602. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The first block contains the pattern for character code 0, the
  603. second the pattern for character code 1 and so on to character
  604. code 255. Note that only the leftmost six pixels are actually
  605. displayed in this mode. The colours of the 0 and 1 pixels in
  606. this mode are defined by <a href="#ModeReg7">VDP Mode Register 7</a>,
  607. initially they are blue and white (on Japanese and European machines)
  608. or black and white (on Brazilian machines).</p>
  609.  
  610.  
  611. <br><a name="VDP-ScreenMode1"></a><h4 align="Left">32x24 Text Mode</h4><br>
  612.  
  613. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The Name Table occupies 768 bytes of VRAM from 1800H to
  614. 1AFFH. As in 40x24 Text Mode normal operation involves placing
  615. character codes in the required position in the table. The
  616. "VPOKE" statement may be used to attain familiarity with the
  617. screen layout:</p>
  618.  
  619. <a name="Figure27"></a>
  620. <ul><table cellspacing="0" cellpadding="0" border="0">
  621.  <tbody><tr><td></td><td rowspan="27">&nbsp;&nbsp;</td><td><tt>0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3</tt></td><td rowspan="27">&nbsp;&nbsp;</td><td></td></tr>
  622.  <tr><td></td><td><tt>01234567890123456789012345678901</tt></td><td></td></tr>
  623.  <tr><td align="Right">1800H</td><td style="border-left: 1px solid; border-right: 1px solid; border-top: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">0</td></tr>
  624.  <tr><td align="Right">1820H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">1</td></tr>
  625.  <tr><td align="Right">1840H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">2</td></tr>
  626.  <tr><td align="Right">1860H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">3</td></tr>
  627.  <tr><td align="Right">1880H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">4</td></tr>
  628.  <tr><td align="Right">18A0H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">5</td></tr>
  629.  <tr><td align="Right">18C0H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">6</td></tr>
  630.  <tr><td align="Right">18E0H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">7</td></tr>
  631.  <tr><td align="Right">1900H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">8</td></tr>
  632.  <tr><td align="Right">1920H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">9</td></tr>
  633.  <tr><td align="Right">1940H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">10</td></tr>
  634.  <tr><td align="Right">1960H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">12</td></tr>
  635.  <tr><td align="Right">19A0H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">13</td></tr>
  636.  <tr><td align="Right">19C0H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">14</td></tr>
  637.  <tr><td align="Right">19E0H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">15</td></tr>
  638.  <tr><td align="Right">1A00H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">16</td></tr>
  639.  <tr><td align="Right">1A20H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">17</td></tr>
  640.  <tr><td align="Right">1A40H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">18</td></tr>
  641.  <tr><td align="Right">1A60H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">19</td></tr>
  642.  <tr><td align="Right">1A80H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">20</td></tr>
  643.  <tr><td align="Right">1AA0H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">21</td></tr>
  644.  <tr><td align="Right">1AC0H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">22</td></tr>
  645.  <tr><td align="Right">1AE0H</td><td style="border-left: 1px solid; border-right: 1px solid; border-bottom: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">23</td></tr>
  646.  <tr><td></td><td><tt>01234567890123456789012345678901</tt></td><td></td></tr>
  647.  <tr><td></td><td><tt>0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3</tt></td><td></td></tr></tbody></table>
  648.  <p>Figure 27: 32x24 Name Table.</p>
  649. </ul>
  650.  
  651. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The Character Pattern Table occupies 2 KB of VRAM from 0000H
  652. to 07FFH. Its structure is the same as in 40x24 Text Mode, all
  653. eight pixels of an 8x8 pattern are now displayed.</p>
  654.  
  655. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The border colour is defined by VDP Mode Register 7 and is
  656. initially blue. An additional table, the Colour Table,
  657. determines the colour of the 0 and 1 pixels. This occupies
  658. thirty-two bytes of VRAM from 2000H to 201FH. Each entry in the
  659. Colour Table defines the 0 and 1 pixel colours for a group of
  660. eight character codes, the lower four bits defining the 0 pixel
  661. colour, the upper four bits the 1 pixel colour. The first entry
  662. in the table defines the colours for character codes 0 to 7,
  663. the second for character codes 8 to 15 and so on for thirty-two
  664. entries. The MSX ROM initializes all entries to the same value,
  665. blue and white, and provides no facilities for changing
  666. individual ones.</p>
  667.  
  668. <br><a name="VDP-ScreenMode2"></a><h4 align="Left">Graphics Mode</h4><br>
  669.  
  670. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The Name Table occupies 768 bytes of VRAM from 1800H to
  671. 1AFFH, the same as in 32x24 Text Mode. The table is initialized
  672. with the character code sequence 0 to 255 repeated three times
  673. and is then left untouched, in this mode it is the Character
  674. Pattern Table which is modified during normal operation.</p>
  675.  
  676. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The Character Pattern Table occupies 6 KB of VRAM from 0000H
  677. to 17FFH. While its structure is the same as in the text modes
  678. it does not contain a character set but is initialized to all 0
  679. pixels. The first 2 KB of the Character Pattern Table is
  680. addressed by the character codes from the first third of the
  681. Name Table, the second 2 KB by the central third of the Name
  682. Table and the last 2 KB by the final third of the Name Table.
  683. Because of the sequential pattern in the Name Table the entire
  684. Character Pattern Table is read out linearly during a video
  685. frame. Setting a point on the screen involves working out where
  686. the corresponding bit is in the Character Pattern Table and
  687. turning it on. For a BASIC program to convert (X,Y) coordinates
  688. to an address see the <a href="http://www.angelfire.com/art2/unicorndreams/msx/RR-BIOS.html#MAPXYC">MAPXYC</a> standard routine in Chapter 4.</p>
  689.  
  690. <a name="Figure28"></a>
  691. <ul><table cellspacing="0" cellpadding="0" border="0">
  692.  <tbody><tr><td></td><td rowspan="27">&nbsp;&nbsp;</td><td><tt>0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3</tt></td><td rowspan="27">&nbsp;&nbsp;</td><td></td></tr>
  693.  <tr><td></td><td><tt>01234567890123456789012345678901</tt></td><td></td></tr>
  694.  <tr><td align="Right">0000H</td><td style="border-left: 1px solid; border-right: 1px solid; border-top: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">0</td></tr>
  695.  <tr><td align="Right">0100H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">1</td></tr>
  696.  <tr><td align="Right">0200H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">2</td></tr>
  697.  <tr><td align="Right">0300H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">3</td></tr>
  698.  <tr><td align="Right">0400H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">4</td></tr>
  699.  <tr><td align="Right">0500H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">5</td></tr>
  700.  <tr><td align="Right">0600H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">6</td></tr>
  701.  <tr><td align="Right">0700H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">7</td></tr>
  702.  <tr><td align="Right">0800H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">8</td></tr>
  703.  <tr><td align="Right">0900H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">9</td></tr>
  704.  <tr><td align="Right">0A00H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">10</td></tr>
  705.  <tr><td align="Right">0B00H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">11</td></tr>
  706.  <tr><td align="Right">0C00H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">12</td></tr>
  707.  <tr><td align="Right">0D00H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">13</td></tr>
  708.  <tr><td align="Right">0E00H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">14</td></tr>
  709.  <tr><td align="Right">0F00H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">15</td></tr>
  710.  <tr><td align="Right">1000H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">16</td></tr>
  711.  <tr><td align="Right">1100H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">17</td></tr>
  712.  <tr><td align="Right">1200H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">18</td></tr>
  713.  <tr><td align="Right">1300H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">19</td></tr>
  714.  <tr><td align="Right">1400H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">20</td></tr>
  715.  <tr><td align="Right">1500H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">21</td></tr>
  716.  <tr><td align="Right">1600H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">22</td></tr>
  717.  <tr><td align="Right">1700H</td><td style="border-left: 1px solid; border-right: 1px solid; border-bottom: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">23</td></tr>
  718.  <tr><td></td><td><tt>01234567890123456789012345678901</tt></td><td></td></tr>
  719.  <tr><td></td><td rowspan="27">&nbsp;&nbsp;</td><td><tt>0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3</tt></td><td rowspan="27">&nbsp;&nbsp;</td><td></td></tr></tbody></table>
  720.  <p>Figure 28: Graphics Character Pattern Table.</p>
  721. </ul>
  722.  
  723. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The border colour
  724. is defined by <a href="#ModeReg7">VDP Mode Register 7</a> and
  725. is initially blue. The Colour Table occupies 6 KB of VRAM from
  726. 2000H to 37FFH. There is an exact byte-to-byte mapping from the
  727. Character Pattern Table to the Colour Table but, because it
  728. takes a whole byte to define the 0 pixel and 1 pixel colours,
  729. there is a lower resolution for colours than for pixels. The
  730. lower four bits of a Colour Table entry define the colour of
  731. all the 0 pixels on the corresponding eight pixel line. The
  732. upper four bits define the colour of the 1 pixels. The Colour
  733. Table is initialized so that the 0 pixel colour and the 1 pixel
  734. colour are blue for the entire table. Because both colours are
  735. the same it will be necessary to alter one colour when a bit is
  736. set in the Character Pattern Table.</p>
  737.  
  738.  
  739.  
  740. <br><a name="VDP-ScreenMode3"></a><h4 align="Left">Multicolour Mode</h4><br>
  741.  
  742. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The Name Table occupies 768 bytes of VRAM from 0800H to
  743. 0AFFH, the screen mapping is the same as in 32x24 Text Mode.
  744. The table is initialized with the following character code
  745. pattern:</p>
  746.  
  747. <ul><table cellspacing="8" cellpadding="0" border="0">
  748.  <tbody><tr><td align="Center">00H to 1FH</td><td>(repeated four times, from 0800H till 087FH)</td></tr>
  749.  <tr><td align="Center">20H to 3FH</td><td>(repeated four times, from 0880H till 08FFH)</td></tr>
  750.  <tr><td align="Center">40H to 5FH</td><td>(repeated four times, from 0900H till 097FH)</td></tr>
  751.  <tr><td align="Center">60H to 7FH</td><td>(repeated four times, from 0980H till 09FFH)</td></tr>
  752.  <tr><td align="Center">80H to 9FH</td><td>(repeated four times, from 0A00H till 0A7FH)</td></tr>
  753.  <tr><td align="Center">A0H to BFH</td><td>(repeated four times, from 0A80H till 0AFFH)</td></tr>
  754. </tbody></table></ul>
  755.  
  756. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;As with Graphics Mode this is just a character code "driver"
  757. pattern, it is the Character Pattern Table which is modified
  758. during normal operation.</p>
  759.  
  760. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The Character Pattern
  761. table occupies 1536 bytes of VRAM from 0000H to 05FFH.
  762. As in the other modes each character code maps
  763. onto an eight byte block in the Character Pattern Table.
  764. Because of the lower resolution in this mode, only two bytes of
  765. the pattern block are actually needed to define an 8x8 pattern:</p>
  766.  
  767. <a name="Figure29"></a>
  768. <ul><table cellspacing="32" cellpadding="0" border="0">
  769.    <tbody><tr align="Center"><td>VRAM</td><td>Byte</td><td>Screen</td></tr>
  770.    <tr valign="Top">
  771.      <td><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td style="border-top: 1px solid; border-left: 1px solid; border-right: 1px solid; padding: 8px">
  772.      <tt><font color="#FF0000">A&nbsp;A&nbsp;A&nbsp;A</font>&nbsp;<font color="#DD0000">B&nbsp;B&nbsp;B&nbsp;B</font><br>
  773.          <font color="#BB0000">C&nbsp;C&nbsp;C&nbsp;C</font>&nbsp;<font color="#990000">D&nbsp;D&nbsp;D&nbsp;D</font><br>
  774.          <font color="#00FF00">E&nbsp;E&nbsp;E&nbsp;E</font>&nbsp;<font color="#00DD00">F&nbsp;F&nbsp;F&nbsp;F</font><br>
  775.          <font color="#00BB00">G&nbsp;G&nbsp;G&nbsp;G</font>&nbsp;<font color="#009900">H&nbsp;H&nbsp;H&nbsp;H</font></tt>
  776.      <hr style="border-style:dashed">
  777.      <tt><font color="#0000FF">W&nbsp;W&nbsp;W&nbsp;W</font>&nbsp;<font color="#0000DD">X&nbsp;X&nbsp;X&nbsp;X</font><br>
  778.          <font color="#0000BB">Y&nbsp;Y&nbsp;Y&nbsp;Y</font>&nbsp;<font color="#000099">Z&nbsp;Z&nbsp;Z&nbsp;Z</font></tt></td></tr>
  779.      <tr><td style="border-left: 1px solid; border-right: 1px solid;" align="Center">.<br>.</td></tr>
  780.      <tr><td style="border-left: 1px dashed; border-right: 1px dashed;" align="Center">.<br><br></td></tr></tbody></table></td>
  781.  
  782.      <td><table cellspacing="0" cellpadding="0" border="0">
  783.      <tbody><tr><td style="padding: 8px">
  784.        <tt>Byte&nbsp;0<br>Byte&nbsp;1<br>Byte&nbsp;2<br>Byte&nbsp;3</tt>
  785.        <hr style="border-style:dashed">
  786.        <tt>Byte&nbsp;8<br>Byte&nbsp;9</tt></td></tr>
  787.      <tr><td align="Center">.<br>.</td></tr>
  788.      <tr><td align="Center">.<br><br></td></tr></tbody></table></td>
  789.  
  790.      <td><table style="border-collapse: collapse" cellspacing="0" cellpadding="2" border="0">
  791.        <tbody><tr>
  792.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%"><tt><font color="#FF0000">A</font></tt></td>
  793.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%"><tt><font color="#DD0000">B</font></tt></td>
  794.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%"><tt><font color="#0000FF">W</font></tt></td>
  795.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%"><tt><font color="#0000DD">X</font></tt></td>
  796.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%">&nbsp;</td>
  797.          <td style="border-top: 1px solid; border-left: 1px dashed" width="10%">&nbsp;</td>
  798.          <td style="border-top: 1px solid; border-left: 1px dashed" width="30%">&nbsp;</td>
  799.          <td style="border-top: 1px solid; border-left: 1px dashed; border-right: 1px solid" width="10%">&nbsp;</td></tr>
  800.        <tr>
  801.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%"><tt><font color="#BB0000">C</font></tt></td>
  802.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%"><tt><font color="#990000">D</font></tt></td>
  803.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%"><tt><font color="#0000BB">Y</font></tt></td>
  804.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%"><tt><font color="#000099">Z</font></tt></td>
  805.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%">&nbsp;</td>
  806.          <td style="border-top: 1px dashed; border-left: 1px dashed" width="10%">&nbsp;</td>
  807.          <td style="border-top: 1px dashed; border-left: 1px dashed" width="30%">&nbsp;</td>
  808.          <td style="border-top: 1px dashed; border-left: 1px dashed; border-right: 1px solid" width="10%">&nbsp;</td></tr>
  809.        <tr>
  810.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%"><tt><font color="#00FF00">E</font></tt></td>
  811.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%"><tt><font color="#00DD00">F</font></tt></td>
  812.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%">&nbsp;</td>
  813.          <td style="border-top: 1px solid; border-left: 1px dashed" width="10%">&nbsp;</td>
  814.          <td style="border-top: 1px dashed; border-left: 1px dashed" width="10%">&nbsp;</td>
  815.          <td style="border-top: 1px dashed; border-left: 1px dashed" width="10%">&nbsp;</td>
  816.          <td style="border-top: 1px dashed; border-left: 1px dashed" width="30%">&nbsp;</td>
  817.          <td style="border-top: 1px dashed; border-left: 1px dashed; border-right: 1px solid" width="10%">&nbsp;</td></tr>
  818.        <tr>
  819.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%"><tt><font color="#00BB00">G</font></tt></td>
  820.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%"><tt><font color="#009900">H</font></tt></td>
  821.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%">&nbsp;</td>
  822.          <td style="border-top: 1px dashed; border-left: 1px dashed" width="10%">&nbsp;</td>
  823.          <td style="border-top: 1px dashed; border-left: 1px dashed" width="10%">&nbsp;</td>
  824.          <td style="border-top: 1px dashed; border-left: 1px dashed" width="10%">&nbsp;</td>
  825.          <td width="30%">&nbsp;</td>
  826.          <td style="border-right: 1px solid" width="10%">&nbsp;</td></tr>
  827.        <tr>
  828.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%">&nbsp;</td>
  829.          <td style="border-top: 1px solid; border-left: 1px solid" width="10%">&nbsp;</td>
  830.          <td style="border-top: 1px dashed; border-left: 1px dashed" width="10%">&nbsp;</td>
  831.          <td style="border-top: 1px dashed; border-left: 1px dashed" width="10%">&nbsp;</td>
  832.          <td style="border-top: 1px dashed; border-left: 1px dashed" width="10%">&nbsp;</td>
  833.          <td style="border-top: 1px dashed" width="10%">&nbsp;</td>
  834.          <td width="30%">&nbsp;</td>
  835.          <td style="border-right: 1px solid" width="10%">&nbsp;</td></tr>
  836.        <tr>
  837.          <td style="border-top: 1px dashed; border-left: 1px solid" width="10%">&nbsp;</td>
  838.          <td style="border-top: 1px dashed; border-left: 1px dashed" width="10%">&nbsp;</td>
  839.          <td style="border-top: 1px dashed; border-left: 1px dashed" width="10%">&nbsp;</td>
  840.          <td style="border-top: 1px dashed; border-left: 1px dashed" width="10%">&nbsp;</td>
  841.          <td style="border-top: 1px dashed; border-left: 1px dashed" width="10%">&nbsp;</td>
  842.          <td width="10%">&nbsp;</td>
  843.          <td style="border-right: 1px dashed" width="30%">&nbsp;</td>
  844.          <td style="border-right: 1px solid" width="10%">&nbsp;</td></tr>
  845.        <tr>
  846.          <td style="border-top: 1px dashed; border-left: 1px solid; border-bottom: 1px solid" width="10%">&nbsp;</td>
  847.          <td style="border-top: 1px dashed; border-left: 1px dashed; border-bottom: 1px solid" width="10%">&nbsp;</td>
  848.          <td style="border-top: 1px dashed; border-left: 1px dashed; border-bottom: 1px solid" width="10%">&nbsp;</td>
  849.          <td style="border-bottom: 1px solid" width="10%">&nbsp;</td>
  850.          <td style="border-bottom: 1px solid" width="10%">&nbsp;</td>
  851.          <td style="border-bottom: 1px solid" width="10%">&nbsp;</td>
  852.          <td style="border-top: 1px dashed; border-bottom: 1px solid" width="30%">&nbsp;</td>
  853.          <td style="border-top: 1px dashed; border-left: 1px dashed; border-bottom: 1px solid; border-right: 1px solid" width="10%">&nbsp;</td></tr>
  854.        </tbody></table></td>
  855.    </tr></tbody></table>
  856.  <p>Figure 29: Multicolour Pattern Block.</p>
  857. </ul>
  858.  
  859. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;As can be seen from
  860. <a href="#Figure29">Figure 29</a>, each four bit section of the two
  861. byte block contains a colour code and thus defines the COLOUR
  862. of a quadrant of the 8x8 pixel pattern. So that the entire
  863. eight bytes of the pattern block can be utilized, a given
  864. character code will use a different two byte section depending
  865. upon the character code's screen location (i.e., its position in
  866. the Name Table):</p>
  867.  
  868. <ul><table cellspacing="8" cellpadding="0" border="0">
  869.   <tbody><tr><td>Video row 0, 4,  8, 12, 16, 20</td><td>⇒</td><td>Uses bytes 0 and 1</td></tr>
  870.   <tr><td>Video row 1, 5,  9, 13, 17, 21</td><td>⇒</td><td>Uses bytes 2 and 3</td></tr>
  871.   <tr><td>Video row 2, 6, 10, 14, 18, 22</td><td>⇒</td><td>Uses bytes 4 and 5</td></tr>
  872.   <tr><td>Video row 3, 7, 11, 15, 19, 23</td><td>⇒</td><td>Uses bytes 6 and 7</td></tr>
  873. </tbody></table></ul>
  874.  
  875. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;When the Name Table is filled with the special driver sequence
  876. of character codes shown above the Character Pattern Table will
  877. be read out linearly during a video frame:</p>
  878.  
  879. <a name="Figure30"></a>
  880. <ul><table cellspacing="0" cellpadding="0" border="0">
  881.   <tbody><tr><td></td><td rowspan="27">&nbsp;&nbsp;</td><td><tt>0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3</tt></td><td rowspan="27">&nbsp;&nbsp;</td><td></td></tr>
  882.   <tr><td></td><td><tt>01234567890123456789012345678901</tt></td><td></td></tr>
  883.   <tr><td align="Right">0000H</td><td style="border-left: 1px solid; border-right: 1px solid; border-top: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">0</td></tr>
  884.   <tr><td align="Right">0002H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">1</td></tr>
  885.   <tr><td align="Right">0004H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">2</td></tr>
  886.   <tr><td align="Right">0006H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">3</td></tr>
  887.   <tr><td align="Right">0100H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">4</td></tr>
  888.   <tr><td align="Right">0102H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">5</td></tr>
  889.   <tr><td align="Right">0104H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">6</td></tr>
  890.   <tr><td align="Right">0106H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">7</td></tr>
  891.   <tr><td align="Right">0200H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">8</td></tr>
  892.   <tr><td align="Right">0202H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">9</td></tr>
  893.   <tr><td align="Right">0204H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">10</td></tr>
  894.   <tr><td align="Right">0206H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">11</td></tr>
  895.   <tr><td align="Right">0300H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">12</td></tr>
  896.   <tr><td align="Right">0302H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">13</td></tr>
  897.   <tr><td align="Right">0304H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">14</td></tr>
  898.   <tr><td align="Right">0306H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">15</td></tr>
  899.   <tr><td align="Right">0400H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">16</td></tr>
  900.   <tr><td align="Right">0402H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">17</td></tr>
  901.   <tr><td align="Right">0404H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">18</td></tr>
  902.   <tr><td align="Right">0406H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">19</td></tr>
  903.   <tr><td align="Right">0500H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">20</td></tr>
  904.   <tr><td align="Right">0502H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">21</td></tr>
  905.   <tr><td align="Right">0504H</td><td style="border-left: 1px solid; border-right: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">22</td></tr>
  906.   <tr><td align="Right">0506H</td><td style="border-left: 1px solid; border-right: 1px solid; border-bottom: 1px solid" bgcolor="#C0E0FF"><tt>OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</tt></td><td align="Right">23</td></tr>
  907.   <tr><td></td><td><tt>01234567890123456789012345678901</tt></td><td></td></tr>
  908.   <tr><td></td><td rowspan="27">&nbsp;&nbsp;</td><td><tt>0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3</tt></td><td rowspan="27">&nbsp;&nbsp;</td><td></td></tr></tbody></table>
  909.   <p>Figure 30: Multicolour Character Pattern Table.</p>
  910. </ul>
  911.  
  912. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The border colour is defined by VDP Mode Register 7 and is
  913. initially blue. There is no separate Colour Table as the
  914. colours are defined directly by the contents of the Character
  915. Pattern Table, this is initially filled with blue.</p>
  916.  
  917.  
  918. <br><a name="VDP-Sprites"></a><h3 align="Left">Sprites</h3><br>
  919.  
  920. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The VDP can control thirty-two sprites in all modes except
  921. 40X24 Text Mode. Their treatment is identical in all modes and
  922. independent of any character-orientated activity.</p>
  923.  
  924. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The Sprite Attribute Table occupies 128 bytes of VRAM from
  925. 1B00H to 1B7FH. The table contains thirty-two four byte blocks,
  926. one for each sprite. The first block controls sprite 0 (the
  927. "top" sprite), the second controls sprite 1 and so on to sprite
  928. 31. The format of each block is as below:</p>
  929.  
  930.  
  931. <a name="Figure31"></a>
  932. <ul>
  933.   <table style="border-collapse: collapse" cellspacing="0" cellpadding="4" border="0">
  934.     <tbody><tr align="Center"><td width="10%">7</td><td width="10%">6</td><td width="10%">5</td><td width="10%">4</td><td width="10%">3</td><td width="10%">2</td><td width="10%">1</td><td width="10%">0</td><td rowspan="5" width="5%">&nbsp;</td><td width="15%"></td></tr>
  935.     <tr align="Center"><td colspan="8" style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#Sprite-Vertical'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">Vertical&nbsp;Position</td><td>Byte&nbsp;0</td></tr>
  936.     <tr align="Center"><td colspan="8" style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#Sprite-Horizontal'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">Horizontal&nbsp;Position</td><td>Byte&nbsp;1</td></tr>
  937.     <tr align="Center"><td colspan="8" style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#Sprite-PatNum'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">Pattern&nbsp;Number</td><td>Byte&nbsp;2</td></tr>
  938.     <tr align="Center"><td style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#Sprite-EC'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">EC</td>
  939.     <td style="border: 1px solid">0</td><td style="border: 1px solid">0</td><td style="border: 1px solid">0</td>
  940.     <td colspan="4" style="border: 1px solid; cursor:pointer; cursor:hand" onclick="window.location='#Sprite-ColCod'" onmouseover="bgColor='#A0D0FF'" onmouseout="bgColor='#FFFFFF'">Colour&nbsp;Code</td><td>Byte&nbsp;3</td></tr>
  941.   </tbody></table>
  942.   <p>Figure 31: Sprite Attribute Block.</p>
  943. </ul>
  944.  
  945.  
  946.  
  947. <a name="Sprite-Vertical"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;Byte 0
  948. specifies the <b>vertical coordinate</b> (Y) of the top-left
  949. pixel of the sprite. The coordinate system runs from -1 (FFH)
  950. for the top pixel line on the screen down to 190 (BEH) for the
  951. bottom line, that is, there is an one-line delay, so sprites
  952. are shown one line below their defined vertical position.
  953. Values less than -1 can be used to slide the sprite in
  954. from the top of the screen. The exact values needed will
  955. obviously depend upon the size of the sprite. Curiously
  956. there has been no attempt in MSX BASIC to reconcile this
  957. coordinate system with the normal graphics range of Y=0 to 191.
  958. As a consequence a sprite will always be one pixel lower on the
  959. screen than the equivalent graphic point. Note that the special
  960. vertical coordinate value of 208 (D0H) placed in a sprite
  961. attribute block will cause the VDP to ignore all subsequent
  962. blocks in the Sprite Attribute Table. Effectively this means
  963. that any lower sprites will disappear from the screen.</p>
  964.  
  965. <a name="Figure32"></a>
  966. <ul><table cellspacing="8" cellpadding="0" border="0">
  967.   <tbody><tr><td><table style="empty-cells: show" width="256px" height="192px" cellspacing="0" cellpadding="0" border="0">
  968.     <tbody><tr><td style="border-left: 1px solid; border-top: 1px solid" width="32px" height="32px"></td><td colspan="4" style="border-top: 1px solid"></td><td style="border-top: 1px solid; border-right: 1px solid"></td></tr>
  969.     <tr><td style="border-left: 1px solid" height="4px"></td><td width="32px" bgcolor="#00FF00"></td><td width="32px" bgcolor="#FF0000"></td><td bgcolor="#FF0000"></td><td width="32px" bgcolor="#FF0000"></td><td style="border-right: 1px solid"></td></tr>
  970.     <tr><td rowspan="2" style="border-left: 1px solid"></td><td height="24px" bgcolor="#00FF00"></td><td></td><td width="32px" bgcolor="#0000FF"></td><td></td><td rowspan="2" style="border-right: 1px solid">1 pixel delay</td></tr>
  971.     <tr><td></td><td></td><td height="4px" bgcolor="#0000FF"></td></tr>
  972.     <tr><td style="border-left: 1px solid; border-bottom: 1px solid" height="124px"></td><td colspan="4" style="border-bottom: 1px solid"></td><td style="border-bottom: 1px solid; border-right: 1px solid"></td></tr>
  973.   </tbody></table></td>
  974.   <td><table cellspacing="0" cellpadding="0" border="0">
  975.     <tbody><tr><td><code>
  976.       10 SCREEN 2,2<br>
  977.       20 SPRITE$(0)=STRING$(32,255)<br>
  978.       30 LINE(32,<b>32</b>)-STEP(15,15),2,BF<br>
  979.       40 PUT SPRITE 0,(64,<b>32</b>),4,0<br>
  980.       50 LINE(48,<b>32</b>)-(160,<b>32</b>),8<br>
  981.       60 GOTO 60
  982.     </code></td></tr>
  983.   </tbody></table></td></tr></tbody></table>
  984.   <p>Figure 32: sprite 1 line delay example (PUT SPRITE sets sprite
  985.     at vertical position 32, but it is actually shown after line
  986.     33 on screen).</p>
  987. </ul>
  988.  
  989. <a name="Sprite-Horizontal"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;Byte 1
  990. specifies the <b>horizontal coordinate</b> (X) of the top-
  991. left pixel of the sprite. The coordinate system runs from 0 for
  992. the leftmost pixel to 255 (FFH) for the rightmost. As this
  993. coordinate system provides no mechanism for sliding a sprite in
  994. from the left a special bit in byte 3 is used for this purpose,
  995. see below.</p>
  996.  
  997. <a name="Sprite-PatNum"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;Byte 2
  998. selects one of the two hundred and fifty-six 8x8 bit
  999. <b>patterns</b> available in the Sprite Pattern Table. If the Size bit
  1000. is set in VDP Mode Register 1, resulting in 16x16 bit patterns
  1001. occupying thirty-two bytes each, the two least significant bits
  1002. of the pattern number are ignored. Thus pattern numbers 0, 1, 2
  1003. and 3 would all select pattern number 0.</p>
  1004.  
  1005. <a name="Sprite-ColCod"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;In Byte 3,
  1006. the four <b>Colour Code</b> bits define the colour of the
  1007. 1 pixels in the sprite patterns, 0 pixels are always
  1008. transparent.</p>
  1009.  
  1010. <a name="Sprite-EC"></a><p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;In Byte 3,
  1011. the <b>Early Clock</b> bit is normally 0 but will shift
  1012. the sprite thirty-two pixels to the left when set to 1. This is
  1013. so that sprites can slide in from the left of the screen, there
  1014. being no spare coordinates in the horizontal direction.</p>
  1015.  
  1016. <a name="Figure33"></a>
  1017. <ul>
  1018.   <table cellspacing="0" cellpadding="4" border="0">
  1019.     <tbody><tr align="Center"><td width="10%">&nbsp;</td><td width="10%">&nbsp;</td><td colspan="2" style="border-left: 2px dashed; border-top: 2px dashed; border-right: 2px dashed" width="20%" bgcolor="#FFFF00">(X,&nbsp;-Y)</td><td colspan="5" width="10%">&nbsp;</td><td rowspan="8" width="10%">&nbsp;</td></tr>
  1020.     <tr align="Center"><td rowspan="7">&nbsp;</td><td style="border-left: 1px solid; border-top: 1px solid">&nbsp;</td><td colspan="2" style="border-top: 1px solid; border-left: 2px solid; border-bottom: 2px solid; border-right: 2px solid" bgcolor="#FFFF00">&nbsp;</td><td colspan="4" style="border-top: 1px solid">&nbsp;</td><td style="border-top: 1px solid; border-right: 1px solid">&nbsp;</td></tr>
  1021.     <tr align="Center"><td colspan="5" rowspan="2" style="border-left: 1px solid">&nbsp;</td><td colspan="2" rowspan="2" style="border: 2px solid" bgcolor="#FFC0C0">(X,&nbsp;Y)</td><td style="border-right: 1px solid">&nbsp;</td></tr>
  1022.     <tr align="Center"><td style="border-right: 1px solid">&nbsp;</td></tr>
  1023.     <tr align="Center"><td colspan="8" style="border-left: 1px solid; border-right: 1px solid">&nbsp;</td></tr>
  1024.     <tr align="Center"><td colspan="2" style="border-left: 1px solid">&nbsp;</td><td colspan="2" rowspan="2" style="border: 2px solid" bgcolor="#C0FFFF">(X-32,&nbsp;Y)</td><td rowspan="2">⇐</td><td rowspan="2">EC=1</td><td colspan="2" rowspan="2" style="border-right: 1px solid">&nbsp;</td></tr>
  1025.     <tr align="Center"><td colspan="2" style="border-left: 1px solid">&nbsp;</td></tr>
  1026.     <tr align="Center"><td colspan="8" style="border-left: 1px solid; border-right: 1px solid">&nbsp;</td></tr>
  1027.     <tr align="Center"><td rowspan="2" style="border-left: 2px dashed; border-top: 2px dashed; border-bottom: 2px dashed" bgcolor="#C0C0FF">&nbsp;</td><td rowspan="2" style="border-left: 1px solid; border-top: 2px solid; border-right: 2px solid; border-bottom: 2px solid" bgcolor="#C0C0FF">&nbsp;</td><td colspan="2">←&nbsp;(X-32,&nbsp;Y)</td><td colspan="2" rowspan="2">&nbsp;</td><td colspan="2" rowspan="2">(X,&nbsp;Y)&nbsp;→</td><td rowspan="2" style="border-left: 2px solid; border-top: 2px solid; border-bottom: 2px solid; border-right: 1px solid" bgcolor="#C0FFC0">&nbsp;</td><td rowspan="2" style="border-top: 2px dashed; border-right: 2px dashed; border-bottom: 2px dashed" bgcolor="#C0FFC0">&nbsp;</td></tr>
  1028.     <tr align="Center"><td>⇐</td><td>EC=1</td></tr>
  1029.     <tr align="Center"><td rowspan="3">&nbsp;</td><td colspan="8" style="border-left: 1px solid; border-right: 1px solid">&nbsp;</td></tr>
  1030.     <tr align="Center"><td colspan="4" style="border-left: 1px solid; border-bottom: 1px solid">&nbsp;</td><td colspan="2" style="border-left: 2px solid; border-top: 2px solid; border-right: 2px solid; border-bottom: 1px solid" bgcolor="#FFC0FF">(X,&nbsp;Y)</td><td colspan="2" style="border-bottom: 1px solid; border-right: 1px solid">&nbsp;</td><td>&nbsp;</td></tr>
  1031.     <tr align="Center"><td width="10%">&nbsp;</td><td width="10%">&nbsp;</td><td width="10%">&nbsp;</td><td width="10%">&nbsp;</td><td colspan="2" style="border-left: 2px dashed; border-bottom: 2px dashed; border-right: 2px dashed" width="20%" bgcolor="#FFC0FF">&nbsp;</td><td width="10%">&nbsp;</td><td width="10%">&nbsp;</td><td width="10%">&nbsp;</td></tr>
  1032.   </tbody></table>
  1033.   <p>Figure 33: sprite control to slide it through the screen
  1034.     edges.</p>
  1035. </ul>
  1036.  
  1037.  
  1038. <p align="Justify">&nbsp;&nbsp;&nbsp;&nbsp;The
  1039. Sprite Pattern Table occupies 2 KB of VRAM from 3800H to
  1040. 3FFFH. It contains two hundred and fifty-six 8x8 pixel
  1041. patterns, numbered from 0 to 255. If the Size bit in VDP Mode
  1042. Register 1 is 0, resulting in 8x8 sprites, then each eight byte
  1043. sprite pattern block is structured in the same way as the
  1044. character pattern block shown in <a href="#Figure26">Figure 26</a>. If the Size bit is
  1045. 1, resulting in 16x16 sprites, then four eight byte blocks are
  1046. needed to define the pattern as below:</p>
  1047.  
  1048. <a name="Figure34"></a>
  1049. <ul>
  1050.   <table cellspacing="0" cellpadding="8" border="0">
  1051.     <tbody><tr><td><table cellspacing="0" cellpadding="4" border="1">
  1052.       <tbody><tr><td bgcolor="#FFA0A0">8&nbsp;Bytes<br>Block&nbsp;A</td></tr><tr>
  1053.       </tr><tr><td bgcolor="#FFFFA0">8&nbsp;Bytes<br>Block&nbsp;B</td></tr><tr>
  1054.       </tr><tr><td bgcolor="#A0FFA0">8&nbsp;Bytes<br>Block&nbsp;C</td></tr><tr>
  1055.       </tr><tr><td bgcolor="#A0A0FF">8&nbsp;Bytes<br>Block&nbsp;D</td></tr><tr>
  1056.     </tr></tbody></table></td>
  1057.     <td>⇒</td>
  1058.     <td><table cellspacing="0" cellpadding="8" border="1">
  1059.       <tbody><tr><td bgcolor="#FFA0A0">A</td><td bgcolor="#A0FFA0">C</td></tr><tr>
  1060.       </tr><tr><td bgcolor="#FFFFA0">B</td><td bgcolor="#A0A0FF">D</td></tr><tr>
  1061.     </tr></tbody></table></td></tr>
  1062.   </tbody></table>
  1063.   <p>Figure 34: 16x16 Sprite Pattern Block.</p>
  1064. </ul>
  1065.  
  1066. <hr>
  1067.  
  1068. <p align="Center"><a href="http://www.angelfire.com/art2/unicorndreams/msx/RR-PSG.html">Go to next chapter: P.S.G.</a></p>
  1069.  
  1070.  
  1071.  
  1072. </body></html>