git.y1.nz

gbdk-2020

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

commit fc7c9b39fd84b5f6f4a4cb6783904c25002397ce
parent 43e6de0384b5b55e29303d1d4421866647dbce1e
Author: Toxa <untoxa@mail.ru>
Date:   Wed, 22 Sep 2021 17:07:41 +0300

fix printf()/sprintf() for the new SDCC; fix COMPAT_PALETTE() macro for GB

Diffstat:
Mgbdk-lib/include/gb/gb.h4++--
Mgbdk-lib/include/stdio.h4++--
Mgbdk-lib/libc/printf.c3+--
Mgbdk-lib/libc/sprintf.c6++----
4 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/gbdk-lib/include/gb/gb.h b/gbdk-lib/include/gb/gb.h @@ -131,7 +131,7 @@ @see DMG_BLACK, DMG_DARK_GRAY, DMG_LITE_GRAY, DMG_WHITE */ -#define DMG_PALETTE(C0, C1, C2, C3) ((UBYTE)((((C3) & 0x03) << 6) | (((C2) & 0x03) << 4) | (((C1) & 0x03) << 2) | ((C0) & 0x03))) +#define DMG_PALETTE(C0, C1, C2, C3) ((uint8_t)((((C3) & 0x03) << 6) | (((C2) & 0x03) << 4) | (((C1) & 0x03) << 2) | ((C0) & 0x03))) /* Limits */ /** Width of the visible screen in pixels. @@ -785,7 +785,7 @@ uint8_t get_vram_byte(uint8_t * addr) OLDCALL __preserves_regs(b, c); */ uint8_t * get_bkg_xy_addr(uint8_t x, uint8_t y) OLDCALL __preserves_regs(b, c); -#define COMPAT_PALETTE(C0,C1,C2,C3) (((C3) << 6) | ((C2) << 4) | ((C1) << 2) | (C0)) +#define COMPAT_PALETTE(C0,C1,C2,C3) ((uint8_t)(((C3) << 6) | ((C2) << 4) | ((C1) << 2) | (C0))) /** Sets palette for 2bpp color translation for GG/SMS, does nothing on GB */ diff --git a/gbdk-lib/include/stdio.h b/gbdk-lib/include/stdio.h @@ -37,7 +37,7 @@ void putchar(char c) OLDCALL; be explicitly re-cast as such when calling the function. See @ref docs_chars_varargs for more details. */ -void printf(const char *format, ...); +void printf(const char *format, ...) OLDCALL; /** Print the string and arguments given by format to a buffer. @@ -46,7 +46,7 @@ void printf(const char *format, ...); Does not return the number of characters printed. */ -void sprintf(char *str, const char *format, ...); +void sprintf(char *str, const char *format, ...) OLDCALL; /** puts() writes the string __s__ and a trailing newline to stdout. */ diff --git a/gbdk-lib/libc/printf.c b/gbdk-lib/libc/printf.c @@ -3,8 +3,7 @@ void __printf(const char *format, void *emitter, char **pData, va_list va); -void printf(const char *format, ...) -{ +void printf(const char *format, ...) OLDCALL { va_list va; va_start(va, format); diff --git a/gbdk-lib/libc/sprintf.c b/gbdk-lib/libc/sprintf.c @@ -98,14 +98,12 @@ void __printf(const char *format, emitter_t emitter, char **pData, va_list va) } } -static void _sprintf_emitter(char c, char ** pData) OLDCALL -{ +static void _sprintf_emitter(char c, char ** pData) OLDCALL { **pData = c; (*pData)++; } -void sprintf(char *into, const char *format, ...) -{ +void sprintf(char *into, const char *format, ...) OLDCALL { va_list va; va_start(va, format);

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