Files
gbdk-2020/docs/api/docs_migrating_versions.html
2025-05-09 23:47:16 -07:00

326 lines
19 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.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>GBDK 2020 Docs: Migrating to new GBDK Versions</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
&#160;<span id="projectnumber">4.4.0</span>
</div>
<div id="projectbrief">API Documentation for GBDK 2020</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @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&amp;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&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('docs_migrating_versions.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">Migrating to new GBDK Versions </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>This section contains information that may be useful to know or important when upgrading to a newer GBDK release.</p>
<h1><a class="anchor" id="autotoc_md227"></a>
GBDK-2020 versions</h1>
<h2><a class="anchor" id="autotoc_md228"></a>
Porting to GBDK-2020 4.4.0</h2>
<ul>
<li>GBDK now requires ~SDCC 4.5.0 or higher with GBDK-2020 patches for the z80 and NES</li>
<li>Build Host:<ul>
<li>Changed from building on MacOS 11 to MacOS 13 for 64 bit Intel</li>
<li>Changed from building on Ubuntu Linux 20.04 to 22.04 for 64 bit Intel</li>
</ul>
</li>
<li>NES<ul>
<li>LCD bkg_scroll_y is now relative to the current scanline<ul>
<li>This change creates higher compatibility with the Game Boy SCY_REG and makes it easier to re-use Game Boy LCD handlers</li>
<li>This behaves differently to 4.3.0 and affects LCD handlers that change the y scrolling coordinate mid-frame</li>
</ul>
</li>
<li>Added <a class="el" href="docs_toolchain.html#utility_makenes">makenes</a> utility for finalizing NES rom headers (called automatically by <a class="el" href="docs_toolchain.html#lcc">lcc</a>)</li>
</ul>
</li>
<li>SMS/GG<ul>
<li>Changed from unsigned (<code>uint16_t</code>) to signed int16 (<code>int16_t</code>) for coordinates with the family of <code>...metasprite...()</code> functions</li>
</ul>
</li>
<li>SDCC<ul>
<li>Changed to using the <code>-N</code> flag with sdas since the the <code>-n</code> flag was removed</li>
</ul>
</li>
<li>Changed <a class="el" href="docs_toolchain.html#lcc">lcc</a> to use <code>--no-optsdcc-in-asm</code> for building user programs and the GBDK library<ul>
<li>This removes some "O line" meta-data from object files to avoid false-positive linker errors</li>
<li>It is a workaround for SDCC now appending the calling convention to the "O Line" in the object files by default</li>
</ul>
</li>
</ul>
<h2><a class="anchor" id="autotoc_md229"></a>
Porting to GBDK-2020 4.3.0</h2>
<ul>
<li>GBDK now requires ~SDCC 4.4.0 or higher with GBDK-2020 patches for the z80 and NES</li>
<li>Changed to new calling convention for <a class="el" href="stdio_8h.html#a133c04c35a1c14c6f8d8078831705661">printf()</a>, <a class="el" href="stdio_8h.html#a440c82287022737c4f2866786ba8a154">sprintf()</a>, <a class="el" href="stdlib_8h.html#af15d7205d8d10c4820f997ce5c526279">abs()</a></li>
<li>Changed to new SDCC calling convention for <a class="el" href="msx_8h.html#adcd40a58f7c7d348d506cc400cd94739">set_bkg_tile_xy()</a>, <a class="el" href="msx_8h.html#a95d929d964d9988f4dc5a25ed399ae08">set_win_tile_xy()</a></li>
<li>The SDCC object file format (<code>.o</code>, <code>.rel</code> files) changed from <code>XL3</code> (24 bit addresses) to <code>XL4</code> (32 bit addresses)<ul>
<li>Bankpack now supports both</li>
</ul>
</li>
<li>Recommend using:<ul>
<li><a class="el" href="sms_8h.html#ae042588f20bf5a2349c8ad8716245233">CURRENT_BANK</a> instead of <code>_current_bank</code></li>
<li><a class="el" href="asm_2types_8h.html#aa8480aed89a168ec484727f5ac985cd0">BANKED</a> macro instead of <code>__banked</code></li>
</ul>
</li>
<li>NES <a class="el" href="msx_8h.html#a7d5ed1aed79d8fd2894893d7f6f9b835">set_sprite_palette()</a> now indexes from <code>0..3</code> instead of <code>4..7</code></li>
<li>png2asset:<ul>
<li>If using either <code>-bpp 1</code> or <code>-pack_mode 1bpp</code> then the other is auto-enabled</li>
<li>Significant bug fixes and changes, check to make sure output is as expected</li>
</ul>
</li>
</ul>
<h2><a class="anchor" id="autotoc_md230"></a>
Porting to GBDK-2020 4.2.0</h2>
<ul>
<li>GBDK now requires ~SDCC 4.3 or higher with GBDK-2020 patches for the z80 and NES</li>
<li>The following new functions replace old ones:<ul>
<li>While the old functions will continue to work for now, migration to new versions is strongly encouraged</li>
<li><a class="el" href="gb_8h.html#af57b77452ef377da18e4fbf0288013d1">vsync()</a>: replaces <a class="el" href="gb_8h.html#a815f8ecad32d14b786a8ed1168518773">wait_vbl_done()</a></li>
<li><a class="el" href="cgb_8h.html#a2a89f4110072dbe76805e7b07299788d">set_default_palette()</a>: replaces <a class="el" href="cgb_8h.html#a6b334e5e452d0650aded17199be1514a">cgb_compatibility()</a></li>
<li><a class="el" href="gb_2metasprites_8h.html#a4de12dbe1868a2a408e8ef583ccc9df1">move_metasprite_flipy()</a>: replaces <a class="el" href="gb_2metasprites_8h.html#a27e3bb17d0458b60b1f0433f66301f46">move_metasprite_hflip()</a></li>
<li><a class="el" href="gb_2metasprites_8h.html#a061cc1e8214c86414dc1d5017b9c8be2">move_metasprite_flipx()</a>: replaces <a class="el" href="gb_2metasprites_8h.html#aa8ff2df0679ebb0b6e0a8f6d83127e1a">move_metasprite_vflip()</a></li>
<li><a class="el" href="gb_2metasprites_8h.html#a21a071eea8fb69b577cfcd86aad5bdac">move_metasprite_flipxy()</a>: replaces <a class="el" href="gb_2metasprites_8h.html#a32a61acd4a76d1de5814f7b94c8bc23f">move_metasprite_hvflip()</a></li>
<li><a class="el" href="gb_2metasprites_8h.html#a6a320e8632e35cba926e089b035146e1">move_metasprite_ex()</a>: replaces <a class="el" href="gb_2metasprites_8h.html#a77475e913bf0a19df28bdbf9d1cf392b">move_metasprite()</a></li>
</ul>
</li>
<li>The unused <code>-DINT_16_BITS</code> argument was removed from the default SDCC compiler and preprocessor arguments (used in pre-GBDK2020 <code>gbdk/include-gb/types.h</code>)</li>
<li>Removed legacy MBC register definitions <code>.MBC1_ROM_PAGE</code> and <code>.MBC_ROM_PAGE</code></li>
<li>SMS/GG<ul>
<li>Swapped A and B buttons to match game boy buttons</li>
</ul>
</li>
</ul>
<h2><a class="anchor" id="autotoc_md231"></a>
Porting to GBDK-2020 4.1.1</h2>
<ul>
<li>No significant changes required</li>
</ul>
<h2><a class="anchor" id="autotoc_md232"></a>
Porting to GBDK-2020 4.1.0</h2>
<ul>
<li>GBDK now requires SDCC 4.2 or higher with GBDK-2020 patches for the z80 linker</li>
<li>The default calling convention changed in SDCC 4.2, see <a class="el" href="docs_coding_guidelines.html#sdcc_calling_convention">Calling Conventions</a> for more details.<ul>
<li>If you are linking to libraries compiled with an older version of SDCC / GBDK then you may have to recompile them.</li>
<li>If there are existing functions written in ASM which <b>receive parameters</b> they should also be reviewed to make sure they work with the new <code>__sdcccall(1)</code> calling convention, or have their header declaration changed to use <code>OLDCALL</code>.</li>
<li>If there are existing functions written in ASM which <b>call other functions written in C</b> the callee C function should be declared OLDCALL.</li>
<li>Function pointer declarations should be checked to see if they need OLDCALL added to the declaration.<ul>
<li>Example (add OLDCALL at the end)</li>
<li>FROM: <code>typedef void (*someFunc)(uint8_t, uint8_t);</code></li>
<li>TO: <code>typedef void (*someFunc)(uint8_t, uint8_t) OLDCALL;</code></li>
</ul>
</li>
<li>If you are using tools such as <code>rgb2sdas</code> (from hUGETracker/Driver) you may need to edit the resulting .o file and replace <code>-mgbz80</code> with <code>-msm83</code> in addition to using <code>OLDCALL</code></li>
</ul>
</li>
<li>The SDCC <code>PORT</code> name for the Game Boy and related clones changed from <code>gbz80</code> to <code>sm83</code>.<ul>
<li>Additional details in the <a class="el" href="docs_supported_consoles.html#console_port_plat_settings">Console Port and Platform Settings</a> section and <a class="el" href="docs_faq.html#faq_gbz80_sm83_old_port_name_error">FAQ entry</a>. <a class="el" href="docs_toolchain.html#lcc">lcc</a> will error out if the old <code>PORT</code> name is passed in.</li>
</ul>
</li>
<li>The library base path changed from <code>lib/small/asxxxx/</code> to <code>lib/</code>.<ul>
<li>For example <code>lib/small/asxxxx/gb</code> becomes <code>lib/gb</code></li>
</ul>
</li>
<li>Allocations for ISR chain lengths were fixed.<ul>
<li>Now they are VBL: 4 user handlers, LCD: 3 user handlers, SIO/TIM/JOY: 4 user handlers</li>
</ul>
</li>
</ul>
<h2><a class="anchor" id="autotoc_md233"></a>
Porting to GBDK-2020 4.0.6</h2>
<ul>
<li>Renamed <code>bgb_emu.h</code> to <code>emu_debug.h</code> and BGB_* functions to EMU_*<ul>
<li>Aliases for the BGB_* ones and a <code>bgb_emu.h</code> shim are present for backward compatibility, but updating to the new naming is recommended</li>
</ul>
</li>
</ul>
<h2><a class="anchor" id="autotoc_md234"></a>
Porting to GBDK-2020 4.0.5</h2>
<ul>
<li>GBDK now requires SDCC 12259 or higher with GBDK-2020 patches</li>
<li>Variables in static storage are now initialized to zero per C standard (but remaining WRAM is not cleared)</li>
<li><a class="el" href="docs_toolchain.html#utility_png2asset">png2asset</a> is the new name for the <code>png2mtspr</code> utility</li>
<li><a class="el" href="docs_toolchain.html#lcc">lcc</a> : Changed default output format when not specified from <code>.ihx</code> to <code>.gb</code> (or other active rom extension)</li>
<li>The <code>_BSS</code> area is deprecated (use <code>_DATA</code> instead)</li>
<li>The <code>_BASE</code> area is renamed to <code>_HOME</code></li>
<li>Variables in static storage are now initialized to zero per C standard (but remaining WRAM is not cleared)</li>
<li><a class="el" href="stdlib_8h.html#aac2ea595a9ea8f5ebd883a0bc05eba5c">itoa()</a>, <a class="el" href="stdlib_8h.html#a38c070016cb06132360cfa5bacc2ed19">uitoa()</a>, <a class="el" href="stdlib_8h.html#a6374e62474a5a76c7ace9a59fb1cc829">ltoa()</a>, <a class="el" href="stdlib_8h.html#ac22b79fe0c1279eabc3daf57328008d2">ultoa()</a> all now require a radix value (base) argument to be passed. On the Game Boy and Analogue Pocket the parameter is required but not utilized.</li>
<li>set_bkg_1bit_data has been renamed to <a class="el" href="sms_8h.html#a4d5f74eed0489ebfdc2410ee3f9f7f04">set_bkg_1bpp_data</a></li>
<li>The following header files which are now cross platform were moved from <code>gb/</code> to <code>gbdk/</code>: <code>bcd.h</code>, <code>console.h</code>, <code>far_ptr.h</code>, <code>font.h</code>, <code>gbdecompress.h</code>, <code>gbdk-lib.h</code>, <code>incbin.h</code>, <code>metasprites.h</code>, <code>platform.h</code>, <code>version.h</code><ul>
<li>When including them use <code>#include &lt;gbdk/...&gt;</code> instead of <code>#include &lt;gb/&gt;</code></li>
</ul>
</li>
</ul>
<h2><a class="anchor" id="autotoc_md235"></a>
Porting to GBDK-2020 4.0.4</h2>
<ul>
<li>GBDK now requires SDCC 12238 or higher</li>
<li>Made sample.h, cgb.h and sgb.h independent from gb.h</li>
</ul>
<h2><a class="anchor" id="autotoc_md236"></a>
Porting to GBDK-2020 4.0.3</h2>
<ul>
<li>No significant changes required</li>
</ul>
<h2><a class="anchor" id="autotoc_md237"></a>
Porting to GBDK-2020 4.0.2</h2>
<ul>
<li>The default font has been reduced from 256 to 96 characters.<ul>
<li>Code using special characters may need to be updated.</li>
<li>The off-by-1 character index offset was removed for fonts. Old fonts with the offset need to be re-adjusted.</li>
</ul>
</li>
</ul>
<h2><a class="anchor" id="autotoc_md238"></a>
Porting to GBDK-2020 4.0.1</h2>
<ul>
<li><b>Important!</b> : The <code>WRAM</code> memory region is no longer automatically initialized to zeros during startup.<ul>
<li>Any variables which are declared without being initialized may have <b>indeterminate values instead of 0</b> on startup. This might reveal previously hidden bugs in your code.</li>
<li>Check your code for variables that are not initialized before use.</li>
<li>In BGB you can turn on triggering exceptions (options panel) reading from unitialized RAM. This allows for some additional runtime detection of uninitialized vars.</li>
</ul>
</li>
<li>In .ihx files, multiple writes to the same ROM address are now warned about using <a class="el" href="docs_toolchain.html#ihxcheck">ihxcheck</a>.</li>
<li><code>set_*_tiles()</code> now wrap maps around horizontal and vertical boundaries correctly. Code relying on it not wrapping correctly may be affected.</li>
</ul>
<h2><a class="anchor" id="autotoc_md239"></a>
Porting to GBDK-2020 4.0</h2>
<ul>
<li>GBDK now requires SDCC 4.0.3 or higher</li>
<li>The old linker <code>link-gbz80</code> has been REMOVED, the linker <a class="el" href="docs_toolchain.html#sdldgb">sdldgb</a> from SDCC is used.<ul>
<li>Due to the linker change, there are no longer warnings about multiple writes to the same ROM address.</li>
</ul>
</li>
<li>GBDK now generates .ihx files, those are converted to a ROM using <a class="el" href="docs_toolchain.html#makebin">makebin</a> (lcc can do this automatically in some use cases)</li>
<li>Setting ROM bytes directly with <code>-Wl-yp0x&lt;address&gt;=0x&lt;value&gt;</code> is no longer supported. Instead use <a class="el" href="docs_toolchain.html#makebin">makebin</a> flags. For example, use <code>-Wm-yC</code> instead of <code>-Wl-yp0x143=0xC0</code>. See <a class="el" href="docs_faq.html#faq_gb_type_header_setting">faq_gb_type_header_setting</a>.</li>
<li>OAM symbol has been renamed to <code>_shadow_OAM</code>, that allows accessing shadow OAM directly from C code</li>
</ul>
<h2><a class="anchor" id="autotoc_md240"></a>
Porting to GBDK-2020 3.2</h2>
<ul>
<li>No significant changes required</li>
</ul>
<h2><a class="anchor" id="autotoc_md241"></a>
Porting to GBDK-2020 3.1.1</h2>
<ul>
<li>No significant changes required</li>
</ul>
<h2><a class="anchor" id="autotoc_md242"></a>
Porting to GBDK-2020 3.1</h2>
<ul>
<li>Behavior formerly enabled by USE_SFR_FOR_REG is on by default now (no need to specify it, it isn't a tested <code>#ifdef</code> anymore). check here why: <a href="https://gbdev.gg8.se/forums/viewtopic.php?id=697">https://gbdev.gg8.se/forums/viewtopic.php?id=697</a></li>
</ul>
<h2><a class="anchor" id="autotoc_md243"></a>
Porting to GBDK-2020 3.0.1</h2>
<ul>
<li>LCC was upgraded to use SDCC v4.0. Makefile changes may be required<ul>
<li>The symbol format changed. To get bgb compatible symbols turn on <code>.noi</code> output (LCC argument: <code>-Wl-j</code> or <code>-debug</code>) and use <code>-Wm-yS</code></li>
<li>?? Suggested: With LCC argument: <code>-Wa-l</code> (sdasgb:<code>-a All user symbols made global</code>)</li>
<li>In SDCC 3.6.0, the default for char changed from signed to unsigned.<ul>
<li>If you want the old behavior use <code>--fsigned-char</code>.</li>
<li>lcc includes <code>--fsigned-char</code> by default</li>
<li>Explicit declaration of unsigned vars is encouraged (for example, '15U' instead of '15')</li>
</ul>
</li>
<li><code>.init</code> address has been removed</li>
</ul>
</li>
</ul>
<hr />
<h1><a class="anchor" id="autotoc_md245"></a>
Historical GBDK versions</h1>
<h2><a class="anchor" id="autotoc_md246"></a>
GBDK 1.1 to GBDK 2.0</h2>
<ul>
<li>Change your int variables to long if they have to be bigger than 255. If they should only contain values between 0 and 255, use an unsigned int.</li>
<li>If your application uses the delay function, you'll have to adapt your delay values.</li>
<li>Several functions have new names. In particular some of them have been changed to macros (e.g. show_bkg() is now SHOW_BKG).</li>
<li>You will probably have to change the name of the header files that you include. </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>