git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

docs/pages/01_getting_started.md

      1 @page docs_getting_started Getting Started
      2 
      3 
      4 Follow the steps in this section to start using GBDK-2020.
      5 
      6 # 1. Download a Release and unzip it
      7 You can get the latest releases from here: https://github.com/gbdk-2020/gbdk-2020/releases
      8 
      9 @anchor windows_sdcc_non_c_drive_path_spaces
     10 ## Known Issue: Windows and folder names with spaces on non-C drives 
     11 There is a known issue on Windows where sdcc will fail when run from folder names with spaces on non-C drives.
     12 
     13 For the time being the workaround is as follows (with `D:\My Stuff\` as an example folder):
     14   - Run Windows Command as administrator
     15   - Run: `fsutil.exe 8dot3name query D:`
     16     - Output: The volume state is: 1 (8dot3 name creation is disabled). The registry state is: 2 (Per volume setting - the default). Based on the above settings, 8dot3 name creation is disabled on D:
     17   - Run: `fsutil 8dot3name set D: 0`
     18     - Output: Successfully enabled 8dot3name generation on D:
     19   - Run: `fsutil.exe 8dot3name query D:`
     20     - Output: The volume state is: 0 (8dot3 name creation is enabled). The registry state is: 2 (Per volume setting - the default). Based on the above settings, 8dot3 name creation is enabled on D:
     21   - Only folders created AFTER the setting has been enabled will get 8.3 filename support, renaming folders does NOT appear to generate 8.3 filename support. However it is possible to manually generate a short path name for an existing folder:
     22     - Run: `D:\>fsutil file setshortname "D:\My stuff" "mystuf~1"`
     23 
     24 
     25 # 2. Compile Example projects
     26 Make sure your GBDK-2020 installation is working correctly by compiling some of the included @ref docs_example_programs "example projects".
     27 
     28 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).
     29 
     30 ## Windows (without Make installed):
     31 Navigate to a project within the example projects folder (`"examples\gb\"` under your GBDK-2020 install folder) and open a command line. Then type:
     32 
     33     compile
     34 
     35 or
     36 
     37     compile.bat
     38 
     39 This should build the example project. You can also navigate into other example project folders and build in the same way.
     40 
     41 
     42 ## Linux / macOS / Windows with Make installed:
     43 Navigate to the example projects folder (`"examples/gb/"` under your GBDK-2020 install folder) and open a command line. Then type:
     44 
     45     make
     46 
     47 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`.
     48 
     49 @anchor macos_unsigned_security_workaround
     50 ### macOS security warnings
     51 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.
     52 
     53 You will need to unquarrantine the files in the bin folder in order to run them. This can be fixed using the following steps.
     54 
     55 Open a terminal and navigate to the gbdk bin folder (`"bin/"` under your GBDK-2020 install folder). Then type:
     56 
     57     xattr -d com.apple.quarantine *
     58 
     59 
     60 
     61 # 3. Use a Template
     62 __To create a new project use a template!__ 
     63 
     64 There are template projects included in the @ref docs_example_programs "GBDK example projects" to help you get up and running. Their folder names start with `template_`.
     65 
     66 1. Copy one of the template folders to a new folder name.
     67 
     68 2. If you moved the folder out of the GBDK examples then you __must__ update the `GBDK` path variable and/or the path to `LCC` in the `Makefile` or `compile.bat` so that it will still build correctly.
     69 
     70 3. Type `make` on the command line in that folder to verify it still builds.
     71 
     72 4. Open main.c to start making changes.
     73 
     74 
     75 # 4. If you use GBTD / GBMB, get the fixed version
     76 If you plan to use GBTD / GBMB for making graphics, make sure to get the version with the `const` fix and other improvements. See @ref const_gbtd_gbmb.
     77 
     78 
     79 # 5. Review Coding Guidelines
     80 Take a look at the @ref docs_coding_guidelines "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.
     81 
     82 If you haven't written programs in C before, check the @ref docs_c_tutorials "C tutorials section".
     83 
     84 
     85 # 6. Hardware and Resources
     86 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.
     87 
     88 What size will your game or program be?
     89   - 32K Cart (no-MBC required)
     90   - Larger than 32K (MBC required)
     91   - See more details about @ref docs_rombanking_mbcs "ROM Banking and MBCs"
     92 
     93 What console platform(s) will it run on?
     94   - Game Boy (GB/GBC)
     95   - Analogue Pocket (AP)
     96   - Sega Master System (SMS)
     97   - Game Gear (GG)
     98   - Mega Duck (DUCK)
     99   - See @ref docs_supported_consoles
    100 
    101 If targeting the Game Boy, what hardware will it run on?
    102   - Game Boy (& Game Boy Color)
    103   - Game Boy Color only
    104   - Game Boy & Super Game Boy
    105   - See how to @ref faq_gb_type_header_setting "set the compatibility type in the cartridge header". Read more about hardware differences in the @ref Pandocs
    106 
    107 
    108 # 7. Set up C Source debugging
    109 Tracking down problems in code is easier with a debugger. Emulicious has a @ref Emulicious_debug "debug adapter" that provides C source debugging with GBDK-2020.
    110 
    111 
    112 # 8. Try a GBDK Tutorial
    113 You might want to start off with a guided GBDK tutorial from the @ref links_gbdk_tutorials "GBDK Tutorials section".
    114 
    115   - __Note:__ Tutorials (or parts of them) may be based on the older GBDK from the 2000's before it was updated to be GBDK-2020. The general principles are all the same, but the setup and parts of the @ref docs_toolchain "toolchain" (compiler/etc) may be somewhat different and some links may be outdated (pointing to the old GBDK or old tools).
    116 
    117 
    118 # 9. Read up!
    119 - It is strongly encouraged to read more @ref docs_index "GBDK-2020 General Documentation".
    120 - Learn about the Game Boy hardware by reading through the @ref Pandocs technical reference.
    121 
    122 
    123 # 10. Need help?
    124 Check out the links for @ref links_help_and_community "online community and support" and read the @ref docs_faq "FAQ".
    125 
    126 
    127 
    128 # Migrating From Pre-GBDK-2020 Tutorials
    129 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.
    130 
    131 ## Also see: 
    132 - @ref docs_migrating_versions
    133 - @ref docs_coding_guidelines
    134 - @ref docs_getting_started (the section above this)
    135 
    136 ## Use auto-banking
    137 GBDK-2020 now supports auto-banking (@ref rom_autobanking). In most cases using auto-banking will be easier and less error prone than manually assigning source and assets to banks.
    138 - There is a source example `banks_autobank` project.
    139 
    140 ## Non-standard types (UINT8, etc)
    141 The old GBDK types `UINT8`, `INT8`, `UINT16`, `INT16` are non-standard and less portable.
    142 
    143 The following should be used instead: `uint8_t`, `int16_t`, `uint16_t`, `int32_t`, `uint32_t` and `bool`.
    144 
    145 These are standard types defined in `stdint.h` (`#include <stdint.h>`) and `stdbool.h` (`#include <stdbool.h>`).
    146 
    147 ## If using GBTD / GBMB, get the fixed version
    148 If you plan to use GBTD / GBMB for making graphics, make sure to get the version with the `const` fix and other improvements. See @ref const_gbtd_gbmb.
    149 
    150 ## LCC and SDCC flags that are not needed
    151 The following flag is no longer needed with @ref lcc and @ref sdcc, it can be removed without any loss of performance.
    152 - `-DUSE_SFR`
    153    - Behavior formerly enabled by USE_SFR_FOR_REG is on by default now (no need to specify it, it isn't a tested `#ifdef` anymore). Check here why: https://gbdev.gg8.se/forums/viewtopic.php?id=697
    154 
    155 ## ROM Header Settings (such as Color, SGB, etc)
    156 Setting ROM bytes directly with `-Wl-yp0x<address>=0x<value>` is no longer supported. Instead use @ref makebin flags. For example, use `-Wm-yC` instead of `-Wl-yp0x143=0xC0`. See @ref faq_gb_type_header_setting.
    157 
    158 ## GBDK Header include changes
    159 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`
    160 - When including them use `#include <gbdk/...>` instead of `#include <gb/>`
    161 
    162 ## Include .h headers, not .c source files
    163 Do not `#include` `.c` source files into other `.c` source files. Instead create `.h` header files for them and include those.
    164 - https://www.tutorialspoint.com/cprogramming/c_header_files.htm
    165 
    166 ## Use the Template Projects
    167 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.
    168 
    169 ## Use hUGEtracker instead of gbt_player
    170 hUGEtracker and its driver @ref hUGEdriver are smaller, more efficient and more versatile than gbt_player.
    171     
    172 

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.