git.y1.nz

gbdk-2020

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

commit d59bd395a8c50d50df06e8234c7b56329cf6bed6
parent a2de13022eb11ba1f2d9290f509c2cc0bbb1616e
Author: Toxa <untoxa@mail.ru>
Date:   Fri, 12 Sep 2025 15:37:28 +0300

SMS/GG: fix parameter order on the set_tile_submap/set_tile_submap_compat

Diffstat:
Mgbdk-lib/examples/cross-platform/large_map/src/large_map.c2+-
Mgbdk-lib/include/sms/sms.h21++++++++-------------
Mgbdk-lib/libc/targets/z80/set_tile_submap.s14+++++++-------
Mgbdk-lib/libc/targets/z80/set_tile_submap_compat.s16++++++++--------
4 files changed, 24 insertions(+), 29 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 @@ -28,7 +28,7 @@ // they work like this: // * Use set_tile_submap for tile indices, to read/write both bytes of map // * Make set_submap_attributes a no-op, as attributes were already set -#define set_submap_indices(x, y, w, h, map, map_w) set_tile_submap(x, y, w, h, map_w, map) +#define set_submap_indices(x, y, w, h, map, map_w) set_tile_submap(x, y, w, h, map, map_w) #define set_submap_attributes(x, y, w, h, map, map_w) #else #define set_submap_indices(x, y, w, h, map, map_w) set_bkg_submap(x, y, w, h, map, map_w) diff --git a/gbdk-lib/include/sms/sms.h b/gbdk-lib/include/sms/sms.h @@ -698,31 +698,26 @@ inline void set_bkg_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const VBK_REG = VBK_TILES; } -void set_tile_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t map_w, const uint8_t *map) Z88DK_CALLEE; -void set_tile_submap_compat(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t map_w, const uint8_t *map) Z88DK_CALLEE; -inline void set_bkg_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) { - set_tile_submap_compat(x, y, w, h, map_w, map); -} -inline void set_win_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) { - set_tile_submap_compat(x, y, w, h, map_w, map); -} +void set_tile_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) Z88DK_CALLEE; +void set_tile_submap_compat(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) Z88DK_CALLEE; +#define set_bkg_submap set_tile_submap_compat +#define set_win_submap set_tile_submap_compat extern uint8_t _submap_tile_offset; inline void set_bkg_based_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w, uint8_t base_tile) { _submap_tile_offset = base_tile; - set_tile_submap_compat(x, y, w, h, map_w, map); + set_tile_submap_compat(x, y, w, h, map, map_w); _submap_tile_offset = 0; } inline void set_win_based_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w, uint8_t base_tile) { _submap_tile_offset = base_tile; - set_tile_submap_compat(x, y, w, h, map_w, map); + set_tile_submap_compat(x, y, w, h, map, map_w); _submap_tile_offset = 0; } -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) -{ +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) { VBK_REG = VBK_ATTRIBUTES; - set_bkg_submap(x, y, w, h, map, map_w); + set_tile_submap_compat(x, y, w, h, map, map_w); VBK_REG = VBK_TILES; } diff --git a/gbdk-lib/libc/targets/z80/set_tile_submap.s b/gbdk-lib/libc/targets/z80/set_tile_submap.s @@ -12,19 +12,19 @@ .area _HOME -; void set_tile_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t map_w, const uint8_t *map) __z88dk_callee __preserves_regs(iyh, iyl); +; void set_tile_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) __z88dk_callee; _set_tile_submap:: - pop hl ; HL = ret - pop bc ; BC = YX - pop de ; DE = WH + pop iy ; IY = ret + pop bc ; BC = XY + pop hl ; HL = HW + pop de ; DE = data dec sp pop af - sub e + sub l ld (.image_tile_width), a ; .image_tile_width contains corrected width - ex (sp), hl ; HL = data - ex de, hl ; HL = WH, DE = data + push iy push hl push de diff --git a/gbdk-lib/libc/targets/z80/set_tile_submap_compat.s b/gbdk-lib/libc/targets/z80/set_tile_submap_compat.s @@ -21,19 +21,19 @@ __submap_tile_offset:: .area _HOME -; void set_tile_submap_compat(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t map_w, const uint8_t *map) __z88dk_callee __preserves_regs(iyh, iyl); +; void set_tile_submap_compat(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) __z88dk_callee; _set_tile_submap_compat:: - pop hl ; HL = ret - pop bc ; BC = YX - pop de ; DE = WH + pop iy ; IY = ret + pop bc ; BC = XY + pop hl ; HL = HW + pop de ; DE = data dec sp pop af - sub e - ld (.image_tile_width_compat), a ; .image_tile_width_compat contains corrected width + sub l + ld (.image_tile_width), a ; .image_tile_width contains corrected width - ex (sp), hl ; HL = data - ex de, hl ; HL = WH, DE = data + push iy push hl push de

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