DMA write conflict revision differences
This commit is contained in:
parent
79ec22b28e
commit
5e7bb0f891
@ -436,6 +436,7 @@ struct GB_gameboy_internal_s {
|
|||||||
uint16_t dma_current_src;
|
uint16_t dma_current_src;
|
||||||
int16_t dma_cycles;
|
int16_t dma_cycles;
|
||||||
bool is_dma_restarting;
|
bool is_dma_restarting;
|
||||||
|
bool dma_write_zero;
|
||||||
uint8_t last_opcode_read; /* Required to emulte HDMA reads from Exxx */
|
uint8_t last_opcode_read; /* Required to emulte HDMA reads from Exxx */
|
||||||
bool hdma_starting;
|
bool hdma_starting;
|
||||||
);
|
);
|
||||||
|
@ -1670,6 +1670,10 @@ void GB_write_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
|
|||||||
else {
|
else {
|
||||||
addr = gb->dma_current_src;
|
addr = gb->dma_current_src;
|
||||||
}
|
}
|
||||||
|
if (GB_is_cgb(gb)) {
|
||||||
|
gb->dma_write_zero = true;
|
||||||
|
if (gb->model < GB_MODEL_CGB_E) return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
write_map[addr >> 12](gb, addr, value);
|
write_map[addr >> 12](gb, addr, value);
|
||||||
}
|
}
|
||||||
@ -1680,8 +1684,11 @@ void GB_dma_run(GB_gameboy_t *gb)
|
|||||||
/* Todo: measure this value */
|
/* Todo: measure this value */
|
||||||
gb->dma_cycles -= 4;
|
gb->dma_cycles -= 4;
|
||||||
gb->dma_steps_left--;
|
gb->dma_steps_left--;
|
||||||
|
if (unlikely(gb->dma_write_zero)) {
|
||||||
if (gb->dma_current_src < 0xe000) {
|
gb->oam[gb->dma_current_dest++] = 0;
|
||||||
|
gb->dma_write_zero = false;
|
||||||
|
}
|
||||||
|
else if (gb->dma_current_src < 0xe000) {
|
||||||
gb->oam[gb->dma_current_dest++] = GB_read_memory(gb, gb->dma_current_src);
|
gb->oam[gb->dma_current_dest++] = GB_read_memory(gb, gb->dma_current_src);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -372,6 +372,11 @@ static void sanitize_state(GB_gameboy_t *gb)
|
|||||||
gb->current_tile_attributes = 0;
|
gb->current_tile_attributes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((unsigned)gb->dma_current_dest + (unsigned)gb->dma_steps_left >= 0xa0) {
|
||||||
|
gb->dma_current_dest = 0;
|
||||||
|
gb->dma_steps_left = 0;
|
||||||
|
}
|
||||||
|
|
||||||
gb->object_low_line_address &= gb->vram_size & ~1;
|
gb->object_low_line_address &= gb->vram_size & ~1;
|
||||||
if (gb->lcd_x > gb->position_in_line) {
|
if (gb->lcd_x > gb->position_in_line) {
|
||||||
gb->lcd_x = gb->position_in_line;
|
gb->lcd_x = gb->position_in_line;
|
||||||
|
Loading…
Reference in New Issue
Block a user