Writes affect the data bus too

This commit is contained in:
Lior Halphon 2023-01-06 18:46:58 +02:00
parent 7a390414ff
commit c92a2c2131
1 changed files with 6 additions and 0 deletions

View File

@ -1736,6 +1736,12 @@ void GB_write_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
if (unlikely(gb->n_watchpoints)) {
GB_debugger_test_write_watchpoint(gb, addr, value);
}
if (bus_for_addr(gb, addr) == GB_BUS_MAIN && addr < 0xFF00) {
gb->data_bus = value;
}
else {
gb->data_bus = 0xFF;
}
if (unlikely(gb->write_memory_callback)) {
if (!gb->write_memory_callback(gb, addr, value)) return;