git.y1.nz

gbdk-2020

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

commit dc96f12d8e42e53df7f9b6600243537ffc72fa57
parent 9d03274342ee734afeb5fa1aadb569b9118d4e46
Author: Toxa <untoxa@mail.ru>
Date:   Sun,  5 Sep 2021 23:10:51 +0300

use SEGA and NINTENDO defines in cross-platform examples

Diffstat:
Mgbdk-lib/examples/cross-platform/large_map/src/large_map.c4++--
Mgbdk-lib/examples/cross-platform/scroller/src/text_scroller.c8++++----
Mgbdk-lib/include/gb/gb.h3+++
Mgbdk-lib/include/sms/sms.h3+++
4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/gbdk-lib/examples/cross-platform/large_map/src/large_map.c b/gbdk-lib/examples/cross-platform/large_map/src/large_map.c @@ -8,9 +8,9 @@ #define camera_max_y ((bigmap_mapHeight - 18) * 8) #define camera_max_x ((bigmap_mapWidth - 20) * 8) -#if defined(_PLAT_gg) || defined(_PLAT_sms) +#if defined(SEGA) #define WRAP_SCROLL_Y(y) ((y) % 224u) -#else +#elif defined(NINTENDO) #define WRAP_SCROLL_Y(y) y #endif diff --git a/gbdk-lib/examples/cross-platform/scroller/src/text_scroller.c b/gbdk-lib/examples/cross-platform/scroller/src/text_scroller.c @@ -11,7 +11,7 @@ const uint8_t * scanline_offsets = scanline_offsets_tbl; uint8_t scroller_x = 0; void scanline_isr() { -#if defined(__TARGET_gb) || defined(__TARGET_ap) +#if defined(NINTENDO) switch (LYC_REG) { case 0: SCX_REG = 0; @@ -25,7 +25,7 @@ void scanline_isr() { SCX_REG = LYC_REG = 0; break; } -#elif defined(__TARGET_sms) || defined(__TARGET_gg) +#elif defined(SEGA) if (VCOUNTER == (SCROLL_POS_PIX_START - 8)) { while (VCOUNTER != SCROLL_POS_PIX_START); VDP_CMD = -scroller_x; VDP_CMD = VDP_RSCX; @@ -50,11 +50,11 @@ void main() { CRITICAL { add_LCD(scanline_isr); -#if defined(__TARGET_gb) || defined(__TARGET_ap) +#if defined(NINTENDO) STAT_REG |= STATF_LYC; LYC_REG = 0; #endif } -#if defined(__TARGET_sms) || defined(__TARGET_gg) +#if defined(SEGA) __WRITE_VDP_REG(VDP_R10, 0x07); #endif set_interrupts(VBL_IFLAG | LCD_IFLAG); diff --git a/gbdk-lib/include/gb/gb.h b/gbdk-lib/include/gb/gb.h @@ -10,6 +10,9 @@ #include <gb/hardware.h> #define NINTENDO +#ifdef SEGA +#undef SEGA +#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 @@ -10,6 +10,9 @@ #include <sms/hardware.h> #define SEGA +#ifdef NINTENDO +#undef NINTENDO +#endif #define VBK_REG VDP_ATTR_SHIFT

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