GBDK 2020 Docs
4.3.0
API Documentation for GBDK 2020
|
Follow the steps in this section to start using GBDK-2020.
You can get the latest releases from here: https://github.com/gbdk-2020/gbdk-2020/releases
There is a known issue on Windows where sdcc will fail when run from folder names with spaces on non-C drives.
For the time being the workaround is as follows (with D:\My Stuff\
as an example folder):
fsutil.exe 8dot3name query D:
fsutil 8dot3name set D: 0
fsutil.exe 8dot3name query D:
D:\>fsutil file setshortname "D:\My stuff" "mystuf~1"
Make sure your GBDK-2020 installation is working correctly by compiling some of the included example projects.
If everything works in the steps below and there are no errors reported then each project that was built should have its own .gb ROM file (or suitable extension for the other supported targets).
Navigate to a project within the example projects folder ("examples\gb\"
under your GBDK-2020 install folder) and open a command line. Then type:
compile
or
compile.bat
This should build the example project. You can also navigate into other example project folders and build in the same way.
Navigate to the example projects folder ("examples/gb/"
under your GBDK-2020 install folder) and open a command line. Then type:
make
This should build all of the examples sequentially. You can also navigate into an individual example project's folder and build it by typing make
.
If you get a security warning on macOS that says ("`... developer cannot be verified, macOS cannot verify that this app is free from malware`"), it does not mean that GBDK is malware. It just means the GBDK toolchain binaries are not signed by Apple, so it won't run them without an additional step.
You will need to unquarrantine the files in the bin folder in order to run them. This can be fixed using the following steps.
Open a terminal and navigate to the gbdk bin folder ("bin/"
under your GBDK-2020 install folder). Then type:
xattr -d com.apple.quarantine *
To create a new project use a template!
There are template projects included in the GBDK example projects to help you get up and running. Their folder names start with template_
.
GBDK
path variable and/or the path to LCC
in the Makefile
or compile.bat
so that it will still build correctly.make
on the command line in that folder to verify it still builds.If you plan to use GBTD / GBMB for making graphics, make sure to get the version with the const
fix and other improvements. See const_gbtd_gbmb.
Take a look at the coding guidelines, even if you have experience writing software for other platforms. There is important information to help you get good results and performance on the Game Boy.
If you haven't written programs in C before, check the C tutorials section.
If you have a specific project in mind, consider what hardware you want to target. It isn't something that has to be decided up front, but it can influence design and implementation.
What size will your game or program be?
What console platform(s) will it run on?
If targeting the Game Boy, what hardware will it run on?
Tracking down problems in code is easier with a debugger. Emulicious has a debug adapter that provides C source debugging with GBDK-2020.
You might want to start off with a guided GBDK tutorial from the GBDK Tutorials section.
Check out the links for online community and support and read the FAQ.
Several popular GBDK Tutorials, Videos and How-to's were made before GBDK-2020 was available, as a result some information they include is outdated or incompatible. The following summarizes changes that should be made for best results.
GBDK-2020 now supports auto-banking (rom_autobanking). In most cases using auto-banking will be easier and less error prone than manually assigning source and assets to banks.
banks_autobank
project.The old GBDK types UINT8
, INT8
, UINT16
, INT16
are non-standard and less portable.
The following should be used instead: uint8_t
, int16_t
, uint16_t
, int32_t
, uint32_t
and bool
.
These are standard types defined in stdint.h
(#include <stdint.h>
) and stdbool.h
(#include <stdbool.h>
).
If you plan to use GBTD / GBMB for making graphics, make sure to get the version with the const
fix and other improvements. See const_gbtd_gbmb.
The following flag is no longer needed with lcc and sdcc, it can be removed without any loss of performance.
-DUSE_SFR
#ifdef
anymore). Check here why: https://gbdev.gg8.se/forums/viewtopic.php?id=697Setting ROM bytes directly with -Wl-yp0x<address>=0x<value>
is no longer supported. Instead use makebin flags. For example, use -Wm-yC
instead of -Wl-yp0x143=0xC0
. See faq_gb_type_header_setting.
The following header files which are now cross platform were moved from gb/
to gbdk/
: bcd.h
, console.h
, far_ptr.h
, font.h
, gbdecompress.h
, gbdk-lib.h
, incbin.h
, metasprites.h
, platform.h
, version.h
#include <gbdk/...>
instead of #include <gb/>
Do not #include
.c
source files into other .c
source files. Instead create .h
header files for them and include those.
Modern project templates are included with GBDK-2020. Using them (and their Makefile or compile.bat) as a starting point for projects is recommended and can help ensure better default settings and project organization.
hUGEtracker and its driver hUGEdriver are smaller, more efficient and more versatile than gbt_player.