WX access conflicts
This commit is contained in:
parent
9c7a8fdb1b
commit
89303ab046
@ -1042,7 +1042,7 @@ abort_fetching_object:
|
|||||||
// Too late to enable the window
|
// Too late to enable the window
|
||||||
}
|
}
|
||||||
else if (gb->io_registers[GB_IO_WX] == (uint8_t) (gb->position_in_line + 7) ||
|
else if (gb->io_registers[GB_IO_WX] == (uint8_t) (gb->position_in_line + 7) ||
|
||||||
gb->io_registers[GB_IO_WX] == (uint8_t) (gb->position_in_line + 6)) {
|
(gb->io_registers[GB_IO_WX] == (uint8_t) (gb->position_in_line + 6) && !gb->wx_just_changed)) {
|
||||||
gb->window_y++;
|
gb->window_y++;
|
||||||
if (gb->io_registers[GB_IO_WX] != 166) {
|
if (gb->io_registers[GB_IO_WX] != 166) {
|
||||||
gb->wx_triggered = true;
|
gb->wx_triggered = true;
|
||||||
|
@ -651,6 +651,9 @@ struct GB_gameboy_internal_s {
|
|||||||
bool vblank_just_occured; // For slow operations involving syscalls; these should only run once per vblank
|
bool vblank_just_occured; // For slow operations involving syscalls; these should only run once per vblank
|
||||||
uint8_t cycles_since_run; // How many cycles have passed since the last call to GB_run(), in 8MHz units
|
uint8_t cycles_since_run; // How many cycles have passed since the last call to GB_run(), in 8MHz units
|
||||||
double clock_multiplier;
|
double clock_multiplier;
|
||||||
|
|
||||||
|
/* Temporary state */
|
||||||
|
bool wx_just_changed;
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ typedef enum {
|
|||||||
GB_CONFLICT_PALETTE_CGB,
|
GB_CONFLICT_PALETTE_CGB,
|
||||||
GB_CONFLICT_DMG_LCDC,
|
GB_CONFLICT_DMG_LCDC,
|
||||||
GB_CONFLICT_SGB_LCDC,
|
GB_CONFLICT_SGB_LCDC,
|
||||||
|
GB_CONFLICT_WX,
|
||||||
} GB_conflict_t;
|
} GB_conflict_t;
|
||||||
|
|
||||||
/* Todo: How does double speed mode affect these? */
|
/* Todo: How does double speed mode affect these? */
|
||||||
@ -46,9 +47,9 @@ static const GB_conflict_t dmg_conflict_map[0x80] = {
|
|||||||
[GB_IO_OBP0] = GB_CONFLICT_PALETTE_DMG,
|
[GB_IO_OBP0] = GB_CONFLICT_PALETTE_DMG,
|
||||||
[GB_IO_OBP1] = GB_CONFLICT_PALETTE_DMG,
|
[GB_IO_OBP1] = GB_CONFLICT_PALETTE_DMG,
|
||||||
[GB_IO_WY] = GB_CONFLICT_READ_OLD,
|
[GB_IO_WY] = GB_CONFLICT_READ_OLD,
|
||||||
|
[GB_IO_WX] = GB_CONFLICT_WX,
|
||||||
|
|
||||||
/* Todo: these were not verified at all */
|
/* Todo: these were not verified at all */
|
||||||
[GB_IO_WX] = GB_CONFLICT_READ_NEW,
|
|
||||||
[GB_IO_SCX] = GB_CONFLICT_READ_NEW,
|
[GB_IO_SCX] = GB_CONFLICT_READ_NEW,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -64,9 +65,9 @@ static const GB_conflict_t sgb_conflict_map[0x80] = {
|
|||||||
[GB_IO_OBP0] = GB_CONFLICT_READ_NEW,
|
[GB_IO_OBP0] = GB_CONFLICT_READ_NEW,
|
||||||
[GB_IO_OBP1] = GB_CONFLICT_READ_NEW,
|
[GB_IO_OBP1] = GB_CONFLICT_READ_NEW,
|
||||||
[GB_IO_WY] = GB_CONFLICT_READ_OLD,
|
[GB_IO_WY] = GB_CONFLICT_READ_OLD,
|
||||||
|
[GB_IO_WX] = GB_CONFLICT_WX,
|
||||||
|
|
||||||
/* Todo: these were not verified at all */
|
/* Todo: these were not verified at all */
|
||||||
[GB_IO_WX] = GB_CONFLICT_READ_NEW,
|
|
||||||
[GB_IO_SCX] = GB_CONFLICT_READ_NEW,
|
[GB_IO_SCX] = GB_CONFLICT_READ_NEW,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -261,6 +262,15 @@ static void cycle_write(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
|
|||||||
gb->pending_cycles = 5;
|
gb->pending_cycles = 5;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case GB_CONFLICT_WX:
|
||||||
|
GB_advance_cycles(gb, gb->pending_cycles);
|
||||||
|
GB_write_memory(gb, addr, value);
|
||||||
|
gb->wx_just_changed = true;
|
||||||
|
GB_advance_cycles(gb, 1);
|
||||||
|
gb->wx_just_changed = false;
|
||||||
|
gb->pending_cycles = 3;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user