git.y1.nz

gbdk-2020

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

docs/pages/09_migrating_new_versions.md

      1 @page docs_migrating_versions Migrating to new GBDK Versions
      2 
      3 This section contains information that may be useful to know or important when upgrading to a newer GBDK release.
      4 
      5 # GBDK-2020 versions
      6 
      7 ## Porting to GBDK-2020 4.5.0
      8   - GBDK now requires ~SDCC 4.5.0 or higher with GBDK-2020 patches for the z80, sm83 and NES
      9   - Build Host:
     10     - Changed from building on MacOS 13 to MacOS 15 for 64 bit Intel
     11     - Changed from building on Windows 2019 to 2022 for Intel
     12   - SMS/GG
     13     - Changed parameter order of @ref set_tile_submap(), @ref set_tile_submap_compat()
     14     - Remove broken and unused `FAST_DIV8` macro
     15     - Removed legacy `___sdcc_bcall trampoline`
     16   - MegaDuck
     17     - Renamed `DUCK_IO_CMD_PRINT_INIT_MAYBE_EXT_IO` to @ref DUCK_IO_CMD_PRINT_INIT_EXT_IO
     18     - Removed`duck_io_printer_detected()`, `duck_io_printer_type()` and replaced them with  @ref duck_io_printer_query(), @ref duck_io_printer_last_status()
     19   - png2asset
     20     - Fixed missing error for `-bin` requiring `-map`
     21 
     22 
     23 ## Porting to GBDK-2020 4.4.0
     24   - GBDK now requires ~SDCC 4.5.0 or higher with GBDK-2020 patches for the z80 and NES
     25   - Build Host:
     26     - Changed from building on MacOS 11 to MacOS 13 for 64 bit Intel
     27     - Changed from building on Ubuntu Linux 20.04 to 22.04 for 64 bit Intel
     28   - NES
     29     - LCD bkg_scroll_y is now relative to the current scanline
     30       - This change creates higher compatibility with the Game Boy SCY_REG and makes it easier to re-use Game Boy LCD handlers
     31       - This behaves differently to 4.3.0 and affects LCD handlers that change the y scrolling coordinate mid-frame
     32     - Added @ref utility_makenes "makenes" utility for finalizing NES rom headers (called automatically by @ref lcc)
     33   - SMS/GG
     34     - Changed from unsigned (`uint16_t`) to signed int16 (`int16_t`) for coordinates with the family of `...metasprite...()` functions
     35     - Changed screen map to be at `0x1800` instead of `0x3800`
     36       - To switch to the older configuration use `__WRITE_VDP_REG_UNSAFE(VDP_R2, R2_MAP_0x3800);` and `__WRITE_VDP_REG_UNSAFE(VDP_R5, R5_SAT_0x3F00);` near the start of main
     37   - SDCC
     38     - Changed to using the `-N` flag with sdas since the the `-n` flag was removed
     39   - Changed @ref lcc to use `--no-optsdcc-in-asm` for building user programs and the GBDK library
     40       - This removes some "O line" meta-data from object files to avoid false-positive linker errors
     41       - It is a workaround for SDCC now appending the calling convention to the "O Line" in the object files by default
     42 
     43 
     44 ## Porting to GBDK-2020 4.3.0
     45   - GBDK now requires ~SDCC 4.4.0 or higher with GBDK-2020 patches for the z80 and NES
     46   - Changed to new calling convention for @ref printf(), @ref sprintf(), @ref abs()
     47   - Changed to new SDCC calling convention for @ref set_bkg_tile_xy(), @ref set_win_tile_xy()
     48   - The SDCC object file format (`.o`, `.rel` files) changed from `XL3` (24 bit addresses) to `XL4` (32 bit addresses)
     49     - Bankpack now supports both
     50   - Recommend using:
     51     - @ref CURRENT_BANK instead of `_current_bank`
     52     - @ref BANKED macro instead of `__banked`
     53   - NES @ref set_sprite_palette() now indexes from `0..3` instead of `4..7`
     54   - png2asset:
     55     - If using either `-bpp 1` or `-pack_mode 1bpp` then the other is auto-enabled
     56     - Significant bug fixes and changes, check to make sure output is as expected
     57 
     58 
     59 ## Porting to GBDK-2020 4.2.0
     60   - GBDK now requires ~SDCC 4.3 or higher with GBDK-2020 patches for the z80 and NES
     61   - The following new functions replace old ones:
     62     - While the old functions will continue to work for now, migration to new versions is strongly encouraged
     63     - vsync(): replaces wait_vbl_done()
     64     - set_default_palette(): replaces cgb_compatibility()
     65     - move_metasprite_flipy(): replaces move_metasprite_hflip()
     66     - move_metasprite_flipx(): replaces move_metasprite_vflip()
     67     - move_metasprite_flipxy(): replaces move_metasprite_hvflip()
     68     - move_metasprite_ex(): replaces move_metasprite()
     69   - The unused `-DINT_16_BITS` argument was removed from the default SDCC compiler and preprocessor arguments (used in pre-GBDK2020 `gbdk/include-gb/types.h`)
     70   - Removed legacy MBC register definitions `.MBC1_ROM_PAGE` and `.MBC_ROM_PAGE`
     71   - SMS/GG
     72     - Swapped A and B buttons to match game boy buttons
     73 
     74 
     75 ## Porting to GBDK-2020 4.1.1
     76   - No significant changes required
     77 
     78 
     79 ## Porting to GBDK-2020 4.1.0
     80   - GBDK now requires SDCC 4.2 or higher with GBDK-2020 patches for the z80 linker
     81   - The default calling convention changed in SDCC 4.2, see @ref sdcc_calling_convention "Calling Conventions" for more details.
     82     - If you are linking to libraries compiled with an older version of SDCC / GBDK then you may have to recompile them.
     83     - If there are existing functions written in ASM which __receive parameters__ they should also be reviewed to make sure they work with the new `__sdcccall(1)` calling convention, or have their header declaration changed to use `OLDCALL`.
     84     - If there are existing functions written in ASM which __call other functions written in C__ the callee C function should be declared OLDCALL.
     85     - Function pointer declarations should be checked to see if they need OLDCALL added to the declaration.
     86       - Example (add OLDCALL at the end)
     87       - FROM: `typedef void (*someFunc)(uint8_t, uint8_t);`
     88       - TO:   `typedef void (*someFunc)(uint8_t, uint8_t) OLDCALL;`
     89     - If you are using tools such as `rgb2sdas` (from hUGETracker/Driver) you may need to edit the resulting .o file and replace `-mgbz80` with `-msm83` in addition to using `OLDCALL`
     90   - The SDCC `PORT` name for the Game Boy and related clones changed from `gbz80` to `sm83`.
     91     - Additional details in the @ref console_port_plat_settings "Console Port and Platform Settings" section and @ref faq_gbz80_sm83_old_port_name_error "FAQ entry". @ref lcc will error out if the old `PORT` name is passed in.
     92   - The library base path changed from `lib/small/asxxxx/` to `lib/`.
     93     - For example  `lib/small/asxxxx/gb` becomes `lib/gb`
     94   - Allocations for ISR chain lengths were fixed.
     95     - Now they are VBL: 4 user handlers, LCD: 3 user handlers, SIO/TIM/JOY: 4 user handlers
     96     
     97 
     98 ## Porting to GBDK-2020 4.0.6
     99   - Renamed `bgb_emu.h` to `emu_debug.h` and BGB_* functions to EMU_*
    100     - Aliases for the BGB_* ones and a `bgb_emu.h` shim are present for backward compatibility, but updating to the new naming is recommended
    101 
    102 
    103 ## Porting to GBDK-2020 4.0.5
    104   - GBDK now requires SDCC 12259 or higher with GBDK-2020 patches
    105   - Variables in static storage are now initialized to zero per C standard (but remaining WRAM is not cleared)
    106   - @ref utility_png2asset "png2asset" is the new name for the `png2mtspr` utility
    107   - @ref lcc : Changed default output format when not specified from `.ihx` to `.gb` (or other active rom extension)
    108   - The `_BSS` area is deprecated (use `_DATA` instead)
    109   - The `_BASE` area is renamed to `_HOME`
    110   - Variables in static storage are now initialized to zero per C standard (but remaining WRAM is not cleared)
    111   - @ref itoa(), @ref uitoa(), @ref ltoa(), @ref ultoa() 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.
    112   - set_bkg_1bit_data has been renamed to @ref set_bkg_1bpp_data
    113   - 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`
    114     - When including them use `#include <gbdk/...>` instead of `#include <gb/>`
    115   
    116 ## Porting to GBDK-2020 4.0.4
    117   - GBDK now requires SDCC 12238 or higher
    118   - Made sample.h, cgb.h and sgb.h independent from gb.h
    119 
    120 
    121 ## Porting to GBDK-2020 4.0.3
    122   - No significant changes required
    123 
    124 
    125 ## Porting to GBDK-2020 4.0.2
    126  - The default font has been reduced from 256 to 96 characters.
    127    - Code using special characters may need to be updated.
    128    - The off-by-1 character index offset was removed for fonts. Old fonts with the offset need to be re-adjusted.
    129 
    130 
    131 ## Porting to GBDK-2020 4.0.1
    132  - __Important!__ : The `WRAM` memory region is no longer automatically initialized to zeros during startup.
    133    - Any variables which are declared without being initialized may have __indeterminate values instead of 0__ on startup. This might reveal previously hidden bugs in your code.
    134    - Check your code for variables that are not initialized before use.
    135    - In BGB you can turn on triggering exceptions (options panel) reading from unitialized RAM. This allows for some additional runtime detection of uninitialized vars.
    136  - In .ihx files, multiple writes to the same ROM address are now warned about using @ref ihxcheck.
    137  - `set_*_tiles()` now wrap maps around horizontal and vertical boundaries correctly. Code relying on it not wrapping correctly may be affected.
    138 
    139 
    140 ## Porting to GBDK-2020 4.0
    141  - GBDK now requires SDCC 4.0.3 or higher
    142  - The old linker `link-gbz80` has been REMOVED, the linker @ref sdldgb from SDCC is used.
    143    - Due to the linker change, there are no longer warnings about multiple writes to the same ROM address.
    144  - GBDK now generates .ihx files, those are converted to a ROM using @ref makebin (lcc can do this automatically in some use cases)
    145  - 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.
    146  - OAM symbol has been renamed to `_shadow_OAM`, that allows accessing shadow OAM directly from C code
    147 
    148 
    149 ## Porting to GBDK-2020 3.2
    150   - No significant changes required
    151 
    152 ## Porting to GBDK-2020 3.1.1
    153   - No significant changes required
    154 
    155 ## Porting to GBDK-2020 3.1
    156   - 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:
    157     https://gbdev.gg8.se/forums/viewtopic.php?id=697
    158 
    159 ## Porting to GBDK-2020 3.0.1
    160  - LCC was upgraded to use SDCC v4.0. Makefile changes may be required
    161    - The symbol format changed. To get bgb compatible symbols turn on `.noi` output (LCC argument: `-Wl-j` or `-debug`) and use `-Wm-yS`
    162    - ?? Suggested: With LCC argument: `-Wa-l` (sdasgb:`-a   All user symbols made global`)
    163    - In SDCC 3.6.0, the default for char changed from signed to unsigned.
    164      - If you want the old behavior use `--fsigned-char`.
    165      - lcc includes `--fsigned-char` by default
    166      - Explicit declaration of unsigned vars is encouraged (for example, '15U' instead of '15')
    167    - `.init` address has been removed
    168 
    169 --------------------------------------------------
    170 
    171 # Historical GBDK versions
    172 
    173 ## GBDK 1.1 to GBDK 2.0
    174  - 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.
    175  - If your application uses the delay function, you'll have to adapt your delay values.
    176  - Several functions have new names. In particular some of them have been changed to macros (e.g. show_bkg() is now SHOW_BKG).
    177  - You will probably have to change the name of the header files that you include.
    178 

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