mohanson/gameboy

Slightly odd rendering on a Mac

ukd1 opened this issue · 2 comments

ukd1 commented

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 bc90e61), 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! 🙇🏻

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

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