git.y1.nz

gbdk-2020

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

commit 437dbed6adc38711d4f7e5a8198770c88cd02698
parent 8873f5bc223f800cfa7c738e3e88aa9dd7fd5194
Author: bbbbbr <reg+github@roughhousing.com>
Date:   Thu, 23 Sep 2021 20:15:49 -0700

Merge pull request #271 from bbbbbr/docs_4_0_5

Docs: mostly rle_decompress related
Diffstat:
Mdocs/config/gbdk-2020-doxyfile4++--
Mdocs/pages/06_toolchain.md2++
Mdocs/pages/10_release_notes.md6+++++-
Agbdk-lib/examples/cross-platform/rle_map/Readme.md9+++++++++
Mgbdk-lib/include/gb/gbdecompress.h5+++--
Mgbdk-lib/include/gbdk/rledecompress.h32++++++++++++++++++++++++++++++--
6 files changed, 51 insertions(+), 7 deletions(-)

diff --git a/docs/config/gbdk-2020-doxyfile b/docs/config/gbdk-2020-doxyfile @@ -2169,10 +2169,10 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -# Defining __PORT_gbz80 fixes some functions that would get missed in +# Define __PORT_gbz80 fixes some functions that would get missed in # headers that are shared by multiple platforms. Use the Game Boy # versions by default -PREDEFINED = __PORT_gbz80 +PREDEFINED=__PORT_gbz80 __TARGET_gb # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/docs/pages/06_toolchain.md b/docs/pages/06_toolchain.md @@ -198,6 +198,8 @@ For detailed settings see @ref gbcompress-settings Compresses (and decompresses) binary file data with the gbcompress algorithm (also used in GBTD/GBMB). Decompression support is available in GBDK, see @ref gb_decompress(). +Can also compress (and decompress) using block style rle encoding with the `--alg=rle` flag. Decompression support is available in GBDK, see @ref rle_decompress(). + @anchor utility_png2asset ## png2asset diff --git a/docs/pages/10_release_notes.md b/docs/pages/10_release_notes.md @@ -29,14 +29,16 @@ https://github.com/gbdk-2020/gbdk-2020/releases - Added generic @ref SWITCH_ROM() and @ref SWITCH_RAM() - Added @ref BGB_printf() and updated bgb debug output. - Added @ref set_native_tile_data(), @ref set_tile_map(), @ref set_1bpp_colors, @ref set_bkg_1bpp_data, @ref set_sprite_1bpp_data, @ref set_2bpp_palette, @ref set_bkg_2bpp_data, @ref set_sprite_2bpp_data, @ref set_tile_2bpp_data (sms/gg only), @ref set_bkg_4bpp_data (sms/gg only), @ref set_sprite_4bpp_data (sms/gg only) + - Added RLE decompression support: @ref rle_init(), @ref rle_decompress(), - Changed @ref itoa(), @ref uitoa(), @ref ltoa(), @ref ultoa() to now require a radix value (base) argument to be passed. On the Game Boy and Analogue Pocket the parameter is required but not utilized. - Examples - Added cross-platform examples (build for multiple consoles: gb, ap, sms, gg) - Added sms, gg, pocket(ap) examples - Added incbin example - Added simple physics sub-pixel / fixed point math example + - Added rle decompression example - Changed windows make.bat files to compile.bat - - Bug fixes and updates for existing examples + - Bug fixes and updates for existing examples - Toolchain / Utilities - @ref utility_png2asset "png2asset" - @ref utility_png2asset "png2asset" is the new name for the `png2mtspr` utility @@ -58,6 +60,8 @@ https://github.com/gbdk-2020/gbdk-2020/releases - @ref utility_gbcompress - Added C source array format output (--cout) (optional variable name argument --varname=) - Added C source array format input (--cin) (experimental) + - Added block style rle compression and decompression mode: `--alg=rle` + - Fixed comrpession errors when input size was larger than 64k - Docs - Added @ref docs_supported_consoles section - Various doc updates and improvements diff --git a/gbdk-lib/examples/cross-platform/rle_map/Readme.md b/gbdk-lib/examples/cross-platform/rle_map/Readme.md @@ -0,0 +1,9 @@ + +RLE Decompress +============ + +Demonstrates using rle_decompress to load a compressed tile map into vram. + +The data was compressed using the `gbcompress` utility using the `--alg=rle` argument. + +`../../../../bin/gbcompress --alg=rle level1_map.bin level1_map.rle` diff --git a/gbdk-lib/include/gb/gbdecompress.h b/gbdk-lib/include/gb/gbdecompress.h @@ -1,7 +1,8 @@ /** @file gb/gbdecompress.h - + GB-Compress decompressor Compatible with the compression used in GBTD + @see utility_gbcompress "gbcompress" */ #ifndef __GBDECOMPRESS_H_INCLUDE @@ -26,7 +27,7 @@ uint16_t gb_decompress(const uint8_t * sour, uint8_t * dest) OLDCALL __preserves Note: This function avoids writes during modes 2 & 3 - @see gb_decompress_bkg, gb_decompress_win_data, gb_decompress_sprite_data + @see gb_decompress_bkg_data, gb_decompress_win_data, gb_decompress_sprite_data */ void gb_decompress_bkg_data(uint8_t first_tile, const uint8_t * sour) OLDCALL __preserves_regs(b, c); diff --git a/gbdk-lib/include/gbdk/rledecompress.h b/gbdk-lib/include/gbdk/rledecompress.h @@ -1,3 +1,11 @@ +/** @file gbdk/rledecompress.h + + Decompressor for RLE encoded data + + Decompresses data which has been compressed with + @ref utility_gbcompress "gbcompress" using the `--alg=rle` argument. +*/ + #ifndef __RLEDECOMPRESS_H_INCLUDE #define __RLEDECOMPRESS_H_INCLUDE @@ -7,11 +15,31 @@ #define RLE_STOP 0 #if defined(__TARGET_gb) || defined(__TARGET_ap) +/** Initialize the RLE decompressor with RLE data at address __data__ + + @param data Pointer to start of RLE compressed data + + @see rle_decompress + */ uint8_t rle_init(void * data) OLDCALL; -uint8_t rle_decompress(void * dest, uint8_t len) OLDCALL; + +/** Decompress RLE compressed data into __dest__ for length __len__ bytes + + @param dest Pointer to destination buffer/address + @param len number of bytes to decompress + + Before calling this function @ref rle_init must be called + one time to initialize the RLE decompressor. + + Decompresses data which has been compressed with + @ref utility_gbcompress "gbcompress" using the `--alg=rle` argument. + + @see rle_init + */ +uint8_t rle_decompress(void * dest, uint8_t len) OLDCALL; #elif defined(__TARGET_sms) || defined(__TARGET_gg) uint8_t rle_init(void * data) __z88dk_fastcall; -uint8_t rle_decompress(void * dest, uint8_t len) __z88dk_callee; +uint8_t rle_decompress(void * dest, uint8_t len) __z88dk_callee; #else #error Unrecognized port #endif

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