It's not verified because it's wrong

This commit is contained in:
Lior Halphon 2021-12-26 21:57:40 +02:00
parent 6ffe924637
commit 59dfb1a85a

View File

@ -285,10 +285,10 @@ static uint8_t read_mbc_rom(GB_gameboy_t *gb, uint16_t addr)
static uint8_t read_vram(GB_gameboy_t *gb, uint16_t addr)
{
GB_display_sync(gb);
if (gb->vram_read_blocked) {
if (unlikely(gb->vram_read_blocked)) {
return 0xFF;
}
if (gb->display_state == 22 && GB_is_cgb(gb) && !gb->cgb_double_speed) {
if (unlikely(gb->display_state == 22 && GB_is_cgb(gb) && !gb->cgb_double_speed)) {
if (addr & 0x1000) {
addr = gb->last_tile_index_address;
}
@ -882,23 +882,10 @@ static void write_mbc(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
static void write_vram(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
{
GB_display_sync(gb);
if (gb->vram_write_blocked) {
if (unlikely(gb->vram_write_blocked)) {
//GB_log(gb, "Wrote %02x to %04x (VRAM) during mode 3\n", value, addr);
return;
}
/* TODO: not verified */
if (gb->display_state == 22 && GB_is_cgb(gb) && !gb->cgb_double_speed) {
if (addr & 0x1000) {
addr = gb->last_tile_index_address;
}
else if (gb->last_tile_data_address & 0x1000) {
/* TODO: This is case is more complicated then the rest and differ between revisions
It's probably affected by how VRAM is layed out, might be easier after a decap is done */
}
else {
addr = gb->last_tile_data_address;
}
}
gb->vram[(addr & 0x1FFF) + (gb->cgb_vram_bank? 0x2000 : 0)] = value;
}