cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

docs_supported_consoles.html (21485B)


      1<!-- HTML header for doxygen 1.8.14-->
      2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      3<html xmlns="http://www.w3.org/1999/xhtml">
      4<head>
      5<meta http-equiv="cache-control" content="max-age=86400"/>
      6<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
      7<meta http-equiv="X-UA-Compatible" content="IE=9"/>
      8<meta name="generator" content="Doxygen 1.8.20"/>
      9<meta name="viewport" content="width=device-width, initial-scale=1"/>
     10<title>GBDK 2020 Docs: Supported Consoles &amp; Cross Compiling</title>
     11<link href="tabs.css" rel="stylesheet" type="text/css"/>
     12<script type="text/javascript" src="jquery.js"></script>
     13<script type="text/javascript" src="dynsections.js"></script>
     14<link href="navtree.css" rel="stylesheet" type="text/css"/>
     15<script type="text/javascript" src="resize.js"></script>
     16<script type="text/javascript" src="navtreedata.js"></script>
     17<script type="text/javascript" src="navtree.js"></script>
     18<link href="search/search.css" rel="stylesheet" type="text/css"/>
     19<script type="text/javascript" src="search/searchdata.js"></script>
     20<script type="text/javascript" src="search/search.js"></script>
     21<link href="doxygen.css" rel="stylesheet" type="text/css" />
     22<link href="doxygen_extra.css" rel="stylesheet" type="text/css"/>
     23</head>
     24<body>
     25<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
     26<div id="titlearea">
     27<table cellspacing="0" cellpadding="0">
     28 <tbody>
     29 <tr style="height: 56px;">
     30  <td id="projectalign" style="padding-left: 0.5em;">
     31   <div id="projectname">GBDK 2020 Docs
     32   &#160;<span id="projectnumber">4.0.6</span>
     33   </div>
     34   <div id="projectbrief">API Documentation for GBDK 2020</div>
     35  </td>
     36 </tr>
     37 </tbody>
     38</table>
     39</div>
     40<!-- end header part -->
     41<!-- Generated by Doxygen 1.8.20 -->
     42<script type="text/javascript">
     43/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
     44var searchBox = new SearchBox("searchBox", "search",false,'Search');
     45/* @license-end */
     46</script>
     47<script type="text/javascript" src="menudata.js"></script>
     48<script type="text/javascript" src="menu.js"></script>
     49<script type="text/javascript">
     50/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
     51$(function() {
     52  initMenu('',true,false,'search.php','Search');
     53  $(document).ready(function() { init_search(); });
     54});
     55/* @license-end */</script>
     56<div id="main-nav"></div>
     57</div><!-- top -->
     58<div id="side-nav" class="ui-resizable side-nav-resizable">
     59  <div id="nav-tree">
     60    <div id="nav-tree-contents">
     61      <div id="nav-sync" class="sync"></div>
     62    </div>
     63  </div>
     64  <div id="splitbar" style="-moz-user-select:none;" 
     65       class="ui-resizable-handle">
     66  </div>
     67</div>
     68<script type="text/javascript">
     69/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
     70$(document).ready(function(){initNavTree('docs_supported_consoles.html',''); initResizable(); });
     71/* @license-end */
     72</script>
     73<div id="doc-content">
     74<!-- window showing the filter options -->
     75<div id="MSearchSelectWindow"
     76     onmouseover="return searchBox.OnSearchSelectShow()"
     77     onmouseout="return searchBox.OnSearchSelectHide()"
     78     onkeydown="return searchBox.OnSearchSelectKey(event)">
     79</div>
     80
     81<!-- iframe showing the search results (closed by default) -->
     82<div id="MSearchResultsWindow">
     83<iframe src="javascript:void(0)" frameborder="0" 
     84        name="MSearchResults" id="MSearchResults">
     85</iframe>
     86</div>
     87
     88<div class="PageDoc"><div class="header">
     89  <div class="headertitle">
     90<div class="title">Supported Consoles &amp; Cross Compiling </div>  </div>
     91</div><!--header-->
     92<div class="contents">
     93<div class="textblock"><p><a class="anchor" id="docs_consoles_supported_list"></a></p>
     94<h1><a class="anchor" id="autotoc_md116"></a>
     95Consoles Supported by GBDK</h1>
     96<p>As of version <code>4.0.5</code> GBDK includes support for other consoles in addition to the Game Boy.</p>
     97<ul>
     98<li>Game Boy and related clones<ul>
     99<li>Nintendo Game Boy / Game Boy Color (GB/GBC)</li>
    100<li>Analogue Pocket (AP)</li>
    101<li>Mega Duck / Cougar Boy (DUCK)</li>
    102</ul>
    103</li>
    104<li>Sega Consoles<ul>
    105<li>Sega Master System (SMS)</li>
    106<li>Sega Game Gear (GG)</li>
    107</ul>
    108</li>
    109</ul>
    110<p>While the GBDK API has many convenience functions that work the same or similar across different consoles, it's important to keep their different capabilities in mind when writing code intended to run on more than one. Some (but not all) of the differences are screen sizes, color abilities, memory layouts, processor type (z80 vs gbz80/sm83) and speed.</p>
    111<p><a class="anchor" id="docs_consoles_compiling"></a></p>
    112<h1><a class="anchor" id="autotoc_md117"></a>
    113Cross Compiling for Different Consoles</h1>
    114<h2><a class="anchor" id="autotoc_md118"></a>
    115lcc</h2>
    116<p>When compiling and building through <a class="el" href="docs_toolchain.html#lcc">lcc</a> use the <code>-m&lt;port&gt;:&lt;plat&gt;</code> flag to select the desired console via it's port and platform combination.</p>
    117<h2><a class="anchor" id="autotoc_md119"></a>
    118sdcc</h2>
    119<p>When building directly with the sdcc toolchain, the following must be specified manually (when using <a class="el" href="docs_toolchain.html#lcc">lcc</a> it will populate these automatically based on <code>-m&lt;port&gt;:&lt;plat&gt;</code>).</p>
    120<p>When compiling with <a class="el" href="docs_toolchain_settings.html#sdcc-settings">sdcc</a>:</p><ul>
    121<li><code>-m&lt;port&gt;</code>, <code>-D__PORT_&lt;port&gt;</code> and <code>-D__TARGET_&lt;plat&gt;</code></li>
    122</ul>
    123<p>When assembling with <a class="el" href="docs_toolchain_settings.html#sdasgb-settings">sdasgb</a> (for GB/AP) and <a class="el" href="docs_toolchain_settings.html#sdasz80-settings">sdasz80</a> (for SMS/GG):</p><ul>
    124<li>Select the appropriate include path: <code>-I&lt;gbdk-path&gt;lib/small/asxxxx/&lt;plat&gt;</code></li>
    125</ul>
    126<p>When linking with <a class="el" href="docs_toolchain_settings.html#sdldgb-settings">sdldgb</a> (for GB/AP) and <a class="el" href="docs_toolchain_settings.html#sdldz80-settings">sdldz80</a> (for SMS/GG):</p><ul>
    127<li>Select the appropriate include paths: <code>-k &lt;gbdk-path&gt;lib/small/asxxxx/&lt;port&gt;</code>, <code>-k &lt;gbdk-path&gt;lib/small/asxxxx/&lt;plat&gt;</code></li>
    128<li>Include the appropriate library files <code>-l &lt;port&gt;.lib</code>, <code>-l &lt;plat&gt;.lib</code></li>
    129<li>The crt will be under <code>&lt;gbdk-path&gt;lib/small/asxxxx/&lt;plat&gt;/crt0.o</code></li>
    130</ul>
    131<h2><a class="anchor" id="autotoc_md120"></a>
    132Console Port and Platform Settings</h2>
    133<ul>
    134<li>Nintendo Game Boy / Game Boy Color<ul>
    135<li><a class="el" href="docs_toolchain.html#lcc">lcc</a> : <code>-mgbz80:gb</code></li>
    136<li>port:<code>gbz80</code>, plat:<code>gb</code></li>
    137</ul>
    138</li>
    139<li>Analogue Pocket<ul>
    140<li><a class="el" href="docs_toolchain.html#lcc">lcc</a> : <code>-mgbz80:ap</code></li>
    141<li>port:<code>gbz80</code>, plat:<code>ap</code></li>
    142</ul>
    143</li>
    144<li>Mega Duck / Cougar Boy<ul>
    145<li><a class="el" href="docs_toolchain.html#lcc">lcc</a> : <code>-mgbz80:duck</code></li>
    146<li>port:<code>gbz80</code>, plat:<code>duck</code></li>
    147</ul>
    148</li>
    149<li>Sega Master System<ul>
    150<li><a class="el" href="docs_toolchain.html#lcc">lcc</a> : <code>-mz80:sms</code></li>
    151<li>port:<code>z80</code>, plat:<code>sms</code></li>
    152</ul>
    153</li>
    154<li>Sega Game Gear<ul>
    155<li><a class="el" href="docs_toolchain.html#lcc">lcc</a> : <code>-mz80:gg</code></li>
    156<li>port:<code>z80</code>, plat:<code>gg</code></li>
    157</ul>
    158</li>
    159</ul>
    160<h1><a class="anchor" id="autotoc_md121"></a>
    161Cross-Platform Constants</h1>
    162<p>There are several constant #defines that can be used to help select console specific code during compile time (with <code>#ifdef</code>, <code>#ifndef</code>) .</p>
    163<h2><a class="anchor" id="autotoc_md122"></a>
    164Console Identifiers</h2>
    165<ul>
    166<li>When <code>&lt;gb/gb.h&gt;</code> is included (either directly or through <code>&lt;gbdk/platform.h&gt;</code>)<ul>
    167<li>When building for Game Boy:<ul>
    168<li><code>NINTENDO</code> will be #defined</li>
    169<li><code>GAMEBOY</code> will be #defined</li>
    170</ul>
    171</li>
    172<li>When building for Analogue Pocket<ul>
    173<li><code>NINTENDO</code> will be #defined</li>
    174<li><code>ANALOGUEPOCKET</code> will be #defined</li>
    175</ul>
    176</li>
    177<li>When building for Mega Duck / Cougar Boy<ul>
    178<li><code>NINTENDO</code> will be #defined</li>
    179<li><code>MEGADUCK</code> will be #defined</li>
    180</ul>
    181</li>
    182</ul>
    183</li>
    184<li>When <code>&lt;sms/sms.h &gt;</code> is included (either directly or through <code>&lt;gbdk/platform.h&gt;</code>)<ul>
    185<li>When building for Master System<ul>
    186<li><code>SEGA</code> will be #defined</li>
    187<li><code>MASTERSYSTEM</code> will be #defined</li>
    188</ul>
    189</li>
    190<li>When building for Game Gear<ul>
    191<li><code>SEGA</code> will be #defined</li>
    192<li><code>GAMEGEAR</code> will be #defined</li>
    193</ul>
    194</li>
    195</ul>
    196</li>
    197</ul>
    198<h2><a class="anchor" id="autotoc_md123"></a>
    199Console Hardware Properties</h2>
    200<p>Constants that describe properties of the console hardware are listed below. Their values will change to reflect the current console target that is being built.</p>
    201<ul>
    202<li><a class="el" href="gb_2hardware_8h.html#a519e327cac96f68a8ca9b77e0343672f">DEVICE_SCREEN_X_OFFSET</a>, <a class="el" href="gb_2hardware_8h.html#af334c0e7dd6e434b3dbebd45bcdeb75a">DEVICE_SCREEN_Y_OFFSET</a></li>
    203<li><a class="el" href="gb_2hardware_8h.html#add7f32ba868ef6517798f5fce337e4b2">DEVICE_SCREEN_WIDTH</a>, <a class="el" href="gb_2hardware_8h.html#ad252264fdcf900e5fbf611f7a45962ed">DEVICE_SCREEN_HEIGHT</a></li>
    204<li><a class="el" href="gb_2hardware_8h.html#a491dc081eae8c81e7ca88075ab806291">DEVICE_SCREEN_BUFFER_WIDTH</a>, <a class="el" href="gb_2hardware_8h.html#a81fb56b6778772f829dab4c534e7749e">DEVICE_SCREEN_BUFFER_HEIGHT</a></li>
    205<li><a class="el" href="gb_2hardware_8h.html#a4d682ed7a6158c5ba10afec739b17a8a">DEVICE_SCREEN_MAP_ENTRY_SIZE</a></li>
    206<li><a class="el" href="gb_2hardware_8h.html#af531e7ac0c0a58517fa3061631745c31">DEVICE_SPRITE_PX_OFFSET_X</a>, <a class="el" href="gb_2hardware_8h.html#a7f6c8420831388300bbec13ea4cb57a0">DEVICE_SPRITE_PX_OFFSET_Y</a></li>
    207<li><a class="el" href="sms_2hardware_8h.html#ad14c51cdfb347c34c364f54e67dc978d">DEVICE_SCREEN_PX_WIDTH</a>, <a class="el" href="sms_2hardware_8h.html#a7bd450aa268b881257089cf8cd6697ec">DEVICE_SCREEN_PX_HEIGHT</a></li>
    208</ul>
    209<h1><a class="anchor" id="autotoc_md124"></a>
    210Using &lt;gbdk/...&gt; headers</h1>
    211<p>Some include files under <code>&lt;gbdk/..&gt;</code> are cross platform and others allow the build process to auto-select the correct include file for the current target port and platform (console).</p>
    212<p>For example, the following can be used </p><pre class="fragment">#include &lt;gbdk/platform.h&gt;
    213#include &lt;gbdk/metasprites.h&gt;
    214</pre><p>Instead of </p><pre class="fragment">#include &lt;gb/gb.h&gt;
    215#include &lt;gb/metasprites.h&gt;
    216</pre><p>and </p><pre class="fragment">#include &lt;sms/sms.h&gt;
    217#include &lt;sms/metasprites.h&gt;
    218</pre><p><a class="anchor" id="docs_consoles_cross_platform_examples"></a></p>
    219<h1><a class="anchor" id="autotoc_md125"></a>
    220Cross Platform Example Projects</h1>
    221<p>GBDK includes an number of cross platform example projects. These projects show how to write code that can be compiled and run on multiple different consoles (for example Game Boy and Game Gear) with, in some cases, minimal differences.</p>
    222<p>They also show how to build for multiple target consoles with a single build command and <code>Makefile</code>. The <code>Makefile.targets</code> allows selecting different <code>port</code> and <code>plat</code> settings when calling the build stages.</p>
    223<h2><a class="anchor" id="autotoc_md126"></a>
    224Cross Platform Asset Example</h2>
    225<p>The cross-platform <code>Logo</code> example project shows how assets can be managed for multiple different console targets together.</p>
    226<p>In the example <a class="el" href="docs_toolchain.html#utility_png2asset">utility_png2asset</a> is used to generate assets in the native format for each console at compile-time from separate source PNG images. The Makefile is set to use the source PNG folder which matches the current console being compiled, and the source code uses <a class="el" href="gb_8h.html#a68651e50243349b48164a8ad983dca4e">set_native_tile_data()</a> to load the assets tiles in native format.</p>
    227<h1><a class="anchor" id="autotoc_md127"></a>
    228Porting From Game Boy to Analogue Pocket</h1>
    229<p>The Analogue Pocket is (for practical purposes) functionally identical to the Game Boy / Color, but has a couple altered register flag and address definitions and a different boot logo. In order for software to be easily ported to the Analogue Pocket, or to run on both, use the following practices.</p>
    230<h2><a class="anchor" id="autotoc_md128"></a>
    231Registers and Flags</h2>
    232<p>Use API defined registers and register flags instead of hardwired ones</p><ul>
    233<li>LCDC register: <a class="el" href="gb_2hardware_8h.html#a6515fdfaa50eeb7e63faeea54f77cd6b">LCDC_REG</a> or <a class="el" href="gb_2hardware_8h.html#a8b576a1fe1473ac4aff8afecb28035cb">rLCDC</a></li>
    234<li>STAT register: <a class="el" href="gb_2hardware_8h.html#ad40ebf3b29add46cdd310a7e0802bc6b">STAT_REG</a> or <a class="el" href="gb_2hardware_8h.html#a338ec378453b4457efdb3008978c0f28">rSTAT</a></li>
    235<li>LCDC flags: -&gt; LCDCF_... (example: <a class="el" href="gb_2hardware_8h.html#a1491fc03ed7f02e7309cc7b0c48b6c8a">LCDCF_ON</a>)</li>
    236<li>STAT flags: -&gt; STATF_... (example: <a class="el" href="gb_2hardware_8h.html#a3b53105cc5be896b48794ba82d2aeb4c">STATF_LYC</a>)</li>
    237</ul>
    238<h2><a class="anchor" id="autotoc_md129"></a>
    239Boot logo</h2>
    240<p>As long as the target console is <a class="el" href="docs_supported_consoles.html#docs_consoles_compiling">set during build time</a> then the correct boot logo will be automatically selected.</p>
    241<h1><a class="anchor" id="autotoc_md130"></a>
    242Porting From Game Boy to Mega Duck / Cougar Boy</h1>
    243<p>The Mega Duck is fairly similar to the classic Game Boy. It has a couple altered register flag and address definitions, no boot logo and a different startup/entry-point address. In order for software to be easily ported to the Mega Duck, or to run on both, use the following practices.</p>
    244<h2><a class="anchor" id="autotoc_md131"></a>
    245Registers and Flags</h2>
    246<p>Use API defined registers and register flags instead of hardwired ones</p><ul>
    247<li>LCDC register: <a class="el" href="gb_2hardware_8h.html#a6515fdfaa50eeb7e63faeea54f77cd6b">LCDC_REG</a> or <a class="el" href="gb_2hardware_8h.html#a8b576a1fe1473ac4aff8afecb28035cb">rLCDC</a></li>
    248<li>STAT register: <a class="el" href="gb_2hardware_8h.html#ad40ebf3b29add46cdd310a7e0802bc6b">STAT_REG</a> or <a class="el" href="gb_2hardware_8h.html#a338ec378453b4457efdb3008978c0f28">rSTAT</a></li>
    249<li>LCDC flags: -&gt; LCDCF_... (example: <a class="el" href="gb_2hardware_8h.html#a1491fc03ed7f02e7309cc7b0c48b6c8a">LCDCF_ON</a>)</li>
    250<li>STAT flags: -&gt; STATF_... (example: <a class="el" href="gb_2hardware_8h.html#a3b53105cc5be896b48794ba82d2aeb4c">STATF_LYC</a>)</li>
    251</ul>
    252<h1><a class="anchor" id="autotoc_md132"></a>
    253Porting From Game Boy to SMS/GG</h1>
    254<h2><a class="anchor" id="autotoc_md133"></a>
    255Tile Data and Tile Map loading</h2>
    256<h3><a class="anchor" id="autotoc_md134"></a>
    257Tile and Map Data in 2bpp Game Boy Format</h3>
    258<ul>
    259<li><a class="el" href="gb_8h.html#a1f5101f2b7bb0123c26a3e257f843626">set_bkg_data()</a> and <a class="el" href="gb_8h.html#ae45b1c639698951b47e44fa8e89556f2">set_sprite_data()</a> will load 2bpp tile data in "game boy" format on both GB and SMS/GG.</li>
    260<li>On the SMS/GG <a class="el" href="gb_8h.html#aa224c9bac27c7fd268e62bdf33338a84">set_2bpp_palette()</a> sets 4 colors that will be used when loading 2bpp assets with <a class="el" href="gb_8h.html#a1f5101f2b7bb0123c26a3e257f843626">set_bkg_data()</a>. This allows GB assets to be easily colorized without changing the asset format. There is some performance penalty for using the conversion.</li>
    261<li><a class="el" href="sms_8h.html#a9a732aec1b7aec7d10a9d76ca4da2064">set_bkg_tiles()</a> loads 1-byte-per-tile tilemaps both for the GB and SMS/GG</li>
    262</ul>
    263<h3><a class="anchor" id="autotoc_md135"></a>
    264Tile and Map Data in Native Format</h3>
    265<p>Use the following api calls when assets are avaialble in the native format for each platform.</p>
    266<p><a class="el" href="gb_8h.html#a68651e50243349b48164a8ad983dca4e">set_native_tile_data()</a></p><ul>
    267<li>GB/AP: loads 2bpp tiles data</li>
    268<li>SMS/GG: loads 4bpp tile data</li>
    269</ul>
    270<p><a class="el" href="gb_8h.html#a55f82ff980398dd97036fd936ebd727e">set_tile_map()</a></p><ul>
    271<li>GB/AP: loads 1-byte-per-tile tilemaps</li>
    272<li>SMS/GG: loads 2-byte-per-tile tilemaps</li>
    273</ul>
    274<p>There are also bit-depth specific API calls:</p><ul>
    275<li>1bpp: <a class="el" href="sms_8h.html#adcb394299a1033616fc7d2faec8bd6ad">set_1bpp_colors</a>, <a class="el" href="sms_8h.html#a4d5f74eed0489ebfdc2410ee3f9f7f04">set_bkg_1bpp_data</a>, <a class="el" href="sms_8h.html#a2cc121fbeb5570248531b85a8f0b5b97">set_sprite_1bpp_data</a></li>
    276<li>2bpp: <a class="el" href="sms_8h.html#aa224c9bac27c7fd268e62bdf33338a84">set_2bpp_palette</a>, <a class="el" href="sms_8h.html#aa7ba76e4d44dbf19da351fd1ea8e3023">set_bkg_2bpp_data</a>, <a class="el" href="sms_8h.html#a10ee2919fcab7a5c482816ed718d1c4a">set_sprite_2bpp_data</a>, <a class="el" href="sms_8h.html#ab752b1bb0f58da2a6d52e9747c4b3dd8">set_tile_2bpp_data</a> (sms/gg only)</li>
    277<li>2bpp: <a class="el" href="sms_8h.html#aeff13dca11be49e8c159820c616016ec">set_bkg_4bpp_data</a> (sms/gg only), <a class="el" href="sms_8h.html#a24f53cfe7e25c04fbb5dcb08cfb3b432">set_sprite_4bpp_data</a> (sms/gg only)</li>
    278</ul>
    279<h3><a class="anchor" id="autotoc_md136"></a>
    280Emulated Game Boy Color map attributes on the SMS/Game Gear</h3>
    281<p>On the Game Boy Color, <a class="el" href="gb_2hardware_8h.html#a5ccae0d556500e1055a0ec8de20c535a">VBK_REG</a> is used to select between the regular background tile map and the background attribute tile map (for setting tile color palette and other properties).</p>
    282<p>This behavior is emulated for the SMS/GG when using <a class="el" href="sms_8h.html#a9a732aec1b7aec7d10a9d76ca4da2064">set_bkg_tiles()</a> and <a class="el" href="gb_2hardware_8h.html#a5ccae0d556500e1055a0ec8de20c535a">VBK_REG</a>. It allows writing a 1-byte tile map separately from a 1-byte attributes map.</p>
    283<dl class="section note"><dt>Note</dt><dd>Tile map attributes on SMS/Game Gear use different control bits than the Game Boy Color, so a modified attribute map must be used.</dd></dl>
    284<h1><a class="anchor" id="autotoc_md137"></a>
    285Hardware Comparison</h1>
    286<p>The specs below reflect the typical configuration of hardware when used with GBDK and is not meant as a complete list of their capabilities.</p>
    287<p>GB/AP</p><ul>
    288<li>Sprites:<ul>
    289<li>256 tiles (upper 128 are shared with background) (amount is doubled in CGB mode)</li>
    290<li>tile flipping/mirroring: yes</li>
    291<li>40 total, max 10 per line</li>
    292<li>2 x 4 color palette (color 0 transparent). 8 x 4 color palettes in CGB mode</li>
    293</ul>
    294</li>
    295<li>Background: 256 tiles (typical setup: upper 128 are shared with sprites) (amount is doubled in CGB mode)<ul>
    296<li>tile flipping/mirroring: no (yes in CGB mode)</li>
    297<li>1 x 4 color palette. 8 x 4 color palettes in CGB mode</li>
    298</ul>
    299</li>
    300<li>Window "layer": available</li>
    301<li>Screen: 160 x 144</li>
    302<li>Hardware Map: 256 x 256</li>
    303</ul>
    304<p>SMS/GG</p><ul>
    305<li>Sprites:<ul>
    306<li>256 tiles (a bit less in the default setup)</li>
    307<li>tile flipping/mirroring: no</li>
    308<li>64 total, max 8 per line</li>
    309<li>1 x 16 color palette (color 0 transparent)</li>
    310</ul>
    311</li>
    312<li>Background: 512 tiles (upper 256 are shared with sprites)<ul>
    313<li>tile flipping/mirroring: yes</li>
    314<li>2 x 16 color palettes</li>
    315</ul>
    316</li>
    317<li>Window "layer": not available</li>
    318<li>SMS<ul>
    319<li>Screen: 256 x 192</li>
    320<li>Hardware Map: 256 x 224</li>
    321</ul>
    322</li>
    323<li>GG<ul>
    324<li>Screen: 160 x 144</li>
    325<li>Hardware Map: 256 x 224</li>
    326</ul>
    327</li>
    328</ul>
    329<p><a class="anchor" id="docs_consoles_safe_display_controller_access"></a></p>
    330<h2><a class="anchor" id="autotoc_md138"></a>
    331Safe VRAM / Display Controller Access</h2>
    332<p>GB/AP</p><ul>
    333<li>VRAM / Display Controller (PPU)<ul>
    334<li>VRAM and some other display data / registers should only be written to when the <a class="el" href="gb_2hardware_8h.html#a3b0bf7449b517b3cda2a89428db6deb9">STATF_B_BUSY</a> bit of <a class="el" href="gb_2hardware_8h.html#ad40ebf3b29add46cdd310a7e0802bc6b">STAT_REG</a> is off. Most GBDK API calls manage this automatically.</li>
    335</ul>
    336</li>
    337</ul>
    338<p>SMS/GG</p><ul>
    339<li>Display Controller (VDP)<ul>
    340<li>Writing to the VDP should not be interrupted while an operation is already in progress (since that will interfere with the internal data pointer causing data to be written to the wrong location).</li>
    341<li>Recommended approach: Avoid writing to the VDP (tiles, map, scrolling, colors, etc) during an interrupt routine (ISR).</li>
    342<li>Alternative (requires careful implementation): Make sure writes to the VDP during an ISR are only performed when the <a class="el" href="sms_8h.html#a388d1dff2698172ba8574e43f5c77c93">_shadow_OAM_OFF</a> flag indicates it is safe to do so. </li>
    343</ul>
    344</li>
    345</ul>
    346</div></div><!-- contents -->
    347</div><!-- PageDoc -->
    348</div><!-- doc-content -->
    349<!-- HTML footer for doxygen 1.8.14-->
    350<!-- start footer part -->
    351<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
    352</div>
    353</body>
    354</html>