gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 87d09cf365fb7f0f2b692cd7c807de6f676b9d1e parent e9da8c295b1492b749b6a38c0dc852c334656f8c Author: Toxa <untoxa@mail.ru> Date: Mon, 6 Sep 2021 12:18:14 +0300 define GAMEBOY, GAMEGEAR, ANALOGUEPOCKET, MASTERSYSTEM; remove -DGAMEBOY=1 from LCC; define palette_entry_t type Diffstat:
| M | gbdk-lib/include/gb/cgb.h | 6 | ++++-- |
| M | gbdk-lib/include/gb/gb.h | 6 | ++++++ |
| M | gbdk-lib/include/sms/sms.h | 12 | +++++++++++- |
| M | gbdk-support/lcc/targets.c | 8 | ++++---- |
4 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/gbdk-lib/include/gb/cgb.h b/gbdk-lib/include/gb/cgb.h @@ -58,6 +58,8 @@ #define RGB_ORANGE RGB(30, 20, 0) #define RGB_TEAL RGB(15, 15, 0) +typedef uint16_t palette_entry_t; + /** Set CGB background palette(s). @param first_palette Index of the first palette to write (0-7) @@ -76,7 +78,7 @@ void set_bkg_palette(uint8_t first_palette, uint8_t nb_palettes, - uint16_t *rgb_data) NONBANKED; + palette_entry_t *rgb_data) NONBANKED; /** Set CGB sprite palette(s). @@ -96,7 +98,7 @@ set_bkg_palette(uint8_t first_palette, void set_sprite_palette(uint8_t first_palette, uint8_t nb_palettes, - uint16_t *rgb_data) NONBANKED; + palette_entry_t *rgb_data) NONBANKED; /** Sets a single color in the specified CGB background palette. diff --git a/gbdk-lib/include/gb/gb.h b/gbdk-lib/include/gb/gb.h @@ -13,6 +13,12 @@ #ifdef SEGA #undef SEGA #endif +#if defined(__TARGET_ap) +#define ANALOGUEPOCKET +#elif defined(__TARGET_gb) +#define GAMEBOY +#endif + /** Joypad bits. A logical OR of these is used in the wait_pad and joypad diff --git a/gbdk-lib/include/sms/sms.h b/gbdk-lib/include/sms/sms.h @@ -13,6 +13,12 @@ #ifdef NINTENDO #undef NINTENDO #endif +#if defined(__TARGET_sms) +#define MASTERSYSTEM +#elif defined(__TARGET_gg) +#define GAMEGEAR +#endif + #define VBK_REG VDP_ATTR_SHIFT @@ -435,6 +441,8 @@ void joypad_ex(joypads_t * joypads) __z88dk_fastcall __preserves_regs(iyh, iyl); #define RGB_LIGHTGRAY RGB( 2, 2, 2) #define RGB_WHITE RGB( 3, 3, 3) +typedef uint8_t palette_entry_t; + #elif defined(__TARGET_gg) #define RGB(r,g,b) ((r)|((g)<<4)|((b)<<8)) @@ -465,6 +473,8 @@ void joypad_ex(joypads_t * joypads) __z88dk_fastcall __preserves_regs(iyh, iyl); #define RGB_ORANGE RGB(15, 10, 0) #define RGB_TEAL RGB( 7, 7, 0) +typedef uint16_t palette_entry_t; + #else #error Unrecognized port #endif @@ -477,7 +487,7 @@ inline void cpu_fast() {} void set_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) __z88dk_callee __preserves_regs(iyh, iyl); #define set_bkg_palette set_palette #define set_sprite_palette(first_palette,nb_palettes,rgb_data) set_palette(1,1,rgb_data) -void set_palette(uint8_t first_palette, uint8_t nb_palettes, uint16_t *rgb_data) __z88dk_callee; +void set_palette(uint8_t first_palette, uint8_t nb_palettes, palette_entry_t *rgb_data) __z88dk_callee; void set_tile_data(uint16_t start, uint16_t ntiles, const void *src) __z88dk_callee __preserves_regs(iyh,iyl); inline void set_bkg_4bpp_data(uint16_t start, uint16_t ntiles, const void *src) { diff --git a/gbdk-support/lcc/targets.c b/gbdk-support/lcc/targets.c @@ -38,9 +38,9 @@ CLASS classes[] = { "gb", // plat "gb", // default_plat EXT_GB, // ROM file extension - "%cpp% %cppdefault% -DGB=1 -DGAMEBOY=1 -DINT_16_BITS $1 $2 $3", + "%cpp% %cppdefault% -DGB=1 -DINT_16_BITS $1 $2 $3", "%includedefault%", - "%com% %comdefault% -Wa%asdefault% -DGB=1 -DGAMEBOY=1 -DINT_16_BITS $1 %comflag% $2 -o $3", + "%com% %comdefault% -Wa%asdefault% -DGB=1 -DINT_16_BITS $1 %comflag% $2 -o $3", "%as_gb% %asdefault% $1 $3 $2", "%bankpack% $1 $2", "%ld_gb% -n -i $1 %libs_include% $3 %crt0dir% $2", @@ -53,9 +53,9 @@ CLASS classes[] = { "ap", // plat "ap", // default_plat EXT_AP, // ROM file extension - "%cpp% %cppdefault% -DGB=1 -DGAMEBOY=1 -DINT_16_BITS $1 $2 $3", + "%cpp% %cppdefault% -DGB=1 -DINT_16_BITS $1 $2 $3", "%includedefault%", - "%com% %comdefault% -Wa%asdefault% -DGB=1 -DGAMEBOY=1 -DINT_16_BITS $1 %comflag% $2 -o $3", + "%com% %comdefault% -Wa%asdefault% -DGB=1 -DINT_16_BITS $1 %comflag% $2 -o $3", "%as_gb% %asdefault% $1 $3 $2", "%bankpack% $1 $2", "%ld_gb% -n -i $1 %libs_include% $3 %crt0dir% $2",
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.