git.y1.nz

gbdk-2020

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

commit 593c35ff7d574c9847c405346637d4bdab8905bd
parent 189ed5665791ea9621e2d23efab99a42ad4cb5cc
Author: bbbbbr <bbbbbr@users.noreply.github.com>
Date:   Mon, 17 Jul 2023 15:54:47 -0700

Merge pull request #544 from bbbbbr/docs_4_2_0

Docs: misc 4.2 updates, formatting
Diffstat:
Mdocs/pages/09_migrating_new_versions.md6++++--
Mdocs/pages/10_release_notes.md2+-
Mgbdk-lib/examples/cross-platform/logo/src/main.c23+++++++++++++----------
Mgbdk-lib/include/gb/gb.h43++++++++++++++++++++++++-------------------
Mgbdk-lib/include/nes/nes.h14+++++++-------
5 files changed, 49 insertions(+), 39 deletions(-)

diff --git a/docs/pages/09_migrating_new_versions.md b/docs/pages/09_migrating_new_versions.md @@ -5,7 +5,7 @@ This section contains information that may be useful to know or important when u # GBDK-2020 versions ## Porting to GBDK-2020 4.2.0 - - GBDK now requires SDCC 4.3 or higher with GBDK-2020 patches for the the z80 linker + - GBDK now requires ~SDCC 4.3 or higher with GBDK-2020 patches for the z80 and NES - The following new functions replace old ones: - While the old functions will continue to work for now, migration to new versions is strongly encouraged - vsync(): replaces wait_vbl_done() @@ -14,13 +14,15 @@ This section contains information that may be useful to know or important when u - move_metasprite_flipx(): replaces move_metasprite_vflip() - move_metasprite_flipxy(): replaces move_metasprite_hvflip() - move_metasprite_ex(): replaces move_metasprite() + - 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`) + ## Porting to GBDK-2020 4.1.1 - No significant changes required ## Porting to GBDK-2020 4.1.0 - - GBDK now requires SDCC 4.2 or higher with GBDK-2020 patches for the the z80 linker + - GBDK now requires SDCC 4.2 or higher with GBDK-2020 patches for the z80 linker - The default calling convention changed in SDCC 4.2, see @ref sdcc_calling_convention "Calling Conventions" for more details. - If you are linking to libraries compiled with an older version of SDCC / GBDK then you may have to recompile them. - 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`. diff --git a/docs/pages/10_release_notes.md b/docs/pages/10_release_notes.md @@ -13,7 +13,7 @@ https://github.com/gbdk-2020/gbdk-2020/releases - Known Issues - SDCC may fail on Windows when @ref windows_sdcc_non_c_drive_path_spaces "run from folder names with spaces on non-C drives". - Library - - Added: set_bkg_attributes(), set_bkg_submap_attributes() + - Added: set_bkg_attributes(), set_bkg_submap_attributes(), set_bkg_attribute_xy() - The following new functions replace old ones. The old functions will continue to work for now, but migration to new versions is strongly encouraged. - vsync(): replaces wait_vbl_done() - set_default_palette(): replaces cgb_compatibility() diff --git a/gbdk-lib/examples/cross-platform/logo/src/main.c b/gbdk-lib/examples/cross-platform/logo/src/main.c @@ -5,6 +5,7 @@ void main(void) { DISPLAY_OFF; fill_bkg_rect(0, 0, DEVICE_SCREEN_WIDTH, DEVICE_SCREEN_HEIGHT, 0); + #if defined(SYSTEM_SEGA) set_palette(0, GBDK_2020_logo_PALETTE_COUNT, GBDK_2020_logo_palettes); #elif defined(SYSTEM_CGB) @@ -13,19 +14,21 @@ void main(void) { } #elif defined(SYSTEM_NES) set_bkg_palette(0, GBDK_2020_logo_PALETTE_COUNT, GBDK_2020_logo_palettes); -#endif +#endif + set_native_tile_data(0, GBDK_2020_logo_TILE_COUNT, GBDK_2020_logo_tiles); - set_bkg_attributes((DEVICE_SCREEN_WIDTH - (GBDK_2020_logo_WIDTH >> 3)) >> 1, - (DEVICE_SCREEN_HEIGHT - (GBDK_2020_logo_HEIGHT >> 3)) >> 1, - GBDK_2020_logo_WIDTH >> 3, - GBDK_2020_logo_HEIGHT >> 3, + set_bkg_attributes((DEVICE_SCREEN_WIDTH - (GBDK_2020_logo_WIDTH >> 3)) >> 1, + (DEVICE_SCREEN_HEIGHT - (GBDK_2020_logo_HEIGHT >> 3)) >> 1, + GBDK_2020_logo_WIDTH >> 3, + GBDK_2020_logo_HEIGHT >> 3, GBDK_2020_logo_map_attributes); - set_tile_map((DEVICE_SCREEN_WIDTH - (GBDK_2020_logo_WIDTH >> 3)) >> 1, - (DEVICE_SCREEN_HEIGHT - (GBDK_2020_logo_HEIGHT >> 3)) >> 1, - GBDK_2020_logo_WIDTH >> 3, - GBDK_2020_logo_HEIGHT >> 3, + set_tile_map((DEVICE_SCREEN_WIDTH - (GBDK_2020_logo_WIDTH >> 3)) >> 1, + (DEVICE_SCREEN_HEIGHT - (GBDK_2020_logo_HEIGHT >> 3)) >> 1, + GBDK_2020_logo_WIDTH >> 3, + GBDK_2020_logo_HEIGHT >> 3, GBDK_2020_logo_map); - wait_vbl_done(); + + vsync(); SHOW_BKG; DISPLAY_ON; } diff --git a/gbdk-lib/include/gb/gb.h b/gbdk-lib/include/gb/gb.h @@ -1136,6 +1136,8 @@ inline void set_bkg_based_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, cons @see SHOW_BKG @see set_bkg_data, set_bkg_submap_attributes, set_win_tiles, set_tiles + + @note On the Game Boy this is only usable in Game Boy Color mode */ inline void set_bkg_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) { @@ -1266,6 +1268,8 @@ inline void set_bkg_based_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, con @see SHOW_BKG @see set_bkg_data, set_bkg_attributes, set_win_submap, set_tiles + + @note On the Game Boy this is only usable in Game Boy Color mode */ inline void set_bkg_submap_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) { @@ -1301,23 +1305,24 @@ inline void set_bkg_submap_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h void get_bkg_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *tiles) OLDCALL PRESERVES_REGS(b, c); -/** - * Set single tile t on background layer at x,y - * @param x X-coordinate - * @param y Y-coordinate - * @param t tile index - * @return returns the address of tile, so you may use faster set_vram_byte() later - */ +/** Set single tile t on background layer at x,y + @param x X-coordinate + @param y Y-coordinate + @param t tile index + + @return returns the address of tile, so you may use faster set_vram_byte() later +*/ uint8_t * set_bkg_tile_xy(uint8_t x, uint8_t y, uint8_t t) OLDCALL PRESERVES_REGS(b, c); #define set_tile_xy set_bkg_tile_xy -/** - * Set single attribute data a on background layer at x,y - * @param x X-coordinate - * @param y Y-coordinate - * @param a tile attributes - * @return returns the address of tile attribute, so you may use faster set_vram_byte() later - */ +/** Set single attribute data a on background layer at x,y + @param x X-coordinate + @param y Y-coordinate + @param a tile attributes + @return returns the address of tile attribute, so you may use faster set_vram_byte() later + + @note On the Game Boy this is only usable in Game Boy Color mode +*/ inline uint8_t * set_bkg_attribute_xy(uint8_t x, uint8_t y, uint8_t a) { uint8_t* addr; @@ -1329,11 +1334,11 @@ inline uint8_t * set_bkg_attribute_xy(uint8_t x, uint8_t y, uint8_t a) #define set_attribute_xy set_bkg_attribute_xy /** - * Get single tile t on background layer at x,y - * @param x X-coordinate - * @param y Y-coordinate + Get single tile t on background layer at x,y + @param x X-coordinate + @param y Y-coordinate - * @return returns tile index + @return returns tile index @note In general **avoid reading from VRAM** since that memory is not accessible at all times. @@ -1341,7 +1346,7 @@ inline uint8_t * set_bkg_attribute_xy(uint8_t x, uint8_t y, uint8_t a) See @ref best_practice_dont_read_vram "coding guidelines" for more details. - */ +*/ uint8_t get_bkg_tile_xy(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b, c); diff --git a/gbdk-lib/include/nes/nes.h b/gbdk-lib/include/nes/nes.h @@ -187,9 +187,9 @@ void remove_LCD(int_handler h); @note The default GBDK VBL is installed automatically. @note On the current NES implementation, this handler - is actually faked, and called before vblank occurs, by - wait_vbl_done. Writes to PPU registers should be done to - the shadow_ versions, so they are updated by the default + is actually faked, and called before vblank occurs, by + @ref vsync(). Writes to PPU registers should be done to + the shadow_ versions, so they are updated by the default VBL handler only when vblank actually occurs. @see ISR_VECTOR() @@ -642,7 +642,7 @@ void set_bkg_attributes_nes16x16(uint8_t x, uint8_t y, uint8_t w, uint8_t h, con Writes that exceed coordinate 31 on the x or y axis will wrap around to the Left and Top edges. - Please note that this is just a wrapper function for set_bkg_attributes_nes16x16 + Please note that this is just a wrapper function for set_bkg_attributes_nes16x16() and divides the coordinates and dimensions by 2 to achieve this. It is intended to make code more portable by using the same coordinate system that systems with the much more common 8x8 attribute resolution would use. @@ -705,7 +705,7 @@ void set_bkg_submap_attributes_nes16x16(uint8_t x, uint8_t y, uint8_t w, uint8_t a sub-region from a source tile map. Useful for scrolling implementations of maps larger than 32 x 30 tiles. - Please note that this is just a wrapper function for set_bkg_submap_attributes_nes16x16 + Please note that this is just a wrapper function for set_bkg_submap_attributes_nes16x16() and divides the coordinates and dimensions by 2 to achieve this. It is intended to make code more portable by using the same coordinate system that systems with the much more common 8x8 attribute resolution would use. @@ -842,7 +842,7 @@ void set_bkg_attribute_xy_nes16x16(uint8_t x, uint8_t y, uint8_t a); /** Set single attribute data a on background layer at x,y - Please note that this is just a wrapper function for set_bkg_submap_attributes_nes16x16 + Please note that this is just a wrapper function for set_bkg_submap_attributes_nes16x16() and divides the coordinates and dimensions by 2 to achieve this. It is intended to make code more portable by using the same coordinate system that systems with the much more common 8x8 attribute resolution would use. @@ -1184,7 +1184,7 @@ void fill_bkg_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) OLD to the transfer buffer, and then written to PPU memory on next vblank. This function must be called to see visible changes to attributes - on the NES target. But it will automatically be called by wait_vbl_done, + on the NES target. But it will automatically be called by @ref vsync(), so the use-cases for calling it manually are rare in practice. */ void flush_shadow_attributes() OLDCALL;

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