mohanson / gameboy

Full featured Cross-platform GameBoy emulator by Rust. Forever boys!.
MIT License
1.37k stars 83 forks source link

Slightly odd rendering on a Mac #38

Open ukd1 opened 1 year ago

ukd1 commented 1 year ago

I'm learning GB dev, and some simple sprite swapping code is not rendering out as expected using this emulator (release built on an M1 Mac from bc90e61fa2de41fccd687a0ed98a8346066875f9), but is with others.

For example with gameboy vs rboy: problem

I've attached the rom, and the code as it's simple. I am building it with @gbdk-2020.

#include <gb/gb.h>

const unsigned char face[] =
{
  0x7E,0x7E,0x81,0x81,0xA5,0xA5,0x81,0x81,
  0xA5,0xA5,0x99,0x99,0x81,0x81,0x7E,0x7E,
  0x7E,0x7E,0x81,0x81,0xA5,0xA5,0x81,0x81,
  0x81,0x81,0xBD,0xBD,0x81,0x81,0x7E,0x7E
};

void main(void) {
    UINT8 current_sprite = 0;
    set_sprite_data(0, 2, face);
    set_sprite_tile(0, 0);
    move_sprite(0, 88, 78);
    SHOW_SPRITES;

    while(1) {
        if (current_sprite == 0) {
            current_sprite = 1;
        } else {
            current_sprite = 0;
        }
        delay(1000);
        set_sprite_tile(0, current_sprite);
    }
}

Anyway, thanks for the effort on this project! 🙇🏻

mohanson commented 1 year ago

I'm guessing there's a bug somewhere, but I don't know how to start right now. I'll try to analyze it, thanks for the report.

ukd1 commented 1 year ago

Of course, hopefully it's detailed enough to help find it.