git.y1.nz

gbdk-2020

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

commit fbd765331322fd54f9e9117ea8ac2cb3df7460c3
parent d009bfeeda801a44bea741c794be463782b81956
Author: Michel Iwaniec <46843052+michel-iwaniec@users.noreply.github.com>
Date:   Sun, 20 Oct 2024 00:59:54 +0100

NES: Fix bugs with non-multiple-of-2 (/4) map width in set_bkg_submap_attributes (#722)

* Add +1 before shift in inline function set_bkg_submap_attributes
* Add-with carry after right-shift of width in set_bkg_submap_attributes_nes16x16
Diffstat:
Mgbdk-lib/include/nes/nes.h2+-
Mgbdk-lib/libc/targets/mos6502/nes/set_tile_submap_attributes.s1+
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/gbdk-lib/include/nes/nes.h b/gbdk-lib/include/nes/nes.h @@ -765,7 +765,7 @@ void set_bkg_submap_attributes_nes16x16(uint8_t x, uint8_t y, uint8_t w, uint8_t */ inline void set_bkg_submap_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *attributes, uint8_t map_w) { - set_bkg_submap_attributes_nes16x16(x >> 1, y >> 1, (w + 1) >> 1, (h + 1) >> 1, attributes, map_w >> 1); + set_bkg_submap_attributes_nes16x16(x >> 1, y >> 1, (w + 1) >> 1, (h + 1) >> 1, attributes, (map_w + 1) >> 1); } diff --git a/gbdk-lib/libc/targets/mos6502/nes/set_tile_submap_attributes.s b/gbdk-lib/libc/targets/mos6502/nes/set_tile_submap_attributes.s @@ -101,6 +101,7 @@ _set_bkg_submap_attributes_nes16x16:: sta *.src_tiles+1 lda *.map_width lsr + adc #0 ; Fix problem with skewed offset when original tilemap is not a multiple-of-two sta *.map_width ldx *.ypos jsr __muluchar

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