mirror of
https://github.com/gbdk-2020/gbdk-2020.git
synced 2026-03-25 00:17:17 +01:00
217 lines
11 KiB
HTML
217 lines
11 KiB
HTML
<!-- HTML header for doxygen 1.8.14-->
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="cache-control" content="max-age=86400"/>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.20"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>GBDK 2020 Docs: Supported Consoles & Cross Compiling</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
<link href="doxygen_extra.css" rel="stylesheet" type="text/css"/>
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">GBDK 2020 Docs
|
|
</div>
|
|
<div id="projectbrief">API Documentation for GBDK 2020</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.20 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */</script>
|
|
<div id="main-nav"></div>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(document).ready(function(){initNavTree('docs_supported_consoles.html',''); initResizable(); });
|
|
/* @license-end */
|
|
</script>
|
|
<div id="doc-content">
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="PageDoc"><div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">Supported Consoles & Cross Compiling </div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="textblock"><p><a class="anchor" id="docs_consoles_supproted_list"></a></p>
|
|
<h1><a class="anchor" id="autotoc_md97"></a>
|
|
Consoles Supported by GBDK</h1>
|
|
<p>As of version <code>4.0.5</code> GBDK includes support for other consoles in addition to the Game Boy.</p>
|
|
<ul>
|
|
<li>Nintendo Game Boy / Game Boy Color</li>
|
|
<li>Analogue Pocket</li>
|
|
<li>Sega Master System</li>
|
|
<li>Sega Game Gear</li>
|
|
</ul>
|
|
<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>
|
|
<p><a class="anchor" id="docs_consoles_compiling"></a></p>
|
|
<h1><a class="anchor" id="autotoc_md98"></a>
|
|
Cross Compiling for Different Consoles</h1>
|
|
<h2><a class="anchor" id="autotoc_md99"></a>
|
|
lcc</h2>
|
|
<p>When compiling and building through <a class="el" href="docs_toolchain.html#lcc">lcc</a> use the <code>-m<port>:<plat></code> flag to select the desired console via it's port and platform combination.</p>
|
|
<h2><a class="anchor" id="autotoc_md100"></a>
|
|
sdcc</h2>
|
|
<p>When compiling directly with <a class="el" href="docs_toolchain.html#sdcc">sdcc</a> use: <code>-m<port></code>, <code>-D__PORT_<port></code> and <code>-D__TARGET_<plat></code></p>
|
|
<h2><a class="anchor" id="autotoc_md101"></a>
|
|
Console Port and Platform Settings</h2>
|
|
<ul>
|
|
<li>Nintendo Game Boy / Game Boy Color<ul>
|
|
<li><a class="el" href="docs_toolchain.html#lcc">lcc</a> : <code>-mgbz80:gb</code></li>
|
|
<li>port:<code>gbz80</code>, plat:<code>gb</code></li>
|
|
</ul>
|
|
</li>
|
|
<li>Analogue Pocket<ul>
|
|
<li><a class="el" href="docs_toolchain.html#lcc">lcc</a> : <code>-mgbz80:ap</code></li>
|
|
<li>port:<code>gbz80</code>, plat:<code>ap</code></li>
|
|
</ul>
|
|
</li>
|
|
<li>Sega Master System<ul>
|
|
<li><a class="el" href="docs_toolchain.html#lcc">lcc</a> : <code>-mz80:sms</code></li>
|
|
<li>port:<code>z80</code>, plat:<code>sms</code></li>
|
|
</ul>
|
|
</li>
|
|
<li>Sega Game Gear<ul>
|
|
<li><a class="el" href="docs_toolchain.html#lcc">lcc</a> : <code>-mz80:gg</code></li>
|
|
<li>port:<code>z80</code>, plat:<code>gg</code></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<h1><a class="anchor" id="autotoc_md102"></a>
|
|
Cross-Platform Constants</h1>
|
|
<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>
|
|
<h2><a class="anchor" id="autotoc_md103"></a>
|
|
Console Identifiers</h2>
|
|
<ul>
|
|
<li>When <code><gb/gb.h></code> is included (either directly or through <code><gbdk/platform.h></code>)<ul>
|
|
<li>When building for Game Boy:<ul>
|
|
<li><code>NINTENDO</code> will be #defined</li>
|
|
<li><code>GAMEBOY</code> will be #defined</li>
|
|
</ul>
|
|
</li>
|
|
<li>When building for Analogue Pocket<ul>
|
|
<li><code>NINTENDO</code> will be #defined</li>
|
|
<li><code>ANALOGUEPOCKET</code> will be #defined</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>When <code><sms/sms.h ></code> is included (either directly or through <code><gbdk/platform.h></code>)<ul>
|
|
<li>When building for Master System<ul>
|
|
<li><code>SEGA</code> will be #defined</li>
|
|
<li><code>MASTERSYSTEM</code> will be #defined</li>
|
|
</ul>
|
|
</li>
|
|
<li>When building for Game Gear<ul>
|
|
<li><code>SEGA</code> will be #defined</li>
|
|
<li><code>GAMEGEAR</code> will be #defined</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<h2><a class="anchor" id="autotoc_md104"></a>
|
|
Console Hardware Properties</h2>
|
|
<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>
|
|
<ul>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<li><a class="el" href="gb_2hardware_8h.html#a4d682ed7a6158c5ba10afec739b17a8a">DEVICE_SCREEN_MAP_ENTRY_SIZE</a></li>
|
|
<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>
|
|
<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>
|
|
</ul>
|
|
<h1><a class="anchor" id="autotoc_md105"></a>
|
|
Using <gbdk/...> headers</h1>
|
|
<p>Some include files under <code><gbdk/..></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>
|
|
<p>For example, the following can be used </p><pre class="fragment">#include <gbdk/platform.h>
|
|
#include <gbdk/metasprites.h>
|
|
</pre><p>Instead of </p><pre class="fragment">#include <gb/gb.h>
|
|
#include <gb/metasprites.h>
|
|
</pre><p>and </p><pre class="fragment">#include <sms/sms.h>
|
|
#include <sms/metasprites.h>
|
|
</pre><p><a class="anchor" id="docs_consoles_cross_platform_examples"></a></p>
|
|
<h1><a class="anchor" id="autotoc_md106"></a>
|
|
Cross Platform Example Projects</h1>
|
|
<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>
|
|
<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>
|
|
<h1><a class="anchor" id="autotoc_md107"></a>
|
|
Porting from the Game Boy to the Analogue Pocket</h1>
|
|
<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 ported to the Analogue Pocket, or to run on both, the following practices should be used.</p>
|
|
<h2><a class="anchor" id="autotoc_md108"></a>
|
|
Boot logo</h2>
|
|
<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>
|
|
<h2><a class="anchor" id="autotoc_md109"></a>
|
|
Registers and Flags</h2>
|
|
<p>Change these hardwired registers and register flags to use API defined ones.</p><ul>
|
|
<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>
|
|
<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>
|
|
<li>LCDC flags: -> LCDCF_... (example: <a class="el" href="gb_2hardware_8h.html#a1491fc03ed7f02e7309cc7b0c48b6c8a">LCDCF_ON</a>)</li>
|
|
<li>STAT flags: -> STATF_... (example: <a class="el" href="gb_2hardware_8h.html#a3b53105cc5be896b48794ba82d2aeb4c">STATF_LYC</a>) </li>
|
|
</ul>
|
|
</div></div><!-- contents -->
|
|
</div><!-- PageDoc -->
|
|
</div><!-- doc-content -->
|
|
<!-- HTML footer for doxygen 1.8.14-->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
</div>
|
|
</body>
|
|
</html>
|